summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-09-23 19:23:06 -0300
committerJesusaves <cpntb1@ymail.com>2021-09-23 19:23:06 -0300
commit11c2c4dec0a4d694182cb4dd702700889ce15159 (patch)
tree48a18e9a242d24439f35353e7816ea148a155839 /npc
parent6afbb9507dea2dc891a0a750abb6fd06805d22c1 (diff)
downloadserverdata-11c2c4dec0a4d694182cb4dd702700889ce15159.tar.gz
serverdata-11c2c4dec0a4d694182cb4dd702700889ce15159.tar.bz2
serverdata-11c2c4dec0a4d694182cb4dd702700889ce15159.tar.xz
serverdata-11c2c4dec0a4d694182cb4dd702700889ce15159.zip
Town Defense Program, which raises siege experience to 3×
(Default is a 35~42% exp bonus)
Diffstat (limited to 'npc')
-rw-r--r--npc/functions/politics.txt19
-rw-r--r--npc/functions/siege.txt6
-rw-r--r--npc/functions/util.txt12
3 files changed, 33 insertions, 4 deletions
diff --git a/npc/functions/politics.txt b/npc/functions/politics.txt
index 7d32fbca1..7c9dd5c8d 100644
--- a/npc/functions/politics.txt
+++ b/npc/functions/politics.txt
@@ -400,6 +400,7 @@ function script POL_Manage {
.@RP=getd("$"+getarg(0)+"_REPUTATION");
.@CR=getd("$"+getarg(0)+"_TAXOFF");
.@DQ=getd("$"+getarg(0)+"_DAILYQUEST");
+ .@SE=getd("$"+getarg(0)+"_SIEGEXP");
.@left=(gettimeparam(GETTIME_HOUR)/4)-TOWN_ACTIONS[.@TP];
mesc l("Town Money: @@", .@GP), 2;
@@ -416,6 +417,7 @@ function script POL_Manage {
rif(.@left, l("Lower city taxes")), 35,
rif(.@CR && .@RP, l("Tax crafters")), 40,
rif(!.@CR, l("Don't tax crafters")), 41,
+ rif(.@left && !.@SE, l("Town Defense Program")), 60,
rif(.@left >= 6, l("Exile a player")), 70,
rif(.@left >= 6, l("Revert a player exile")), 71,
rif(.@left, l("Raise server wide EXP")), 80,
@@ -515,6 +517,23 @@ function script POL_Manage {
setd(.@town$+"_REPUTATION", .@RP+1);
mesc l("Crafters no longer pays taxes. (Tax exempt)"), 1;
break;
+ // Mark 60: Global events interference
+ case 60:
+ .@cost = 2000 - (.@RP * 10);
+ mesc l("Town Defense Program"), 3;
+ mesc l("You need @@ GP to make this investment.", .@cost);
+ mesc l("This program will cause experience gain to be tripled during the next siege to the town.");
+ if (.@GP < .@cost)
+ break;
+ mesc l("Are you sure?");
+ if (askyesno() == ASK_YES) {
+ setd(.@town$+"_SIEGEXP", 1);
+ setd(.@town$+"_MONEY", .@GP-.@cost);
+ TOWN_ACTIONS[.@TP]+=1;
+ mesc l("Town Defense Program enabled."), 1;
+ next;
+ }
+ break;
// Mark 70: Exile and Player functions
case 70:
mesc l("Exiled players will not be able to save to menhir."), 1;
diff --git a/npc/functions/siege.txt b/npc/functions/siege.txt
index e76280bf0..5103cb659 100644
--- a/npc/functions/siege.txt
+++ b/npc/functions/siege.txt
@@ -177,6 +177,12 @@ function script siege_setup {
pvpon(.@m$);
setmapflag(.@m$,mf_zone,"MMO"); // MMO Zone: Overrides GM Commands
setmapflag(.@m$,mf_bexp,rand2(135,142)); // 35~42% EXP UP on siege maps
+ .@tn$ = MapToLoc(.@m$, false);
+ if (getd("$"+.@tn$+"_SIEGEXP")) {
+ setmapflag(.@m$, mf_bexp, 300); // Triple EXP is on
+ kamibroadcast("Experience for siege map has been set to 3×!", "INFORMATION");
+ setd("$"+.@tn$+"_SIEGEXP", 0);
+ }
return;
}
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index a276cd541..a07d6665a 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -1077,7 +1077,7 @@ function script LocToMap {
}
// Convert map name to location id
-// MapToLoc( MapName )
+// MapToLoc( MapName, report=True )
function script MapToLoc {
// Fill variable
.@v$=getarg(0);
@@ -1088,10 +1088,14 @@ function script MapToLoc {
else
.@err=RB_DEBUGMES;
- // Validade variable, see npc/config/location.txt first
+ // Validate variable, see npc/config/location.txt first
.@lx=array_find($@LOCMASTER_MAP$, .@v$);
- if (.@lx < 0)
- return Exception("Invalid map passed to MapToLoc: "+.@v$, .@err);
+ if (.@lx < 0) {
+ if (getarg(1, true))
+ return Exception("Invalid map passed to MapToLoc: "+.@v$, .@err);
+ else
+ return "";
+ }
return $@LOCMASTER_LOC$[.@lx];
}