From 0a41f29cf4eb925e303b600ee01c5fe135f3b99e Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Sat, 2 Mar 2024 21:42:35 +0100 Subject: [PATCH 1/4] Update records.dm --- code/game/verbs/records.dm | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/code/game/verbs/records.dm b/code/game/verbs/records.dm index 743a09d0ab6e..5f0482adee71 100644 --- a/code/game/verbs/records.dm +++ b/code/game/verbs/records.dm @@ -225,3 +225,47 @@ GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new) set category = "OOC.Records" GLOB.medals_view_tgui.tgui_interact(mob) + +GLOBAL_DATUM_INIT(medals_view_given_tgui, /datum/medals_view_given_tgui, new) + +/datum/medals_view_given_tgui/tgui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "MedalsViewer", "[user.ckey]'s Medals") + ui.open() + +/datum/medals_view_given_tgui/ui_static_data(mob/user) + . = ..() + .["medals"] = list() + + for(var/datum/view_record/medal_view/medal as anything in DB_VIEW(/datum/view_record/medal_view, DB_COMP("giver_player_id", DB_EQUALS, user.client.player_data.id))) + var/xeno_medal = FALSE + if(medal.medal_type in GLOB.xeno_medals) + xeno_medal = TRUE + + var/list/current_medal = list( + "round_id" = medal.round_id, + "medal_type" = medal.medal_type, + "medal_icon" = replacetext(medal.medal_type, " ", "-"), + "xeno_medal" = xeno_medal, + "recipient_name" = medal.recipient_name, + "recipient_role" = medal.recipient_role, + "giver_name" = medal.giver_name, + "citation" = medal.citation + ) + + .["medals"] += list(current_medal) + +/datum/medals_view_given_tgui/ui_state(mob/user) + return GLOB.always_state + +/datum/medals_view_given_tgui/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/spritesheet/medal) + ) + +/client/verb/view_given_medals() + set name = "View Given Medals" + set category = "OOC.Records" + + GLOB.medals_view_given_tgui.tgui_interact(mob) From dadbc21287ba413d787b78f530420206f477a8eb Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Sat, 2 Mar 2024 21:43:30 +0100 Subject: [PATCH 2/4] Update records.dm --- code/game/verbs/records.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/verbs/records.dm b/code/game/verbs/records.dm index 5f0482adee71..4525e7b1e4ed 100644 --- a/code/game/verbs/records.dm +++ b/code/game/verbs/records.dm @@ -265,7 +265,7 @@ GLOBAL_DATUM_INIT(medals_view_given_tgui, /datum/medals_view_given_tgui, new) ) /client/verb/view_given_medals() - set name = "View Given Medals" + set name = "View Medals Given to Others" set category = "OOC.Records" GLOB.medals_view_given_tgui.tgui_interact(mob) From 069dfc3271276f8dcc5585d86a3c7fb7482fa3a1 Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Sat, 2 Mar 2024 21:51:29 +0100 Subject: [PATCH 3/4] Update records.dm --- code/game/verbs/records.dm | 47 ++++++++++++-------------------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/code/game/verbs/records.dm b/code/game/verbs/records.dm index 4525e7b1e4ed..f633089f6782 100644 --- a/code/game/verbs/records.dm +++ b/code/game/verbs/records.dm @@ -184,6 +184,7 @@ GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new) + /datum/medals_view_tgui/tgui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) if(!ui) @@ -194,7 +195,7 @@ GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new) . = ..() .["medals"] = list() - for(var/datum/view_record/medal_view/medal as anything in DB_VIEW(/datum/view_record/medal_view, DB_COMP("player_id", DB_EQUALS, user.client.player_data.id))) + for(var/datum/view_record/medal_view/medal as anything in get_medals()) var/xeno_medal = FALSE if(medal.medal_type in GLOB.xeno_medals) xeno_medal = TRUE @@ -212,6 +213,10 @@ GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new) .["medals"] += list(current_medal) +/datum/medals_view_tgui/proc/get_medals() + return DB_VIEW(/datum/view_record/medal_view, DB_COMP("player_id", DB_EQUALS, user.client.player_data.id)) + + /datum/medals_view_tgui/ui_state(mob/user) return GLOB.always_state @@ -226,43 +231,19 @@ GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new) GLOB.medals_view_tgui.tgui_interact(mob) -GLOBAL_DATUM_INIT(medals_view_given_tgui, /datum/medals_view_given_tgui, new) - -/datum/medals_view_given_tgui/tgui_interact(mob/user, datum/tgui/ui) - ui = SStgui.try_update_ui(user, src, ui) - if(!ui) - ui = new(user, src, "MedalsViewer", "[user.ckey]'s Medals") - ui.open() - -/datum/medals_view_given_tgui/ui_static_data(mob/user) - . = ..() - .["medals"] = list() +GLOBAL_DATUM_INIT(medals_view_given_tgui, /datum/medals_view_tgui/given_medals, new) - for(var/datum/view_record/medal_view/medal as anything in DB_VIEW(/datum/view_record/medal_view, DB_COMP("giver_player_id", DB_EQUALS, user.client.player_data.id))) - var/xeno_medal = FALSE - if(medal.medal_type in GLOB.xeno_medals) - xeno_medal = TRUE - var/list/current_medal = list( - "round_id" = medal.round_id, - "medal_type" = medal.medal_type, - "medal_icon" = replacetext(medal.medal_type, " ", "-"), - "xeno_medal" = xeno_medal, - "recipient_name" = medal.recipient_name, - "recipient_role" = medal.recipient_role, - "giver_name" = medal.giver_name, - "citation" = medal.citation - ) +/datum/medals_view_tgui/given_medals/get_medals() + return DB_VIEW(/datum/view_record/medal_view, DB_COMP("giver_player_id", DB_EQUALS, user.client.player_data.id)) - .["medals"] += list(current_medal) -/datum/medals_view_given_tgui/ui_state(mob/user) - return GLOB.always_state +/datum/medals_view_tgui/given_medals/tgui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "MedalsViewer", "[user.ckey]'s Given Medals") + ui.open() -/datum/medals_view_given_tgui/ui_assets(mob/user) - return list( - get_asset_datum(/datum/asset/spritesheet/medal) - ) /client/verb/view_given_medals() set name = "View Medals Given to Others" From f8b3aa4902eba32fda1b2b9167c9cbaf5cec3b1f Mon Sep 17 00:00:00 2001 From: TheGamerdk <5618080+TheGamerdk@users.noreply.github.com> Date: Sat, 2 Mar 2024 21:57:22 +0100 Subject: [PATCH 4/4] Update records.dm --- code/game/verbs/records.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/game/verbs/records.dm b/code/game/verbs/records.dm index f633089f6782..05506804790a 100644 --- a/code/game/verbs/records.dm +++ b/code/game/verbs/records.dm @@ -195,7 +195,7 @@ GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new) . = ..() .["medals"] = list() - for(var/datum/view_record/medal_view/medal as anything in get_medals()) + for(var/datum/view_record/medal_view/medal as anything in get_medals(user)) var/xeno_medal = FALSE if(medal.medal_type in GLOB.xeno_medals) xeno_medal = TRUE @@ -213,7 +213,7 @@ GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new) .["medals"] += list(current_medal) -/datum/medals_view_tgui/proc/get_medals() +/datum/medals_view_tgui/proc/get_medals(mob/user) return DB_VIEW(/datum/view_record/medal_view, DB_COMP("player_id", DB_EQUALS, user.client.player_data.id)) @@ -234,7 +234,7 @@ GLOBAL_DATUM_INIT(medals_view_tgui, /datum/medals_view_tgui, new) GLOBAL_DATUM_INIT(medals_view_given_tgui, /datum/medals_view_tgui/given_medals, new) -/datum/medals_view_tgui/given_medals/get_medals() +/datum/medals_view_tgui/given_medals/get_medals(mob/user) return DB_VIEW(/datum/view_record/medal_view, DB_COMP("giver_player_id", DB_EQUALS, user.client.player_data.id))