Skip to content

Commit

Permalink
workstm
Browse files Browse the repository at this point in the history
  • Loading branch information
wraith-54321 committed Nov 16, 2023
1 parent f74ee9a commit 41696e0
Show file tree
Hide file tree
Showing 20 changed files with 141 additions and 66 deletions.
4 changes: 2 additions & 2 deletions code/__DEFINES/~monkestation/admin.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define ADMIN_APPROVE_TOKEN(user) "(<A href='?_src_=holder;[HrefToken(forceGlobal = TRUE)];approve_antag_token=[REF(user)]'>Yes</a>)"
#define ADMIN_REJECT_TOKEN(user) "(<A href='?_src_=holder;[HrefToken(forceGlobal = TRUE)];reject_antag_token=[REF(user)]'>No</a>)"
#define ADMIN_APPROVE_ANTAG_TOKEN(user) "(<A href='?_src_=holder;[HrefToken(forceGlobal = TRUE)];approve_antag_token=[REF(user)]'>Yes</a>)"
#define ADMIN_REJECT_ANTAG_TOKEN(user) "(<A href='?_src_=holder;[HrefToken(forceGlobal = TRUE)];reject_antag_token=[REF(user)]'>No</a>)"
#define ADMIN_OPEN_REVIEW(id) "(<A href='?_src_=holder;[HrefToken(forceGlobal = TRUE)];open_music_review=[id]'>Open Review</a>)"
#define ADMIN_APPROVE_TOKEN_EVENT(user) "(<A href='?_src_=holder;[HrefToken(forceGlobal = TRUE)];approve_token_event=[REF(user)]'>Yes</a>)"
#define ADMIN_REJECT_TOKEN_EVENT(user) "(<A href='?_src_=holder;[HrefToken(forceGlobal = TRUE)];reject_token_event=[REF(user)]'>No</a>)"
Expand Down
5 changes: 3 additions & 2 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ GLOBAL_LIST_INIT(admin_verbs_fun, list(
// Client procs
/client/proc/admin_away,
/client/proc/add_mob_ability,
/client/proc/adjust_players_antag_tokens,
/client/proc/adjust_players_metacoins,
/client/proc/adjust_players_antag_tokens, //monkestation edit
/client/proc/adjust_players_event_tokens, //monkestation edit
/client/proc/adjust_players_metacoins, //monkestation edit
/client/proc/admin_change_sec_level,
/client/proc/change_ocean, //monkestation addition
/client/proc/cinematic,
Expand Down
36 changes: 29 additions & 7 deletions code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1762,22 +1762,24 @@
else if(href_list["approve_antag_token"])
if(!check_rights(R_ADMIN))
return
var/atom/movable/target = locate(href_list["approve_token"])
var/atom/movable/target = locate(href_list["approve_antag_token"])
if(!IS_CLIENT_OR_MOCK(target))
return
var/client/user_client = target
user_client.client_token_holder.approve_token()
message_admins("[user_client]'s token has been approved, by [owner]")
user_client.client_token_holder.approve_antag_token()
message_admins("[user_client]'s token has been approved by [owner].")
log_admin("[user_client]'s token has been approved by [owner].")

else if(href_list["reject_antag_token"])
if(!check_rights(R_ADMIN))
return
var/atom/movable/target = locate(href_list["reject_token"])
var/atom/movable/target = locate(href_list["reject_antag_token"])
if(!IS_CLIENT_OR_MOCK(target))
return
var/client/user_client = target
user_client.client_token_holder.reject_token()
message_admins("[user_client]'s token has been rejected, by [owner]")
user_client.client_token_holder.reject_antag_token()
message_admins("[user_client]'s token has been rejected by [owner].")
log_admin("[user_client]'s token has been rejected by [owner].")

else if(href_list["open_music_review"])
if(!check_rights(R_ADMIN))
Expand All @@ -1788,5 +1790,25 @@
return
cassette_review.ui_interact(usr)

// else if()
else if(href_list["approve_token_event"])
if(!check_rights(R_ADMIN))
return
var/atom/movable/target = locate(href_list["approve_token_event"])
if(!IS_CLIENT_OR_MOCK(target))
return
var/client/user_client = target
user_client.client_token_holder.approve_token_event()
message_admins("[user_client]'s token event has been approved by [owner].")
log_admin("[user_client]'s token event has been approved by [owner].")

else if(href_list["reject_token_event"])
if(!check_rights(R_ADMIN))
return
var/atom/movable/target = locate(href_list["reject_token_event"])
if(!IS_CLIENT_OR_MOCK(target))
return
var/client/user_client = target
user_client.client_token_holder.reject_token_event()
message_admins("[user_client]'s token event has been rejected by [owner].")
log_admin("[user_client]'s token event has been rejected by [owner].")
//monkestation edit end
60 changes: 53 additions & 7 deletions monkestation/code/datums/meta_tokens.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
GLOBAL_LIST_INIT(used_monthly_token, list())

///assoc list of how many event tokens each role gets each month
GLOBAL_LIST_INIT(patreon_etoken_values, list(
NO_RANK = 0,
RANK_TANKS = 100,
ASSISTANT_RANK = 500,
COMMAND_RANK = 1000,
TRAITOR_RANK = 2500,
NUKIE_RANK = 5000,
))

/client
var/datum/meta_token_holder/client_token_holder

Expand Down Expand Up @@ -69,7 +79,7 @@ GLOBAL_LIST_INIT(used_monthly_token, list())
return FALSE
return TRUE

/datum/meta_token_holder/proc/spend_token(tier, use_donor = FALSE)
/datum/meta_token_holder/proc/spend_antag_token(tier, use_donor = FALSE)
if(use_donor)
if(donator_token)
donator_token = FALSE
Expand All @@ -88,7 +98,8 @@ GLOBAL_LIST_INIT(used_monthly_token, list())
convert_tokens_to_list()

///adjusts the users tokens, yes they can be in antag token debt
/datum/meta_token_holder/proc/adjust_tokens(tier, amount)
/datum/meta_token_holder/proc/adjust_antag_tokens(tier, amount)
var/list/old_token_values = list(HIGH_THREAT = total_high_threat_tokens, MEDIUM_THREAT = total_medium_threat_tokens, LOW_THREAT = total_low_threat_tokens)
switch(tier)
if(HIGH_THREAT)
total_high_threat_tokens += amount
Expand All @@ -97,25 +108,60 @@ GLOBAL_LIST_INIT(used_monthly_token, list())
if(LOW_THREAT)
total_low_threat_tokens += amount

log_admin("[key_name(owner)] had their antag tokens adjusted from high: [old_token_values[HIGH_THREAT]], medium: [old_token_values[MEDIUM_THREAT]], \
low: [old_token_values[LOW_THREAT]], to, high: [total_high_threat_tokens], medium: [total_medium_threat_tokens], low: [total_low_threat_tokens]")
convert_tokens_to_list()

/datum/meta_token_holder/proc/approve_token(thing_to_approve)
/datum/meta_token_holder/proc/approve_antag_token()
if(!in_queue)
return
to_chat(owner, "Your request to play as [in_queue] has been approved.")

spend_token(in_queued_tier, queued_donor)
to_chat(owner, "Your request to play as [in_queue] has been approved.")
spend_antag_token(in_queued_tier, queued_donor)
if(!owner.mob.mind)
owner.mob.mind_initialize()
in_queue.antag_token(owner.mob.mind, owner.mob)
in_queue.antag_token(owner.mob.mind, owner.mob) //might not be in queue

qdel(in_queue)
in_queue = null
in_queued_tier = null
queued_donor = FALSE

/datum/meta_token_holder/proc/reject_token(thing_to_reject)
/datum/meta_token_holder/proc/reject_antag_token()
if(!in_queue)
return

to_chat(owner, "Your request to play as [in_queue] has been denied.")
in_queue = null
in_queued_tier = null
queued_donor = FALSE

/datum/meta_token_holder/proc/adjust_event_tokens(amount)
check_event_tokens(owner)
var/old_value = event_tokens
event_tokens += amount
log_admin("[key_name(owner)] had their event tokens adjusted from [old_value] to, [event_tokens].")
convert_tokens_to_list()

/datum/meta_token_holder/proc/check_event_tokens(client/checked_client)
var/month_number = text2num(time2text(world.time, "MM"))
if(event_token_month != month_number)
event_token_month = month_number
event_tokens = GLOB.patreon_etoken_values[checked_client.patreon.owned_rank]
convert_tokens_to_list()

/datum/meta_token_holder/proc/approve_token_event()
if(!queued_token_event)
return

to_chat(owner, "Your request to trigger [queued_token_event] has been approved.")
adjust_event_tokens(-queued_token_event.token_cost)
SStwitch.add_to_queue(initial(queued_token_event.id_tag))
queued_token_event = null

/datum/meta_token_holder/proc/reject_token_event()
if(!queued_token_event)
return

to_chat(owner, "Your request to trigger [queued_token_event] has been denied.")
queued_token_event = null
3 changes: 2 additions & 1 deletion monkestation/code/modules/admin/antag_tokens.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
if(!tier)
return

chosen_client.client_token_holder.adjust_tokens(tier, adjustment_amount)
log_admin("[key_name(src)] adjusted the [tier] antag tokens of [key_name(chosen_client)] by [adjustment_amount].")
chosen_client.client_token_holder.adjust_antag_tokens(tier, adjustment_amount)
16 changes: 8 additions & 8 deletions monkestation/code/modules/admin/event_tokens.dm
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/client/proc/set_players_event_tokens()
/client/proc/adjust_players_event_tokens()
set category = "Admin.Fun"
//due to the fact that these reset each month im just making this directly this this value instead of add or subtract
set name = "Set Event Tokens"
set desc = "Set how many event tokens someone has."

set name = "Adjust Event Tokens"
set desc = "Adjust how many event tokens someone has."

var/mob/chosen_player = tgui_input_list(src, "Choose a Player", "Player List", GLOB.player_list)
if(!chosen_player)
return

var/client/chosen_client = chosen_player.client
var/adjustment_amount = tgui_input_number(src, "What should we set this users tokens to?", "Input Value", TRUE)
if(!adjustment_amount || !chosen_client || !chosen_client.patreon)
var/adjustment_amount = tgui_input_number(src, "How much should we adjust this users tokens by?", "Input Value", TRUE)
if(!adjustment_amount || !chosen_client)
return

check_event_tokens(chosen_client)
chosen_client.prefs.event_tokens = adjustment_amount
log_admin("[key_name(src)] adjusted the event tokens of [key_name(chosen_client)] by [adjustment_amount].")
chosen_client.client_token_holder.adjust_event_tokens(adjustment_amount)
1 change: 0 additions & 1 deletion monkestation/code/modules/client/event_tokens.dm

This file was deleted.

53 changes: 21 additions & 32 deletions monkestation/code/modules/client/verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ GLOBAL_LIST_INIT(low_threat_antags, list(
/datum/antagonist/paradox_clone,
))

//PLACEHOLDER VALUES(1 to 1 cent to token conversion, also you get a free token if you dont pay yeah totally)
///assoc list of how many event tokens each role gets each month
GLOBAL_LIST_INIT(patreon_etoken_values, list(
NO_RANK = 0,
RANK_TANKS = 100,
ASSISTANT_RANK = 500,
COMMAND_RANK = 1000,
TRAITOR_RANK = 2500,
NUKIE_RANK = 5000,
))

/client/verb/spend_antag_tokens()
set category = "IC"
set name = "Spend Antag Tokens"
Expand Down Expand Up @@ -83,11 +72,12 @@ GLOBAL_LIST_INIT(patreon_etoken_values, list(
client_token_holder.in_queue = new chosen_antagonist

to_chat(src, "Your request has been sent to the admins.")
SEND_NOTFIED_ADMIN_MESSAGE('sound/items/bikehorn.ogg', "[span_admin("[span_prefix("ANTAG TOKEN:")] <EM>[key_name(src)]</EM> [ADMIN_APPROVE_TOKEN(src)] [ADMIN_REJECT_TOKEN(src)] | \
SEND_NOTFIED_ADMIN_MESSAGE('sound/items/bikehorn.ogg', "[span_admin("[span_prefix("ANTAG TOKEN:")] <EM>[key_name(src)]</EM> \
[ADMIN_APPROVE_ANTAG_TOKEN(src)] [ADMIN_REJECT_ANTAG_TOKEN(src)] | \
[src] has requested to use their antag token to be a [chosen_antagonist].")]")

/client/proc/trigger_token_event()
set category = "Ghost"
/client/verb/trigger_token_event()
set category = "IC"
set name = "Trigger Token Event"
set desc = "Opens a ui to spend event tokens on"

Expand All @@ -96,28 +86,27 @@ GLOBAL_LIST_INIT(patreon_etoken_values, list(

var/static/list/event_list
if(!event_list)
event_list = subtypesof(/datum/twitch_event)
for(var/datum/twitch_event/event as anything in event_list)
if(!event.token_cost)
event_list -= event
event_list = list()
for(var/event as anything in GLOB.twitch_events_by_type)
var/datum/twitch_event/event_instance = GLOB.twitch_events_by_type[event]
if(!event_instance.token_cost)
continue
event_list += event_instance

client_token_holder.check_event_tokens(src)

check_event_tokens(src)
var/datum/twitch_event/selected_event = tgui_input_list(src, "Event tokens: [client_token_holder.event_tokens]", "Choose an event to trigger", event_list)
if(!selected_event)
return

var/datum/twitch_event/selected_event = tgui_input_list(src, "Event tokens: [prefs.event_tokens]", "Choose an event to trigger", event_list)
var/confirm = tgui_alert(src, "Are you sure you want to trigger [selected_event.event_name]? It will cost [selected_event.token_cost] event tokens.", "Trigger token event", \
list("Yes", "No"))
if(confirm == "Yes")
if(prefs.event_tokens >= selected_event.token_cost)
SEND_NOTFIED_ADMIN_MESSAGE('sound/items/bikehorn.ogg', "MESSAGE")
if(client_token_holder.event_tokens >= selected_event.token_cost)
client_token_holder.queued_token_event = selected_event
to_chat(src, "Your request has been sent.")
SEND_NOTFIED_ADMIN_MESSAGE('sound/items/bikehorn.ogg', "[span_admin("[span_prefix("TOKEN EVENT:")] <EM>[key_name(src)]</EM> \
[ADMIN_APPROVE_TOKEN_EVENT(src)] [ADMIN_REJECT_TOKEN_EVENT(src)] | \
[src] has requested use their event tokens to trigger [selected_event].")]")
return
to_chat(src, "You dont have enough tokens to trigger this event.")

/proc/approve_token_event()

/proc/reject_token_event()

/proc/check_event_tokens(client/checked_client)
var/month_number = text2num(time2text(world.time, "MM"))
if(checked_client.prefs.event_token_month != month_number)
checked_client.prefs.event_token_month = month_number
checked_client.prefs.event_tokens = GLOB.patreon_etoken_values[checked_client.patreon.owned_rank]
2 changes: 1 addition & 1 deletion monkestation/code/modules/code_redemption/code_redeemer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GLOBAL_LIST_INIT(redeemed_codes, list())
if(isnum(path))
usr.client.prefs.adjust_metacoins(usr.ckey, path, "Redeemed a Giveaway Code", donator_multipler = FALSE)
else if(path == HIGH_THREAT || path == MEDIUM_THREAT || path == LOW_THREAT)
usr.client.client_token_holder.adjust_tokens(path, 1)
usr.client.client_token_holder.adjust_antag_tokens(path, 1)
to_chat(usr, span_boldnotice("You have successfully redeemed a giveaway code for: [path] Antag Token."))
else
var/pathedstring = text2path(path)
Expand Down
3 changes: 2 additions & 1 deletion monkestation/code/modules/twitch_bits/events/amongus.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
event_duration = 15 MINUTES
event_flags = TWITCH_AFFECTS_ALL
id_tag = "amongus-all15"
token_cost = 500

/datum/twitch_event/amongus/ook
event_name = "Amongus Ook"
event_duration = 30 MINUTES
event_flags = TWITCH_AFFECTS_STREAMER
id_tag = "amongus-ook10"

token_cost = 500

/datum/twitch_event/amongus/run_event(name)
. = ..()
Expand Down
1 change: 1 addition & 0 deletions monkestation/code/modules/twitch_bits/events/anime_ook.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
event_duration = 1 SECONDS
event_flags = TWITCH_AFFECTS_STREAMER
id_tag = "anime-ook"
token_cost = 100

/datum/twitch_event/anime_ook/run_event(name)
. = ..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
event_duration = 15 MINUTES //effect is very minor so it lasts for a while
event_flags = TWITCH_AFFECTS_ALL
id_tag = "australia-mode"
token_cost = 500

/datum/twitch_event/australia_mode/run_event(name)
. = ..()
Expand Down
1 change: 1 addition & 0 deletions monkestation/code/modules/twitch_bits/events/buff.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
event_duration = 5 MINUTES
event_flags = TWITCH_AFFECTS_ALL
id_tag = "buff-5"
token_cost = 500

/datum/twitch_event/buff/run_event(name)
. = ..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
event_duration = 1 SECONDS
event_flags = TWITCH_AFFECTS_STREAMER
id_tag = "chucklenuts-ook"
token_cost = 800

/datum/twitch_event/chucklenuts/random
event_name = "Think Fast"
Expand Down
2 changes: 2 additions & 0 deletions monkestation/code/modules/twitch_bits/events/die_fate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
event_duration = 1 SECONDS
event_flags = TWITCH_AFFECTS_STREAMER
id_tag = "ook-die-fate"
token_cost = 2500

/datum/twitch_event/free_wiz/run_event(name)
. = ..()
Expand All @@ -19,3 +20,4 @@
event_name = "Change Everyone's Fate"
event_flags = TWITCH_AFFECTS_ALL
id_tag = "everyone-die-fate"
token_cost = 5002 // :)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
event_duration = 1 SECONDS
event_flags = TWITCH_AFFECTS_STREAMER
id_tag = "give-ook-item"
token_cost = 1000

/datum/twitch_event/give_smsword/run_event(name)
. = ..()
Expand Down
1 change: 1 addition & 0 deletions monkestation/code/modules/twitch_bits/events/rod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
event_flags = TWITCH_AFFECTS_STREAMER
id_tag = "rod-ook"
announce = FALSE //takes a while to reach its target so dont announce it
token_cost = 3000

/datum/twitch_event/clang/run_event(name)
. = ..()
Expand Down
1 change: 1 addition & 0 deletions monkestation/code/modules/twitch_bits/events/skinny.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
event_duration = 5 MINUTES
event_flags = TWITCH_AFFECTS_ALL
id_tag = "skinny-5"
token_cost = 500

/datum/twitch_event/skinny/run_event(name)
. = ..()
Expand Down
Loading

0 comments on commit 41696e0

Please sign in to comment.