@program xp-essence-crond.muf.i386.so.1.0 1 1000 d i ( Alynna's new XP/Essence systems Essence: Refreshes only 1 an hour 2 if the character is logged off. Those with drain dont get any.. XP: 1 XP per 24 hours connected if VOTED for. 1 XP per week no VOTE required, 1 XP per month no VOTE required. ) $include $lib/rp $include $lib/alynna $include $lib/case $def HOUR 60 60 * $def DAY 24 $def WEEK 24 7 * $def MONTH 24 30 * lvar param lvar target lvar tmp lvar cur lvar tprop lvar value lvar entered lvar lastroll : essence ( d -- i ) dup "body" getstatint swap dup "mind" getstatint swap dup "spirit" getstatint swap dup "bodyplus" getstatint swap dup "mindplus" getstatint swap dup "spiritplus" getstatint swap -7 rotate + + + + + swap "Boon/Quickened/?" getstat if 2 * then ; : start-crond ( Every hour ) begin ( Start at the beginning ) #0 target ! begin ( Increasing by one ) target @ int 1 + dbref target ! ( Players only ) target @ player? if ( If the target doesnt have drain, or if it does with conditions.. ) target @ "Bane/Drain/?" getstat if target @ location "@Loc/Type" envprop swap pop tostr tolower "{undrain}" smatch if 1 else 0 then else 1 then if ( check essence ) target @ "essence" getstatint me @ essence < if ( if awake ) target @ awake? if ( give 1 ) target @ "essence" over over getstatint 1 + dup target @ essence > if pop target @ essence then setstat target @ "lastessence" systime setstat target @ "You regain ^GREEN^1^NORMAL^ essence." "Essence" pretty ansi_notify else ( give 2 ) target @ "essence" over over getstatint 2 + dup target @ essence > if pop target @ essence then setstat target @ "lastessence" systime setstat target @ "You regain ^GREEN^2^NORMAL^ essence." "Essence" pretty ansi_notify then ( awake ) then ( essence ) then ( drain ) ( My own personal Jesus ) target @ "lifecron" over over getstatint 1 + setstat target @ awake? if target @ "wakecron" over over getstatint 1 + setstat then ( Per day online, only if awake, or it could cause a race condition ) target @ awake? if target @ "wakecron" getstatint DAY % not if ( If they were voted by someone ) target @ "votedby" getstat if ( Give them 1 XP ) target @ str "You earned ^GREEN^1^NORMAL^XP (after 24 hours online time) for votes from: ^YELLOW^" target @ "votedby" getstat "^NORMAL^." cat "VoteCycle" pretty ansi_notify target @ "xp" over over getstatint 100 + setstat target @ "votedby" 0 setstat me @ "votedfor" 0 setstat then then then ( Per week no matter what ) target @ "lifecron" getstatint WEEK % not if target @ "You earned ^GREEN^1^NORMAL^XP for existing through the week." "VoteCycle" pretty ansi_notify target @ "xp" over over getstatint 100 + setstat target @ "votedby" 0 setstat then ( Per month no matter what ) target @ "lifecron" getstatint MONTH % not if target @ "You earned ^GREEN^1^NORMAL^XP for existing through the month." "VoteCycle" pretty ansi_notify target @ "xp" over over getstatint 100 + setstat target @ "votedby" 0 setstat then ( Else die ) then target @ dbtop dbcmp until ( And repeat ) command @ "crontest" smatch if str "Umm.. " me @ "lifecron" getstat " and " me @ "wakecron" getstat ", and even " DAY me @ "wakecron" getstatint DAY % - "." cat "Debug" pretty tellhere pid kill then HOUR sleep repeat ; : vote ( Try to figure this out! ) param @ match target ! ( Did we find someone by that name? ) target @ int 0 < if "Ambiguous or unresolvable target." "Vote" pretty tellme exit then ( Was it a player? ) target @ player? not if "You can only vote for players, sorry." "Vote" pretty tellme exit then ( Am I trying to vote for myself?) target @ me @ dbcmp if "You cannot vote for yourself." "Vote" pretty tellme exit then ( Else do it - Start with some 'votedby' sanity ) target @ "votedby" getstatstr dup "0" stringcmp not if pop "" then tmp ! ( Add my name if its not already there ) tmp @ me @ name instr not if target @ "votedby" str tmp @ me @ name " " cat setstat me @ "votedfor" str tmp @ target @ name " " cat setstat me @ str "You just voted for ^CYAN^" target @ "^NORMAL^." cat "Vote" pretty ansi_notify target @ str "^CYAN^" me @ "^NORMAL^ just voted for you." cat "Vote" pretty ansi_notify else me @ str "You already voted for ^CYAN^" target @ "^NORMAL^ today." cat "Vote" pretty ansi_notify then ; : vote-all me @ location contents cur ! begin cur @ player? if cur @ awake? if cur @ me @ dbcmp not if cur @ name param ! vote then then then cur @ next dup ok? if cur ! 0 else pop 1 then until ; : essence-spend param @ strip target ! target @ entered ! param @ target ! me @ me @ target @ "level" lookupstat if me @ me @ target @ "level" lookupstat dup "" "/level" subst tprop ! getstat value ! else me @ me @ target @ "?" lookupstat if me @ target @ "?" lookupstat "" "/?" subst tprop ! -1 value ! else "Not a valid stat." "Yerf" pretty tellme exit then then tprop @ "quality/*" smatch if str me @ " spends ^GREEN^" value @ "^NORMAL^ essence using the quality ^CYAN^" entered @ "^NORMAL^." cat "Quality" pretty tellhere me @ "essence" over over getstat value @ toint - setstat else "This isn't listed as a quality on your sheet." "Quality" pretty tellme then ; : xp-show "XP and voting information" header tellme str "XP: ^GREEN^" me @ "xp" getstatint 100 / "." me @ "xp" getstatint 100 % intostr dup strlen 1 = if "0" swap strcat then 10 lj "^NORMAL^Hours till next XP: ^CYAN^" DAY me @ "wakecron" getstatint DAY % - "^NORMAL" cat tellme str "Voted for: ^GREEN^" me @ "votedfor" getstat dup not if pop "None" then "^NORMAL^" cat tellme str "Voted by: ^GREEN^" me @ "votedby" getstat dup not if pop "None" then "^NORMAL^" cat tellme "Fools Moon RPsystem 1.0" footer tellme ; lvar attuned lvar spiritstat lvar spiritroll lvar medstat lvar medroll lvar regained : essence-meditate me @ "Skill/Meditation/Level" getstat not if "You must have the skill 'meditation', to be able to meditate." "Meditation" pretty tellme exit then me @ "lastmeditate" getstat me @ "lifecron" getstat >= if "You have already meditated this hour." "Meditate" pretty tellme exit then param @ not if "here" param ! then param @ match target ! target @ int 0 < if "Ambiguous or unresolvable target." "Meditate" pretty tellme exit then target @ room? if target @ "@loc/type" envprop swap pop tolower "{vestibule|nexus}" smatch if me @ name target @ "@loc/attuned" envprop swap pop tostr "{" swap "}" strcat strcat smatch if 1 attuned ! else 0 attuned ! then me @ "Skill/Meditation/Level" getstatint medstat ! medstat @ lroll medroll ! attuned @ if target @ "@loc/type" envprop swap pop tolower "{nexus}" smatch if medroll @ 1 - medroll ! else medroll @ 2 - medroll ! then then me @ "spirit" getstatint me @ "spiritplus" getstatint + spiritstat ! spiritstat @ lroll spiritroll ! attuned @ if target @ "@loc/type" envprop swap pop tolower "{nexus}" smatch if spiritroll @ 1 - spiritroll ! else spiritroll @ 2 - spiritroll ! then then spiritroll @ medroll @ < if spiritroll @ value ! else medroll @ value ! then value @ 4 < if value @ 4 - 2 / 0 swap - 1 + regained ! else 0 regained ! then str "Spirit/Meditate - Ranks: " spiritstat @ "/" medstat @ " - Rolls: " spiritroll @ "/" medroll @ cat "Meditate" pretty tellhere me @ "essence" over over getstatint regained @ + dup me @ essence > if pop me @ essence then setstat me @ "lastessence" systime setstat str me @ " regained ^GREEN^" regained @ "^NORMAL^ essence." cat "Meditate" pretty tellhere else "Target must be a vestibule or nexus." "Meditate" pretty tellme exit then then target @ player? if me @ location "@loc/type" envprop swap pop tolower "{vestibule|nexus}" smatch if me @ "Skill/Meditate/Level" getstat else "Target must be a vestibule or nexus." "Meditate" pretty tellme exit then then me @ "lastmeditate" me @ "lifecron" getstat setstat ; : essence-drain param @ not if "here" param ! param @ match target ! target @ int 0 < if "Ambiguous or unresolvable target." "Drain" pretty tellme exit then target @ room? if else "Target must be a vestibule or nexus." "Drain" pretty tellme exit then then target @ player? if then ; : main param ! command @ tolower case "essence" smatch when essence-spend end "meditate" smatch when essence-meditate end "{xp|+xp}" smatch when xp-show end "+vote" smatch when vote end "+vote/all" smatch when vote-all end "queued event." smatch when start-crond end "crontest" smatch when start-crond end endcase ; . c q