Date: 2023/01/20 23:53:10 UTC-08:00
Type: Denizen Script
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
upgrader_inventory_logic_world:
type: world
debug: true
events:
on player clicks in Upgrader_GUI:
- define inv <context.inventory>
- define click_inv <context.clicked_inventory>
- define slot <context.slot>
- define sh_click <context.is_shift_click>
- if <[click_inv]> == <[inv]>:
- if <[slot]> == 21 or <[slot]> == 22 or <[slot]> == 23:
#- announce "click correct slot"
- determine cancelled:false
- else:
- if <[slot]> == 25:
#- narrate "<&[base]>upgrade button clicked!"
- run locally path:upgrader_process_logic def:<[inv]>
- determine cancelled
- else:
# - narrate "click cancelled"
- determine cancelled
- if <[click_inv]> != <[inv]> && <[sh_click]>:
#- narrate "shift cancelled"
- determine cancelled
on player drags in Upgrader_GUI:
- define inv <context.inventory>
- define click_inv <context.clicked_inventory>
- if <[click_inv]> == <[inv]>:
- announce "drag cancelled"
- determine cancelled
on player closes Upgrader_GUI:
- drop <context.inventory.slot[21]>
- drop <context.inventory.slot[22]>
- drop <context.inventory.slot[23]>
upgrader_process_logic:
- define inv <[1]>
- define nbt <[inv].slot[21].raw_nbt>
- define phy_dmg <[inv].slot[21].raw_nbt.get[MMOITEMS_PHYSICAL_DAMAGE].after[double:]>
- define phy_dmg2 <[inv].slot[21].raw_nbt.get[MMOITEMS_PHYSICAL_DAMAGE]>
- if <[inv].slot[21].raw_nbt.contains[MMOITEMS_PHYSICAL_DAMAGE]>:
- narrate "old physical damage = <[phy_dmg]>"
- define new_value <[phy_dmg2].after[double:].add[2.0]>
- narrate "new physical damage = <[new_value]>"
- inventory adjust <[inv].slot[21]> raw_nbt:<[nbt].with[MMOITEMS_PHYSICAL_DAMAGE].as[double:2.3]>
- narrate "after adjust = <[inv].slot[21].raw_nbt.get[MMOITEMS_PHYSICAL_DAMAGE]>"
- else:
- narrate "no physical damage"