From 8df106c0fb7a325c501e70f53b89950856491779 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 9 Sep 2019 17:21:59 -0300 Subject: Town Admin basic infrastructure: Invest in exports. Raise reputation. Control taxes. Resign the Office. --- npc/functions/politics.txt | 117 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) (limited to 'npc/functions/politics.txt') diff --git a/npc/functions/politics.txt b/npc/functions/politics.txt index 997cd3cf7..0b02aa0c5 100644 --- a/npc/functions/politics.txt +++ b/npc/functions/politics.txt @@ -236,3 +236,120 @@ function script POL_TownInfo { } + +// Town Managment +// POL_MANAGE( TOWNCODE ) +function script POL_TownInfo { + .@town$="$"+getarg(0); + .@MAYOR$=getd("$"+getarg(0)+"_MAYOR$"); + + if (strcharinfo(0) != .@MAYOR$) + return; + + do + { + .@GP=getd("$"+getarg(0)+"_MONEY"); + .@TX=getd("$"+getarg(0)+"_TAX"); + .@EX=getd("$"+getarg(0)+"_EXPORT"); + .@RP=getd("$"+getarg(0)+"_REPUTATION"); + + mesc l("Town Money: @@", .@GP), 2; + mesc l("Town Reputation: @@ | @@.@@%% Tax", .@RP, .@TX/100, .@TX%100), 2; + mesc l("Town Weekly Exports: @@", .@EX), 2; + next; + menuint + l("Nothing"), 0, + l("Invest in Exportations"), 10, + l("Invest in Reputation"), 20, + l("Raise city taxes"), 30, + l("Lower city taxes"), 35, + l("Resign"), 99; + mes ""; + switch (@menuret) { + // Mark 10: Exports + case 10: + .@cost=.@EX/10; + mesc l("Investing in Exportations"), 3; + mesc l("You need @@ GP to make this investment.", .@cost); + if (.@GP < .@cost) + break; + mesc l("Are you sure?"); + if (askyesno() == ASK_YES) { + .@GP=getd("$"+getarg(0)+"_MONEY"); + setd(.@town$+"_MONEY", .@GP-.@cost); + setd(.@town$+"_EXPORT", .@EX+3); + mesc l("Investment executed"), 2; + next; + } + break; + // Mark 20: Reputation + case 20: + .@cost=.@RP*3; + mesc l("Investing in Reputation"), 3; + if (.@RP >= 100) { + mesc l("Reputation cannot go above 100!"), 1; + next; + break; + } + mesc l("You need @@ GP to make this investment.", .@cost); + if (.@GP < .@cost) + break; + mesc l("Are you sure?"); + if (askyesno() == ASK_YES) { + .@GP=getd("$"+getarg(0)+"_MONEY"); + setd(.@town$+"_MONEY", .@GP-.@cost); + setd(.@town$+"_REPUTATION", .@RP+1); + mesc l("Investment executed"), 2; + next; + } + break; + // Mark 30: TAXES + case 30: + .@cost=.@TX/10; + mesc l("Raising Taxes"), 3; + mesc l("You need @@ Reputation to make this investment.", .@cost); + mesc l("Taxes will raise in 0.01~0.03%, capped at 10%."); + if (.@RP < .@cost || .@TX >= 1000) + break; + mesc l("Are you sure?"); + if (askyesno() == ASK_YES) { + setd(.@town$+"_REPUTATION", .@RP-.@cost); + setd(.@town$+"_TAX", .@TX+rand2(1,3)); + mesc l("Taxes raised"), 1; + next; + } + break; + case 35: + .@cost=.@TX/30; + mesc l("Lowering Taxes"), 3; + mesc l("You will gain @@ Reputation.", .@cost); + mesc l("Taxes will fall in 0.01~0.03%, capped at 0.00%"); + if (.@TX <= 0 || .@RP >= 100) + break; + mesc l("Are you sure?"); + if (askyesno() == ASK_YES) { + setd(.@town$+"_TAX", max(0, .@TX-.@cost)); + setd(.@town$+"_REPUTATION", min(100, .@RP+.@cost)); + mesc l("Taxes raised"), 1; + next; + } + break; + // Mark 90: Office + case 99: + mesc l("Really resign?"), 1; + next; + if (askyesno() == ASK_YES) { + setd(.@town$+"_MAYOR$", any("Jesus Saves", "Saulc GM")); + mesc l("YOU HAVE RESIGNED THE OFFICE."), 1; + close; + } + default: + return; + } + + // End script + } while (true); + return; +} + + -- cgit v1.2.3-60-g2f50