From 85b3121b4d8577ea7a08e7eeb95973602c096e2b Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 6 May 2019 20:15:09 -0300 Subject: Disregard GMs when calculating player average level on Sieges --- npc/functions/siege.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 -- cgit v1.2.3-60-g2f50