Skip to content

Commit

Permalink
commiting some shit
Browse files Browse the repository at this point in the history
  • Loading branch information
flleeppyy committed Sep 2, 2024
1 parent 7130e1e commit af416c7
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 48 deletions.
2 changes: 1 addition & 1 deletion code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ GLOBAL_VAR(restart_counter)
log_admin("[key_name(usr)] Has requested an immediate world restart via client side debugging tools")
message_admins("[key_name_admin(usr)] Has requested an immediate world restart via client side debugging tools")
to_chat(world, span_boldannounce("Rebooting World immediately due to host request."))
SSplexora.Shutdown(TRUE) // Monkestation edit: plexora
SSplexora.Shutdown(TRUE, usr ? key_name(usr) : null) // Monkestation edit: plexora
else
to_chat(world, span_boldannounce("Rebooting world..."))
Master.Shutdown() //run SS shutdowns
Expand Down
106 changes: 105 additions & 1 deletion monkestation/code/controllers/subsystem/plexora.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ SUBSYSTEM_DEF(plexora)
request.begin_async()
UNTIL(request.is_complete())

/datum/controller/subsystem/plexora/Shutdown(hard = FALSE)
/datum/controller/subsystem/plexora/Shutdown(hard = FALSE, requestedby)
var/list/body = list();
body["type"] = "servershutdown"
body["timestamp"] = rustg_unix_timestamp()
Expand All @@ -132,6 +132,9 @@ SUBSYSTEM_DEF(plexora)
body["playercount"] = length(GLOB.clients)
body["hard"] = hard

if (!isnull(requestedby))
body["requestedby"] = requestedby

http_basicasync("serverupdates", body)

/datum/controller/subsystem/plexora/proc/serverstarted()
Expand Down Expand Up @@ -408,6 +411,27 @@ SUBSYSTEM_DEF(plexora)

return mentors

/datum/world_topic/plx_getloadoutrewards
keyword = "PLX_getloadoutrewards"
require_comms_key = TRUE

/datum/world_topic/plx_getloadoutrewards/Run(list/input)
return subtypesof(/datum/store_item) - typesof(/datum/store_item/roundstart)

/datum/world_topic/plx_getunusualitems
keyword = "PLX_getunusualitems"
require_comms_key = TRUE

/datum/world_topic/plx_getunusualitems/Run(list/input)
return GLOB.possible_lootbox_clothing

/datum/world_topic/get_unusualeffects
keyword = "PLX_getunusualeffects"
require_comms_key = TRUE

/datum/world_topic/get_unusualeffects/Run(list/input)
return subtypesof(/datum/component/particle_spewer) - /datum/component/particle_spewer/movement

/datum/world_topic/plx_getsmites
keyword = "PLX_getsmites"
require_comms_key = TRUE
Expand Down Expand Up @@ -534,6 +558,86 @@ SUBSYSTEM_DEF(plexora)

return returning

/datum/world_topic/plx_generategiveawaycodes
keyword = "PLX_generategiveawaycodes"
require_comms_key = TRUE

/datum/world_topic/plx_generategiveawaycodes/Run(list/input)
var/type = input["type"]
var/codeamount = input["limit"]

var/codes = list()

if (type == "loadout" && !input["loadout"])
return

for (var/i in 1 to codeamount)
var/code
var/returning = list("type" = type)

switch(type)
if ("coin")
var/amount = input["amount"]
if (!amount)
amount = 5000
returning["amount"] = amount
code = generate_coin_code(amount, TRUE)
if ("loadout")
var/loadout = input["loadout"]
//we are not chosing a random one for this, you MUST specify
if (!loadout) return
returning["loadout"] = loadout
code = generate_loadout_code(loadout, TRUE)
if ("antagtoken")
var/tokentype = input["antagtoken"]
if (!tokentype)
tokentype = LOW_THREAT
code = generate_antag_token_code(tokentype, TRUE)
if ("unusual")
var/item = input["unusual_item"]
var/effect = input["unusual_effect"]
if (!item)
item = pick(GLOB.possible_lootbox_clothing)
if (!effect)
var/static/list/possible_effects = subtypesof(/datum/component/particle_spewer) - /datum/component/particle_spewer/movement
effect = pick(possible_effects)
returning["item"] = item
returning["effect"] = effect
code = generate_unusual_code(item, effect, TRUE)
codes += code
return codes

/datum/world_topic/plx_givecoins
keyword = "PLX_givecoins"
require_comms_key = TRUE

/datum/world_topic/plx_givecoins/Run(list/input)
var/ckey = input["ckey"]
var/amount = input["amount"]
var/reason = input["reason"]

var/client/userclient = disambiguate_client(ckey)

var/datum/preferences/prefs
if (isnull(userclient))
var/datum/client_interface/mock_player = new(ckey)
mock_player.prefs = new /datum/preferences(mock_player)

prefs = mock_player.prefs
else
prefs = userclient.prefs

prefs.adjust_metacoins(ckey, amount, reason, donator_multipler = FALSE, respects_roundcap = FALSE, announces = FALSE)

return list("totalcoins" = prefs.metacoins)

/datum/world_topic/plx_generategiveawaycode
keyword = "PLX_generategiveawaycode"
require_comms_key = TRUE

/datum/world_topic/plx_generategiveawaycode/Run(list/input)


/datum/world_topic/plx_forceemote
keyword = "PLX_forceemote"
require_comms_key = TRUE
Expand Down
2 changes: 1 addition & 1 deletion monkestation/code/modules/blueshift/uplinks/kits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
name = "M-90gl Carbine Case (Hard)"
desc = "A fully-loaded, specialized three-round burst carbine that fires .223 ammunition from a 30 round magazine \
with a 40mm underbarrel grenade launcher. Use secondary-fire to fire the grenade launcher. Comes with two spare magazines \
and a box of 40mm rubber slugs."
and a box of 40mm HE."
item = /obj/item/storage/toolbox/guncase/m90gl
cost = 14

Expand Down
99 changes: 57 additions & 42 deletions monkestation/code/modules/code_redemption/code_generator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,64 @@ GLOBAL_LIST_INIT(stored_codes, list())

switch(choice)
if("Coins")
generate_coin_code()
generate_coin_code_tgui()
if("Loadout Items")
generate_loadout_code()
generate_loadout_code_tgui()
if("Antag Tokens")
generate_antag_token_code()
generate_antag_token_code_tgui()
if("Unusual")
generate_unsual_code()
generate_unusual_code_tgui()

/proc/generate_coin_code(no_logs = FALSE)
/proc/generate_coin_code_tgui(no_logs = FALSE)
if(!check_rights(R_FUN))
return
var/amount = tgui_input_number(usr, "Please enter an amount of coins to give", "Coin Amount", 0, 10000, 0)
if(!amount)
return
return generate_coin_code(amount, no_logs)

/proc/generate_loadout_code_tgui(no_logs = FALSE)
if(!check_rights(R_FUN))
return
var/choice = tgui_input_list(usr, "Please choose a loadout item to award", "Loadout Choice", subtypesof(/datum/store_item) - typesof(/datum/store_item/roundstart))
if(!choice)
return
return generate_loadout_code(choice, no_logs)

/proc/generate_antag_token_code_tgui(no_logs = FALSE)
if(!check_rights(R_FUN))
return
var/choice = tgui_input_list(usr, "Please choose an antag token level to award", "Token Choice", list(HIGH_THREAT, MEDIUM_THREAT, LOW_THREAT))
if(!choice)
return
return generate_antag_token_code(choice, no_logs)

/proc/generate_unusual_code_tgui(no_logs = FALSE)
if(!check_rights(R_FUN))
return
var/item_choice = tgui_alert(usr, "Should it be a random item?", "Loadout Choice", list("Yes", "No"))
if(!item_choice)
return
if(item_choice == "Yes")
item_choice = pick(GLOB.possible_lootbox_clothing)
else
item_choice = tgui_input_list(usr, "Please choose a loadout item to award", "Loadout Choice", GLOB.possible_lootbox_clothing)
if(!item_choice || !ispath(item_choice))
return

var/effect_choice = tgui_alert(usr, "Should it be a random effect?", "Loadout Choice", list("Yes", "No"))
if(!effect_choice)
return
var/static/list/possible_effects = subtypesof(/datum/component/particle_spewer) - /datum/component/particle_spewer/movement
if(effect_choice == "Yes")
effect_choice = pick(possible_effects)
else
effect_choice = tgui_input_list(usr, "Please choose an effect to give the item.", "Loadout Choice", possible_effects)
if(!effect_choice || !ispath(effect_choice))
return
return generate_unusual_code(item_choice, effect_choice, no_logs)

/proc/generate_coin_code(amount, no_logs = FALSE)
if(!amount)
return
var/string = generate_code_string()
Expand All @@ -48,10 +94,7 @@ GLOBAL_LIST_INIT(stored_codes, list())
to_chat(usr, span_big("Your generated code is: [string]"))
return string

/proc/generate_loadout_code(no_logs = FALSE)
if(!check_rights(R_FUN))
return
var/choice = tgui_input_list(usr, "Please choose a loadout item to award", "Loadout Choice", subtypesof(/datum/store_item) - typesof(/datum/store_item/roundstart))
/proc/generate_loadout_code(choice, no_logs = FALSE)
if(!choice)
return
reload_global_stored_codes()
Expand All @@ -76,12 +119,7 @@ GLOBAL_LIST_INIT(stored_codes, list())
to_chat(usr, span_big("Your generated code is: [string]"))
return string

/proc/generate_antag_token_code(no_logs = FALSE)
if(!check_rights(R_FUN))
return
var/choice = tgui_input_list(usr, "Please choose an antag token level to award", "Token Choice", list(HIGH_THREAT, MEDIUM_THREAT, LOW_THREAT))
if(!choice)
return
/proc/generate_antag_token_code(choice, no_logs = FALSE)
var/string = generate_code_string()

var/json_file = file(CODE_STORAGE_PATH)
Expand All @@ -104,30 +142,7 @@ GLOBAL_LIST_INIT(stored_codes, list())
to_chat(usr, span_big("Your generated code is: [string]"))
return string

/proc/generate_unsual_code(no_logs = FALSE)
if(!check_rights(R_FUN))
return
var/item_choice = tgui_alert(usr, "Should it be a random item?", "Loadout Choice", list("Yes", "No"))
if(!item_choice)
return
if(item_choice == "Yes")
item_choice = pick(GLOB.possible_lootbox_clothing)
else
item_choice = tgui_input_list(usr, "Please choose a loadout item to award", "Loadout Choice", GLOB.possible_lootbox_clothing)
if(!item_choice || !ispath(item_choice))
return

var/effect_choice = tgui_alert(usr, "Should it be a random effect?", "Loadout Choice", list("Yes", "No"))
if(!effect_choice)
return
var/static/list/possible_effects = subtypesof(/datum/component/particle_spewer) - /datum/component/particle_spewer/movement
if(effect_choice == "Yes")
effect_choice = pick(possible_effects)
else
effect_choice = tgui_input_list(usr, "Please choose an effect to give the item.", "Loadout Choice", possible_effects)
if(!effect_choice || !ispath(effect_choice))
return

/proc/generate_unusual_code(item_choice, effect_choice, no_logs = FALSE)
reload_global_stored_codes()
var/string = generate_code_string()

Expand Down Expand Up @@ -181,11 +196,11 @@ GLOBAL_LIST_INIT(stored_codes, list())
var/list/generated_codes = list()
for(var/num in 1 to amount)
if(choice == "Coins")
generated_codes += generate_coin_code(TRUE)
generated_codes += generate_coin_code_tgui(TRUE)
else if(choice == "Loadout Items")
generated_codes += generate_loadout_code(TRUE)
generated_codes += generate_loadout_code_tgui(TRUE)
else
generated_codes += generate_antag_token_code(TRUE)
generated_codes += generate_antag_token_code_tgui(TRUE)

log_game("[usr] generated [amount] new redemption codes.")
message_admins("[usr] generated a new redemption codes.")
Expand Down
4 changes: 2 additions & 2 deletions monkestation/code/modules/mentor/mentor_pm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
var/datum/request/request = GLOB.mentor_requests.requests[ckey][length(GLOB.mentor_requests.requests[ckey])]
if(request)
id = "[request.id]"
SSplexora.mticket_pm(request, usr, msg)
SSplexora.mticket_pm(request, src.mob, usr, msg)

var/regular_webhook_url = CONFIG_GET(string/regular_mentorhelp_webhook_url)
if(regular_webhook_url)
Expand Down Expand Up @@ -61,7 +61,7 @@
var/datum/request/request = GLOB.mentor_requests.requests[ckey][length(GLOB.mentor_requests.requests[ckey])]
if(request)
id = "[request.id]"
SSplexora.mticket_pm(request, usr, msg)
SSplexora.mticket_pm(request, src.mob, usr, msg)

var/regular_webhook_url = CONFIG_GET(string/regular_mentorhelp_webhook_url)
if(regular_webhook_url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@

/datum/symptom/wendigo_warning
name = "Fullness Syndrome"
desc = "An unsual symptom that causes the infected to feel hungry, even after eating."
desc = "An unusual symptom that causes the infected to feel hungry, even after eating."
stage = 1
badness = EFFECT_DANGER_ANNOYING
var/list/host_messages = list(
Expand Down

0 comments on commit af416c7

Please sign in to comment.