From 1b20e2026bfbb7c72a6ce530bf0ca15005e2c3a0 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 1 Jan 2020 20:46:43 -0300 Subject: Mercenary banalization prototype --- npc/020-1/_import.txt | 1 + npc/020-1/trainer.txt | 147 ++++++++++++++++++++++++++++++++++++++++++++++++ npc/items/mercenary.txt | 46 +++++++++++++++ 3 files changed, 194 insertions(+) create mode 100644 npc/020-1/trainer.txt (limited to 'npc') diff --git a/npc/020-1/_import.txt b/npc/020-1/_import.txt index ca7a3e6a9..2eb1208d0 100644 --- a/npc/020-1/_import.txt +++ b/npc/020-1/_import.txt @@ -8,5 +8,6 @@ "npc/020-1/serge.txt", "npc/020-1/siege.txt", "npc/020-1/town.txt", +"npc/020-1/trainer.txt", "npc/020-1/wateranimation.txt", "npc/020-1/well.txt", diff --git a/npc/020-1/trainer.txt b/npc/020-1/trainer.txt new file mode 100644 index 000000000..79f589ea7 --- /dev/null +++ b/npc/020-1/trainer.txt @@ -0,0 +1,147 @@ +// TMW2 scripts. +// Authors: +// Jesusalva +// Description: +// Mercenary Trainer + +020-1,39,89,0 script Mercenary Trainer NPC_REDY_MALE_SWORD,{ + mesn; + mesq l("Hello, I am a sword to hire, a Mercenary Trainer and Chief."); + next; + mesn; + mesq l("Do you want to hire a mercenary? Or perhaps get a card so you can invoke them later? I can even make them stronger if you wish."); + next; + goto L_Main; + +L_Main: + select + l("Hire a mercenary"), + l("Buy a mercenary card"), + l("Evolve mercenaries"), + l("Bye."); + mes ""; + switch (@menu) { + // Hire Card + case 1: + if (!is_staff()) { + mesc l("ERROR: Unknown error"), 1; + break; + } + menuint + l("[%d GP] [Lv 1~25] Hire for one hour", 2500), 1, + l("[%d GP] [Lv 26~40] Hire for one hour", 7500), 2, + l("[%d GP] [Lv 41~60] Hire for one hour", 15000), 3, + l("[%d GP] [Lv 61~79] Hire for one hour", 30000), 4, + l("[%d GP] [Lv 80~100] Hire for one hour", 50000), 5, + l("I've changed my mind"), 0; + switch (@menuret) { + case 1: + .@gp=max(2000, POL_AdjustPrice(2500)); + if (Zeny < .@gp) { + mesc l("You cannot pay."), 1; + next; + } else { + .@mid=merc_randid(0, 0, 0, 0, 1000); + mercenary_create .@mid, 3600000; + POL_PlayerMoney(.@gp); + } + break; + case 2: + .@gp=max(7000, POL_AdjustPrice(7500)); + if (Zeny < .@gp) { + mesc l("You cannot pay."), 1; + next; + } else { + .@mid=merc_randid(0, 0, 0, 1000, 0); + mercenary_create .@mid, 3600000; + POL_PlayerMoney(.@gp); + } + break; + case 3: + .@gp=max(14000, POL_AdjustPrice(15000)); + if (Zeny < .@gp) { + mesc l("You cannot pay."), 1; + next; + } else { + mercenary_create merc_randid(0, 0, 1000, 0, 0), 3600000; + POL_PlayerMoney(.@gp); + } + break; + case 4: + .@gp=max(27000, POL_AdjustPrice(30000)); + if (Zeny < .@gp) { + mesc l("You cannot pay."), 1; + next; + } else { + mercenary_create merc_randid(0, 1000, 0, 0, 0), 3600000; + POL_PlayerMoney(.@gp); + } + break; + case 5: + .@gp=max(45000, POL_AdjustPrice(50000)); + if (Zeny < .@gp) { + mesc l("You cannot pay."), 1; + next; + } else { + mercenary_create merc_randid(1000, 0, 0, 0, 0), 3600000; + POL_PlayerMoney(.@gp); + } + break; + default: + break; + } + break; + // Buy Card + case 2: + npcshopattach(.name$); + openshop; + closedialog; + close; + break; + // Evolve Card + case 3: + mesc l("ERROR: Unknown error"), 1; + break; + // Leave + default: + closeclientdialog; + goodbye; + close; + break; + } + goto L_Main; + +OnInit: + tradertype(NST_MARKET); + sellitem MercBoxEE, 25000, 1; + sellitem MercBoxDD, 15000, 2; + sellitem MercBoxCC, 7500, 3; + sellitem MercBoxBB, 3750, 4; + sellitem MercBoxAA, 1250, 5; + + .distance=5; + .sex=G_MALE; + end; + +OnClock0001: +OnClock1201: + restoreshopitem MercBoxEE, 25000, 1; + restoreshopitem MercBoxDD, 15000, 2; + restoreshopitem MercBoxCC, 7500, 3; + restoreshopitem MercBoxBB, 3750, 4; + restoreshopitem MercBoxAA, 1250, 5; + end; + +// Pay your taxes! +OnBuyItem: + debugmes("Purchase confirmed"); + PurchaseTaxes("Nival"); + end; + +OnSellItem: + debugmes("Sale confirmed"); + PurchaseTaxes("Nival"); + end; + +} + diff --git a/npc/items/mercenary.txt b/npc/items/mercenary.txt index 15060795d..65ffededd 100644 --- a/npc/items/mercenary.txt +++ b/npc/items/mercenary.txt @@ -57,4 +57,50 @@ function script cond_mercboxset { } */ +// Get mercenary ID +// merc_randid(5★, 4★, 3★, 2★, 1★) +function script merc_randid { + .@s5=getarg(0,0); + .@s4=getarg(1,0); + .@s3=getarg(2,0); + .@s2=getarg(3,0); + .@s1=getarg(4,0); + + .@sumup=.@s5+.@s4+.@s3+.@s2+.@s1; + /* I wonder if this is needed...? + .@s4+=.@s5; + .@s3+=.@s4; + .@s2+=.@s3; + .@s1+=.@s2; + */ + + // Make the seed. More level and luck increases odds of higher rarity + .@seed=max(0, rand(0, .@sumup)-BaseLevel-readparam(bLuk)); + + // 5 ★ + if (.@seed < .@s5) { + setarray .@r, 1192, 1191, 1193, 1210; + .@n=any_of(.@r); + // 4 ★ + } else if (.@seed < .@s4) { + setarray .@r, 1194, 1195, 1209, 1205; + .@n=any_of(.@r); + // 3 ★ + } else if (.@seed < .@s3) { + setarray .@r, 1196, 1197, 1198, 1208; + .@n=any_of(.@r); + // 2 ★ + } else if (.@seed < .@s2) { + if (.@mode) + setarray .@r, 1200, 1201, 1199, 1207; + .@n=any_of(.@r); + // 1 ★ + } else { + setarray .@r, 1203, 1204, 1202, 1206; + .@n=any_of(.@r); + } + + debugmes "Return: %d ([%d, %d, %d])", .@n, .@r[0], .@r[1], .@r[2]; + return .@n; +} -- cgit v1.2.3-60-g2f50