Files
convert_holy_sword.sk
Code
1 58
convert_holy_sword.sk
options:
mythic-item-id: REPLACE_WITH_MYTHIC_ITEM_ID
on inventory click:
set {_p} to player
set {_key} to uuid of {_p}
if {holy-sword-convert::%{_key}%} is set:
cancel event
stop
if cursor item of {_p} is a diamond sword:
if name of cursor item of {_p} is "&e神聖之劍":
cancel event
set {holy-sword-convert::%{_key}%} to true
wait 1 tick
if {_p} is online:
if cursor item of {_p} is a diamond sword:
if name of cursor item of {_p} is "&e神聖之劍":
set cursor item of {_p} to air
execute console command "mm items give %{_p}% {@mythic-item-id} 1"
delete {holy-sword-convert::%{_key}%}
on inventory drag:
set {_key} to uuid of player
if {holy-sword-convert::%{_key}%} is set:
cancel event
on drop:
set {_key} to uuid of player
if {holy-sword-convert::%{_key}%} is set:
cancel event
on pickup:
if event-item is a diamond sword:
if name of event-item is "&e神聖之劍":
set {_p} to player
set {_before} to 0
loop {_p}'s inventory:
if loop-item is a diamond sword:
if name of loop-item is "&e神聖之劍":
add amount of loop-item to {_before}
wait 1 tick
if {_p} is online:
set {_after} to 0
loop {_p}'s inventory:
if loop-item is a diamond sword:
if name of loop-item is "&e神聖之劍":
add amount of loop-item to {_after}
set {_converted} to {_after} - {_before}
if {_converted} > 0:
remove {_converted} of diamond swords named "&e神聖之劍" from {_p}
execute console command "mm items give %{_p}% {@mythic-item-id} %{_converted}%"