summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
Diffstat (limited to 'npc')
-rw-r--r--npc/functions/siege.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/npc/functions/siege.txt b/npc/functions/siege.txt
index c4bb47ae1..bd733c253 100644
--- a/npc/functions/siege.txt
+++ b/npc/functions/siege.txt
@@ -25,6 +25,7 @@ function script siege_calcdiff {
.@bsum=0;
.@highest=getarg(1, false);
.@c = getunits(BL_PC, .@players, false, getarg(0));
+ .@skip=0;
// Fallback: No players on map, always return 0
if (.@c == 0)
@@ -32,12 +33,30 @@ function script siege_calcdiff {
// There is at least one player, do things properly
for (.@i = 0; .@i < .@c; .@i++) {
+ /*
+ // Dead players are not counted
+ if (ispcdead(strcharinfo(0, "", .@players[.@i])))
+ continue;
+ */
.@b=readparam(BaseLevel, .@players[.@i]);
+
+ // GMs are not counted
+ if (getgroupid(.@players[.@i]) >= 60) {
+ .@skip+=1;
+ .@b=0;
+ }
.@bsum+=.@b;
if (.@b > .@highest)
.@highest=.@b;
}
+
+ // Sanitize
+ .@c-=.@skip;
+ if (!.@c)
+ .@c=1;
+
//debugmes "calcdiff: Total %d Average %d Highest %d", .@bsum, (.@bsum/.@c), .@highest;
+
if (getarg(1,false))
return .@highest;
else