[1] | 1 | //===== eAthena Script ======================================= |
---|
| 2 | //= Kunai "Trader" @ que_ng |
---|
| 3 | //===== By: ================================================== |
---|
| 4 | //= eAthena dev team |
---|
| 5 | //===== Current Version: ===================================== |
---|
| 6 | //= 1.2a |
---|
| 7 | //===== Compatible With: ===================================== |
---|
| 8 | //= eAthena 1.0 |
---|
| 9 | //===== Description: ========================================= |
---|
| 10 | //= NPC that trades you a few shurikens + ninja stones for |
---|
| 11 | //= elemental kunais. |
---|
| 12 | //===== Additional Comments: ================================= |
---|
| 13 | //= 1.0 Added the npc. It uses a function that sends the item |
---|
| 14 | //= id of the 2 required items plus the amount. Can trade |
---|
| 15 | //= up to 500 units (5,000 kunais) at once. [erKURITA] |
---|
| 16 | //= 1.1 Officialized script [Playtester] |
---|
| 17 | //= 1.2a Optimized/cleaned up a bit [ultramage] |
---|
| 18 | //============================================================ |
---|
| 19 | |
---|
| 20 | que_ng,72,29,3 script Kunai Merchant Kashin 83,{ |
---|
| 21 | |
---|
| 22 | mes "[Kashin]"; |
---|
| 23 | if(BaseJob != Job_Ninja) { |
---|
| 24 | mes "I am Kashin of the Wind. I distribute trade items to the shadows."; |
---|
| 25 | next; |
---|
| 26 | mes "[Kashin]"; |
---|
| 27 | mes "It doesn't seem like you are a Ninja... Just take a good look around and be on your way."; |
---|
| 28 | close; |
---|
| 29 | } |
---|
| 30 | mes "I'm Kashin!"; |
---|
| 31 | mes "If you're ever short on Shurikens, come and see me."; |
---|
| 32 | next; |
---|
| 33 | mes "[Kashin]"; |
---|
| 34 | mes "What will it be?"; |
---|
| 35 | mes "Choose what you want."; |
---|
| 36 | next; |
---|
| 37 | |
---|
| 38 | switch(select("Poison Kunais:Frost Kunais:Wind Kunais:Earth Kunais:Fire Kunais:Cancel")) { |
---|
| 39 | //usage: callfunc "Kunai_Trade",itemreqid1,itemreqct1,itemreqid2,itemreqct2,itemidtrade; |
---|
| 40 | case 1: callfunc "Kunai_Trade",13250,20,7524,1,13259; break; |
---|
| 41 | case 2: callfunc "Kunai_Trade",13251,8,7522,2,13255; break; |
---|
| 42 | case 3: callfunc "Kunai_Trade",13252,4,7523,2,13257; break; |
---|
| 43 | case 4: callfunc "Kunai_Trade",13253,2,7524,1,13256; break; |
---|
| 44 | case 5: callfunc "Kunai_Trade",13254,1,7521,2,13258; break; |
---|
| 45 | default: |
---|
| 46 | mes "[Kashin]"; |
---|
| 47 | mes "Hmm~ Ok~"; |
---|
| 48 | mes "Come again~"; |
---|
| 49 | mes "I, Kashin of the Wind, will always be at this place."; |
---|
| 50 | close; |
---|
| 51 | } |
---|
| 52 | close; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | function script Kunai_Trade { |
---|
| 56 | |
---|
| 57 | mes "[Kashin]"; |
---|
| 58 | mes "If you give me "+getarg(1)+" "+getitemname(getarg(0))+" and "+getarg(3)+" "+getitemname(getarg(2))+", I'll give you a pack of 10 "+getitemname(getarg(4))+"."; |
---|
| 59 | next; |
---|
| 60 | mes "[Kashin]"; |
---|
| 61 | mes "You can trade up to 500 packs at a time."; |
---|
| 62 | mes "If you don't want to trade, just enter 0 as the amount."; |
---|
| 63 | next; |
---|
| 64 | input .@amount; |
---|
| 65 | |
---|
| 66 | mes "[Kashin]"; |
---|
| 67 | if(.@amount < 1) { |
---|
| 68 | mes "Hmm~ Ok~"; |
---|
| 69 | mes "Come again~"; |
---|
| 70 | mes "I, Kashin of the Wind, will always be at this place."; |
---|
| 71 | close; |
---|
| 72 | } |
---|
| 73 | if(.@amount > 500) { |
---|
| 74 | mes "You've exceeded the input amount!"; |
---|
| 75 | mes "Enter a valid number next time~!"; |
---|
| 76 | close; |
---|
| 77 | } |
---|
| 78 | if(countitem(getarg(0)) < .@amount*getarg(1) || countitem(getarg(2)) < .@amount*getarg(3)) { |
---|
| 79 | mes "Hmm... this is no good~"; |
---|
| 80 | mes "You don't have enough materials to trade in for the amount of Kunai's that you want."; |
---|
| 81 | mes "Bring some more if you want this amount."; |
---|
| 82 | close; |
---|
| 83 | } |
---|
| 84 | if(checkweight(getarg(4), .@amount*10) == 0) { |
---|
| 85 | mes "Your bag is too full to carry the trade items. Come back after you made room for the traded items."; |
---|
| 86 | close; |
---|
| 87 | } |
---|
| 88 | mes "Ok~ Very well!"; |
---|
| 89 | mes "Amount verified!"; |
---|
| 90 | mes "Here are your traded items."; |
---|
| 91 | delitem getarg(0),getarg(1)*.@amount; |
---|
| 92 | delitem getarg(2),getarg(3)*.@amount; |
---|
| 93 | getitem getarg(4),10*.@amount; |
---|
| 94 | close; |
---|
| 95 | } |
---|