Date: 2023/01/20 06:59:56 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
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 phy_dmg <[inv].slot[21].raw_nbt.get[MMOITEMS_PHYSICAL_DAMAGE]>
- if <[inv].slot[21].raw_nbt.contains[MMOITEMS_PHYSICAL_DAMAGE]>:
- narrate "physical damage = <[phy_dmg].replace[double:].with[].add[2.0]>"
- else:
- narrate "no physical damage"