Skip to content

Commit

Permalink
Merge pull request #566 from wraith-54321/twitch-tokens-real
Browse files Browse the repository at this point in the history
Adds twitch event tokens for patreons
  • Loading branch information
dwasint authored Dec 30, 2023
2 parents 22f4f36 + da803ac commit 91e337d
Show file tree
Hide file tree
Showing 89 changed files with 2,440 additions and 286 deletions.
3 changes: 0 additions & 3 deletions code/__DEFINES/admin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@
#define ADMIN_SHOW_PAPER(atom) "(<A href='?_src_=holder;[HrefToken(forceGlobal = TRUE)];show_paper=[REF(atom)]'>SHOW</a>)"
/// Displays "(PLAY)" in the chat, when clicked it tries to play internet sounds from the request.
#define ADMIN_PLAY_INTERNET(text) "(<A href='?_src_=holder;[HrefToken(forceGlobal = TRUE)];play_internet=[url_encode(text)]'>PLAY</a>)"
#define ADMIN_APPROVE_TOKEN(user) "(<A href='?_src_=holder;[HrefToken(forceGlobal = TRUE)];approve_token=[REF(user)]'>Yes</a>)"
#define ADMIN_REJECT_TOKEN(user) "(<A href='?_src_=holder;[HrefToken(forceGlobal = TRUE)];reject_token=[REF(user)]'>No</a>)"
#define ADMIN_OPEN_REVIEW(id) "(<A href='?_src_=holder;[HrefToken(forceGlobal = TRUE)];open_music_review=[id]'>Open Review</a>)"

/atom/proc/Admin_Coordinates_Readable(area_name, admin_jump_ref)
var/turf/T = Safe_COORD_Location()
Expand Down
6 changes: 5 additions & 1 deletion code/__DEFINES/role_preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define ROLE_OPERATIVE "Operative"
#define ROLE_TRAITOR "Traitor"
#define ROLE_WIZARD "Wizard"
#define ROLE_CLOCK_CULTIST "Clock Cultist"
#define ROLE_CLOCK_CULTIST "Clock Cultist" //monkestation edit

// Midround roles
#define ROLE_ABDUCTOR "Abductor"
Expand All @@ -39,6 +39,7 @@
#define ROLE_SPACE_DRAGON "Space Dragon"
#define ROLE_SPIDER "Spider"
#define ROLE_WIZARD_MIDROUND "Wizard (Midround)"
#define ROLE_DRIFTING_CONTRACTOR "Drifting Contractor" //monkestation edit

// Latejoin roles
#define ROLE_HERETIC_SMUGGLER "Heretic Smuggler"
Expand Down Expand Up @@ -148,8 +149,11 @@ GLOBAL_LIST_INIT(special_roles, list(
ROLE_SPACE_DRAGON = 0,
ROLE_SPIDER = 0,
ROLE_WIZARD_MIDROUND = 14,
//monkestation edit start
ROLE_DRIFTING_CONTRACTOR = 0,
ROLE_VAMPIRICACCIDENT = 0,
ROLE_MONSTERHUNTER = 0,
//monkestation edit end

// Latejoin
ROLE_HERETIC_SMUGGLER = 0,
Expand Down
15 changes: 0 additions & 15 deletions code/__DEFINES/twitch.dm

This file was deleted.

File renamed without changes.
6 changes: 6 additions & 0 deletions code/__DEFINES/~monkestation/admin.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
///Sends all admins the chosen sound
#define SEND_ADMINS_NOTFICATION_SOUND(sound) for(var/client/X in GLOB.admins){X << sound;}
///Sends a message in adminchat
#define SEND_ADMINCHAT_MESSAGE(message) to_chat(GLOB.admins, type = MESSAGE_TYPE_ADMINCHAT, html = message, confidential = TRUE)
///Sends a message in adminchat with the chosen notfication sound
#define SEND_NOTFIED_ADMIN_MESSAGE(sound, message) SEND_ADMINS_NOTFICATION_SOUND(sound); SEND_ADMINCHAT_MESSAGE(message)
28 changes: 28 additions & 0 deletions code/__DEFINES/~monkestation/twitch.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#define TWITCH_AFFECTS_STREAMER (1 << 0)
#define TWITCH_AFFECTS_ALL (1 << 1)
#define TWITCH_AFFECTS_RANDOM (1 << 2)

// twitch event IDs
#define T_EVENT_AMONGUS_ALL_15 "amongus-all15"
#define T_EVENT_AMONGUS_OOK_10 "amongus-ook10"
#define T_EVENT_ANIME_OOK "anime-ook"
#define T_EVENT_AUSTRALIA_MODE "australia-mode"
#define T_EVENT_BUFF_5 "buff-5"
#define T_EVENT_CHUCKLENUTS_OOK "chucklenuts-ook"
#define T_EVENT_CHUCKLENUTS_RANDOM "chucklenuts-random"
#define T_EVENT_OOK_DIE_FATE "ook-die-fate"
#define T_EVENT_EVERYONE_DIE_FATE "everyone-die-fate"
#define T_EVENT_GIVE_OOK_ITEM "give-ook-item"
#define T_EVENT_GIVE_EVERYONE_ITEM "give-everyone-item"
#define T_EVENT_ROD_OOK "rod-ook"
#define T_EVENT_SKINNY_5 "skinny-5"

//For linking twitch account to ss13
#define NO_TWITCH_SUB "" //these are the possible values for the twitch subs
#define TWITCH_SUB_TIER_1 "1000"
#define TWITCH_SUB_TIER_2 "2000"
#define TWITCH_SUB_TIER_3 "3000"

#define ACCESS_TWITCH_SUB_TIER_1 1
#define ACCESS_TWITCH_SUB_TIER_2 2
#define ACCESS_TWITCH_SUB_TIER_3 3
2 changes: 2 additions & 0 deletions code/__DEFINES/~monkestation/uplink.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// the uplink flag for contractors
#define UPLINK_CONTRACTORS (1 << 6)
26 changes: 25 additions & 1 deletion code/datums/components/uplink.dm
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,22 @@
data["current_stock"] = remaining_stock
data["shop_locked"] = uplink_handler.shop_locked
data["purchased_items"] = length(uplink_handler.purchase_log?.purchase_log)
data["locked_entries"] = uplink_handler.locked_entries //monkestation edit
//monkestation edit start
data["locked_entries"] = uplink_handler.locked_entries
data["is_contractor"] = (uplink_handler.uplink_flag == UPLINK_CONTRACTORS)
var/list/contractor_items = list()
for(var/datum/contractor_item/item in uplink_handler.contractor_market_items)
contractor_items += list(list(
"id" = item.type,
"name" = item.name,
"desc" = item.desc,
"cost" = item.cost,
"stock" = item.stock,
"item_icon" = item.item_icon,
))
data["contractor_items"] = contractor_items
data["contractor_rep"] = uplink_handler.contractor_rep
//monkestation edit end
return data

/datum/component/uplink/ui_static_data(mob/user)
Expand Down Expand Up @@ -303,6 +318,15 @@
if(uplink_handler.owner?.current != ui.user || !uplink_handler.can_take_objectives)
return TRUE

//monkestation edit start
switch(action)
if("buy_contractor")
var/item = params["item"]
for(var/datum/contractor_item/hub_item in uplink_handler.contractor_market_items)
if(hub_item.name == item)
hub_item.handle_purchase(uplink_handler, ui.user)
//monkestation edit end

switch(action)
if("regenerate_objectives")
uplink_handler.generate_objectives()
Expand Down
10 changes: 7 additions & 3 deletions code/game/objects/items/melee/baton.dm
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,11 @@
)
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))

//monkestation edit start
/obj/item/melee/baton/telescopic/additional_effects_non_cyborg(mob/living/target, mob/living/user)
. = ..()
target.Disorient(6 SECONDS, 5, paralyze = 3 SECONDS, stack_status = FALSE)
//monkestation edit end

/obj/item/melee/baton/telescopic/suicide_act(mob/living/user)
var/mob/living/carbon/human/human_user = user
Expand Down Expand Up @@ -371,7 +373,8 @@
playsound(src, on_sound, 50, TRUE)
return COMPONENT_NO_DEFAULT_MESSAGE

/obj/item/melee/baton/telescopic/contractor_baton
//monkestation removal start
/*/obj/item/melee/baton/telescopic/contractor_baton
name = "contractor baton"
desc = "A compact, specialised baton assigned to Syndicate contractors. Applies light electrical shocks to targets."
icon = 'icons/obj/weapons/baton.dmi'
Expand All @@ -385,7 +388,7 @@
force = 5
cooldown = 2.5 SECONDS
force_say_chance = 80 //very high force say chance because it's funny
stamina_damage = 170
stamina_damage = 170 //monkestation edit: stam damage increased
clumsy_knockdown_time = 24 SECONDS
affect_cyborg = TRUE
on_stun_sound = 'sound/effects/contractorbatonhit.ogg'
Expand All @@ -399,7 +402,8 @@
/obj/item/melee/baton/telescopic/contractor_baton/additional_effects_non_cyborg(mob/living/target, mob/living/user)
target.set_jitter_if_lower(40 SECONDS)
target.set_stutter_if_lower(40 SECONDS)
target.set_stutter_if_lower(40 SECONDS)*/
//monkestation removal end

/obj/item/melee/baton/security
name = "stun baton"
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 @@ -106,8 +106,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
1 change: 1 addition & 0 deletions code/modules/admin/antag_panel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ GLOBAL_VAR(antag_prototypes)
GLOB.antag_prototypes[cat_id] = list(A)
else
GLOB.antag_prototypes[cat_id] += A
sortTim(GLOB.antag_prototypes, GLOBAL_PROC_REF(cmp_text_asc)) //monkestation edit
sortTim(GLOB.antag_prototypes, GLOBAL_PROC_REF(cmp_text_asc),associative=TRUE)

var/list/sections = list()
Expand Down
39 changes: 30 additions & 9 deletions code/modules/admin/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1758,26 +1758,26 @@
return

web_sound(usr, link_url)

else if(href_list["approve_token"])
//monkestation edit start
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.saved_tokens.approve_token()
message_admins("[user_client]'s token has been approved, by [owner]")
user_client.client_token_holder.approve_antag_token()
log_admin("[user_client]'s token has been approved by [owner].")

else if(href_list["reject_token"])
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.saved_tokens.reject_token()
message_admins("[user_client]'s token has been rejected, by [owner]")
user_client.client_token_holder.reject_antag_token()
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 @@ -1787,3 +1787,24 @@
if(!istype(cassette_review))
return
cassette_review.ui_interact(usr)

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()
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()
log_admin("[user_client]'s token event has been rejected by [owner].")
//monkestation edit end
16 changes: 13 additions & 3 deletions code/modules/antagonists/traitor/datum_traitor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
if(give_secondary_objectives)
uplink_handler.has_objectives = TRUE
uplink_handler.generate_objectives()
//monkestation edit start
else
uplink_handler.has_objectives = FALSE
//monkestation edit end

if(uplink_handler.progression_points < SStraitor.current_global_progression)
uplink_handler.progression_points = SStraitor.current_global_progression * SStraitor.newjoin_progression_coeff
Expand Down Expand Up @@ -344,12 +348,18 @@
var/completed_objectives_text = "Completed Uplink Objectives: "
for(var/datum/traitor_objective/objective as anything in uplink_handler.completed_objectives)
if(objective.objective_state == OBJECTIVE_STATE_COMPLETED)
completed_objectives_text += "<br><B>[objective.name]</B> - ([objective.telecrystal_reward] TC, [DISPLAY_PROGRESSION(objective.progression_reward)] Reputation)"
completed_objectives_text += "<br><B>[objective.name]</B> - ([objective.telecrystal_reward] TC, [DISPLAY_PROGRESSION(objective.progression_reward)] Threat Level)"
//monkestation edit on previous line: replaced "Reputation" with "Threat Level"
result += completed_objectives_text
result += "<br>The traitor had a total of [DISPLAY_PROGRESSION(uplink_handler.progression_points)] Reputation and [uplink_handler.telecrystals] Unused Telecrystals."

result += "<br>The traitor had a total of [DISPLAY_PROGRESSION(uplink_handler.progression_points)] Threat Level and [uplink_handler.telecrystals] Unused Telecrystals."
//monkestation edit on previous line: replaced "Reputation" with "Threat Level"
var/special_role_text = lowertext(name)

//monkestation edit start
if(uplink_handler?.purchased_contractor_items)
result += contractor_round_end()
//monkestation edit end

if(traitor_won)
result += span_greentext("The [special_role_text] was successful!")
else
Expand Down
16 changes: 10 additions & 6 deletions code/modules/antagonists/traitor/objective_category.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,31 @@
// Category should just get autoGC'd here if they don't have any length, this may not be necessary
qdel(category)

/datum/traitor_category_handler/proc/objective_valid(datum/traitor_objective/objective_path, progression_points)
/datum/traitor_category_handler/proc/objective_valid(datum/traitor_objective/objective_path, progression_points, uplink_flag) //monkestation edit: adds uplink_flag
if(initial(objective_path.abstract_type) == objective_path)
return FALSE
if(progression_points < initial(objective_path.progression_minimum))
return FALSE
if(progression_points > initial(objective_path.progression_maximum))
return FALSE
//monkestation edit start
if(!(initial(objective_path.valid_uplinks) & uplink_flag))
return FALSE
//monkestation edit end
return TRUE

/datum/traitor_category_handler/proc/get_possible_objectives(progression_points)
/datum/traitor_category_handler/proc/get_possible_objectives(progression_points, uplink_flag) //monkestation edit: adds uplink_flag
var/list/valid_objectives = list()
for(var/datum/traitor_objective_category/category as anything in all_categories)
var/list/category_list = list()
for(var/value in category.objectives)
if(islist(value))
var/list/objective_category = filter_invalid_objective_list(value, progression_points)
var/list/objective_category = filter_invalid_objective_list(value, progression_points, uplink_flag) //monkestation edit:: adds uplink_flag
if(!length(objective_category))
continue
category_list[objective_category] = category.objectives[value]
else
if(!objective_valid(value, progression_points))
if(!objective_valid(value, progression_points, uplink_flag)) //monkestation edit: adds uplink_flag
continue
category_list[value] = category.objectives[value]
if(!length(category_list))
Expand All @@ -41,7 +45,7 @@

return valid_objectives

/datum/traitor_category_handler/proc/filter_invalid_objective_list(list/objectives, progression_points)
/datum/traitor_category_handler/proc/filter_invalid_objective_list(list/objectives, progression_points, uplink_flag) //monkestation edit: adds uplink_flag
var/list/filtered_objectives = list()
for(var/value in objectives)
if(islist(value))
Expand All @@ -50,7 +54,7 @@
continue
filtered_objectives[result] = objectives[value]
else
if(!objective_valid(value, progression_points))
if(!objective_valid(value, progression_points, uplink_flag)) //monkestation edit: adds uplink_flag
continue
filtered_objectives[value] = objectives[value]
return filtered_objectives
Expand Down
3 changes: 3 additions & 0 deletions code/modules/antagonists/traitor/objectives/kidnapping.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//MONKESTATIONFILE REMOVAL, CHECK THE FILE IN THE MODULAR DIRECTORY
/*
/datum/traitor_objective/target_player/kidnapping
name = "Kidnap %TARGET% the %JOB TITLE% and deliver them to %AREA%"
description = "%TARGET% holds extremely important information regarding secret NT projects - and you'll need to kidnap and deliver them to %AREA%, where our transport pod will be waiting. \
Expand Down Expand Up @@ -321,3 +323,4 @@
for (var/obj/item/implant/storage/internal_bag in kidnapee.implants)
belongings += internal_bag.contents
return belongings
*/
5 changes: 5 additions & 0 deletions code/modules/antagonists/traitor/traitor_objective.dm
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@
/datum/traitor_objective/proc/completion_payout()
handler.progression_points += progression_reward
handler.telecrystals += telecrystal_reward
//monkestation edit start
if(given_contractor_rep)
handler.contractor_rep += given_contractor_rep
//monkestation edit end

/// Used for sending data to the uplink UI
/datum/traitor_objective/proc/uplink_ui_data(mob/user)
Expand All @@ -243,6 +247,7 @@
"objective_state" = objective_state,
"original_progression" = original_progression,
"telecrystal_penalty" = telecrystal_penalty,
"contractor_rep" = given_contractor_rep, //monkestation edit
)

/datum/traitor_objective/proc/on_objective_taken(mob/user)
Expand Down
Loading

0 comments on commit 91e337d

Please sign in to comment.