Added the ability to define the ip and computer id for a manual ban (in the banning panel). This is so mirroring bans or banning people who were not online during the round in progress does not require admins to spawn a mob, set their variables and then ban the mob.

If however an admin attempts to add a manual ban for a player who was present during the current round, a player who still has a mob somewhere in the game world, the proc will prioritize the mob's ip and computer id variables, not the things entered in the banning panel form.
This commit is contained in:
errorage
2013-07-16 07:26:51 +02:00
committed by volas
parent 515fdc9f6e
commit 64d6012399
2 changed files with 18 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
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) //Either pass the mob you wish to ban in the 'banned_mob' attribute, or the banckey, banip and bancid variables. If both are passed, the mob takes priority! If a mob is not passed, banckey is the minimum that needs to be passed! banip and bancid are optional.
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/banip = null, var/bancid = null)
if(!check_rights(R_MOD,0) && !check_rights(R_BAN)) return if(!check_rights(R_MOD,0) && !check_rights(R_BAN)) return
@@ -40,6 +41,8 @@ datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration =
ip = banned_mob.client.address ip = banned_mob.client.address
else if(banckey) else if(banckey)
ckey = ckey(banckey) ckey = ckey(banckey)
computerid = bancid
ip = banip
var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_player WHERE ckey = '[ckey]'") var/DBQuery/query = dbcon.NewQuery("SELECT id FROM erro_player WHERE ckey = '[ckey]'")
query.Execute() query.Execute()
@@ -290,6 +293,8 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
output += "<option value='[BANTYPE_JOB_TEMP]'>JOB TEMPBAN</option>" output += "<option value='[BANTYPE_JOB_TEMP]'>JOB TEMPBAN</option>"
output += "</select></td>" output += "</select></td>"
output += "<td><b>Ckey:</b> <input type='text' name='dbbanaddckey'></td></tr>" output += "<td><b>Ckey:</b> <input type='text' name='dbbanaddckey'></td></tr>"
output += "<tr><td><b>IP:</b> <input type='text' name='dbbanaddip'></td>"
output += "<td><b>Computer id:</b> <input type='text' name='dbbanaddcid'></td></tr>"
output += "<tr><td><b>Duration:</b> <input type='text' name='dbbaddduration'></td>" output += "<tr><td><b>Duration:</b> <input type='text' name='dbbaddduration'></td>"
output += "<td><b>Job:</b><select name='dbbanaddjob'>" output += "<td><b>Job:</b><select name='dbbanaddjob'>"
output += "<option value=''>--</option>" output += "<option value=''>--</option>"

View File

@@ -72,6 +72,8 @@
var/bantype = text2num(href_list["dbbanaddtype"]) var/bantype = text2num(href_list["dbbanaddtype"])
var/banckey = href_list["dbbanaddckey"] var/banckey = href_list["dbbanaddckey"]
var/banip = href_list["dbbanaddip"]
var/bancid = href_list["dbbanaddcid"]
var/banduration = text2num(href_list["dbbaddduration"]) var/banduration = text2num(href_list["dbbaddduration"])
var/banjob = href_list["dbbanaddjob"] var/banjob = href_list["dbbanaddjob"]
var/banreason = href_list["dbbanreason"] var/banreason = href_list["dbbanreason"]
@@ -107,9 +109,18 @@
playermob = M playermob = M
break break
banreason = "(MANUAL BAN) "+banreason banreason = "(MANUAL BAN) "+banreason
DB_ban_record(bantype, playermob, banduration, banreason, banjob, null, banckey) if(!playermob)
if(banip)
banreason = "[banreason] (CUSTOM IP)"
if(bancid)
banreason = "[banreason] (CUSTOM CID)"
else
message_admins("Ban process: A mob matching [playermob.ckey] was found at location [playermob.x], [playermob.y], [playermob.z]. Custom ip and computer id fields replaced with the ip and computer id from the located mob")
DB_ban_record(bantype, playermob, banduration, banreason, banjob, null, banckey, banip, bancid )
else if(href_list["editrights"]) else if(href_list["editrights"])
if(!check_rights(R_PERMISSIONS)) if(!check_rights(R_PERMISSIONS))