//===== Hercules Script ======================================
//= Multiple Extra Drops
//===== By: ==================================================
//= Cretino (Yuri Moreira Lima)
//= Revised English: Aeromesi
//===== Current Version: =====================================
//= 1.7a (Revised English by Aeromesi)
//===== Description: =========================================
//= Add new drops to the monsters and global extra drops with possibility of adding extra global drops by element and/or races.
//===== Additional Comments: =================================
//= 1.1 Now you can add unlimited monsters with extra drops.
// Command to change extra drops and percentage of a monster added. [Cretino]
//= 1.2 Now you can add global extra drops. (Items that can be dropped by any monster) (Idea by [JulioCF]:[Cronus-Emulator])
// Now you can also add global extra drops with elements and/or races. [Cretino]
//= 1.3 Calculation of percentage updated.
// NPC optimized.
// Fixes in commands: 'drop#add', 'drop#remove', 'drop#show', 'drop#edit'. [Cretino]
//= 1.4 NPC optimized.
// Command 'drop#add' more detailed in the comments below. [Cretino]
//= 1.5 Now you can add global extra drops for Boss monsters.
// Updated commands: 'drop#add', 'drop#remove', 'drop#show', 'drop#edit'. [Cretino]
//= 1.6 Now you can add drops for a specified time.
// Calculation percentage updated, now almost identical to the emulator.
// Updated commands: 'drop#add', 'drop#remove', 'drop#show'.
// Bug fix: Problem when trying to add global extra drops for Boss monsters.
// NPC added in 'prontera' on coordinates '147 171',
// So players can do research about extra drops.
// Fixes in command: 'drop#remove'.
// Functions added: 'extra_drop_compatibility', 'remove_expired_mob', 'global_drop_string_format', 'mob_drop_exists',
// 'percent_format', 'cap_value' e 'max'.
// Functions added to break array limit: 'deletearrayd', 'copyarrayd', 'cleararrayd', 'setarrayd',
// 'getelementofarrayd', 'getarraysized'. [Cretino]
//= 1.7 Updated to get Hercules compatibility.
// Little translation from Portuguese to english.
// TODO: Need to revise all script with comments for spelling errors.
// TODO: Need to update old functions to remove 'break array limit', because
// I created this script before the upgrade that allows you to create arrays with more than 127 data,
// but no worries, it still works fine. [Cretino]
//============================================================
// Q: How to manipulate the drops?
// R: Send a whisper via Whispering System with 'npc:extradrop'.
// Note: You can see the commands below.
// Note 2: Read all comments to understand how it works.
// Note 3: May have spelling errors. (Sorry for my english :x) // Fixed by Aeromesi :D
// Note 4: If anyone with good english can revise this, I'd appreciate it.
// Note 5: If you found any bug, report in topic or send me a private message.
// Note 6: READ ALL COMMENTS TO UNDERSTAND HOW IT WORKS!! (Yes, again as a reminder!) :)
// I will not teach how to use, because the comments are well explained.
//Elements
// None = -1
// Neutral = 0
// Water = 1
// Earth = 2
// Fire = 3
// Wind = 4
// Poison = 5
// Holy = 6
// Dark = 7
// Ghost = 8
// Undead = 9
//Races
// None = -1
// Formless = 0
// Undead = 1
// Brute = 2
// Plant = 3
// Insect = 4
// Fish = 5
// Demon = 6
// DemiHuman = 7
// Angel = 8
// Dragon = 9
// All commands and example of usage:
//drop#add#<type>#<mobid>#<itemid>#<rate>#<element>#<race>#<isboss>#<time>
//<type> = The type you want to add. (0 = extra drops in monsters, 1 = global extra drops)
//<mobid> = monster ID. (Only used if <type> = 0)
//<itemid> = Item ID.
//<rate> = Rate to get the item. (1 = 0.01%, 10 = 0.10%, 100 = 1.00%, 1000 = 10.00%, 10000 = 100.00%)
//<element> = If <element> isn't defined your value is equal to '-1'. (Only used if <type> = 1)
//<race> = If <race> isn't defined your value is equal to '-1'. (Only used if <type> = 1)
//<isboss> = If <isboss> is '1' the item will be dropped only by boss monsters,
// else if <isboss> is '0' or '-1' the item will be dropped only for non Boss monsters.
//<time> = If added, an item can only be dropped in the period. (day:hour:minute:second)
// Eg:
//1:4:54:47 = 1 day, 4 hours, 54 minutes and 47 seconds.
//0:1:11:24 = 1 hour, 11 minutes and 24 seconds.
//0:0:41:59 = 41 minutes and 59 seconds.
//Examples of usage: (TODO: Add more comments in examples of usage.)
// No specific time
//drop#add#<type=0>#<mobid>#<itemid>#<rate>
//drop#add#<type=1>#<itemid>#<rate>
//drop#add#<type=1>#<itemid>#<rate>#<element>
//drop#add#<type=1>#<itemid>#<rate>#<element=-1>#<race>
//drop#add#<type=1>#<itemid>#<rate>#<element>#<race>
//drop#add#<type=1>#<itemid>#<rate>#<element=-1>#<race=-1>#<isboss=1>
//drop#add#<type=1>#<itemid>#<rate>#<element>#<race>#<isboss=1>
// With specific time
//drop#add#<type=0>#<mobid>#<itemid>#<rate>#<time>
//drop#add#<type=1>#<itemid>#<rate>#<time>
//drop#add#<type=1>#<itemid>#<rate>#<element>#<time>
//drop#add#<type=1>#<itemid>#<rate>#<element=-1>#<race>#<time>
//drop#add#<type=1>#<itemid>#<rate>#<element=-1>#<race=-1>#<isboss=1>#<time>
//drop#add#<type=1>#<itemid>#<rate>#<element>#<race>#<isboss=1>#<time>
// More examples:
//drop#add#0#1002#517#10
// The above command adds the item 'Meat' in the monster 'Poring' with chance of '0.10%'. (<itemid> = 517) (<mobid> = 1002) (<rate> = 10)
//drop#add#0#1002#511#10000
// The above command adds the item 'Green Herb' in the monster 'Poring' with chance of '100.00%'. (<itemid> = 511) (<mobid> = 1002) (<rate> = 10000)
//drop#add#0#1002#512#10000#0:0:4:54
// The above command adds the item 'Apple' in the monster 'Poring' with chance of '100.00%' only for '4 minutes and 54 seconds'.
//(<itemid> = 512) (<mobid> = 1002) (<rate> = 10000) (<time> = 0:0:4:45)
//drop#add#1#519#1697
// The above command adds the item 'Milk' in global mode with chance of '16.97%'. (<itemid> = 519) (<rate> = 1697)
// Note: Global extra drops can be dropped by any monster
//drop#add#1#520#1411#1
// The above command adds the item 'Hinalle Leaflet' in global mode with chance of '14.11%' and element 'Water'.
//(<itemid> = 520) (<rate> = 1411) (<element> = 1)
// Note: If <element> is defined like this example, only monsters with same element will be able to drop the item.
// Note 2: This example will work only for monsters with element 'Water'.
//drop#add#1#521#1671#-1#5
// The above command adds the item 'Aloe Leaflet' in global mode with chance of '16.71%' of the monster race 'Fish'.
//(<itemid> = 521) (<rate> = 1671) (<race> = 5)
// Note: If <race> is defined like this example, only monsters with same race will be able to drop the item.
// Note 2: This example will work only for monsters with race 'Fish'.
//drop#add#1#522#5411#3#7
// The above command adds the item 'Mastela Fruit' in global mode with chance of '54.11%' and element 'Fire' and of the monster race 'DemiHuman'.
//(<itemid> = 522) (<rate> = 5411) (<element> = 3) (<race> = 7)
// Note: If <element> and <race> is defined like this example, only monsters with same element and race will be able to drop the item.
// Note 2: This example will work only for monsters with element 'Fire' and of the monster race 'DemiHuman'.
//drop#add#1#523#3147#-1#-1#1
// The above command adds the item 'Holy Water' in global mode with chance of '31.47%' and only for boss monsters.
//(<itemid> = 523) (<rate> = 3147) (<isboss> = 1)
// Note: This example will work only for boss monsters.
//drop#add#1#525#6931#3#7#1
// The above command adds the item 'Panacea' in global mode with chance of '31.47%' and element 'Fire' and of the monster race 'Undead' and only for boss monsters.
//(<itemid> = 525) (<rate> = 3147) (<element> = 3) (<race> = 1) (<isboss> = 1)
// Note: If <element>, <race> and <isboss> is defined like this example, only boss monsters with same element and race will be able to drop the item.
// Note 2: This example will work only for boss monsters with element 'Fire' and of the monster race 'Undead'.
// TODO: Need update and translate to english.
//drop#remove#<type>#<mobid>#<itemid>
//<type> = O tipo que ser� utilizado na remo��o:
//=> 0 = Remove o item <itemid> do monster <mobid>.
//=> 1 = Remove todos os itens do monster <mobid>.
//=> 2 = Remove o item global <itemid>.
//=> 3 = Remove todos os itens globais.
//=> 4 = Remove todos os itens de todos os monsters.
//<mobid> = Id do monster
//<itemid> = Id do item (OBS: Caso o <type> seja 1, n�o � preciso adicionar <itemid>)
//Examples of usage:
//drop#remove#<type=1>#<mobid> - Remove all extra drops from <mobid>.
//drop#remove#<type=0>#<mobid>#<itemid> - Remove the specific <itemid> from <mobid>.
//drop#remove#<type=2>#<itemid> - Remove the specific <itemid> from global extra drops.
//drop#remove#<type=3> - Remove all global extra drops.
//drop#remove#<type=4> - Remove all extra drops from all monsters.
// More examples:
//drop#remove#1#1002
//O comando acima remove todos os itens adicionados do monster 'Poring' {mobid = 1002}.
//drop#remove#0#1002#517
//O comando acima remove o item 'Carne' {itemid = 517} do monster 'Poring' {mobid = 1002}.
//drop#remove#2#519
//O comando acima remove o item global 'Leite' {itemid = 519}.
//drop#remove#3
//O comando acima remove todos os itens globais adicionados.
//drop#remove#4
//O comando acima remove todos os itens de todos os monsters adicionados.
//drop#show#<type>#<mobid>
//<type> = O tipo que ser� utilizado para mostrar os itens extra dropados pelo monster, 0 = Mostra todos os itens extra dropados pelo monster <mobid>, 1 = Mostra todos itens extra dropados de todos os monsters adicionados.
//<mobid> = Id do monster (OBS: Caso o <type> seja 1, n�o � preciso adicionar <mobid>).
//Examples of usage:
//drop#show#<type=1> - Show extra drops from all monsters.
//drop#show#<type=0>#<mobid> - Show extra drops from a specific <mobid>
//drop#show#<type=2> - Show all global extra drops.
// More examples:
//drop#show#1
//O comando acima mostra todos itens extra dropados de todos monsters adicionados.
//drop#show#0#1002
//O comando acima motra todos itens extra dropados pelo monster 'Poring' {mobid = 1002}.
//drop#show#2
//O comando acima mostra todos itens extra globais.
///drop#edit#<type>#<mobid>#<itemid>#<value>
//<type> = O tipo que ser� utilizado para alterar:
//=> 0 = Alterar <itemid> atual por <value>.
//=> 1 = Alterar chance atual de <itemid> por <value>.
//=> 2 = Alterar <itemid> global atual por <value>.
//=> 3 = Alterar chance global atual por <value>.
//=> 4 = Alterar o elemento global do <itemid> por <value>.
//=> 5 = Alterar a ra�a global do <itemid> por <value>.
//=> 6 = Altera o item global para ser dropado somente por mvp ou n�o.
//<mobid> = Id do monster.
//<itemid> = Id do item.
//<value> = Valor.
//Examples of usage:
//drop#edit#<type=0>#<mobid>#<itemid>#<value=other_itemid> - Will change current extra drop <itemid> to <value>
//drop#edit#<type=1>#<mobid>#<itemid>#<value=rate> - Will change current rate of extra drop <itemid> to <value>
//drop#edit#<type=2>#<itemid>#<value=other_itemid> - Will change current global extra drop <itemid> to <value>
//drop#edit#<type=3>#<itemid>#<value=rate> - Will change current rate of global extra drop <itemid> to <value>
//drop#edit#<type=4>#<itemid>#<value=element> - Will change current element of global extra drop <itemid> to <value>
//drop#edit#<type=5>#<itemid>#<value=race> - Will change current race of global extra drop <itemid> to <value>
//drop#edit#<type=6>#<itemid>#<value=isboss> - Will change current boss type of global extra drop <itemid> to <value>
// Note: <isboss> = 0, any monster can drop, else <isboss> = 1, only boss monsters can drop.
// More examples:
//drop#edit#0#1002#511#517
//O comando acima altera o item 'Erva Verde' {itemid = 511} do monster 'Poring' {mobid = 1002} para 'Carne' {value = 517}.
//drop#edit#1#1002#517#1000
//O comando acima altera a chance o item 'Carne' {itemid = 517} do monster 'Poring' {mobid = 1002} para 10.00% {value = 1000}.
//drop#edit#2#519#522
//O comando acima altera o item global 'Leite' {itemid = 519} para 'Mastela' {value = 522}.
//drop#edit#3#522#158
//O comando acima altera a chance do item global 'Mastela' {itemid = 522} para 1.58% {value = 158}.
//drop#edit#4#522#1
//O comando acima altera o elemento global do item 'Mastela' {itemid = 522} para 'Elemento: �gua' {value = 1}.
//drop#edit#5#522#0
//O comando acima altera a ra�a global do item 'Mastela' {itemid = 522} para 'Ra�a: Amorfo' {value = 0}.
//drop#edit#5#522#-1
//O comando acima altera a ra�a global do item 'Mastela' {itemid = 522} para 'Ra�a: Nenhum' {value = -1},
//Em outras palavras, ele remove a ra�a do item.
//drop#edit#4#522#-1
//O comando acima altera o elemento global do item 'Mastela' {itemid = 522} para 'Elemento: Nenhum' {value = -1},
//Em outras palavras, ele remove o elemento do item.
//drop#edit#6#522#1
//O comando acima altera o modo mvp do item global 'Mastela' {itemid = 522} para que seja dropado somente por 'MvP' {value = 1},
//Isto tamb�m ir� depender se voc� adicionou elemento e/ou ra�a ao item global.
//drop#edit#6#522#0
//O comando acima altera o modo mvp do item global 'Mastela' {itemid = 522} para que seja dropado por 'qualquer tipo de monster' {value = 0},
//Isto tamb�m ir� depender se voc� adicionou elemento e/ou ra�a ao item global.
- script extradrop -1,{
end;
OnInit:
// Settings
// GameMaster Level to Access
set .gm_level, 99;
// 1 = Drop item on floor
// 0 = Get item to player like '@autoloot'.
// Note: If '0' and player is overweight the item will drop on floor.
set .drop_style, 0;
// 1 = Show a message to player if drop an item (Message format: '"You got 'Royal Jelly' {526}, chance: 10.05%.')
// 0 = Disabled
set .show_msg, 1;
// Will check 'battle_flags' (drops_by_luk, drops_by_luk2, pk_mode, rare_drop_announce) and do calculations like the emulator.
// 0 = Disabled
// TODO: Enable support to 'mob_size_influence' battleflag.
set .check_battle_flag, 1;
// Will check if players have 'SC_CASH_RECEIVEITEM' or 'SC_OVERLAPEXPUP' active,
// like 'Bubble Gum' and 'Malang Cat Can'. (Effects to increment drop rate)
// 0 = Disabled
set .check_item_boost, 1;
// Save the drops to table 'picklog', like the emulator.
// 0 = Disabled
set .log, 1;
// While enabled a special modified based on the difference between the player and monster level is applied
// based on the http://irowiki.org/wiki/Drop_System#Level_Factor table like the emulator.
// 0 = Disabled
set .renewal_drop, 1;
// ONLY CHANGE IF YOU KNOW WHAT YOU'RE DOING !!
set .is_boss, 0x00020;
set .freeloop_size_active, 128;
setarray .element$[0], "Neutral", "Water", "Earth", "Fire", "Wind", "Poison", "Holy", "Dark", "Ghost", "Undead";
setarray .race$[0], "Formless", "Undead", "Brute", "Plant", "Insect", "Fish", "Demon", "DemiHuman", "Angel", "Dragon";
end;
OnWhisperGlobal:
if (@whispervar0$ == "drop" && getgroupid() >= .gm_level)
{
setarray .@type[0], @whispervar2$, @whispervar3$, @whispervar4$, @whispervar5$, @whispervar6$, @whispervar7$;
if (@whispervar1$ == "add")
{
if (strmobinfo(1, .@type[1]) == "" && .@type[0] <= 0)
{
message strcharinfo(0), "Invalid monster ID.";
end;
}
else if ((getitemname(.@type[2]) == "null" && .@type[0] <= 0) || (getitemname(.@type[1]) == "null" && .@type[0] == 1))
{
message strcharinfo(0), "Invalid item ID.";
end;
}
else if (.@type[0] <= 0 && .@type[3] <= 0 || .@type[0] == 1 && .@type[2] <= 0)
{
message strcharinfo(0), "Invalid rate.";
end;
}
if (.@type[3] > 10000 && .@type[0] <= 0 || .@type[2] > 10000 && .@type[0] == 1)
{
if (.@type[0] <= 0)
set .@type[3], 10000;
else
set .@type[2], 10000;
}
if (.@type[0] == 1)
{
if (.@type[3] > 9 || .@type[4] > 9 || .@type[3] < -1 || .@type[4] < -1)
{
message strcharinfo(0), "Invalid element and/or monster race.";
end;
}
else if (.@type[5] < -1 || .@type[5] > 1)
{
message strcharinfo(0), "Invalid type.";
end;
}
}
if (.@type[0] <= 0)
{
if (@whispervar6$ != "" && charat(@whispervar6$, 1) != "" && getstrlen(@whispervar6$) > 2)
{
if (sscanf(@whispervar6$, "%d:%d:%d:%d", .@day, .@hour, .@minute, .@seconds) == 4)
set .@time_accept, 1;
else
{
message strcharinfo(0), "Invalid time.";
end;
}
}
set .@mob_name$, getmonsterinfo(.@type[1], MOB_NAME);
set .@item_name$, getitemname(.@type[2]);
set .@array_temp_name$, "$mob_" + .@type[1];
set .@drop_array$, .@array_temp_name$ + "_drop";
set .@time_array$, .@array_temp_name$ + "_time";
set .@rate_array$, .@array_temp_name$ + "_rate";
if (!callfunc("mob_drop_exists", .@drop_array$, .@type[2]))
{
message strcharinfo(0), "The item '" + .@item_name$ + "' {" + .@type[2] + "}, is already added in the monster: '" + .@mob_name$ + "' {" + .@type[1] + "}.";
end;
}
if (getarraysize(getd(.@drop_array$)) <= 0)
callfunc("setarrayd", "$mob_id", callfunc("getarraysized", "$mob_id"), .@type[1]);
setd .@drop_array$ + "[" + getarraysize(getd(.@drop_array$)) + "]", .@type[2];
setd .@rate_array$ + "[" + getarraysize(getd(.@rate_array$)) + "]", .@type[3];
if (.@time_accept)
setd .@time_array$ + "[" + getarraysize(getd(.@time_array$)) + "]", gettimetick(2) + ((.@day ? .@day * 86400 : 0) + (.@hour ? .@hour * 3600 : 0) + (.@minute ? .@minute * 60 : 0) + (.@seconds ? .@seconds * 1 : 0));
else
setd .@time_array$ + "[" + getarraysize(getd(.@time_array$)) + "]", -1;
message strcharinfo(0), "Monster: '" + .@mob_name$ + "' {" + .@type[1] + "}, Item added: '" + .@item_name$ + "' {" + .@type[2] + "}, chance: " + callfunc("percent_format", .@type[3])+". Total of drops in this monster: " + getarraysize(getd(.@drop_array$)) + ".";
end;
}
else if (.@type[0] == 1)
{
if (@whispervar5$ != "" && charat(@whispervar5$, 1) != "" && getstrlen(@whispervar5$) > 2)
{
if (sscanf(@whispervar5$, "%d:%d:%d:%d", .@day, .@hour, .@minute, .@seconds) == 4)
set .@time_accept, 1;
else
{
message strcharinfo(0), "Invalid time.";
end;
}
}
else if (@whispervar6$ != "" && charat(@whispervar6$, 1) != "" && getstrlen(@whispervar6$) > 2)
{
if (sscanf(@whispervar6$, "%d:%d:%d:%d", .@day, .@hour, .@minute, .@seconds) == 4)
set .@time_accept, 1;
else
{
message strcharinfo(0), "Invalid time.";
end;
}
}
else if (@whispervar7$ != "" && charat(@whispervar7$, 1) != "" && getstrlen(@whispervar7$) > 2)
{
if (sscanf(@whispervar7$, "%d:%d:%d:%d", .@day, .@hour, .@minute, .@seconds) == 4)
set .@time_accept, 1;
else
{
message strcharinfo(0), "Invalid time.";
end;
}
}
else if (@whispervar8$ != "")
{
if (sscanf(@whispervar8$, "%d:%d:%d:%d", .@day, .@hour, .@minute, .@seconds) == 4)
set .@time_accept, 1;
else
{
message strcharinfo(0), "Invalid time.";
end;
}
}
set .@item_name$, getitemname(.@type[1]);
if (!callfunc("mob_drop_exists", 1, .@type[1]))
{
message strcharinfo(0), "The item '"+.@item_name$+"' {"+.@type[1]+"}, is already added in global mode.";
end;
}
setarray $mob_global_drop[getarraysize($mob_global_drop)], .@type[1];
setarray $mob_global_rate[getarraysize($mob_global_rate)], .@type[2];
setarray $mob_global_element[getarraysize($mob_global_element)], ((@whispervar5$ == "") ? -1 : (charat(@whispervar5$, 1) == "") ? .@type[3] : -1);
setarray $mob_global_race[getarraysize($mob_global_race)], ((@whispervar6$ == "") ? -1 : (charat(@whispervar6$, 1) == "") ? .@type[4] : -1);
setarray $mob_global_ismvp[getarraysize($mob_global_ismvp)], ((@whispervar7$ == "") ? -1 : (charat(@whispervar7$, 2) == "") ? (.@type[5] == 0) ? -1 : .@type[5] : -1);
if (.@time_accept)
setarray $mob_global_time[getarraysize($mob_global_time)], gettimetick(2) + ((.@day ? .@day * 86400 : 0) + (.@hour ? .@hour * 3600 : 0) + (.@minute ? .@minute * 60 : 0) + (.@seconds ? .@seconds * 1 : 0));
else
setarray $mob_global_time[getarraysize($mob_global_time)], -1;
message strcharinfo(0), "Global drop added: '" + .@item_name$ + "' {" + .@type[1] + "}, chance: " + callfunc("percent_format", .@type[2]) + "" + callfunc("global_drop_string_format", getarraysize($mob_global_drop) - 1) + ". Total of global extra drops: " + getarraysize($mob_global_drop) + ".";
end;
}
}
else if (@whispervar1$ == "remove")
{
if ((strmobinfo(1, .@type[1]) == "" && .@type[0] == 1) || (strmobinfo(1, .@type[1]) == "" && .@type[0] <= 0))
{
message strcharinfo(0), "Invalid monster ID.";
end;
}
else if ((getitemname(.@type[2]) == "null" && .@type[0] <= 0) || (getitemname(.@type[1]) == "null" && .@type[0] == 2))
{
message strcharinfo(0), "Invalid item ID.";
end;
}
if (.@type[0] == 2)
set .@item_name$, getitemname(.@type[1]);
else
set .@item_name$, getitemname(.@type[2]);
if (.@type[0] <= 1)
set .@mob_name$, getmonsterinfo(.@type[1], MOB_NAME);
if (.@type[0] <= 1)
{
if (callfunc("getarraysized", "$mob_id") > .freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < callfunc("getarraysized", "$mob_id"); set .@i, .@i + 1)
{
set .@mob_id, callfunc("getelementofarrayd", "$mob_id", .@i);
set .@array_temp_name$, "$mob_" + .@mob_id;
set .@drop_array$, .@array_temp_name$ + "_drop";
set .@time_array$, .@array_temp_name$ + "_time";
set .@rate_array$, .@array_temp_name$ + "_rate";
if (.@mob_id == .@type[1])
{
if (.@type[0] == 1)
{
deletearray getd(.@drop_array$);
deletearray getd(.@rate_array$);
deletearray getd(.@time_array$);
callfunc("setarrayd", "$mob_id", .@i, 0);
if (.@free)
freeloop(false);
message strcharinfo(0), "All items were deleted from the monster: '"+.@mob_name$+"' {"+.@type[1]+"}.";
end;
}
else
{
if (getarraysize(getd(.@drop_array$)) > .freeloop_size_active)
set .@free, freeloop(true);
for (set .@j, 0; .@j < getarraysize(getd(.@drop_array$)); set .@j, .@j + 1)
{
set .@time_val$, .@time_array$ + "[" + .@j + "]";
set .@rate$, .@rate_array$ + "[" + .@j + "]";
set .@drop$, .@drop_array$ + "[" + .@j + "]";
if (getd(.@drop$) == .@type[2])
{
deletearray getd(.@drop$), 1;
deletearray getd(.@rate$), 1;
deletearray getd(.@time_val$), 1;
if (getarraysize(getd(.@drop_array$)) <= 0)
{
deletearray getd(.@drop_array$);
deletearray getd(.@time_array$);
deletearray getd(.@rate_array$);
callfunc("setarrayd", "$mob_id", .@i, 0);
}
if (.@free)
freeloop(false);
message strcharinfo(0), "The item '" + .@item_name$ + "' {" + .@type[2] + "}, was deleted from the monster: '" + .@mob_name$ + "' {" + .@type[1] + "}.";
end;
}
}
if (.@free)
freeloop(false);
message strcharinfo(0), "The item '" + .@item_name$ + "' {" + .@type[2] + "}, doesn't exist in the monster: '" + .@mob_name$ + "' {" + .@type[1] + "}.";
end;
}
}
}
if (.@free)
freeloop(false);
message strcharinfo(0), "There is no items in this monster: '" + .@mob_name$ + "' {" + .@type[1] + "}.";
end;
}
else if (.@type[0] == 2)
{
if (getarraysize($mob_global_drop) > .freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < getarraysize($mob_global_drop); set .@i, .@i + 1)
{
if ($mob_global_drop[.@i] == .@type[1])
{
deletearray $mob_global_drop[.@i], 1;
deletearray $mob_global_rate[.@i], 1;
deletearray $mob_global_element[.@i], 1;
deletearray $mob_global_race[.@i], 1;
deletearray $mob_global_ismvp[.@i], 1;
deletearray $mob_global_time[.@i], 1;
if (.@free)
freeloop(false);
message strcharinfo(0), "The global item '" + .@item_name$ + "' {" + .@type[1] + "}, has been deleted.";
end;
}
}
if (.@free)
freeloop(false);
message strcharinfo(0), "The item '"+.@item_name$+"' {"+.@type[1]+"}, isn't a global item.";
end;
}
else if (.@type[0] == 3)
{
if (getarraysize($mob_global_drop) > 0)
{
deletearray $mob_global_drop;
deletearray $mob_global_rate;
deletearray $mob_global_element;
deletearray $mob_global_race;
deletearray $mob_global_ismvp;
deletearray $mob_global_time;
message strcharinfo(0), "All global items were deleted.";
end;
}
message strcharinfo(0), "There is no global items.";
end;
}
else if (.@type[0] == 4)
{
if (callfunc("getarraysized", "$mob_id") > .freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < callfunc("getarraysized", "$mob_id"); set .@i, .@i + 1)
{
set .@mob_id, callfunc("getelementofarrayd", "$mob_id", .@i);
set .@array_temp_name$, "$mob_" + .@mob_id;
set .@drop_array$, .@array_temp_name$ + "_drop";
set .@time_array$, .@array_temp_name$ + "_time";
set .@rate_array$, .@array_temp_name$ + "_rate";
deletearray getd(.@drop_array$);
deletearray getd(.@rate_array$);
deletearray getd(.@time_array$);
callfunc("setarrayd", "$mob_id", .@i, 0);
}
if (.@free)
freeloop(false);
message strcharinfo(0), "All items were cleared of all the monsters you modified.";
end;
}
}
else if (@whispervar1$ == "show")
{
if (strmobinfo(1, .@type[1]) == "" && .@type[0] <= 0)
{
message strcharinfo(0), "Invalid monster ID.";
end;
}
if (.@type[0] <= 0)
{
set .@mob_name$, getmonsterinfo(.@type[1], MOB_NAME);
callfunc("remove_expired_mob", 0, .@type[1]);
set .@array_temp_name$, "$mob_" + .@type[1];
set .@drop_array$, .@array_temp_name$ + "_drop";
set .@time_array$, .@array_temp_name$ + "_time";
set .@rate_array$, .@array_temp_name$ + "_rate";
if (getarraysize(getd(.@drop_array$)) > 0)
{
dispbottom "======= '" + .@mob_name$ + "' {" + .@type[1] + "} =======";
if (getarraysize(getd(.@drop_array$)) > .freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < getarraysize(getd(.@drop_array$)); set .@i, .@i + 1)
{
set .@id, getd(.@drop_array$ + "[" + .@i + "]");
set .@rate, getd(.@rate_array$ + "[" + .@i + "]");
set .@time, getd(.@time_array$ + "[" + .@i + "]");
dispbottom "Item: '"+getitemname(.@id)+"' {" + .@id + "}, chance: " + callfunc("percent_format", .@rate) + ". Time left: " + ((.@time == -1) ? "No specific time" : callfunc("Time2Str", .@time)) + ".";
}
if (.@free)
freeloop(false);
dispbottom "=============================================";
end;
}
message strcharinfo(0), "There is no items in this monster: '" + .@mob_name$ + "' {" + .@type[1] + "}.";
end;
}
else if (.@type[0] == 1)
{
callfunc("remove_expired_mob");
if (callfunc("getarraysized", "$mob_id") > .freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < callfunc("getarraysized", "$mob_id"); set .@i, .@i + 1)
{
set .@mob_id, callfunc("getelementofarrayd", "$mob_id", .@i);
set .@array_temp_name$, "$mob_" + .@mob_id;
set .@drop_array$, .@array_temp_name$ + "_drop";
set .@time_array$, .@array_temp_name$ + "_time";
set .@rate_array$, .@array_temp_name$ + "_rate";
dispbottom "======= '" + getmonsterinfo(.@mob_id, MOB_NAME) + "' {" + .@mob_id + "} =======";
if (getarraysize(getd(.@drop_array$)) > .freeloop_size_active)
set .@free, freeloop(true);
for (set .@j, 0; .@j < getarraysize(getd(.@drop_array$)); set .@j, .@j + 1)
{
set .@id, getd(.@drop_array$ + "[" + .@j + "]");
set .@rate, getd(.@rate_array$ + "[" + .@j + "]");
set .@time, getd(.@time_array$ + "[" + .@j + "]");
dispbottom "Item: '" + getitemname(.@id) + "' {" + .@id + "}, chance: " + callfunc("percent_format", .@rate) + ". Time left: " + ((.@time == -1) ? "No specific time" : callfunc("Time2Str", .@time)) + ".";
}
if (.@free)
freeloop(false);
dispbottom "=============================================";
if (.@i + 1 == callfunc("getarraysized", "$mob_id"))
{
if (.@free)
freeloop(false);
end;
}
}
if (.@free)
freeloop(false);
message strcharinfo(0), "There is no monster with extra drops.";
end;
}
else if (.@type[0] == 2)
{
callfunc("remove_expired_mob", 1);
if (getarraysize($mob_global_drop) > 0)
{
dispbottom "======= Global Drops =======";
if (getarraysize($mob_global_drop) > .freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < getarraysize($mob_global_drop); set .@i, .@i + 1)
{
dispbottom "Item: '" + getitemname($mob_global_drop[.@i]) + "' {" + $mob_global_drop[.@i] + "}, chance: " + callfunc("percent_format", $mob_global_rate[.@i]) + "" + callfunc("global_drop_string_format", .@i) + ". Time left: " + (($mob_global_time[.@i] == -1) ? "No specific time" : callfunc("Time2Str", $mob_global_time[.@i])) + ".";
dispbottom "=============================================";
}
if (.@free)
freeloop(false);
}
else
message strcharinfo(0), "There is no global items.";
end;
}
}
else if (@whispervar1$ == "edit")
{
if (strmobinfo(1, .@type[1]) == "" && .@type[0] <= 1)
{
message strcharinfo(0), "Invalid monster ID.";
end;
}
else if ((getitemname(.@type[2]) == "null" && .@type[0] <= 1) || (getitemname(.@type[3]) == "null" && .@type[0] <= 0) || (getitemname(.@type[1]) == "null" && .@type[0] == 2) || (getitemname(.@type[2]) == "null" && .@type[0] == 2) || (getitemname(.@type[1]) == "null" && .@type[0] >= 3 && .@type[0] <= 6))
{
message strcharinfo(0), "Invalid item ID.";
end;
}
else if (.@type[0] == 1 && .@type[3] <= 0 || .@type[0] == 3 && .@type[2] <= 0)
{
message strcharinfo(0), "Invalid rate.";
end;
}
if (.@type[3] > 10000 && .@type[0] == 1 || .@type[2] > 10000 && .@type[0] == 3)
set .@type[3], 10000;
if (.@type[0] == 4 || .@type[0] == 5)
{
if (.@type[2] < -1 || .@type[2] > 9)
{
message strcharinfo(0), "Invalid element and/or monster race.";
end;
}
}
else if (.@type[0] == 6)
{
if (.@type[2] < 0 || .@type[2] > 1)
{
message strcharinfo(0), "Invalid type.";
end;
}
}
if (.@type[0] <= 1)
set .@mob_name$, getmonsterinfo(.@type[1], MOB_NAME);
if (.@type[0] <= 1)
{
set .@item_name$, getitemname(.@type[2]);
set .@item_name_change$, getitemname(.@type[3]);
set .@array_temp_name$, "$mob_" + .@type[1];
set .@drop_array$, .@array_temp_name$ + "_drop";
set .@time_array$, .@array_temp_name$ + "_time";
set .@rate_array$, .@array_temp_name$ + "_rate";
if (getarraysize(getd(.@drop_array$)) > 0)
{
if (getarraysize(getd(.@drop_array$)) > .freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < getarraysize(getd(.@drop_array$)); set .@i, .@i + 1)
{
set .@id, getd(.@drop_array$ + "[" + .@i + "]");
if (.@id == .@type[3] && .@type[0] <= 0)
{
if (.@free)
freeloop(false);
message strcharinfo(0), "The item '" + .@item_name_change$ + "' {" + .@type[3] + "}, is already added in monster: '" + .@mob_name$ + "' {" + .@type[1] + "}.";
end;
}
}
for (set .@i, 0; .@i < getarraysize(getd(.@drop_array$)); set .@i, .@i + 1)
{
set .@id$, .@drop_array$ + "[" + .@i + "]";
set .@rate$, .@rate_array$ + "[" + .@i + "]";
if (getd(.@id$) == .@type[2])
{
if (.@type[0] <= 0)
{
if (.@free)
freeloop(false);
message strcharinfo(0), "Monster: '" + .@mob_name$ + "' {" + .@type[1] + "}, item changed, from: '" + .@item_name$ + "' {" + .@type[2] + "}, to: '" + .@item_name_change$ + "' {" + .@type[3] + "}.";
setd .@id$, .@type[3];
end;
}
else if (.@type[0] == 1)
{
if (.@free)
freeloop(false);
message strcharinfo(0), "Monster: '" + .@mob_name$ + "' {" + .@type[1] + "}, changed chance of item '" + .@item_name$ + "' {" + .@type[2] + "}, from: " + callfunc("percent_format", getd(.@rate$)) + ", to: " + callfunc("percent_format", .@type[3]) + ".";
setd .@rate$, .@type[3];
end;
}
}
}
if (.@free)
freeloop(false);
message strcharinfo(0), "The item '" + .@item_name$ + "' {" + .@type[2] + "}, doesn't exist in the monster: '" + .@mob_name$ + "' {" + .@type[1] + "}.";
end;
} // Parado aqui
}
else if (.@type[0] > 1 && .@type[0] < 7)
{
set .@item_name$, getitemname(.@type[1]);
if (.@type[0] > 1 && .@type[0] < 4)
set .@item_name_change$, getitemname(.@type[2]);
if (getarraysize($mob_global_drop) > 0)
{
if (getarraysize($mob_global_drop) > .freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < getarraysize($mob_global_drop); set .@i, .@i + 1)
{
if ($mob_global_drop[.@i] == .@type[2] && .@type[0] == 2)
{
if (.@free)
freeloop(false);
message strcharinfo(0), "The global item '" + .@item_name_change$ + "' {" + .@type[2] + "}, is already added.";
end;
}
}
for (set .@i, 0; .@i < getarraysize($mob_global_drop); set .@i, .@i + 1)
{
if ($mob_global_drop[.@i] == .@type[1])
{
if (.@type[0] == 2)
{
if (.@free)
freeloop(false);
message strcharinfo(0), "Global item changed, from: '" + .@item_name$ + "' {" + .@type[1] + "}, to: '" + .@item_name_change$ + "' {" + .@type[2] + "}.";
setarray $mob_global_drop[.@i], .@type[2];
end;
}
else if (.@type[0] == 3)
{
if (.@free)
freeloop(false);
message strcharinfo(0), "Rate of global item '" + .@item_name$ + "' {" + .@type[1] + "} changed, from: " + callfunc("percent_format", $mob_global_rate[.@i]) + ", to: " + callfunc("percent_format", .@type[2]) + ".";
setarray $mob_global_rate[.@i], .@type[2];
end;
}
else if (.@type[0] == 4)
{
if ($mob_global_element[.@i] > -1 && .@type[2] > -1)
message strcharinfo(0), "Element of global item '" + .@item_name$ + "' {" + .@type[1] + "} changed, from: " + .element$[$mob_global_element[.@i]] + " {" + $mob_global_element[.@i] + "}, to: " + .element$[.@type[2]] + " {" + .@type[2] + "}.";
else if ($mob_global_element[.@i] > -1 && .@type[2] == -1)
message strcharinfo(0), "Element of global item '" + .@item_name$ + "' {" + .@type[1] + "} changed, from: " + .element$[$mob_global_element[.@i]] + " {" + $mob_global_element[.@i] + "}, to: None {-1}.";
else if (.@type[2] == -1)
message strcharinfo(0), "Element of global item '" + .@item_name$ + "' {" + .@type[1] + "} changed, from: None {-1}, to: None {-1}.";
else
message strcharinfo(0), "Element of global item '" + .@item_name$ + "' {" + .@type[1] + "} changed, from: None {-1}, to: " + .element$[.@type[2]] + " {" + .@type[2] + "}.";
if (.@free)
freeloop(false);
setarray $mob_global_element[.@i], .@type[2];
end;
}
else if (.@type[0] == 5)
{
if ($mob_global_race[.@i] > -1 && .@type[2] > -1)
message strcharinfo(0), "Race of global item '" + .@item_name$ + "' {" + .@type[1] + "} changed, from: " + .race$[$mob_global_race[.@i]] + ", to: " + .race$[.@type[2]] + " {" + .@type[2] + "}.";
else if ($mob_global_race[.@i] > -1 && .@type[2] == -1)
message strcharinfo(0), "Race of global item '" + .@item_name$ + "' {" + .@type[1] + "} changed, from: " + .race$[$mob_global_race[.@i]] + ", to: None {-1}.";
else if (.@type[2] == -1)
message strcharinfo(0), "Race of global item '" + .@item_name$ + "' {" + .@type[1] + "} changed, from: None {-1}, to: None {-1}.";
else
message strcharinfo(0), "Race of global item '" + .@item_name$ + "' {" + .@type[1] + "} changed, from: None {-1}, to: " + .race$[.@type[2]] + " {" + .@type[2] + "}.";
if (.@free)
freeloop(false);
setarray $mob_global_race[.@i], .@type[2];
end;
}
else if (.@type[0] == 6)
{
if ($mob_global_ismvp[.@i] > -1)
set .@is_boss_msg$, "Yes {1}";
else
set .@is_boss_msg$, "No {-1}";
if (.@type[2] > -1 && .@type[2] != 0)
{
set .@is_boss_msg_change$, "Yes {1}";
setarray $mob_global_ismvp[.@i], 1;
}
else
{
set .@is_boss_msg_change$, "No {-1}";
setarray $mob_global_ismvp[.@i], -1;
}
if (.@free)
freeloop(false);
message strcharinfo(0), "Boss type of global item '" + .@item_name$ + "' {" + .@type[1] + "} changed, from: " + .@is_boss_msg$ + ", to: " + .@is_boss_msg_change$ + ".";
end;
}
}
}
}
if (.@free)
freeloop(false);
message strcharinfo(0), "The global item '" + .@item_name$ + "' {" + .@type[1] + "}, doesn't exist.";
end;
}
// Verificar depois se tem necessidade aqui...
// Adicionado somente por seguran�a...
if (.@free)
freeloop(false);
message strcharinfo(0), "Monster: '" + .@mob_name$ + "' {" + .@type[1] + "}, doesn't exist.";
end;
}
}
end;
}
prontera,147,171,5 script Drops Extra#1 2_F_MAGICMASTER,{
set .@npc_name$, "[" + strnpcinfo(1) + "]";
set .@freeloop_size_active, getvariableofnpc(.freeloop_size_active, "extradrop");
mes .@npc_name$;
mes "Hey " + strcharinfo(0) + ", what do you want?";
switch(select("- View Extra Drops of a Specific Monster:- View Extra Drops of all Monsters:- All Global Extra Drops:- Nothing"))
{
next;
mes .@npc_name$;
case 1:
mes "Choose an Option:";
switch(select("- Show List:- Search by Monster ID:- Nothing"))
{
next;
mes .@npc_name$;
case 1:
if (!callfunc("getarraysized", "$mob_id"))
mes "There is no Monster with Extra Drops.";
else
{
callfunc("remove_expired_mob");
if (!callfunc("getarraysized", "$mob_id"))
mes "There is no Monster with Extra Drops.";
else
{
set .@menu$, "";
if (callfunc("getarraysized", "$mob_id") > .@freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < callfunc("getarraysized", "$mob_id"); set .@i, .@i + 1)
{
set .@mob_id, callfunc("getelementofarrayd", "$mob_id", .@i);
set .@mob_name$, getmonsterinfo(.@mob_id, MOB_NAME);
set .@menu$, .@menu$ + "- '" + .@mob_name$ + "' " + "{" + .@mob_id + "}";
set .@menu$, .@menu$ + ":";
}
if (.@free)
freeloop(false);
mes "Choose an Option:";
set .@selected, select(.@menu$);
set .@mob_id, callfunc("getelementofarrayd", "$mob_id", (.@selected - 1));
set .@mob_name$, getmonsterinfo(.@mob_id, MOB_NAME);
set .@array_temp_name$, "$mob_" + .@mob_id;
set .@drop_array$, .@array_temp_name$ + "_drop";
set .@time_array$, .@array_temp_name$ + "_time";
set .@rate_array$, .@array_temp_name$ + "_rate";
if (getarraysize(getd(.@drop_array$)) > 0)
{
callfunc("remove_expired_mob", 0, .@mob_id, .@selected - 1);
if (getarraysize(getd(.@drop_array$)) > 0)
{
mes "'" + .@mob_name$ + "' {" + .@mob_id + "}";
if (getarraysize(getd(.@drop_array$)) > .@freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < getarraysize(getd(.@drop_array$)); set .@i, .@i + 1)
{
set .@id, getd(.@drop_array$ + "[" + .@i + "]");
set .@rate, getd(.@rate_array$ + "[" + .@i + "]");
set .@time, getd(.@time_array$ + "[" + .@i + "]");
mes "Item: '" + getitemname(.@id) + "' {" + .@id + "}, chance: " + callfunc("percent_format", .@rate) + ". Time left: " + ((.@time == -1) ? "No specific time" : callfunc("Time2Str", .@time)) + ".";
mes " ";
}
if (.@free)
freeloop(false);
}
else
mes "There is no items in this Monster: '" + .@mob_name$ + "' {" + .@mob_id + "}";
}
else
mes "There is no items in this Monster: '" + .@mob_name$ + "' {" + .@mob_id + "}";
}
}
break;
case 2:
if (!callfunc("getarraysized", "$mob_id"))
mes "There is no Monster with Extra Drops.";
else
{
callfunc("remove_expired_mob");
if (!callfunc("getarraysized", "$mob_id"))
mes "There is no Monster with Extra Drops.";
else
{
mes "Input the Monster ID:";
input .@mob_id;
next;
mes .@npc_name$;
if (strmobinfo(1, .@mob_id) == "")
{
mes "Invalid monster ID.";
break;
}
set .@mob_name$, getmonsterinfo(.@mob_id, MOB_NAME);
set .@array_temp_name$, "$mob_" + .@mob_id;
set .@drop_array$, .@array_temp_name$ + "_drop";
set .@time_array$, .@array_temp_name$ + "_time";
set .@rate_array$, .@array_temp_name$ + "_rate";
if (getarraysize(getd(.@drop_array$)) > 0)
{
callfunc("remove_expired_mob", 0, .@mob_id);
if (getarraysize(getd(.@drop_array$)) > 0)
{
mes "'" + .@mob_name$ + "' {" + .@mob_id + "}";
if (getarraysize(getd(.@drop_array$)) > .@freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < getarraysize(getd(.@drop_array$)); set .@i, .@i + 1)
{
set .@id, getd(.@drop_array$ + "[" + .@i + "]");
set .@rate, getd(.@rate_array$ + "[" + .@i + "]");
set .@time, getd(.@time_array$ + "[" + .@i + "]");
mes "Item: '" + getitemname(.@id) + "' {" + .@id + "}, chance: " + callfunc("percent_format", .@rate) + ". Time left: " + ((.@time == -1) ? "No specific time" : callfunc("Time2Str", .@time)) + ".";
mes " ";
}
if (.@free)
freeloop(false);
}
else
mes "There is no items in this Monster: '" + .@mob_name$ + "' {" + .@mob_id + "}";
}
else
mes "There is no items in this Monster: '" + .@mob_name$ + "' {" + .@mob_id + "}";
}
}
break;
case 3:
mes "Come back whenever you need me!";
break;
}
break;
case 2:
if (!callfunc("getarraysized", "$mob_id"))
mes "There is no Monster with Extra Drops.";
else
{
callfunc("remove_expired_mob");
if (!callfunc("getarraysized", "$mob_id"))
mes "There is no Monster with Extra Drops.";
else
{
if (callfunc("getarraysized", "$mob_id") > .@freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < callfunc("getarraysized", "$mob_id"); set .@i, .@i + 1)
{
set .@mob_id, callfunc("getelementofarrayd", "$mob_id", .@i);
set .@mob_name$, getmonsterinfo(.@mob_id, MOB_NAME);
set .@array_temp_name$, "$mob_" + .@mob_id;
set .@drop_array$, .@array_temp_name$ + "_drop";
set .@time_array$, .@array_temp_name$ + "_time";
set .@rate_array$, .@array_temp_name$ + "_rate";
mes "'" + .@mob_name$ + "' {" + .@mob_id + "}";
for (set .@j, 0; .@j < getarraysize(getd(.@drop_array$)); set .@j, .@j + 1)
{
set .@id, getd(.@drop_array$ + "[" + .@j + "]");
set .@rate, getd(.@rate_array$ + "[" + .@j + "]");
set .@time, getd(.@time_array$ + "[" + .@j + "]");
mes "Item: '" + getitemname(.@id) + "' {" + .@id + "}, chance: " + callfunc("percent_format", .@rate) + ". Time left: " + ((.@time == -1) ? "No specific time" : callfunc("Time2Str", .@time)) + ".";
mes " ";
}
if ((.@i + 1) == callfunc("getarraysized", "$mob_id"))
break;
}
if (.@free)
freeloop(false);
}
}
break;
case 3:
callfunc("remove_expired_mob", 1);
if (getarraysize($mob_global_drop) > 0)
{
for (set .@i, 0; .@i < getarraysize($mob_global_drop); set .@i, .@i + 1)
{
set .@item_name$, getitemname($mob_global_drop[.@i]);
mes "Global item: '" + .@item_name$ + "' {" + $mob_global_drop[.@i] + "}, chance: " + callfunc("percent_format", $mob_global_rate[.@i]) + "" + callfunc("global_drop_string_format", .@i) + ". Time left: " + (($mob_global_time[.@i] == -1) ? "No specific time" : callfunc("Time2Str", $mob_global_time[.@i])) + ".";
mes " ";
}
}
else
mes "There is no Global items.";
break;
case 4:
mes "Come back whenever you need me!";
break;
}
close;
}
// callfunc("extra_drop_compatibility","<variable name>");
function script extra_drop_compatibility {
if ($mob_count)
{
setd getarg(0), $mob_count - 1;
set $mob_count, 0;
}
return;
}
// callfunc("deletearrayd","<array name>",<first value>,<how much to delete>);
function script deletearrayd {
set .@name$, getarg(0);
set .@pos, getarg(1, 0);
set .@size, getarg(2, 0);
set .@prefix$, charat(.@name$, 0);
set .@posfix$, (charat(.@name$, getstrlen(.@name$) - 1) != "$") ? "" : "$";
if (.@posfix$ != "")
delchar(.@name$, getstrlen(.@name$) - 1);
if (.@name$ == "" || .@pos < 0 || .@size < 0 || !(.@prefix$ == "@" || .@prefix$ == "$" || .@prefix$ == "." || .@prefix$ == "'"))
return 0;
if (!.@size)
{
deletearray getd(.@name$ + "_" + (.@pos ? (.@pos / 128) : 0) + .@posfix$ + "[" + (.@pos ? (.@pos % 128) : 0) + "]");
setd .@name$ + "_size", ((.@pos - 1) <= 0) ? 0 : (.@pos - 1);
}
else
{
deletearray getd(.@name$ + "_" + (.@pos ? (.@pos / 128) : 0) + .@posfix$ + "[" + (.@pos ? (.@pos % 128) : 0) + "]"), .@size;
setd .@name$ + "_size", ((getd(.@name$ + "_size") - .@size) <= 0) ? 0 : getd(.@name$ + "_size") - .@size;
}
return 1;
}
// callfunc("copyarrayd","<destination array>",<first value>,"<source array>",<first value>,<amount of data to copy>);
function script copyarrayd {
set .@freeloop_size_active, getvariableofnpc(.freeloop_size_active, "extradrop");
set .@dest_name$, getarg(0);
set .@dest_pos, getarg(1);
set .@src_name$, getarg(2);
set .@src_pos, getarg(3);
set .@size, getarg(4) - .@dest_pos;
set .@dest_prefix$, charat(.@dest_name$, 0);
set .@dest_posfix$, (charat(.@dest_name$, getstrlen(.@dest_name$) - 1) != "$") ? "" : "$";
set .@src_prefix$, charat(.@src_name$, 0);
set .@src_posfix$, (charat(.@src_name$, getstrlen(.@src_name$) - 1) != "$") ? "" : "$";
if (.@dest_name$ == "" || .@src_name$ == "" || .@dest_pos < 0 || .@src_pos < 0 || .@size <= 0
|| !(.@dest_prefix$ == "@" || .@dest_prefix$ == "$" || .@dest_prefix$ == "." || .@dest_prefix$ == "'")
|| !(.@src_prefix$ == "@" || .@src_prefix$ == "$" || .@src_prefix$ == "." || .@src_prefix$ == "'")
|| .@dest_posfix$ != .@src_posfix$ || (.@dest_name$ == .@src_name$ && .@dest_pos == .@src_pos))
return 0;
if (.@size > .@freeloop_size_active)
set .@free, freeloop(true);
if (.@dest_name$ == .@src_name$ && .@dest_pos > .@src_pos)
{
for(set .@i, .@size - 1; .@i >= 0; set .@i, .@i - 1)
{
set .@value$, callfunc("getelementofarrayd", .@src_name$, .@src_pos + .@i);
callfunc("setarrayd", .@dest_name$, .@dest_pos + .@i, .@value$);
}
}
else
{
for(set .@i, 0; .@i < .@size; set .@i, .@i + 1)
{
set .@value$, callfunc("getelementofarrayd", .@src_name$, .@src_pos + .@i);
callfunc("setarrayd", .@dest_name$, .@dest_pos + .@i, .@value$);
}
}
if (.@free)
freeloop(false);
return 1;
}
// callfunc("cleararrayd","<array name>",<first value to alter>,<value>,<number of values to set>);
function script cleararrayd {
set .@freeloop_size_active, getvariableofnpc(.freeloop_size_active, "extradrop");
set .@name$, getarg(0);
set .@pos, getarg(1);
set .@value$, getarg(2);
set .@size, getarg(3);
set .@prefix$, charat(.@name$, 0);
if (.@name$ == "" || .@pos < 0 || .@size < 0 || !(.@prefix$ == "@" || .@prefix$ == "$" || .@prefix$ == "." || .@prefix$ == "'"))
return 0;
if (.@size > .@freeloop_size_active)
set .@free, freeloop(true);
for(set .@i, .@pos; .@i < .@size; set .@i, .@i + 1)
callfunc("setarrayd", .@name$, .@i, .@value$);
if (.@free)
freeloop(false);
return 1;
}
// callfunc("setarrayd","<array name>",<position>,<value>{,<value>...<value>});
function script setarrayd {
set .@freeloop_size_active, getvariableofnpc(.freeloop_size_active, "extradrop");
set .@name$, getarg(0);
set .@pos, getarg(1);
set .@prefix$, charat(.@name$, 0);
set .@posfix$, (charat(.@name$, getstrlen(.@name$) - 1) != "$") ? "" : "$";
if (.@posfix$ != "")
delchar(.@name$, getstrlen(.@name$) - 1);
if (.@name$ == "" || .@pos < 0 || !(.@prefix$ == "@" || .@prefix$ == "$" || .@prefix$ == "." || .@prefix$ == "'"))
return 0;
set .@var_size$, .@name$ + "_size";
// Pega o valor do contador antigo e passa para o novo.
// Para n�o ter necessidade de ter que reconfigurar o script,
// Caso j� tenha utilizado ele e tenha monstros com drop extra adicionados.
callfunc("extra_drop_compatibility", .@var_size$);
if (getargcount() - 2 > .@freeloop_size_active)
set .@free, freeloop(true);
for(set .@i, 2; .@i < getargcount(); set .@i, .@i + 1)
{
set .@value$, getarg(.@i);
set .@var_name$, .@name$ + "_" + (.@pos / 128) + .@posfix$ + "[" + (.@pos % 128) + "]";
if (.@posfix$ == "")
{
if (getd(.@var_name$) == 0 && atoi(.@value$) != 0 && .@pos >= getd(.@var_size$))
setd .@var_size$, .@pos;
}
else
{
if (getd(.@var_name$) == "" && atoi(.@value$) != "" && .@pos >= getd(.@var_size$))
setd .@var_size$, .@pos;
}
setd .@var_name$, (.@posfix$ == "") ? atoi(.@value$) : .@value$;
set .@pos, .@pos + 1;
}
if (.@free)
freeloop(false);
if (!((callfunc("getelementofarrayd", .@name$, getd(.@var_size$)) != ((.@posfix$ == "") ? 0 : "")) ? 1 : 0) && ((.@posfix$ == "") ? (atoi(.@value$) == 0) : (.@value$ == "")))
{
if (getd(.@var_size$) > .@freeloop_size_active)
set .@free, freeloop(true);
for(set .@i, getd(.@var_size$) - 1; .@i >= 0; set .@i, .@i - 1)
{
if (callfunc("getelementofarrayd", .@name$, .@i) != ((.@posfix$ == "") ? 0 : ""))
{
setd .@var_size$, .@i;
break;
}
}
if (.@free)
freeloop(false);
if (.@i == -1)
setd .@var_size$, 0;
}
return 1;
}
// callfunc("getelementofarrayd","<array name>",<position>);
function script getelementofarrayd {
set .@name$, getarg(0);
set .@pos, getarg(1);
set .@prefix$, charat(.@name$, 0);
set .@posfix$, (charat(.@name$, getstrlen(.@name$) - 1) != "$") ? "" : "$";
if (.@name$ == "" || .@pos < 0 || !(.@prefix$ == "@" || .@prefix$ == "$" || .@prefix$ == "." || .@prefix$ == "'"))
return 0;
// Pega o valor do contador antigo e passa para o novo.
// Para n�o ter necessidade de ter que reconfigurar o script,
// Caso j� tenha utilizado ele e tenha monstros com drop extra adicionados.
callfunc("extra_drop_compatibility", .@name$ + "_size");
return getd(.@name$ + "_" + (.@pos / 128) + .@posfix$ + "[" + (.@pos % 128) + "]");
}
// callfunc("getarraysized","<array name>");
function script getarraysized {
set .@name$, getarg(0);
set .@prefix$, charat(.@name$, 0);
set .@posfix$, (charat(.@name$, getstrlen(.@name$) - 1) != "$") ? "" : "$";
if (.@posfix$ != "")
delchar(.@name$, getstrlen(.@name$) - 1);
if (.@name$ == "" || .@pos < 0 || !(.@prefix$ == "@" || .@prefix$ == "$" || .@prefix$ == "." || .@prefix$ == "'"))
return 0;
// Pega o valor do contador antigo e passa para o novo.
// Para n�o ter necessidade de ter que reconfigurar o script,
// Caso j� tenha utilizado ele e tenha monstros com drop extra adicionados.
callfunc("extra_drop_compatibility", .@name$ + "_size");
return getd(.@name$ + "_size") ? getd(.@name$ + "_size") + 1 : ((callfunc("getelementofarrayd", .@name$, 0) != ((.@posfix$ == "") ? 0 : "")) ? 1 : 0);
}
// callfunc("percent_format",<value>);
function script percent_format {
return (getarg(0) / 100)+"."+(((getarg(0) % 100) <= 9) ? "0" : "")+""+(getarg(0) % 100)+"%";
}
// callfunc("cap_value",<value 1>,<value 2 >,<value 3>);
function script cap_value {
return ((getarg(0) >= getarg(2)) ? getarg(2) : (getarg(0) <= getarg(1)) ? getarg(1) : getarg(0));
}
// callfunc("max",<min>,<max>);
function script max {
return (((getarg(0)) > (getarg(1))) ? (getarg(0)) : (getarg(1)));
}
// callfunc("remove_expired_mob"{,<type>{,<mob id>{,<position>}}});
function script remove_expired_mob {
set .@freeloop_size_active, getvariableofnpc(.freeloop_size_active, "extradrop");
set .@type, getarg(0, 0);
set .@id, getarg(1, 0);
set .@position, getarg(2, -1);
if (.@type)
{
if (.@position > -1)
{
if (gettimetick(2) >= $mob_global_time[.@position] && $mob_global_time[.@position] != -1)
{
deletearray $mob_global_drop[.@position], 1;
deletearray $mob_global_rate[.@position], 1;
deletearray $mob_global_element[.@position], 1;
deletearray $mob_global_race[.@position], 1;
deletearray $mob_global_ismvp[.@position], 1;
deletearray $mob_global_time[.@position], 1;
}
}
else
{
if (getarraysize($mob_global_drop) > .@freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < getarraysize($mob_global_drop); set .@i, .@i + 1)
{
if (gettimetick(2) >= $mob_global_time[.@i] && $mob_global_time[.@i] != -1)
{
deletearray $mob_global_drop[.@i], 1;
deletearray $mob_global_rate[.@i], 1;
deletearray $mob_global_element[.@i], 1;
deletearray $mob_global_race[.@i], 1;
deletearray $mob_global_ismvp[.@i], 1;
deletearray $mob_global_time[.@i], 1;
}
}
if (.@free)
freeloop(false);
}
}
else
{
if (.@position > -1 && .@id > 0)
{
set .@mob_id, callfunc("getelementofarrayd", "$mob_id", .@position);
if (strmobinfo(1, .@mob_id) != "")
{
set .@array_temp_name$, "$mob_" + .@mob_id;
set .@drop_array$, .@array_temp_name$ + "_drop";
set .@time_array$, .@array_temp_name$ + "_time";
set .@rate_array$, .@array_temp_name$ + "_rate";
if (getarraysize(getd(.@drop_array$)) > .@freeloop_size_active)
set .@free, freeloop(true);
for (set .@j, 0; .@j < getarraysize(getd(.@drop_array$)); set .@j, .@j + 1)
{
set .@time_val$, .@time_array$ + "[" + .@j + "]";
set .@rate$, .@rate_array$ + "[" + .@j + "]";
set .@drop$, .@drop_array$ + "[" + .@j + "]";
if (gettimetick(2) >= getd(.@time_val$) && getd(.@time_val$) != -1)
{
deletearray getd(.@drop$), 1;
deletearray getd(.@rate$), 1;
deletearray getd(.@time_val$), 1;
if (getarraysize(getd(.@drop_array$)) <= 0)
{
deletearray getd(.@drop_array$);
deletearray getd(.@time_array$);
deletearray getd(.@rate_array$);
callfunc("setarrayd", "$mob_id", .@position, 0);
break;
}
}
}
if (.@free)
freeloop(false);
}
}
else
{
if (callfunc("getarraysized", "$mob_id") > .@freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < callfunc("getarraysized", "$mob_id"); set .@i, .@i + 1)
{
set .@mob_id, callfunc("getelementofarrayd", "$mob_id", .@i);
if (.@id != .@mob_id && .@id != 0)
continue;
set .@array_temp_name$, "$mob_" + .@mob_id;
set .@drop_array$, .@array_temp_name$ + "_drop";
set .@time_array$, .@array_temp_name$ + "_time";
set .@rate_array$, .@array_temp_name$ + "_rate";
for (set .@j, 0; .@j < getarraysize(getd(.@drop_array$)); set .@j, .@j + 1)
{
set .@time_val$, .@time_array$ + "[" + .@j + "]";
set .@rate$, .@rate_array$ + "[" + .@j + "]";
set .@drop$, .@drop_array$ + "[" + .@j + "]";
if (gettimetick(2) >= getd(.@time_val$) && getd(.@time_val$) != -1)
{
deletearray getd(.@drop$), 1;
deletearray getd(.@rate$), 1;
deletearray getd(.@time_val$), 1;
if (getarraysize(getd(.@drop_array$)) <= 0)
{
deletearray getd(.@drop_array$);
deletearray getd(.@time_array$);
deletearray getd(.@rate_array$);
callfunc("setarrayd", "$mob_id", .@i, 0);
break;
}
}
}
break;
}
if (.@free)
freeloop(false);
}
}
return;
}
// callfunc("global_drop_string_format",<global array position>);
function script global_drop_string_format {
for (set .@i, 0; .@i < 10; set .@i, .@i + 1)
set .@element$[.@i], getvariableofnpc(.element$[.@i], "extradrop");
for (set .@i, 0; .@i < 10; set .@i, .@i + 1)
setarray .@race$[.@i], getvariableofnpc(.race$[.@i], "extradrop");
set .@position, getarg(0);
if ($mob_global_element[.@position] > -1)
set .@string_format$, ", Element: "+.@element$[$mob_global_element[.@position]]+" {"+$mob_global_element[.@position]+"}";
else
set .@string_format$, ", Element: None {-1}";
if ($mob_global_race[.@position] > -1)
set .@string_format$, .@string_format$ + ", Race: "+.@race$[$mob_global_race[.@position]]+" {"+$mob_global_race[.@position]+"}";
else
set .@string_format$, .@string_format$ + ", Race: None {-1}";
if ($mob_global_ismvp[.@position] > -1)
set .@string_format$, .@string_format$ + ", Boss: Yes {1}";
else
set .@string_format$, .@string_format$ + ", Boss: No {-1}";
return .@string_format$;
}
// callfunc("mob_drop_exists",<type>,<item id>);
function script mob_drop_exists {
set .@type$, getarg(0, 0);
set .@item_id, getarg(1);
if (atoi(.@type$) == 1)
{
if (!getarraysize($mob_global_drop))
return true;
for(set .@i, 0; .@i < getarraysize($mob_global_drop); set .@i, .@i + 1)
{
if (.@item_id == $mob_global_drop[.@i])
{
set .@item_id, 0;
break;
}
}
}
else
{
if (!getarraysize(getd(.@type$)))
return true;
for(set .@i, 0; .@i < getarraysize(getd(.@type$)); set .@i, .@i + 1)
{
set .@drop_id$, .@type$ + "[" + .@i + "]";
if (.@item_id == getd(.@drop_id$))
{
set .@item_id, 0;
break;
}
}
}
return ((!.@item_id) ? false : true);
}
// callfunc("get_rate",<rate>,<diff>,<mode>,<check_ismvp>{,<is_mvp>});
function script get_rate {
set .@rate, getarg(0);
set .@diff, getarg(1);
set .@mode, getarg(2);
set .@check_ismvp, getarg(3, 0);
set .@is_mvp, getarg(4, -1);
set .@check_battle_flag, getvariableofnpc(.check_battle_flag, "extradrop");
set .@check_item_boost, getvariableofnpc(.check_item_boost, "extradrop");
set .@renewal_drop, getvariableofnpc(.renewal_drop, "extradrop");
set .@is_boss, getvariableofnpc(.is_boss, "extradrop");
if (.@check_battle_flag)
{
// Change drops depending on monsters size
// Not implemented.
// Note: Need put support to script command 'getmonsterinfo' to get 'md->special_state.size'.
/*
if (getbattleflag("mob_size_influence"))
{
set .@special_state, getmonsterinfo(killedrid, 23);
if (.@special_state == 1 && .@rate >= 2)
set .@rate, .@rate / 2;
else if(.@special_state == 2)
set .@rate, .@rate * 2;
}
*/
// Drops affected by luk as a fixed increase
if (getbattleflag("drops_by_luk"))
set .@rate, .@rate + (readparam(bLuk) * getbattleflag("drops_by_luk") / 100);
// Drops affected by luk as a % increase
if (getbattleflag("drops_by_luk2"))
set .@rate, (5 + .@rate * readparam(bLuk) * getbattleflag("drops_by_luk2") / 10000);
// pk_mode increase drops if 20 level difference
if (getbattleflag("pk_mode") && .@diff >= 20)
set .@rate, (.@rate + ((.@rate / 100) * 25));
}
if (.@check_item_boost)
{
// Increase drop rate if user has SC_CASH_RECEIVEITEM
set .@val1, getstatus(SC_CASH_RECEIVEITEM, 1); // Now rig the drop rate to never be over 90% unless it is originally > 90%
set .@val2, getstatus(SC_OVERLAPEXPUP, 2);
if (getstatus(SC_CASH_RECEIVEITEM, 5) > 0)
set .@rate, callfunc("max", .@rate, callfunc("cap_value", (5 + .@rate * .@val1 / 100), 0, 9000));
if (getstatus(SC_OVERLAPEXPUP, 5) > 0)
set .@rate, callfunc("max", .@rate, callfunc("cap_value", (5 + .@rate * .@val2 / 100), 0, 9000));
}
if (RENEWAL_DROP && .@renewal_drop > 0)
{
if ((.@diff >= -15 && .@diff <= -13) || (.@diff >= 13 && .@diff <= 15))
set .@drop_modifier, 60;
else if ((.@diff >= -12 && .@diff <= -10) || (.@diff >= 10 && .@diff <= 12))
set .@drop_modifier, 70;
else if ((.@diff >= -9 && .@diff <= -7) || (.@diff >= 7 && .@diff <= 9))
set .@drop_modifier, 80;
else if ((.@diff >= -6 && .@diff <= -4) || (.@diff >= 4 && .@diff <= 6))
set .@drop_modifier, 90;
else if ((.@diff >= -3 && .@diff <= 0) || (.@diff >= 0 && .@diff <= 3) || (.@mode&.@is_boss))
{
if ((.@check_ismvp > 0 && .@is_mvp > -1) || !.@check_ismvp)
set .@drop_modifier, 100;
else
set .@drop_modifier, 50;
}
else
set .@drop_modifier, 50;
if (.@drop_modifier != 100)
{
set .@rate, .@rate * .@drop_modifier / 100;
if (.@rate < 1)
set .@rate, 1;
}
}
set .@mod_drop, readparam(126); // SP_MOD_DROP
if (.@mod_drop != 100)
{
set .@rate, .@rate * .@mod_drop / 100;
if (.@rate < 1)
set .@rate, 1;
}
if (.@rate > 10000)
set .@rate, 10000;
return .@rate;
}
- script OnExtraDropEvent -1,{
end;
OnNPCKillEvent:
set .@drop_style, getvariableofnpc(.drop_style, "extradrop");
set .@show_msg, getvariableofnpc(.show_msg, "extradrop");
set .@is_boss, getvariableofnpc(.is_boss, "extradrop");
set .@check_battle_flag, getvariableofnpc(.check_battle_flag, "extradrop");
set .@freeloop_size_active, getvariableofnpc(.freeloop_size_active, "extradrop");
set .@log, getvariableofnpc(.log, "extradrop");
getmapxy(.@map$, .@x, .@y, 0);
set .@diff, getmonsterinfo(killedrid, MOB_LV) - BaseLevel;
set .@race, getmonsterinfo(killedrid, MOB_RACE);
set .@mode, getmonsterinfo(killedrid, MOB_MODE);
set .@element, getmonsterinfo(killedrid, MOB_ELEMENT);
if (getarraysize($mob_global_drop) > 0)
{
if (!(strmobinfo(1, killedrid) == ""))
{
if (getarraysize($mob_global_drop) > .@freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < getarraysize($mob_global_drop); set .@i, .@i + 1)
{
if (gettimetick(2) >= $mob_global_time[.@i] && $mob_global_time[.@i] != -1)
{
deletearray $mob_global_drop[.@i], 1;
deletearray $mob_global_rate[.@i], 1;
deletearray $mob_global_element[.@i], 1;
deletearray $mob_global_race[.@i], 1;
deletearray $mob_global_ismvp[.@i], 1;
deletearray $mob_global_time[.@i], 1;
if (getarraysize($mob_global_drop) <= 0)
break;
}
else
{
set .@item_name$, getitemname($mob_global_drop[.@i]);
set .@rate, callfunc("get_rate", $mob_global_rate[.@i], .@diff, .@mode, 1, $mob_global_ismvp[.@i]);
if (rand(10000) >= .@rate)
continue;
if ($mob_global_race[.@i] > -1 && $mob_global_race[.@i] != .@race)
continue;
if ($mob_global_element[.@i] > -1 && $mob_global_element[.@i] != .@element)
continue;
if ($mob_global_ismvp[.@i] > -1 && !(.@mode&.@is_boss))
continue;
if (.@drop_style > 0)
makeitem $mob_global_drop[.@i], 1, .@map$, .@x, .@y;
else
{
if (checkweight($mob_global_drop[.@i], 1))
getitem $mob_global_drop[.@i], 1;
else
makeitem $mob_global_drop[.@i], 1, .@map$, .@x, .@y;
}
// A Rare Drop Global Announce
if (.@rate <= getbattleflag("rare_drop_announce") && .@check_battle_flag)
announce "'" + strcharinfo(0) + "' got " + getmonsterinfo(killedrid, MOB_NAME) + "'s " + .@item_name$ + " (chance: " + callfunc("percent_format", .@rate) + ")", bc_all;
// Logs
if (.@log > 0)
query_sql "INSERT INTO `picklog` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `unique_id`) VALUES (NOW(), '"+getcharid(0)+"', 'M', '"+$mob_global_drop[.@i]+"', '-1', '0', '0', '0', '0', '0', '"+strcharinfo(3)+"', '0')";
if (.@show_msg > 0)
message strcharinfo(0), "You got '" + .@item_name$ + "' {" + $mob_global_drop[.@i] + "}, chance: " + callfunc("percent_format", .@rate) + ".";
}
}
if (.@free)
freeloop(false);
}
}
if (callfunc("getarraysized", "$mob_id") > .@freeloop_size_active)
set .@free, freeloop(true);
for (set .@i, 0; .@i < callfunc("getarraysized", "$mob_id"); set .@i, .@i + 1)
{
set .@mob_id, callfunc("getelementofarrayd", "$mob_id", .@i);
set .@array_temp_name$, "$mob_" + .@mob_id;
set .@drop_array$, .@array_temp_name$ + "_drop";
set .@time_array$, .@array_temp_name$ + "_time";
set .@rate_array$, .@array_temp_name$ + "_rate";
if (.@mob_id != killedrid)
continue;
if (getarraysize(getd(.@drop_array$)) > .@freeloop_size_active && !.@free)
set .@free, freeloop(true);
for (set .@j, 0; .@j < getarraysize(getd(.@drop_array$)); set .@j, .@j + 1)
{
set .@time_val$, .@time_array$ + "[" + .@j + "]";
set .@rate$, .@rate_array$ + "[" + .@j + "]";
set .@drop$, .@drop_array$ + "[" + .@j + "]";
if (gettimetick(2) >= getd(.@time_val$) && getd(.@time_val$) != -1)
{
deletearray getd(.@drop$), 1;
deletearray getd(.@rate$), 1;
deletearray getd(.@time_val$), 1;
if (getarraysize(getd(.@drop_array$)) <= 0)
{
deletearray getd(.@drop_array$);
deletearray getd(.@time_array$);
deletearray getd(.@rate_array$);
callfunc("setarrayd", "$mob_id", .@i, 0);
break;
}
}
else
{
set .@id, getd(.@drop$);
set .@item_name$, getitemname(.@id);
set .@rate, callfunc("get_rate", getd(.@rate$), .@diff, .@mode);
if (rand(10000) >= .@rate)
continue;
if (.@drop_style > 0)
makeitem .@id, 1, .@map$, .@x, .@y;
else
{
if (checkweight(.@id, 1))
getitem .@id, 1;
else
makeitem .@id, 1, .@map$, .@x, .@y;
}
// A Rare Drop Global Announce
if (.@rate <= getbattleflag("rare_drop_announce") && .@check_battle_flag)
announce "'" + strcharinfo(0) + "' got " + getmonsterinfo(killedrid, MOB_NAME) + "'s " + .@item_name$ + " (chance: " + callfunc("percent_format", .@rate) + ")", bc_all;
// Logs
if (.@log > 0)
query_sql "INSERT INTO `picklog` (`time`, `char_id`, `type`, `nameid`, `amount`, `refine`, `card0`, `card1`, `card2`, `card3`, `map`, `unique_id`) VALUES (NOW(), '"+getcharid(0)+"', 'M', '"+.@id+"', '-1', '0', '0', '0', '0', '0', '"+strcharinfo(3)+"', '0')";
if (.@show_msg > 0)
message strcharinfo(0), "You got '" + .@item_name$ + "' {" + .@id + "}, chance: " + callfunc("percent_format", .@rate) + ".";
}
}
if (callfunc("getarraysized", "$mob_id") <= .@freeloop_size_active && .@free)
freeloop(false);
}
if (.@free)
freeloop(false);
end;
}