// Item and Monster search function (attached to item #12105) [Neviril]
function script F_Search {
mes "This info kit fits right in your pocket!";
mes "What do you want to do?";
menu "- Search for a Monster",-,"- Search for an Item",L_Item;
next;
L_Mob2:
dispbottom "Initiating Monster Database...";
progressbar "0xRRGGBB",1;
mes "Database successfully loaded. What Monster do you want to learn about?:";
mes " ";
mes "Please ^ff0000only input the Monster's full name^000000 or there will be incorrect results!";
input .@mobname$;
.@amount = query_sql ("SELECT ID, HP, SP, ATK1, Race, Element, DEF, MDEF FROM mob_db WHERE kName = '"+ escape_sql(.@mobname$) +"'", @id, .@hp, .@sp, .@atk1, .@race, .@element, .@def, .@mdef);
if (.@amount == 0) { //No mobs found
next;
mes "^ff0000Error 404^000000: The Monster '^ff0000"+.@mobname$+"^000000' does not exist in the official database!";
mes "Please check your spelling or try the advanced Monster search option.";
next;
menu "Search for another Monster",L_Mob2,"Try advanced (Custom) Monster search",L_Adv,"Exit",L_later2;
}
for (.@i = 0; .@i < .@amount; .@i++) {
next;
mes "[Search Results: '"+.@mobname$+"' ]";
mes "Name: "+.@mobname$;
mes "ID: "+@id[.@i];
mes "HP: "+.@hp[.@i];
mes "SP: "+.@sp[.@i];
mes "ATK: "+.@atk1[.@i];
mes "DEF: "+getmonsterinfo(@id,7);
mes "MDEF: "+getmonsterinfo(@id,8);
mes "Base EXP: "+getmonsterinfo(@id[.@i],3);
mes "Job EXP: "+getmonsterinfo(@id[.@i],4);
mes "Race: "+getmonsterinfo(@id,19);
mes "Element: "+.@element[.@i];
mes "Size: "+getmonsterinfo(@id,18);
}
next;
goto L_Menu;
// Searching in mob_db2
L_Adv:
.@amount4 = query_sql ("SELECT ID, HP, SP, ATK1, Race, Element, DEF, MDEF FROM mob_db2 WHERE kName = '"+ escape_sql(.@mobname$) +"'", @id, .@hp, .@sp, .@atk1, .@race, .@element, .@def, .@mdef);
if (.@amount4 == 0) { //No mobs found
next;
mes "^ff0000Error 404^000000: The Monster '^ff0000"+.@mobname$+"^000000' does not exist in the custom database!";
mes "Please check your spelling and try again.";
next;
menu "Search for another Monster",L_Mob2,"Exit",L_later2;
}
for (.@i = 0; .@i < .@amount4; .@i++) {
next;
mes "[Custom Search Results: '"+.@mobname$+"' ]";
mes "Name: "+.@mobname$;
mes "ID: "+@id[.@i];
mes "HP: "+.@hp[.@i];
mes "SP: "+.@sp[.@i];
mes "ATK: "+.@atk1[.@i];
mes "DEF: "+getmonsterinfo(@id,7);
mes "MDEF: "+getmonsterinfo(@id,8);
mes "Base EXP: "+getmonsterinfo(@id[.@i],3);
mes "Job EXP: "+getmonsterinfo(@id[.@i],4);
mes "Race: "+getmonsterinfo(@id,19);
mes "Element: "+.@element[.@i];
mes "Size: "+getmonsterinfo(@id,18);
}
next;
goto L_Menu6;
L_Menu:
menu "Where can I find '"+.@mobname$+"'?",L_find,"Try advanced (Custom) Monster search",L_Adv,"Search for another Monster",L_Mob2,"Exit",L_later;
L_Menu6:
menu "Where can I find '"+.@mobname$+"'?",L_find,"Search for another Monster",L_Mob2,"Exit",L_later;
L_find:
atcommand "@whereis "+@id;
dispbottom "[ Notice ] : The Information Kit search feature only locates the naturally spawned monsters!";
next;
goto L_Menu4;
L_Menu4:
menu "Search for another Monster",L_Mob2,"Exit",L_later;
L_later:
close;
// Start item search
L_Item:
next;
L_Item2:
dispbottom "Initiating Item Database...";
progressbar "0xRRGGBB",1;
mes "Database successfully loaded. What Item do you want to learn about?:";
mes " ";
mes "Please ^ff0000only input the Item's full name^000000 or there will be incorrect results!";
input .@itemname$;
// Searching in item_db
.@amount2 = query_sql ("SELECT ID, weight, atk, defence, slots, equip_level_min FROM item_db WHERE name_japanese = '"+ escape_sql(.@itemname$) +"'", @iid, .@weight, .@attack, .@defence, .@slots, .@elvl);
if (.@amount2 == 0) { //No items found
next;
mes "^ff0000Error 404^000000: The Item '^ff0000"+.@itemname$+"^000000' does not exist in the official database!";
mes "Please check your spelling or try the advanced Item search option.";
next;
menu "Search for another Item",L_Item2,"Try advanced (Custom) Item search",L_Adv2,"Exit",L_later2;
}
for (.@i = 0; .@i < .@amount2; .@i++) {
next;
mes "[Search Results: '"+.@itemname$+"' ]";
mes "Name: "+.@itemname$+" ["+.@slots[.@i]+"] ";
mes "ID: "+@iid[.@i];
mes "ATK: "+.@attack[.@i];
mes "DEF: "+.@defence[.@i];
mes "Lv Req: "+.@elvl[.@i];
mes "Weight: "+(.@weight[.@]/10);
mes "Buy Price: "+getiteminfo(@iid,0);
mes "Sell Price: "+getiteminfo(@iid,1);
}
next;
goto L_Menu2;
// Searching in item_db2
L_Adv2:
.@amount3 = query_sql ("SELECT ID, weight, atk, defence, slots, equip_level_min FROM item_db2 WHERE name_japanese = '"+ escape_sql(.@itemname$) +"'", @iid, .@weight, .@attack, .@defence, .@slots, .@elvl);
if (.@amount3 == 0) { //No items found
next;
mes "^ff0000Error 404^000000: The Item '^ff0000"+.@itemname$+"^000000' does not exist in the custom database!";
mes "Please check your spelling and try again.";
next;
menu "Search for another Item",L_Item2,"Exit",L_later2;
}
for (.@i = 0; .@i < .@amount3; .@i++) {
next;
mes "[Custom Search Results: '"+.@itemname$+"' ]";
mes "Name: "+.@itemname$+" ["+.@slots[.@i]+"] ";
mes "ID: "+@iid[.@i];
mes "ATK: "+.@attack[.@i];
mes "DEF: "+.@defence[.@i];
mes "Lv Req: "+.@elvl[.@i];
mes "Weight: "+(.@weight[.@]/10);
mes "Buy Price: "+getiteminfo(@iid,0);
mes "Sell Price: "+getiteminfo(@iid,1);
}
next;
goto L_Menu3;
L_Menu2:
menu "Which monster drops '"+.@itemname$+"'?",-,"Try advanced (Custom) Item search",L_Adv2,"Search for another Item",L_Item2,"Exit",L_later2;
for (.@i = 0; .@i < .@amount2; .@i++) {
atcommand "@whodrops "+@iid[.@i];
}
next;
goto L_Menu5;
L_Menu3:
menu "Which monster drops '"+.@itemname$+"'?",-,"Search for another Item",L_Item2,"Exit",L_later2;
for (.@i = 0; .@i < .@amount3; .@i++) {
atcommand "@whodrops "+@iid[.@i];
}
next;
goto L_Menu5;
L_Menu5:
menu "Search for another Item",-,"Exit",L_later2;
goto L_Item;
L_later2:
close;
}