From 0c7999d8782853f7711a884646a6054e8caa6d51 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 7 Jun 2019 21:52:08 -0300 Subject: Nivalis Meltdown Forge: Receive 50~70% of invested ingots back! Coal and Everburn Powder are NEVER returned because they are consumed at craft. All values are rounded down. Wooden Sword is an exception. Only for craft items. --- npc/020-5/bracco.txt | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'npc/020-5') diff --git a/npc/020-5/bracco.txt b/npc/020-5/bracco.txt index 0854387a2..6a914a477 100644 --- a/npc/020-5/bracco.txt +++ b/npc/020-5/bracco.txt @@ -7,6 +7,31 @@ 020-5,31,25,0 script Bracco NPC_M_SHOPKEEPER,{ goto L_Start; + // Meltdown( item, price, {id1, amount1}, {id2, amount2}... ) + function Meltdown { + if (getargcount() < 2 || getargcount() % 2 != 0) + return Exception("Faulty learning Meltdown command invoked - error"); + + .@index=getarg(0); + .@price=getarg(1); + mesn; + mesc l("Really melt down your @@? It'll cost you @@ GP. This action cannot be undone!", getinvindexlink(.@index), .@price), 1; + next; + if (askyesno() == ASK_NO || Zeny < .@price) + return; + + failedremovecardsindex .@index, 0; + Zeny-=.@price; + + // TODO: Inventoryplace + // Add Items (if inventory is full, your fault and not mine) + for (.@i=2;.@i < getargcount(); .@i++) { + getitem getarg(.@i), getarg(.@i+1); + .@i++; + } + return; + } + // blacksmith_create( BaseItem1, Amount, BaseItem2, Amount, PrizeItem, Price ) function blacksmith_create { .@base1=getarg(0); @@ -59,11 +84,16 @@ L_Start: select l("Trade"), l("I'm actually looking for an item forged!"), + l("I would like an item melted!"), l("Leave"); + mes ""; if (@menu == 2) goto L_Forge; + if (@menu == 3) + goto L_Meltdown; + closedialog; if (@menu == 1) shop .name$; @@ -95,6 +125,40 @@ L_Forge: } goto L_Forge; +L_Meltdown: + mesn; + mesc l("What item do you want to melt down? This is irreversible, and may return some ingots to you, but there is no way to tell how many you'll receive!"), 1; + mesc l("Each item have it's own tax."); + .@it=requestitemindex(); + delinventorylist(); + getinventorylist(); + .@id=@inventorylist_id[.@it]; + mes ""; + // Returns 50~70% of invested ingots, rounded down. Never returns Coal. + switch (.@id) { + case WoodenSword: + Meltdown(.@it, 500, WoodenLog, rand2(5,10)); // Exception: 25~50% returned + break; + case BugSlayer: + Meltdown(.@it, 1000, IronIngot, rand2(4,5)); + break; + case ShortGladius: + Meltdown(.@it, 1500, IronIngot, rand2(6,8)); + break; + case Backsword: + Meltdown(.@it, 2000, IronIngot, rand2(9,12), TinIngot, rand2(1,2)); + break; + case ShortSword: + Meltdown(.@it, 2500, IronIngot, rand2(12,16), TinIngot, rand2(2,3)); + break; + default: + mesn; + mesq l("I cannot melt this. I only melt down equipment, and not everything I know how to!"); + next; + break; + } + goto L_Meltdown; + OnInit: .@npcId = getnpcid(.name$); setunitdata(.@npcId, UDT_HEADTOP, NPCEyes); -- cgit v1.2.3-70-g09d2