diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-05-06 20:15:09 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-05-06 20:15:09 -0300 |
commit | 85b3121b4d8577ea7a08e7eeb95973602c096e2b (patch) | |
tree | ee7104b710e31e8866847a7663b0808c3d25f59d /npc | |
parent | 1e32412e91d3321cc18f5966d7e8943e5da4181d (diff) | |
download | serverdata-85b3121b4d8577ea7a08e7eeb95973602c096e2b.tar.gz serverdata-85b3121b4d8577ea7a08e7eeb95973602c096e2b.tar.bz2 serverdata-85b3121b4d8577ea7a08e7eeb95973602c096e2b.tar.xz serverdata-85b3121b4d8577ea7a08e7eeb95973602c096e2b.zip |
Disregard GMs when calculating player average level on Sieges
Diffstat (limited to 'npc')
-rw-r--r-- | npc/functions/siege.txt | 19 |
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 |