viewing paste Identifier | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
//===== 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;
}
Viewed 941 times, submitted by Guest.