diff --git a/modular_ss220/donor/code/client_procs.dm b/modular_ss220/donor/code/client_procs.dm index d90a876f1aab..97819cbc77b1 100644 --- a/modular_ss220/donor/code/client_procs.dm +++ b/modular_ss220/donor/code/client_procs.dm @@ -1,28 +1,49 @@ #define MAX_SAVE_SLOTS_SS220 5 + +/datum/client_login_processor/donator_check/proc/CheckAutoDonatorLevel(client/C) + if(C.holder) + C.donator_level = 2 + return + + var/is_wl = GLOB.configuration.overflow.reroute_cap == 0.5 ? TRUE : FALSE + + var/datum/db_query/rank_ckey_read = SSdbcore.NewQuery( + "SELECT admin_rank FROM [is_wl ? "admin" : "admin_wl"] WHERE ckey=:ckey", + list("ckey" = C.ckey), disable_replace = is_wl) + + if(!rank_ckey_read.warn_execute()) + qdel(rank_ckey_read) + return + + while(rank_ckey_read.NextRow()) + C.donator_level = 2 + + qdel(rank_ckey_read) + /datum/client_login_processor/donator_check/process_result(datum/db_query/Q, client/C) if(IsGuestKey(C.ckey)) return - if(check_rights_client(R_ADMIN, FALSE, C)) - C.donator_level = DONATOR_LEVEL_MAX - C.donor_loadout_points() - C.donor_character_slots() - return + CheckAutoDonatorLevel(C) while(Q.NextRow()) var/total = Q.item[1] + var/donator_level = 0 switch(total) if(220 to 439) - C.donator_level = 1 + donator_level = 1 if(440 to 999) - C.donator_level = 2 + donator_level = 2 if(1000 to 2219) - C.donator_level = 3 + donator_level = 3 if(2220 to 9999) - C.donator_level = 4 + donator_level = 4 if(10000 to INFINITY) - C.donator_level = DONATOR_LEVEL_MAX + donator_level = DONATOR_LEVEL_MAX + + C.donator_level = max(donator_level, C.donator_level) + C.donor_loadout_points() C.donor_character_slots() diff --git a/modular_ss220/whitelist/code/wl_admin.dm b/modular_ss220/whitelist/code/wl_admin.dm index 9b751d646e98..38d665ba123e 100644 --- a/modular_ss220/whitelist/code/wl_admin.dm +++ b/modular_ss220/whitelist/code/wl_admin.dm @@ -1,6 +1,10 @@ -/datum/controller/subsystem/dbcore/NewQuery(sql_query, arguments) +/datum/controller/subsystem/dbcore/NewQuery(sql_query, arguments, disable_replace = FALSE) if(GLOB.configuration.overflow.reroute_cap != 0.5) return ..() + + if(disable_replace) + return ..() + var/regex/r = regex("\\b(admin)\\b") sql_query = r.Replace(sql_query, "admin_wl") . = ..()