implement HYPER COIN EVENT
This commit is contained in:
parent
55ebc9856c
commit
2ebe97ebcd
17
coin.rb
17
coin.rb
@ -31,12 +31,14 @@ def get_coin_count(user)
|
|||||||
scoreboard[user] || 0
|
scoreboard[user] || 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def increment_coin(user)
|
def increment_coin(user, amount=1)
|
||||||
scoreboard = load_scoreboard()
|
scoreboard = load_scoreboard()
|
||||||
coins = get_coin_count(scoreboard, user) + 1
|
coins = get_coin_count(user) + amount
|
||||||
scoreboard[user] = coins
|
scoreboard[user] = coins
|
||||||
|
|
||||||
File.write(SCOREBOARD, scoreboard.to_yaml)
|
File.write(SCOREBOARD, scoreboard.to_yaml)
|
||||||
|
|
||||||
|
return coins
|
||||||
end
|
end
|
||||||
|
|
||||||
def empty_coin(user)
|
def empty_coin(user)
|
||||||
@ -61,12 +63,17 @@ end
|
|||||||
bot.message(content: 'GET COIN' ) do |event|
|
bot.message(content: 'GET COIN' ) do |event|
|
||||||
# update score
|
# update score
|
||||||
if coin_state_active
|
if coin_state_active
|
||||||
increment_coin(event.author.id)
|
if(rand(100) == 47)
|
||||||
|
hyper_coin_amount = rand(100)
|
||||||
|
coins = increment_coin(event.author.id, hyper_coin_amount)
|
||||||
|
event.respond "What astounding luck!!! #{event.author.display_name}, you've just activated HYPER COIN EVENT and have received #{hyper_coin_amount} coins for a grand total of #{coins} coins!"
|
||||||
|
else
|
||||||
|
coins = increment_coin(event.author.id)
|
||||||
|
event.respond "Nice catch, #{event.author.display_name}! You have #{plural('coin', coins)} now!"
|
||||||
|
end
|
||||||
|
|
||||||
coin_state_active = false
|
coin_state_active = false
|
||||||
|
|
||||||
coins = get_coin_count(event.author.id)
|
|
||||||
event.respond "Nice catch, #{event.author.display_name}! You have #{plural('coin', coins)} now!"
|
|
||||||
else
|
else
|
||||||
event.respond "No coins for you, #{event.author.display_name}!"
|
event.respond "No coins for you, #{event.author.display_name}!"
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user