summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-01-19 23:30:22 -0300
committerJesusaves <cpntb1@ymail.com>2020-01-19 23:30:22 -0300
commitb4d9fc0158bc17c61076c866b4752114625999af (patch)
tree79f608a48185cb06d31c2ea1dc92c07585c5f47f
parent67cad3e5c11261cb6af6890701afb462b192dadc (diff)
downloadserverdata-b4d9fc0158bc17c61076c866b4752114625999af.tar.gz
serverdata-b4d9fc0158bc17c61076c866b4752114625999af.tar.bz2
serverdata-b4d9fc0158bc17c61076c866b4752114625999af.tar.xz
serverdata-b4d9fc0158bc17c61076c866b4752114625999af.zip
Rewrite siege so it realizes a proper cleanup
-rw-r--r--npc/functions/siege.txt13
1 files changed, 11 insertions, 2 deletions
diff --git a/npc/functions/siege.txt b/npc/functions/siege.txt
index 1b34d02d3..10dd96a9d 100644
--- a/npc/functions/siege.txt
+++ b/npc/functions/siege.txt
@@ -356,25 +356,34 @@ function script do_siege {
detachrid();
}
- // No one is active, cancel the event (FIXME)
+ // No one is active, cancel the event
if (!.@idle) {
kamibroadcast(col(b("EVENT CANCELLED DUE TO PLAYER INACTIVITY"),1));
$@MK_AGGRO=$@MK_AGGRO/5; // Lower aggro bar to 20%
+
+ // Cleanup and Garbage Collection
+ siege_revert(.@m$);
+ siege_revert(.@o$);
+ enablenpc("Mana Stone");
+ setd("$@SIEGE_"+.@c$, 0);
end;
}
// In past, we had a $@SIEGE_<town> to determine difficulty
// This behavior is now deprecated, we use a global $SIEGE_DIFFICULTY
// Which raises in 1 every victory and lowers in 1 every defeat (capped at 1)
+ // But this behavior can be overriden
if (!getd("$@SIEGE_"+.@c$)) {
.@difc=max(1, getd("$SIEGE_DIFFICULTY"));
// And then, we reset $@SIEGE_<town> so it can be manipulated
// And set .@difc to this value
setd("$@SIEGE_"+.@c$, .@difc);
- .@difc=getd("$@SIEGE_"+.@c$);
}
+ // Set difficulty based on previous value
+ .@difc=getd("$@SIEGE_"+.@c$);
+
switch (.@t) {
// Warmup
case 70: