@program vote.ffa2rps.muf 1 10000 d i $include $lib/rp $include $lib/alynna $def wizonly me @ mlevel 5 < if { "^RED^Permission denied.^NORMAL^" }tell exit then lvar delta lvar param $def uppercap 10.0 : calcdelta { #-1 "*" "P" find_array foreach swap pop dup timestamps pop swap pop swap pop systime 604800 - < if pop then repeat }array array_count var! onlinethismonth 25.0 onlinethismonth @ / 3 round delta ! { onlinethismonth @ " people have been on this week, " delta @ "xp will be rewarded per vote, up to " uppercap "xp." }tell ; : give0.25xp { #-1 "*" "P" find_array foreach swap pop dup timestamps pop swap pop swap pop systime 604800 - < if pop then repeat }array var! active active @ foreach swap pop "xp" over over getstat 1.0 + setstat repeat { "Giving 0.25 XP to " { active @ foreach swap pop name repeat }array array_commas "." }tell ; : commit var bonus wizonly calcdelta "Giving monthly vote XP ..." header tellme { #-1 "*" "P" find_array foreach swap pop var! target target @ "votes" getstat target @ "xpbonus" getstat or if target @ then repeat }array var! voted voted @ foreach swap pop dup var! target "votes" getstat dup not if pop 0 else " " explode_array array_count then var! votes { "^GREEN^" target @ name 20 lj "^CYAN^" votes @ toint tostr 3 rj " votes" " " 17 lj "^YELLOW^" target @ "xpbonus" getstat var! temp temp @ tostr "nan" smatch if 0.0 dup bonus ! else target @ "xpbonus" getstat dup not if pop votes @ delta @ * 0.0 uppercap limit then dup bonus ! then "xp" temp @ nan = target @ "xpbonus" getstat or if " (Manually set)" else " " then target @ "xp" over over getstat bonus @ + setstat "OK!" #55 { "p #mail " target @ "=You received " bonus @ "XP for your " votes @ " unique votes, plus 0.25xp for being active this week. Total " bonus @ 0.25 + "XP." }cat force target @ "xpbonus" 0 setstat target @ "votes" 0 setstat target @ "resources" 0 setstat }tell repeat "------------------------------------------------------------------------------" tellme give0.25xp #55 "@wall Weekly vote cycle complete -- All players active this week have received at least 1xp and their voted XP bonus." force "FairVote 1.0" footer tellme ; : adjust var target var value wizonly param @ not if { "Usage: @adjust = Set amount to give for a bonus." }tell { "Usage: @adjust Set amount to give back to the default." }tell exit then param @ "=" instr not if param @ pmatch target ! nan value ! else param @ "=" split tofloat value ! pmatch target ! then target @ int 0 < if { "Adjust who?" }tell exit then value @ tostr "nan" smatch if target @ "xpbonus" 0 setstat { "XP bonus for " target @ ansi_unparseobj " set to default." }tell exit then value @ not if target @ "xpbonus" nan setstat { "XP bonus for " target @ ansi_unparseobj " set to 0xp." }tell exit then target @ "xpbonus" value @ setstat { "XP bonus for " target @ ansi_unparseobj " set to " value @ "xp." }tell exit ; : review wizonly calcdelta "People who received good RP votes this month" header tellme { #-1 "*" "P" find_array foreach swap pop var! target target @ "votes" getstat target @ "xpbonus" getstat or if target @ then repeat }array var! voted voted @ foreach swap pop dup var! target "votes" getstat dup not if pop "" else " " explode_array array_count then var! votes param @ if target @ name { "*" param @ "*" }cat smatch not if continue then then { "^GREEN^" target @ name 20 lj "^CYAN^" votes @ toint tostr 3 rj " votes" " " 17 lj "^YELLOW^" target @ "xpbonus" getstat var! temp temp @ tostr "nan" smatch if 0.0 else target @ "xpbonus" getstat dup not if pop votes @ delta @ * 0.0 uppercap limit then then "xp" temp @ nan = target @ "xpbonus" getstat or if " (Manually set)" then }tell { "^CYAN^ " { target @ "@rp/votes" array_get_reflist foreach name swap pop repeat }array array_commas }tell repeat "FairVote 1.0" footer tellme ; : vote param @ part_pmatch var! target me @ target @ dbcmp if { "You tried to vote for yourself. This incident has been reported." }tell #55 { "wc " me @ " tried to vote for his/her self!" }cat force exit then target @ int 0 < if { "Vote for who?" }tell exit then target @ "@rp/votes" array_get_reflist var! votes { me @ }array votes @ array_union votes ! target @ "@rp/votes" votes @ array_put_reflist { "You submitted a good RP vote for " target @ "." }tell ; : main param ! command @ case "vote" smatch when vote end "@review" smatch when review end "@adjust" smatch when adjust end "@commit" smatch when commit end endcase ; . c q