Files
daily_vouchers.sk
Code
1 130
daily_vouchers.sk
options:
gui-title: "&8Daily Voucher Rewards"
voucher-name: "&6Daily Voucher"
voucher-lore: "&7Redeem this voucher for a daily reward."
command /daily:
description: Opens the daily voucher rewards menu.
trigger:
set {_uuid} to uuid of player
set {_next-day} to 1
if {daily.streak::%{_uuid}%} is set:
set {_next-day} to {daily.streak::%{_uuid}%} + 1
if {_next-day} is greater than 7:
set {_next-day} to 1
if {daily.last-claim::%{_uuid}%} is set:
set {_elapsed} to difference between now and {daily.last-claim::%{_uuid}%}
if {_elapsed} is greater than 2 days:
set {_next-day} to 1
set {daily.gui::%{_uuid}%} to true
open chest inventory with 3 rows named "{@gui-title}" to player
set slot 10 of player's current inventory to chest minecart named "&cDay 1 &8[Locked]" with lore "&7Reward: &f1 voucher" and "&8Claim the previous day first"
set slot 11 of player's current inventory to chest minecart named "&cDay 2 &8[Locked]" with lore "&7Reward: &f1 voucher" and "&8Claim the previous day first"
set slot 12 of player's current inventory to chest minecart named "&cDay 3 &8[Locked]" with lore "&7Reward: &f2 vouchers" and "&8Claim the previous day first"
set slot 13 of player's current inventory to chest minecart named "&cDay 4 &8[Locked]" with lore "&7Reward: &f1 voucher" and "&8Claim the previous day first"
set slot 14 of player's current inventory to chest minecart named "&cDay 5 &8[Locked]" with lore "&7Reward: &f1 voucher" and "&8Claim the previous day first"
set slot 15 of player's current inventory to chest minecart named "&cDay 6 &8[Locked]" with lore "&7Reward: &f1 voucher" and "&8Claim the previous day first"
set slot 16 of player's current inventory to chest minecart named "&cDay 7 &8[Locked]" with lore "&7Reward: &f3 vouchers" and "&8Claim the previous day first"
if {_next-day} is 1:
set slot 10 of player's current inventory to chest minecart named "&eDay 1 &8[Available]" with lore "&7Reward: &f1 voucher" and "&aClick to claim"
else if {_next-day} is 2:
set slot 11 of player's current inventory to chest minecart named "&eDay 2 &8[Available]" with lore "&7Reward: &f1 voucher" and "&aClick to claim"
else if {_next-day} is 3:
set slot 12 of player's current inventory to chest minecart named "&eDay 3 &8[Available]" with lore "&7Reward: &f2 vouchers" and "&aClick to claim"
else if {_next-day} is 4:
set slot 13 of player's current inventory to chest minecart named "&eDay 4 &8[Available]" with lore "&7Reward: &f1 voucher" and "&aClick to claim"
else if {_next-day} is 5:
set slot 14 of player's current inventory to chest minecart named "&eDay 5 &8[Available]" with lore "&7Reward: &f1 voucher" and "&aClick to claim"
else if {_next-day} is 6:
set slot 15 of player's current inventory to chest minecart named "&eDay 6 &8[Available]" with lore "&7Reward: &f1 voucher" and "&aClick to claim"
else if {_next-day} is 7:
set slot 16 of player's current inventory to chest minecart named "&eDay 7 &8[Available]" with lore "&7Reward: &f3 vouchers" and "&aClick to claim"
on inventory click:
set {_uuid} to uuid of player
if {daily.gui::%{_uuid}%} is not true:
stop
cancel event
if clicked slot is 10:
set {_clicked-day} to 1
else if clicked slot is 11:
set {_clicked-day} to 2
else if clicked slot is 12:
set {_clicked-day} to 3
else if clicked slot is 13:
set {_clicked-day} to 4
else if clicked slot is 14:
set {_clicked-day} to 5
else if clicked slot is 15:
set {_clicked-day} to 6
else if clicked slot is 16:
set {_clicked-day} to 7
else:
stop
set {_next-day} to 1
if {daily.last-claim::%{_uuid}%} is set:
set {_elapsed} to difference between now and {daily.last-claim::%{_uuid}%}
if {_elapsed} is less than 1 day:
send "&cYou have already claimed today's voucher." to player
stop
if {_elapsed} is greater than 2 days:
set {daily.streak::%{_uuid}%} to 0
if {daily.streak::%{_uuid}%} is set:
set {_next-day} to {daily.streak::%{_uuid}%} + 1
if {_next-day} is greater than 7:
set {_next-day} to 1
if {_clicked-day} is not {_next-day}:
send "&eYou must claim Day %{_next-day}%&e's reward." to player
stop
set {_amount} to 1
if {_clicked-day} is 3:
set {_amount} to 2
else if {_clicked-day} is 7:
set {_amount} to 3
set {daily.streak::%{_uuid}%} to {_clicked-day}
set {daily.last-claim::%{_uuid}%} to now
give {_amount} of paper named "{@voucher-name}" with lore "{@voucher-lore}" to player
if {_amount} is 1:
send "&aYou claimed &f1 &adaily voucher!" to player
else:
send "&aYou claimed &f%{_amount}% &adaily vouchers!" to player
delete {daily.gui::%{_uuid}%}
close player's inventory
on inventory drag:
set {_uuid} to uuid of player
if {daily.gui::%{_uuid}%} is true:
cancel event
on inventory close:
set {_uuid} to uuid of player
delete {daily.gui::%{_uuid}%}
on quit:
set {_uuid} to uuid of player
delete {daily.gui::%{_uuid}%}
on script load:
send "&aDaily voucher system loaded successfully." to console