diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-01-27 17:40:58 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-01-27 17:40:58 -0300 |
commit | bf68fda600acbbc3e632a3bef2d8fd3f70d71d2e (patch) | |
tree | b707791f7b086b60dc77ca4a76824f2ab57572b3 /npc/025-1/rum.txt | |
parent | 35b14b4ee5625d3896311c42b15ccf68d55e6477 (diff) | |
download | serverdata-bf68fda600acbbc3e632a3bef2d8fd3f70d71d2e.tar.gz serverdata-bf68fda600acbbc3e632a3bef2d8fd3f70d71d2e.tar.bz2 serverdata-bf68fda600acbbc3e632a3bef2d8fd3f70d71d2e.tar.xz serverdata-bf68fda600acbbc3e632a3bef2d8fd3f70d71d2e.zip |
Fungus' drops and the Rum Making Barrel (Fortress Town Utility)
Diffstat (limited to 'npc/025-1/rum.txt')
-rw-r--r-- | npc/025-1/rum.txt | 181 |
1 files changed, 181 insertions, 0 deletions
diff --git a/npc/025-1/rum.txt b/npc/025-1/rum.txt new file mode 100644 index 000000000..935582eb3 --- /dev/null +++ b/npc/025-1/rum.txt @@ -0,0 +1,181 @@ +// TMW2 Scripts +// Author: +// Jesusalva +// Description: +// Crazyfefe Rum +// Variables: +// FORTRESS_DATE = When the Rum started being done +// FORTRESS_DONE = When the Rum will be ready +// FORTRESS_AMMO = How much Rum you're trying to make +// Success Rate is based on how much you're trying to do and how long ago that was + +025-1,106,56,0 script Rum Barrel NPC_NO_SPRITE,{ + goto L_Main; + // rumbarrel_chance() + // Returns chance (0~10,000) to successfully obtain sake + // FORTRESS_DONE/FORTRESS_DATE is taken in account + function rumbarrel_chance { + .@max=10000; + .@base=FORTRESS_DATE;//-(FORTRESS_DONE-FORTRESS_DATE); + // .@c = how much time is left until completion + // .@d = original amount of time required + // .@e = Current time + .@c=FORTRESS_DONE-.@base; //-gettimetick(2); + .@d=FORTRESS_DATE-.@base; //-FORTRESS_DONE; + .@e=gettimetick(2)-.@base; + + // We must divide everything by 10 to cause imprecision + // aka. don't cause overflow bug + .@c=.@c/10; + .@d=.@d/10; + .@e=.@e/10; + + //debugmes "%d - %d - %d", .@d, .@e, .@c; + //debugmes "Start - Now - Finish"; + if (.@c == 0) + return .@max; + if ($@GM_OVERRIDE) debugmes "Ratio: %d/%d = %d", .@e, .@c, (.@e*.@max)/.@c; + return min(10000, (.@e*.@max)/.@c); + } + +L_Main: + if (!FORTRESS_DATE) { + mesn; + mesc l("Do you want to make %s?", l("Rum")); + mesc l("This barrel is a courtesy from Dimond Cove Inn."); + next; + select + l("Information"), + l("Yes"), + l("No"); + mes ""; + + switch (@menu) { + case 1: + mesc l("Produced item:"); + mesc l("@@", getitemlink(CrazyRum)); + mesc l("%s (rare)", getitemlink(WhiskeyAle)); + mes ""; + mesc l("Cost per %s glass:", l("twelve")); + mesc l("* @@/@@ @@", countitem(ArtichokeHerb), 25, getitemlink(ArtichokeHerb)); + mesc l("* @@/@@ @@", countitem(Fungus), 25, getitemlink(Fungus)); + mesc l("* @@/@@ @@", countitem(RedApple), 25, getitemlink(RedApple)); + mesc l("* @@/@@ @@", countitem(Beer), 5, getitemlink(Beer)); + mesc l("* @@/@@ @@", countitem(Milk), 25, getitemlink(Milk)); + mesc l("* @@/@@ @@", countitem(ShadowHerb), 100, getitemlink(ShadowHerb)); + mesc l("* @@ Water Bottle", 1); + next; + break; + case 2: + mesc l("How many batches do you want to produce? (max. 5)"); + input .@glass_count; + if (.@glass_count < 1 || + .@glass_count > 5 || + countitem(ArtichokeHerb) < 25*.@glass_count || + countitem(Fungus) < 25*.@glass_count || + countitem(RedApple) < 25*.@glass_count || + countitem(Beer) < 5*.@glass_count || + countitem(Milk) < 25*.@glass_count || + countitem(ShadowHerb) < 100*.@glass_count + ) { + mesc l("Not enough ingredients or invalid amount."), 1; + break; + } + mesc l("Which water will you use?"); + mesc l("The bottom-most the water, the better the bonus."); + menuint + l("Cancel"), -1, + rif(countitem(BottleOfSewerWater) >= .@glass_count, l("Sewer Water")), 0, + rif(countitem(BottleOfSeaWater) >= .@glass_count, l("Sea Water")), 3600, + rif(countitem(BottleOfTonoriWater) >= .@glass_count, l("Tonori Water")), 11760, + rif(countitem(BottleOfWoodlandWater) >= .@glass_count, l("Woodland Water")), 12000, + rif(countitem(BottleOfDivineWater) >= .@glass_count, l("Divine Water")), 21600; + mes ""; + if (@menuret < 0) + break; + switch (@menuret) { + case 0: + .@bonus=@menuret; + .@water=BottleOfSewerWater; + break; + case 3600: + .@bonus=@menuret; + .@water=BottleOfSeaWater; + break; + case 11760: + .@bonus=@menuret; + .@water=BottleOfTonoriWater; + break; + case 12000: + .@bonus=@menuret; + .@water=BottleOfWoodlandWater; + break; + case 21600: + .@bonus=@menuret; + .@water=BottleOfDivineWater; + break; + default: + mesc l("Error, invalid return code, blame Saulc"), 1; + mes "==== SCRIPT ABORTED"; + close; + } + + // Save data + delitem ArtichokeHerb, .@glass_count*25; + delitem Fungus, .@glass_count*25; + delitem RedApple, .@glass_count*25; + delitem Beer, .@glass_count*5; + delitem Milk, .@glass_count*25; + delitem ShadowHerb, .@glass_count*100; + delitem .@water, .@glass_count; + FORTRESS_AMMO=.@glass_count; + FORTRESS_DATE=gettimetick(2); + FORTRESS_DONE=gettimetick(2)-.@bonus+.mintime; + FORTRESS_DONE+=.cuptime*FORTRESS_AMMO; + break; + case 3: + close; + break; + } + goto L_Main; + } else { + mesn; + mesc l("Your request for @@ @@ are being fermented for @@.", FORTRESS_AMMO, getitemlink(CrazyRum), FuzzyTime(FORTRESS_DATE)); + next; + inventoryplace CrazyRum, FORTRESS_AMMO; + mesn; + mes l("Trying to retrieve it now will have @@ % chance to be successful.", rumbarrel_chance()/100); + mes l("Attempt to retrieve it now?"); + next; + if (askyesno() == ASK_YES) { + if (rand(1000,10000) < rumbarrel_chance()) { + mesc l("Success!"), 3; + if (false) + getitem WhiskeyAle, FORTRESS_AMMO*.cupammo; + else + getitem CrazyRum, FORTRESS_AMMO*.cupammo; + } else { + mesc l("The %s wasn't ready yet and you lost it...", l("Rum")), 1; + } + FORTRESS_DATE=0; + FORTRESS_AMMO=0; + } + } + close; + +OnInit: + .sex = G_OTHER; + .distance = 4; + + // Time to make each batch (48 hours) + .cuptime=(60*60*48); + // Base time to make any amount of cups (120 hours - five days) + .mintime=(60*60*120); + // Amount of cups + .cupammo=12; + end; + +} + + + |