$include $lib/rp $include $lib/alynna $def wizonly me @ mlevel 5 < if { "^RED^Permission denied.^NORMAL^" }tell exit then lvar delta lvar commit lvar param $def uppercap 15 target @ growth 3.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! onlinethisweek onlinethisweek @ 50 - 10 / 1 10 limit delta ! { onlinethisweek @ " people have been on this week, " delta @ "DP will be rewarded for a weekly bonus." }tell ; ( : normalize { #-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 "DP" over over getstat 1.0 + 0 round setstat repeat { "Giving 1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031415926535897932384626433 DP (LOL) to " { active @ foreach swap pop name repeat }array array_commas " (and rounding down to the nearest DP)." }tell ; ) ( : commit wizonly var bonus calcdelta "Giving monthly vote DP ..." header tellme { #-1 "*" "P" find_array foreach swap pop var! target target @ "votes" getstat target @ "DPbonus" getstat or if target @ then repeat }array var! voted voted @ foreach swap pop dup var! target "/@rp/votes/" array_get_propvals array_count var! votes { "^GREEN^" target @ name 20 lj "^CYAN^" votes @ toint tostr 3 rj " votes" " " 17 lj "^YELLOW^" target @ "DPbonus" getstat var! temp temp @ tostr "nan" smatch if 0.0 dup bonus ! else target @ "DPbonus" getstat dup not if pop votes @ delta @ * 0.0 uppercap limit then dup bonus ! then "DP" temp @ nan = target @ "DPbonus" getstat or if " (Manually set)" else " " then target @ "DP" over over getstat bonus @ + 2 round setstat "OK!" #55 { "p #mail " target @ "=You received " bonus @ "DP for your " votes @ " unique votes, plus 1DP for being active this week. Total " bonus @ 0.25 + "DP." }cat force target @ "DPbonus" 0 setstat target @ "votes" 0 setstat target @ "resources" target @ mresources setstat }tell repeat "------------------------------------------------------------------------------" tellme #55 "@wall Weekly vote cycle complete -- All players active this week have received at least 1.0DP and their voted DP 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 @ "DPbonus" 0 setstat { "DP bonus for " target @ ansi_unparseobj " set to default." }tell exit then value @ not if target @ "DPbonus" nan setstat { "DP bonus for " target @ ansi_unparseobj " set to 0DP." }tell exit then target @ "DPbonus" value @ setstat { "DP bonus for " target @ ansi_unparseobj " set to " value @ "DP." }tell exit ; : weekly wizonly calcdelta "Voting information" header tellme { #-1 "*" "P" find_array foreach swap pop var! target target @ "character_mode" getstat 256 >= if target @ then repeat }array var! voted voted @ foreach swap pop dup var! target "/@rp/votes/" array_get_propvals array_count 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" " " 10 lj "^YELLOW^" { target @ "ap" getstat tostr 3 rj "/" target @ aplimit tostr 3 lj " AP" }cat 12 lj "^PURPLE^" target @ dp target @ power + target @ "lastpower" getstat - " DP+Power this week" }tell commit @ if target @ "DP" over over getstat delta @ + toint setstat target @ "lastpower" target @ dp target @ power + setstat #55 { "p #mail " target @ "=You received " delta @ "DP from the weekly MUCK activity bonus." }cat force target @ "resources" target @ mresources setstat then target @ "/@rp/votes/" array_get_propvals if { "^CYAN^ " { target @ "/@rp/votes/" array_get_propvals foreach pop repeat }array array_commas }tell then repeat "FairVote 1.0" footer tellme commit @ if #55 { "@wall Weekly cycle -- Active players this week: " { #-1 "*" "P" find_array foreach swap pop dup timestamps pop swap pop swap pop systime 604800 - < if pop then repeat }array array_count ", weekly MUCK activity bonus: " delta @ "DP." }cat force then ; : ap { "^YELLOW^Activity points: " me @ "ap" getstat toint " of " me @ aplimit ", " me @ aplimit me @ "ap" getstat toint - " required to generate a DP." }cat "AP" pretty tellme { "^YELLOW^Factors affecting your AP limit: ^GREEN^120^YELLOW^ + (Growth[(^CYAN^" me @ growth "^YELLOW^-1)*10=^GREEN^" me @ growth -- 10 * "^YELLOW^]) - (Votes[^CYAN^" me @ "/@rp/votes/" array_get_propvals array_count dup "^YELLOW^*5=^GREEN^" swap 5 * "^YELLOW^])" }cat "AP" pretty tellme { "^YELLOW^This location is generating " me @ apgen "AP per minute, from its " me @ location numactiveplayers " active and IC player(s): [(^CYAN^" me @ location numactiveplayers "^YELLOW^/2)=^GREEN^" me @ apgen "^YELLOW^]" }cat "AP" pretty tellme ; : vote param @ " " explode_array foreach dup var! target swap pop part_pmatch dup not if pop target @ match then 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 @ owner target ! target @ { "votes/" me @ name }cat systime setstat { "You submitted a good RP vote for " target @ "." }tell target @ "^White^You just received a good RP vote! ^Red^(Vote may not be unique)^ ^" ANSI_NOTIFY target @ "^White^To vote for a player type: ^cyan^vote ^ ^" ANSI_NOTIFY repeat ; : main param ! command @ case "vote" smatch when vote end "+ap" smatch when ap end "@review" smatch when 0 commit ! weekly end "@adjust" smatch when adjust end "@commit" smatch when 1 commit ! weekly end endcase ;