diff --git a/code/modules/admin/DB ban/functions.dm b/code/modules/admin/DB ban/functions.dm index 436fc253..cbae0994 100644 --- a/code/modules/admin/DB ban/functions.dm +++ b/code/modules/admin/DB ban/functions.dm @@ -1,5 +1,5 @@ -datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = -1, var/reason, var/job = "", var/rounds = 0, var/banckey = null, var/autobanner = 0, var/autoip = null, var/autocid = null) +datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = -1, var/reason, var/job = "", var/rounds = 0, var/banckey = null, var/autobanner = 0, var/autoip = null, var/autocid = null, var/mirrorid = null) if(!check_rights(R_MOD,0) && !check_rights(R_BAN) && !autobanner) return @@ -88,9 +88,14 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = reason = sql_sanitize_text(reason) - var/sql = "INSERT INTO ss13_ban (`id`,`bantime`,`serverip`,`bantype`,`reason`,`job`,`duration`,`rounds`,`expiration_time`,`ckey`,`computerid`,`ip`,`a_ckey`,`a_computerid`,`a_ip`,`who`,`adminwho`,`edits`,`unbanned`,`unbanned_datetime`,`unbanned_ckey`,`unbanned_computerid`,`unbanned_ip`) VALUES (null, Now(), '[serverip]', '[bantype_str]', '[reason]', '[job]', [(duration)?"[duration]":"0"], [(rounds)?"[rounds]":"0"], Now() + INTERVAL [(duration>0) ? duration : 0] MINUTE, '[ckey]', '[computerid]', '[ip]', '[a_ckey]', '[a_computerid]', '[a_ip]', '[who]', '[adminwho]', '', null, null, null, null, null)" + message_admins("Mirror ID: [mirrorid ? mirrorid : "NOT A MIRROR!"].") + world.log << "Mirror ID: [mirrorid ? mirrorid : "NOT A MIRROR!"]." + + var/sql = "INSERT INTO ss13_ban (`id`,`mirrorid`,`bantime`,`serverip`,`bantype`,`reason`,`job`,`duration`,`rounds`,`expiration_time`,`ckey`,`computerid`,`ip`,`a_ckey`,`a_computerid`,`a_ip`,`who`,`adminwho`,`edits`,`unbanned`,`unbanned_datetime`,`unbanned_ckey`,`unbanned_computerid`,`unbanned_ip`) VALUES (null, [mirrorid ? "'[mirrorid]'" : "null"], Now(), '[serverip]', '[bantype_str]', '[reason]', '[job]', [(duration)?"[duration]":"0"], [(rounds)?"[rounds]":"0"], Now() + INTERVAL [(duration>0) ? duration : 0] MINUTE, '[ckey]', '[computerid]', '[ip]', '[a_ckey]', '[a_computerid]', '[a_ip]', '[who]', '[adminwho]', '', null, null, null, null, null)" var/DBQuery/query_insert = dbcon.NewQuery(sql) query_insert.Execute() + if (query_insert.ErrorMsg()) + message_admins("ERROR: [query_insert.ErrorMsg()].") usr << "\blue Ban saved to database." message_admins("[autobanner ? "Adminbot" : key_name_admin(usr)] has added a [bantype_str] for [ckey] [(job)?"([job])":""] [(duration > 0)?"([duration] minutes)":""] with the reason: \"[reason]\" to the ban database.",1) @@ -127,7 +132,7 @@ datum/admins/proc/DB_ban_unban(var/ckey, var/bantype, var/job = "") else bantype_sql = "bantype = '[bantype_str]'" - var/sql = "SELECT id FROM ss13_ban WHERE ckey = '[ckey]' AND [bantype_sql] AND (unbanned is null OR unbanned = false)" + var/sql = "SELECT id, mirrorid FROM ss13_ban WHERE ckey = '[ckey]' AND [bantype_sql] AND (unbanned is null OR unbanned = false)" if(job) sql += " AND job = '[job]'" @@ -136,12 +141,14 @@ datum/admins/proc/DB_ban_unban(var/ckey, var/bantype, var/job = "") return var/ban_id + var/mirrorid var/ban_number = 0 //failsafe var/DBQuery/query = dbcon.NewQuery(sql) query.Execute() while(query.NextRow()) ban_id = query.item[1] + mirrorid = text2num(query.item[2]) ban_number++; if(ban_number == 0) @@ -158,7 +165,24 @@ datum/admins/proc/DB_ban_unban(var/ckey, var/bantype, var/job = "") usr << "\red Database update failed due to a ban ID mismatch. Contact the database admin." return - DB_ban_unban_by_id(ban_id) + if (mirrorid) + if (alert(usr, "This ban is mirrored from another ban. Do you wish to lift the original, or this one specifically?", "Original Ban?", "Lift The Original", "Lift This One") == "Lift The Original") + ban_id = mirrorid + + var/mirrored = 0 + var/DBQuery/mirrorquery = dbcon.NewQuery("SELECT id FROM ss13_ban WHERE mirrorid = '[ban_id]' AND (unbanned is null OR unbanned = false);") + mirrorquery.Execute() + if (mirrorquery.ErrorMsg()) + message_admins("Error: [mirrorquery.ErrorMsg()].") + while (mirrorquery.NextRow()) + mirrored++ + + var/liftmirrored = 0 + if (mirrored) + if (alert(usr, "Do you wish to lift [mirrored] mirrored ban(s) tied to this one?", "Mirrored Bans", "Yes", "No") == "Yes") + liftmirrored = 1 + + DB_ban_unban_by_id(ban_id, liftmirrored) datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null) @@ -220,7 +244,7 @@ datum/admins/proc/DB_ban_edit(var/banid = null, var/param = null) usr << "Cancelled" return -datum/admins/proc/DB_ban_unban_by_id(var/id) +datum/admins/proc/DB_ban_unban_by_id(var/id, var/liftmirrored = 0) if(!check_rights(R_BAN)) return @@ -260,6 +284,11 @@ datum/admins/proc/DB_ban_unban_by_id(var/id) var/DBQuery/query_update = dbcon.NewQuery(sql_update) query_update.Execute() + if (liftmirrored) + var/DBQuery/updatemirrored = dbcon.NewQuery("UPDATE ss13_ban SET unbanned = 1, unbanned_datetime = Now(), unbanned_ckey = '[unban_ckey]', unbanned_computerid = '[unban_computerid]', unbanned_ip = '[unban_ip]' WHERE mirrorid = [id];") + updatemirrored.Execute() + if (updatemirrored.ErrorMsg()) + message_admins("Error: [updatemirrored.ErrorMsg()].") /client/proc/DB_ban_panel() set category = "Admin" @@ -415,4 +444,4 @@ datum/admins/proc/DB_ban_unban_by_id(var/id) output += "" - usr << browse(output,"window=lookupbans;size=900x500") \ No newline at end of file + usr << browse(output,"window=lookupbans;size=900x500") diff --git a/code/modules/admin/IsBanned.dm b/code/modules/admin/IsBanned.dm index 01c811a8..066cf60b 100644 --- a/code/modules/admin/IsBanned.dm +++ b/code/modules/admin/IsBanned.dm @@ -102,6 +102,7 @@ world/IsBanned(key,address,computer_id) var/desc = null var/tobantype = null + var/mirrorid = null var/multireason = null var/newreason = null @@ -115,20 +116,27 @@ world/IsBanned(key,address,computer_id) failedcid = 0 cidquery = " OR computerid = '[computer_id]' " - var/DBQuery/query = dbcon.NewQuery("SELECT ckey, ip, computerid, a_ckey, reason, expiration_time, duration, bantime, bantype FROM ss13_ban WHERE (ckey = '[ckeytext]' [ipquery] [cidquery]) AND (bantype = 'PERMABAN' OR (bantype = 'TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)") + var/DBQuery/query = dbcon.NewQuery("SELECT id, mirrorid, ckey, ip, computerid, a_ckey, reason, expiration_time, duration, bantime, bantype FROM ss13_ban WHERE (ckey = '[ckeytext]' [ipquery] [cidquery]) AND (bantype = 'PERMABAN' OR (bantype = 'TEMPBAN' AND expiration_time > Now())) AND isnull(unbanned)") query.Execute() while(query.NextRow()) - var/pckey = query.item[1] - var/pip = query.item[2] - var/pcid = query.item[3] - var/ackey = query.item[4] - var/reason = query.item[5] - var/expiration = query.item[6] - var/duration = query.item[7] - var/bantime = query.item[8] - var/bantype = query.item[9] + var/id = text2num(query.item[1]) + mirrorid = text2num(query.item[2]) + var/pckey = query.item[3] + var/pip = query.item[4] + var/pcid = query.item[5] + var/ackey = query.item[6] + var/reason = query.item[7] + var/expiration = query.item[8] + var/duration = query.item[9] + var/bantime = query.item[10] + var/bantype = query.item[11] + + if (!mirrorid) + mirrorid = id + + world.log << "We got here! Wee!" var/expires = "" if(text2num(duration) > 0) @@ -169,7 +177,7 @@ world/IsBanned(key,address,computer_id) toban = 1 if(banFlag & (KEYBAN|IDBAN|IPBAN)) - Adminbot.DB_ban_record(1, null, null, multireason, null, null, ckey(key), 1, address, computer_id) + Adminbot.DB_ban_record(1, null, null, multireason, null, null, ckey(key), 1, address, computer_id, mirrorid) notes_add_sql(key, newreason, null, address, computer_id) if(toban) diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 2052558e..ae8ea010 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -87,12 +87,6 @@ if(href_list["warnview"]) warnings_check() - if(href_list["preference"]) - if(istype(mob, /mob/new_player)) - var/mob/new_player/P = mob - if(P.ready) - return - prefs.process_link(src, href_list) ..() //redirect to hsrc.Topic() /client/proc/handle_spam_prevention(var/message, var/mute_type, var/pass = 1) @@ -341,9 +335,3 @@ 'icons/spideros_icons/sos_13.png', 'icons/spideros_icons/sos_14.png' ) - -/client/verb/edit_character() - set name = "Edit Character" - set category = "Preferences" - set desc = "Allows you to edit your character and preferences" - prefs.ShowChoices(src) diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 9590702f..cea406ad 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -203,7 +203,7 @@ datum/preferences if(24 to 1000) return "God" -/datum/preferences/proc/SetSkills(client/user) +/datum/preferences/proc/SetSkills(mob/user) if(SKILLS == null) setup_skills() @@ -239,8 +239,8 @@ datum/preferences user << browse(HTML, "window=show_skills;size=600x800") return -/datum/preferences/proc/ShowChoices(client/user) - if(!user) return +/datum/preferences/proc/ShowChoices(mob/user) + if(!user || !user.client) return update_preview_icon() user << browse_rsc(preview_icon_side, "previewicon2.png") user << browse_rsc(preview_icon_front, "previewicon1.png") @@ -437,7 +437,7 @@ datum/preferences banned = jobban_isbanned(user, "pAI") if (banned == "Age Restricted") - var/time = config.age_restrictions[i] - user.player_age + var/time = config.age_restrictions[i] - user.client.player_age dat += "Be [i]: \[IN [time] DAYS]
" else if (banned) dat += "Be [i]: \[BANNED]
" @@ -455,7 +455,7 @@ datum/preferences user << browse(dat, "window=preferences;size=560x736") -/datum/preferences/proc/SetChoices(client/user, limit = 16, list/splitJobs = list("Chief Medical Officer"), width = 550, height = 660) +/datum/preferences/proc/SetChoices(mob/user, limit = 16, list/splitJobs = list("Chief Medical Officer"), width = 550, height = 660) if(!job_master) return @@ -497,8 +497,8 @@ datum/preferences else if(jobban_isbanned(user, rank)) HTML += "[rank] \[BANNED]" continue - if(!job.player_old_enough(user)) - var/available_in_days = job.available_in_days(user) + if(!job.player_old_enough(user.client)) + var/available_in_days = job.available_in_days(user.client) HTML += "[rank] \[IN [(available_in_days)] DAYS]" continue if((job_civilian_low & ASSISTANT) && (rank != "Assistant")) @@ -552,7 +552,7 @@ datum/preferences user << browse(HTML, "window=mob_occupation;size=[width]x[height]") return -/datum/preferences/proc/SetDisabilities(client/user) +/datum/preferences/proc/SetDisabilities(mob/user) var/HTML = "" HTML += "
" HTML += "Choose disabilities
" @@ -572,7 +572,7 @@ datum/preferences user << browse(HTML, "window=disabil;size=350x300") return -/datum/preferences/proc/SetRecords(client/user) +/datum/preferences/proc/SetRecords(mob/user) var/HTML = "" HTML += "
" HTML += "Set Character Records
" @@ -597,7 +597,7 @@ datum/preferences user << browse(HTML, "window=records;size=350x300") return -/datum/preferences/proc/SetAntagoptions(client/user) +/datum/preferences/proc/SetAntagoptions(mob/user) if(uplinklocation == "" || !uplinklocation) uplinklocation = "PDA" var/HTML = "" @@ -615,7 +615,7 @@ datum/preferences user << browse(HTML, "window=antagoptions") return -/datum/preferences/proc/SetFlavorText(client/user) +/datum/preferences/proc/SetFlavorText(mob/user) var/HTML = "" HTML += "
" HTML += "Set Flavour Text
" @@ -667,7 +667,7 @@ datum/preferences if(job.title != new_title) player_alt_titles[job.title] = new_title -/datum/preferences/proc/SetJob(client/user, role) +/datum/preferences/proc/SetJob(mob/user, role) var/datum/job/job = job_master.GetJob(role) if(!job) user << browse(null, "window=mob_occupation") @@ -786,10 +786,10 @@ datum/preferences job_engsec_low |= job.flag return 1 -/datum/preferences/proc/process_link(client/user, list/href_list) +/datum/preferences/proc/process_link(mob/user, list/href_list) if(!user) return - //if(!istype(user, /mob/new_player)) return //WE CAN EDIT CHARACTER WHENEVER + if(!istype(user, /mob/new_player)) return if(href_list["preference"] == "job") switch(href_list["task"]) if("close") @@ -1554,7 +1554,7 @@ datum/preferences message_admins("[character] ([character.ckey]) has spawned with their gender as plural or neuter. Please notify coders.") character.gender = MALE -/datum/preferences/proc/open_load_dialog(client/user) +/datum/preferences/proc/open_load_dialog(mob/user) var/dat = "" dat += "
" @@ -1576,7 +1576,7 @@ datum/preferences user << browse(dat, "window=saves;size=300x390") -/datum/preferences/proc/close_load_dialog(client/user) +/datum/preferences/proc/close_load_dialog(mob/user) user << browse(null, "window=saves") @@ -1596,7 +1596,7 @@ datum/preferences return temp.hair_species -/datum/preferences/proc/custom_robot_limb(client/user,) +/datum/preferences/proc/custom_robot_limb(mob/user,) var/covering_name = input(user, "What kind of covering do you want?") as null|anything in get_limb_covering_names() if (!covering_name) return @@ -1637,7 +1637,7 @@ var/list/limb_connection_data return limb_connection_data -/datum/preferences/proc/pick_organ_to_customize(client/user,var/is_organic_species) +/datum/preferences/proc/pick_organ_to_customize(mob/user,var/is_organic_species) var/list/valid_targets = list("Left Leg","Right Leg","Left Arm","Right Arm","Left Foot","Right Foot","Left Hand","Right Hand") if (!is_organic_species) valid_targets.Add(list("Head","Chest","Groin")) @@ -1648,7 +1648,7 @@ var/list/limb_connection_data return limb_info[limb_name] -/datum/preferences/proc/customize_limbs(client/user,var/is_organic_species) +/datum/preferences/proc/customize_limbs(mob/user,var/is_organic_species) var/list/limb_info = pick_organ_to_customize(user,is_organic_species) if (!limb_info) return diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 10a89bf0..cb6e60e9 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -219,7 +219,10 @@ usr << "Thank you for your vote!" usr << browse(null,"window=privacypoll") - if(!href_list["late_join"]) + if(!ready && href_list["preference"]) + if(client) + client.prefs.process_link(src, href_list) + else if(!href_list["late_join"]) new_player_panel() if(href_list["showpoll"])