viewing paste Unknown #14818 | 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
prontera,153,150,4  script  Enchant 872,{
    mes .npc$;
    mes "Hello there!";
    mes "I can enchant your items,";
    mes "for a small fee of "+.pric+"z.";
    emotion e_no1,0; next;
    if(select("Yes:No")&2) { mes .npc$; mes "Alright, thanks anyways!"; close; }
    if(Zeny<.pric) { mes .npc$; mes "I'm sorry you don't have enough Zeny, please come back later."; close; }
    
    mes .npc$;
    mes "Which item would you like to enchant?"; next;
    while(set(.@a,.@a+1)<=getarraysize(.equip)) {
        if(getequipid(.equip[.@a - 1])>-1)
            set .@menu$, .@menu$+.eqp$[.@a-1]+"- [^0000FF"+getitemname(getequipid(.equip[.@a - 1]))+"^000000]:";
        else set .@menu$, .@menu$+"^adb4be"+.eqp$[.@a-1]+"- [Empty]^000000:";
    }
        
    select(.@menu$);
    set .@eq_loc, @menu;
    set .@eq_itm, getequipid(.@eq_loc);
    if(.@eq_itm<0) {
        mes .npc$;
        mes "Hmm, I don't think you have anything equipped there.";
        close;
    }
    
    set .@menu$, "";
    set .@a, .en_orb[0];
    while((set(.@a,.@a+1)-1)<=.en_orb[1])
        if(getiteminfo(.@a-1,2)>-1)
            if(set(.@c,countitem(.@a-1))) {
                set .@menu$, .@menu$+getitemname(.@a-1)+" x"+.@c+":";
                set .@b,.@b+1; set .@item[.@b], .@a-1;
            }
            
    if(.@menu$=="") {
        mes .npc$;
        mes "Hmm, you don't seem to have any enchantment orbs.";
        close;
    }
 
    mes .npc$;
    mes "Please, select an enchantment from the menu."; next;
    select(.@menu$);
    set .@itm, .@item[@menu];
 
    set .@menu$, ""; set .@a, 0;
    while((set(.@a,.@a+1)-1)<4) {
        setd(".@crd"+.@a, getequipcardid(.@eq_loc,.@a-1));
        if(getequipcardid(.@eq_loc,.@a-1))
            set .@menu$, .@menu$+.@a+.crd_c$[.@a-1]+" Slot- [^a92435"+getitemname(getequipcardid(.@eq_loc,.@a-1))+"^000000]:";
        else set .@menu$, .@menu$+.@a+.crd_c$[.@a-1]+" Slot- [^30ad25Empty^000000]:";
    }
    
    mes .npc$;
    mes "Select a slot."; next;
    select(.@menu$);
    set .@eqrf, getequiprefinerycnt(.@eq_loc);
    if(getequipcardid(.@eq_loc,@menu-1)) {
        mes .npc$;
        mes "Would you like me to remove this card?"; next;
        if(select("Yes:No")&2) { mes .npc$; mes "Alright, thanks anyways!"; close; }
        getitem getequipcardid(.@eq_loc,@menu-1),1;
        delitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@crd1, .@crd2, .@crd3, .@crd4;
        setd(".@crd"+@menu, 0);
        getitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@crd1, .@crd2, .@crd3, .@crd4;
    }
 
    if(rand(100)>.perc) {
        mes .npc$;
        mes "I'm sorry but I've failed you!";
        misceffect 155; emotion e_sob,0;
        set Zeny,Zeny-.pric;
        close;
    }
    
    set Zeny,Zeny-.pric;
    delitem .@itm,1;
    delitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@crd1, .@crd2, .@crd3, .@crd4;
    setd(".@crd"+@menu, .@itm);
    getitem2 .@eq_itm, 1, 1, .@eqrf, 0, .@crd1, .@crd2, .@crd3, .@crd4;
    misceffect .efet;
    emotion e_no1,0;
    mes .npc$;
    mes "All done!";
    equip .@eq_itm;
    close;
 
//NPC Constants
    OnInit:
        //=-=-=-=-=-=-=Configuration=-=-=-=-=-=-=
        set      .npc$  ,   "[^0000FFEnchant Expert^000000]"; // NPC Name
        set      .pric  ,   1000000;                          // Price
        set      .efet  ,   154;                              // Effect Number
        set      .perc  ,   rand(50,80);                      // Percent
        setarray .crd_c$,   "st", "nd", "rd", "th";           // Count
        setarray .en_orb,   4700, 4862;                       // Range of IDs selected for enchanting.
        setarray .eqp$  ,   "Upper Headgear", "Mid Headgear", "Low Headgear";
        setarray .equip ,   1, 9, 10;
        set      .e_len ,   getarraysize(.eqp$);
        //=-=-=-=-=-=-=-=-Skorm-=-=-=-=-=-=-=-=-=
}
Viewed 635 times, submitted by Normynator.