- D1 Meta Docs - Denizen Script -
Home Page / Pi to one million places / Contact mcmonkey / Donate / Paste Scripts / Denizen Help /
You are browsing as a guest.
Login | Register


Click here to create your own public paste ~ ~ click to duplicate and edit this paste


TitleUntitled Paste
TypeDenizen Script
Date2018/12/01 20:26:44 UTC-08:00
ByGuest
Other
Paste
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
5800
skill:
  # *Abstract* base skill object.
  type: custom
  debug: true
  uuid: null
  tags:
    corePlayer: # Returns the corePlayer relative to the skill.
      - determine "custom@corePlayer[uuid=<c.this.uuid>]"
    name: # Returns the name of the skill.
      - determine "<c.this.before[<&lb>].after[skill_].to_titlecase>"
    level: # Returns the level of the skill.
      - determine "<yaml[<c.this.corePlayer.file_id>].read[skills.<c.this.name>.level]>"
    xp: # Returns the XP points of the skill.
      - determine "<yaml[<c.this.corePlayer.file_id>].read[skills.<c.this.name>.xp]>"
    xp_needed: # Returns the XP points needed to level up the skill.
      - determine "<yaml[<c.this.corePlayer.file_id>].read[skills.<c.this.name>.xp_needed]>"
    level_xp: # Returns the XP points needed to level up a level of the skill.
      - define level "<c.value>"
      - define base "200"
      - define multiplier "13"
      - define power "2.1"
      - determine "<def[base].add[<def[level].sub[1].power[<def[power]>].mul[<def[multiplier]>]>].round_down>"
  mechanisms:
    xp: # Handles general XP changes.
      - define xp "<c.value>"
      - yaml set "id:<c.this.corePlayer.file_id>" "skills.<c.this.name>.xp:<def[xp]>"
    xp_needed: # Handles general XP needed changes.
      - define xp_needed "<c.value||null>"
      - if "<def[xp_needed]>" == null:
        - queue clear
      - yaml set "id:<c.this.corePlayer.file_id>" "skills.<c.this.name>.xp_needed:<def[xp_needed]>"
    add_xp: # Handles vanilla XP earnings.
      - define xp "<c.value||null>"
      - if "<def[xp]>" == null:
        - queue clear
      - adjust "<c.this>" "xp:<c.this.xp.add[<def[xp]>]>"
      - define msg "<&a><c.this.name><&co> <&b><c.this.xp><&8>/<&c><c.this.xp_needed>" 
      - run coreActionBar "def:<def[msg]>" "player:<c.this.corePlayer.player>" instantly
      - if "<c.this.xp>" >= "<c.this.xp_needed>":
        - adjust "<c.this>" "level_up:true"
    level: # Handles general level changes.
      - define level "<c.value||null>"
      - if "<def[level]>" == null:
        - queue clear
      - define corePlayer "<c.this.corePlayer>"
      - define player "<def[corePlayer].player>"
      - yaml set "id:<def[corePlayer].file_id>" "skills.<c.this.name>.level:<def[level]>"
    level_up: # Handles leveling up.
      - while "<c.this.xp>" >= "<c.this.xp_needed>":
        - adjust "<c.this>" "level<c.this.level.add[1]>"
        - adjust "<c.this>" "xp:<c.this.xp.sub[<c.this.xp_needed>]>"
        - adjust "<c.this>" "xp_needed:<c.this.level_xp[<c.this.level>]>"
      - define title "<&6><&l>Congratulations!"
      - define subtitle "<&e>You are now level <&l><c.this.level><&e>!"
      - define player "<c.this.corePlayer.player>"
      - title "title:<def[title]>" "subtitle:<def[subtitle]>" "player:<def[player]>"
      - playsound "<def[player]>" "sound:ENTITY_PLAYER_LEVELUP"



RawRaw



Pastes made: 59170