//===== eAthena Script =======================================
// Item Identifier
//===== By: ==================================================
// Spamrat
//===== Current Version: =====================================
// 1.0
//===== Compatible With: =====================================
// eAthena SVN 3422+
//===== Description: =========================================
// This will setup a NPC in the towns available via the
// @go 0 through @go 6 commands that will identify all
// the player's unidentified equipment.
//===== Comments: ============================================
// To use the main function, use the following template.
//
// callfunc "F_Identifier", <"Name of NPC">, <ID Fee per Item>;
//
// The function will not return back to the calling script or
// NPC, but just end execution when finished or canceled.
//===== Additional Comments: =================================
// 1.0 First Version (Spamrat)
//============================================================
prontera.gat,147,161,5 script Deckard#ID0 851,{
callfunc "F_Identifier", "Deckard", 100;
}
morocc.gat,168,105,3 script Winston#ID1 851,{
callfunc "F_Identifier", "Winston", 100;
}
geffen.gat,112,63,5 script Edward#ID2 851,{
callfunc "F_Identifier", "Edward", 100;
}
payon.gat,166,221,2 script Mark#ID3 851,{
callfunc "F_Identifier", "Mark", 100;
}
alberta.gat,183,143,5 script Boris#ID4 851,{
callfunc "F_Identifier", "Boris", 100;
}
izlude.gat,132,121,5 script Yaring#ID5 851,{
callfunc "F_Identifier", "Yaring", 100;
}
aldebaran.gat,133,119,5 script Robert#ID6 851,{
callfunc "F_Identifier", "Robert", 100;
}
function script F_Identifier {
set @NPCName$, getarg(0);
set @IDFee, getarg(1);
mes "[" + @NPCName$ + "]";
mes "Need me to identify your equipment?";
next;
menu "Yes, please.",-,"No thanks.",L_Cancel;
mes "[" + @NPCName$ + "]";
if (@IDFee <= 0) { mes "Ok, let me have a look at your inventory."; }
else { mes "Ok, lets have a look at how many need to be identified."; }
next;
if (@inventorylist_count > 0) {
deletearray @inventorylist_id[0], @inventorylist_count;
deletearray @inventorylist_amount[0], @inventorylist_count;
deletearray @inventorylist_equip[0], @inventorylist_count;
deletearray @inventorylist_refine[0], @inventorylist_count;
deletearray @inventorylist_identify[0], @inventorylist_count;
deletearray @inventorylist_attribute[0], @inventorylist_count;
deletearray @inventorylist_card1[0], @inventorylist_count;
deletearray @inventorylist_card2[0], @inventorylist_count;
deletearray @inventorylist_card3[0], @inventorylist_count;
deletearray @inventorylist_card4[0], @inventorylist_count;
set @inventorylist_count, 0;
}
getinventorylist;
if (@inventorylist_count == 0) goto L_EmptyInventory;
set @Y, 0;
for( set @X, 0; @X < @inventorylist_count; set @X, @X + 1 ) {
if (@inventorylist_identify[@X] == 0) { set @UnIDdItem[@Y], @X; set @Y, @Y + 1; }
}
if (@Y == 0) goto L_AllIdentified;
if (@IDFee <= 0) goto L_Idenfity;
mes "[" + @NPCName$ + "]";
if (@Y == 1) { mes "You have 1 unidentified item."; }
else { mes "You have " + @Y + " unidentified items."; }
mes " ";
mes "It will cost you ^0000FF" + @IDFee + " zeny^000000 per unidentified item.";
next;
if (Zeny < @IDFee) goto L_NotEnoughZeny1;
mes "[" + @NPCName$ + "]";
mes "How many do you want me to identify?";
next;
switch(select("As many as possible.","I'll choose the amount.","Cancel")) {
case 1:
goto L_Identify;
case 2:
mes "[" + @NPCName$ + "]";
mes "Please enter the amount you want identified.";
mes " ";
if (@Y == 1) { mes "You have 1 unidentified item."; }
else { mes "You have " + @Y + " unidentified items."; }
next;
input @Z;
if (@Z <= 0) goto L_Cancel;
if (@Z > @Y) set @Z, @Y;
if (Zeny < @Z * @IDFee) goto L_NotEnoughZeny2;
if (@Z < @Y) set @Y, @Z;
goto L_Identify;
default:
goto L_Cancel;
}
L_EmptyInventory:
mes "[" + @NPCName$ + "]";
mes "You don't even have anything equipped, much less in your inventory.";
next;
mes "[" + @NPCName$ + "]";
mes "Come back when you've got something for me to look at.";
goto L_Cancel;
L_AllIdentified:
mes "[" + @NPCName$ + "]";
mes "Everything has already been identified.";
goto L_Cancel;
L_Identify:
for( set @X, 0; @X < @Y; set @X, @X + 1 ) {
set @Z, @UnIDdItem[@X];
if (Zeny < @IDFee) goto L_NotEnoughZeny3;
if (@IDFee > 0) set Zeny, Zeny - @IDFee;
delitem2 @inventorylist_id[@Z], 1, 0, @inventorylist_refine[@Z], @inventorylist_attribute[@Z], @inventorylist_card1[@Z], @inventorylist_card2[@Z], @inventorylist_card3[@Z], @inventorylist_card4[@Z];
getitem2 @inventorylist_id[@Z], 1, 1, @inventorylist_refine[@Z], @inventorylist_attribute[@Z], @inventorylist_card1[@Z], @inventorylist_card2[@Z], @inventorylist_card3[@Z], @inventorylist_card4[@Z];
}
mes "[" + @NPCName$ + "]";
if (@Y == 1) { mes "I have successfully identified 1 item."; }
else { mes "I have successfully identified " + @Y + " items."; }
mes " ";
mes "Thank you for your patronage.";
goto L_Cancel;
L_NotEnoughZeny1:
mes "[" + @NPCName$ + "]";
mes "However, you don't even have enough zeny to cover the first item.";
goto L_Cancel;
L_NotEnoughZeny2:
mes "[" + @NPCName$ + "]";
mes "I'm sorry, but you don't have enough zeny to have me identify that many items.";
goto L_Cancel;
L_NotEnoughZeny3:
mes "[" + @NPCName$ + "]";
mes "I'm sorry, but you don't have enough zeny left to pay my fee.";
mes " ";
set @Z, @X + 1;
if (@Z == 1) { mes "However, I have successfully identified 1 of your items."; }
else { mes "However, I have successfully identified " + @Z + " of your items."; }
goto L_Cancel;
L_Cancel:
close2;
if (@inventorylist_count > 0) {
deletearray @inventorylist_id[0], @inventorylist_count;
deletearray @inventorylist_amount[0], @inventorylist_count;
deletearray @inventorylist_equip[0], @inventorylist_count;
deletearray @inventorylist_refine[0], @inventorylist_count;
deletearray @inventorylist_identify[0], @inventorylist_count;
deletearray @inventorylist_attribute[0], @inventorylist_count;
deletearray @inventorylist_card1[0], @inventorylist_count;
deletearray @inventorylist_card2[0], @inventorylist_count;
deletearray @inventorylist_card3[0], @inventorylist_count;
deletearray @inventorylist_card4[0], @inventorylist_count;
set @inventorylist_count, 0;
}
set @NPCName$, "";
set @IDFee, 0;
set @X, 0;
set @Y, 0;
set @Z, 0;
end;
}