Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions lua/damagelogs/client/tabs/rdm_manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,26 @@ end)
local status = {
[RDM_MANAGER_WAITING] = TTTLogTranslate(GetDMGLogLang, "RDMWaiting"),
[RDM_MANAGER_PROGRESS] = TTTLogTranslate(GetDMGLogLang, "RDMInProgress"),
[RDM_MANAGER_FINISHED] = TTTLogTranslate(GetDMGLogLang, "RDMFinished")
[RDM_MANAGER_FINISHED] = TTTLogTranslate(GetDMGLogLang, "RDMFinished"),
[RDM_MANAGER_READYFORSTAFF] = TTTLogTranslate(GetDMGLogLang, "RDMReadyForStaff"),
}

RDM_MANAGER_STATUS = status

local icons = {
[RDM_MANAGER_WAITING] = "icon16/clock.png",
[RDM_MANAGER_PROGRESS] = "icon16/arrow_refresh.png",
[RDM_MANAGER_FINISHED] = "icon16/accept.png"
[RDM_MANAGER_FINISHED] = "icon16/accept.png",
[RDM_MANAGER_READYFORSTAFF] = "icon16/user_suit.png",
}

RDM_MANAGER_ICONS = icons

local colors = {
[RDM_MANAGER_PROGRESS] = Color(0, 0, 190),
[RDM_MANAGER_FINISHED] = Color(0, 190, 0),
[RDM_MANAGER_WAITING] = Color(100, 100, 100)
[RDM_MANAGER_WAITING] = Color(100, 100, 100),
[RDM_MANAGER_READYFORSTAFF] = Color(245, 0, 192),
}

local function TakeAction()
Expand Down Expand Up @@ -313,7 +316,7 @@ local function TakeAction()

if ulx and mode == 2 then
txt = TTTLogTranslate(GetDMGLogLang, "RemoveAutoJails")
elseif sam or serverguard then
elseif serverguard then
txt = TTTLogTranslate(GetDMGLogLang, "RemoveOneAutoSlay")
end

Expand All @@ -326,15 +329,15 @@ local function TakeAction()
if ulx then
RunConsoleCommand("ulx", mode == 1 and "aslayid" or "ajailid", report.attacker, "0")
elseif sam then
RunConsoleCommand("sam", mode == 1 and "aslayid" or "ajailid", report.attacker, "0")
RunConsoleCommand("sam", mode == 1 and "aslayid" or "ajailid", report.attacker, "0", " ")
elseif serverguard then
serverguard.command.Run("raslay", false, attacker:Nick())
end
else
if ulx then
RunConsoleCommand("ulx", mode == 1 and "aslayid" or "ajailid", report.attacker, "0")
elseif sam then
RunConsoleCommand("sam", mode == 1 and "aslayid" or "ajailid", report.attacker, "0")
RunConsoleCommand("sam", mode == 1 and "aslayid" or "ajailid", report.attacker, "0", " ")
else
Damagelog:Notify(DAMAGELOG_NOTIFY_ALERT, TTTLogTranslate(GetDMGLogLang, "VictimReportedDisconnected"), 2, "buttons/weapon_cant_buy.wav")
end
Expand All @@ -346,15 +349,15 @@ local function TakeAction()
if ulx then
RunConsoleCommand("ulx", mode == 1 and "aslayid" or "ajailid", report.victim, "0")
elseif sam then
RunConsoleCommand("sam", mode == 1 and "aslayid" or "ajailid", report.victim, "0")
RunConsoleCommand("sam", mode == 1 and "aslayid" or "ajailid", report.victim, "0", " ")
elseif serverguard then
serverguard.command.Run("raslay", false, victim:Nick())
end
else
if ulx then
RunConsoleCommand("ulx", mode == 1 and "aslayid" or "ajailid", report.victim, "0")
elseif sam then
RunConsoleCommand("sam", mode == 1 and "aslayid" or "ajailid", report.victim, "0")
RunConsoleCommand("sam", mode == 1 and "aslayid" or "ajailid", report.victim, "0", " ")
else
Damagelog:Notify(DAMAGELOG_NOTIFY_ALERT, TTTLogTranslate(GetDMGLogLang, "VictimReportedDisconnected"), 2, "buttons/weapon_cant_buy.wav")
end
Expand Down Expand Up @@ -427,6 +430,7 @@ function PANEL:UpdateReport(index)

local cancelledIcon = report.status == RDM_MANAGER_WAITING
and "icon16/exclamation.png"
or report.status == RDM_MANAGER_READYFORSTAFF and "icon16/user_suit.png"
or (report.canceled and "icon16/tick.png" or "icon16/cross.png")

if not self.Reports[index] then
Expand Down Expand Up @@ -731,6 +735,7 @@ function Damagelog:DrawRDMManager(x, y)
local menu = DermaMenu()
local attacker = player.GetBySteamID(Damagelog.SelectedReport.attacker)
DrawStatusMenuOption(RDM_MANAGER_WAITING, menu)
DrawStatusMenuOption(RDM_MANAGER_READYFORSTAFF, menu)
DrawStatusMenuOption(RDM_MANAGER_PROGRESS, menu)
DrawStatusMenuOption(RDM_MANAGER_FINISHED, menu)
menu:Open()
Expand Down Expand Up @@ -1072,7 +1077,8 @@ function PANEL:SetPlayer(reported, ply, steamid, report)
if ulx then
RunConsoleCommand("ulx", mode == 1 and "aslayid" or "ajailid", ply:SteamID(), tostring(self.NumSlays), self.CurrentReason)
elseif sam then
RunConsoleCommand("sam", mode == 1 and "aslayid" or "ajailid", ply:SteamID(), tostring(self.NumSlays), self.CurrentReason)
local reason = self.CurrentReason ~= "" and self.CurrentReason or " "
RunConsoleCommand("sam", mode == 1 and "aslayid" or "ajailid", ply:SteamID(), tostring(self.NumSlays), reason)
elseif serverguard then
serverguard.command.Run("aslay", false, ply:Nick(), self.NumSlays, self.CurrentReason)
end
Expand All @@ -1083,7 +1089,8 @@ function PANEL:SetPlayer(reported, ply, steamid, report)
RunConsoleCommand("ulx", mode == 1 and "aslayid" or "ajailid", (reported and report.attacker) or (not reported and report.victim), tostring(self.NumSlays), self.CurrentReason)
self.SetConclusion((reported and report.attacker_nick) or (not reported and report.victim_nick), self.NumSlays, self.CurrentReason)
elseif sam then
RunConsoleCommand("sam", mode == 1 and "aslayid" or "ajailid", (reported and report.attacker) or (not reported and report.victim), tostring(self.NumSlays), self.CurrentReason)
local reason = self.CurrentReason ~= "" and self.CurrentReason or " "
RunConsoleCommand("sam", mode == 1 and "aslayid" or "ajailid", (reported and report.attacker) or (not reported and report.victim), tostring(self.NumSlays), reason)
self.SetConclusion((reported and report.attacker_nick) or (not reported and report.victim_nick), self.NumSlays, self.CurrentReason)
else
Damagelog:Notify(DAMAGELOG_NOTIFY_ALERT, TTTLogTranslate(GetDMGLogLang, "VictimReportedDisconnected"), 2, "buttons/weapon_cant_buy.wav")
Expand Down
16 changes: 9 additions & 7 deletions lua/damagelogs/server/autoslay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ function Damagelog:SetSlays(admin, steamid, slays, reason, target)
end

if slays == 0 then
Damagelog.SQLiteDatabase.Query("DELETE FROM damagelog_autoslay WHERE ply = '" .. (target and target:SteamID() or steamid) .. "';")

Damagelog.SQLiteDatabase.Query("DELETE FROM damagelog_autoslay WHERE ply = '" .. (IsValid(target) and target:SteamID() or steamid) .. "';")

if ulx then
if target then
Expand Down Expand Up @@ -271,13 +272,14 @@ function Damagelog:SetSlays(admin, steamid, slays, reason, target)

ulx.fancyLogAdmin(admin, "#A " .. (difference > 0 and "added " or "removed ") .. math.abs(difference) .. msg .. old_slays .. " time(s) by #s.", target, reason, list)
elseif sam then
sam.player.send_message(nil, "{A} {V_1} {V} {V_2} {T} for {R}. They were previously {V_3} {V_4} time(s) by {V_5}.", {

sam.player.send_message(nil, "{A} {V_1} {V} {V_2} {T} for {A_2}. They were previously {V_3} {V_4} time(s) by {V_5}.", {
A = admin_nick,
V_1 = difference > 0 and "added " or "removed ",
V = math.abs(difference),
V_2 = aslay and " autoslays to " or " autojails to ",
T = target,
R = reason,
T = target:Nick(),
A_2 = reason,
V_3 = aslay and " autoslain " or " autojailed ",
V_4 = old_slays,
V_5 = list
Expand All @@ -293,13 +295,13 @@ function Damagelog:SetSlays(admin, steamid, slays, reason, target)

ulx.fancyLogAdmin(admin, "#A " .. (difference > 0 and "added " or "removed ") .. math.abs(difference) .. msg .. old_slays .. " time(s) by #s.", steamid, reason, list)
elseif sam then
sam.player.send_message(nil, "{A} {V_1} {V} {V_2} {T} for {R}. They were previously {V_3} {V_4} time(s) by {V_5}.", {
sam.player.send_message(nil, "{A} {V_1} {V} {V_2} {T} for {A_2}. They were previously {V_3} {V_4} time(s) by {V_5}.", {
A = admin_nick,
V_1 = difference > 0 and "added " or "removed ",
V = math.abs(difference),
V_2 = aslay and " autoslays to " or " autojails to ",
T = steamid,
R = reason,
A_2 = reason,
V_3 = aslay and " autoslain " or " autojailed ",
V_4 = old_slays,
V_5 = list
Expand Down Expand Up @@ -635,4 +637,4 @@ if Damagelog.ULX_Autoslay_ForceRole then
end
end
end)
end
end
17 changes: 12 additions & 5 deletions lua/damagelogs/server/rdm_manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ net.Receive("DL_UpdateStatus", function(_len, ply)

hook.Run("RDMManagerStatusUpdated", ply, index, status, previous)

if status == RDM_MANAGER_WAITING then
if status == RDM_MANAGER_WAITING or status == RDM_MANAGER_READYFORSTAFF then
msg = string_format(TTTLogTranslate(ply.DMGLogLang, "HasSetReport"), ply:Nick(), index, TTTLogTranslate(ply.DMGLogLang, "RDMWaiting"))
local syncEnt = Damagelog:GetSyncEnt()

Expand All @@ -537,15 +537,19 @@ net.Receive("DL_UpdateStatus", function(_len, ply)

local syncEnt = Damagelog:GetSyncEnt()

if IsValid(syncEnt) and previousStatus == RDM_MANAGER_WAITING and not tbl.adminReport then
syncEnt:SetPendingReports(syncEnt:GetPendingReports() - 1)
if IsValid(syncEnt) and not tbl.adminReport then
if previousStatus == RDM_MANAGER_WAITING or previousStatus == RDM_MANAGER_READYFORSTAFF then
syncEnt:SetPendingReports(syncEnt:GetPendingReports() - 1)
end
end
elseif status == RDM_MANAGER_FINISHED then
msg = string_format(TTTLogTranslate(ply.DMGLogLang, "HasSetReport"), ply:Nick(), index, TTTLogTranslate(ply.DMGLogLang, "Finished"))
local syncEnt = Damagelog:GetSyncEnt()

if IsValid(syncEnt) and previousStatus == RDM_MANAGER_WAITING and not tbl.adminReport then
syncEnt:SetPendingReports(syncEnt:GetPendingReports() - 1)
if IsValid(syncEnt) and not tbl.adminReport then
if previousStatus == RDM_MANAGER_WAITING or previousStatus == RDM_MANAGER_READYFORSTAFF then
syncEnt:SetPendingReports(syncEnt:GetPendingReports() - 1)
end
end
end

Expand Down Expand Up @@ -773,6 +777,9 @@ net.Receive("DL_GetForgive", function(_, ply)
end
end
else
if tbl.status == RDM_MANAGER_WAITING then
tbl.status = RDM_MANAGER_READYFORSTAFF
end
tbl.handedOffToAdminsAt = os.time()
end

Expand Down
Loading