Paste #40285: Edit of P#40284 - WOw

Date: 2017/02/26 13:08:52 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


exp_for_level:
  type: procedure
  debug: false
  definitions: level
  script:
  - determine <def[level].sub[1].power[2.6].mul[84]||1>
level_for_xp:
  type: procedure
  debug: false
  definitions: xp
  script:
  - determine <def[xp].div[84].power[0.384615384615385].add[1].round_down||1>

get_level:
  type: procedure
  debug: false
  script:
  - determine <proc[level_for_xp].context[<player.flag[level_<def[1]>||0>]||1>]
  - narrate "get_level"

give_xp:
  type: task
  speed: 0
  debug: true
  script:
  - if <def[2]||null> !matches number {
    - debug error "No valid XP specified!"
    - queue clear
    }
  - if <def[2]> == 0 {
    - queue clear
    }
  - define 2 <def[2].round>                     
  - flag <player> skill_<def[1]>:+:<def[2]>
  - run check_level <def[1]>
  - narrate "Give_xp"

check_level:
  type: task
  debug: false
  speed: 0
  max_level: 100
  script:
  - if <player.flag[level_<def[1]>]> < <proc[get_level]>
  {
    - narrate "TEST!"
    - run level_up def:<def[1]>
  } 

level_up:
  type: task
  debug: false
  speed: 0
  script:
  - flag <player> level_<def[1]>:++
  - narrate "<&c>Gefeliciteerd! Je level is nu <player.flag[level_<def[1]>.as_int>."
  - wait 2t
  - run check_level instantly