This commit is contained in:
lifestorm
2024-08-04 23:12:27 +03:00
parent 0e770b2b49
commit ba1fc01b16
7084 changed files with 2173495 additions and 14 deletions

View File

@@ -0,0 +1,44 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
netstream.Hook("SetDatafileLoyaltyPoints", function(target, amount)
netstream.Start("SetDatafileLoyaltyPointsServer", target, amount)
end)
netstream.Hook("OpenDatafileCl", function(table)
if !PLUGIN.contentSubframe then return end
if !IsValid(PLUGIN.contentSubframe) then return end
PLUGIN.file = table
if !PLUGIN.file or PLUGIN.file and istable(PLUGIN.file) and !PLUGIN.file.genericdata then
if !PLUGIN.file then return end
if istable(PLUGIN.file) and PLUGIN.file["charID"] then
if CAMI.PlayerHasAccess(LocalPlayer(), "Helix - Basic Admin Commands") then
Derma_Query("Something went wrong with the datafile of this individual", "Do you want to reset the datafile of charID: "..PLUGIN.file["charID"].."?",
"Confirm Operation", function()
netstream.Start("ResetDatafileToDefault", PLUGIN.file["charID"])
end, "Cancel")
end
end
return
end
for _, v in pairs(PLUGIN.contentSubframe:GetChildren()) do
v:SetVisible(false)
end
PLUGIN.datafileInfo = vgui.Create("ixDatafileInfo", PLUGIN.contentSubframe)
PLUGIN.datafileFunctions = vgui.Create("ixDatafileFunctions", PLUGIN.contentSubframe)
end)

View File

@@ -0,0 +1,37 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
function PLUGIN:LoadFonts(font, genericFont)
surface.CreateFont( "DatapadTitle", {
font = "Open Sans Bold", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = true,
size = SScaleMin(32 / 3),
weight = 550,
antialias = true,
} )
end
netstream.Hook("OpenPDA", function(table, text)
if IsValid(PLUGIN.ixDatapad) then
PLUGIN.ixDatapad:Remove()
end
PLUGIN.updatelist = table
PLUGIN.ixDatapad = vgui.Create("ixDatafilePDA")
surface.PlaySound("willardnetworks/datapad/open.wav")
if (text != nil) then
PLUGIN.functions:SetVisible(false)
PLUGIN.searchProfiles = vgui.Create("ixDatapadSearchProfiles", PLUGIN.contentSubframe)
PLUGIN.searchEntry:SetValue(text)
PLUGIN.searchButton:DoClick()
end
end)

View File

@@ -0,0 +1,31 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PANEL = {}
function PANEL:Init()
self:SetSize(ScrW(), ScrH())
ix.gui.medicalComputer = self:Add("MedicalComputerBase")
end
function PANEL:Think()
if !IsValid(ix.gui.medicalComputer) then
self:Remove()
end
if IsValid(ix.gui.medicalComputer.functionsPanel) then
if IsValid(ix.gui.medicalComputer.functionsPanel.medicalButton) then
ix.gui.medicalComputer.functionsPanel.medicalButton:Remove()
end
end
end
vgui.Register("CitizenComputer", PANEL, "EditablePanel")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,136 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
PLUGIN.file = {}
ix.flag.Add("T", "Bypass PDA Transaction Logs.")
ix.config.Add("TransactionLogDaysDatafile", 14, "How many days to show transaction logs for.", nil, {
data = {min = 1, max = 31},
category = "Datafile"
})
ix.command.Add("SetDatafilePoints", {
description = "Set datafile loyalty points.",
adminOnly = true,
arguments = {
ix.type.character,
ix.type.number
},
OnRun = function(self, client, target, amount)
if (target) then
local genericData = target:GetGenericdata()
if genericData.socialCredits then
genericData.socialCredits = !genericData.combine and math.Clamp(amount, 0, 200) or amount
target:SetGenericdata(genericData)
target:Save()
end
client:NotifyLocalized("Set "..target.player:Name().."'s points to "..amount)
end
end
})
ix.command.Add("Datafile", {
description = "Open datafile as Overwatch or OTA.",
OnCheckAccess = function(self, client)
local faction = ix.faction.Get(client:Team())
if (faction.alwaysDatafile or client:GetCharacter():HasFlags("U")) then
return true
elseif (client:HasActiveCombineSuit() and client:GetCharacter():GetInventory():HasItem("pda")) then
return true
end
return false
end,
arguments = {
ix.type.string
},
OnRun = function(self, client, text)
if (self:OnCheckAccess(client)) then
PLUGIN:Refresh(client, text)
else
client:NotifyLocalized("Nie masz dostępu do datapadu")
end
end
})
ix.char.RegisterVar("genericdata", {
field = "genericdata",
fieldType = ix.type.text,
default = {},
bNoDisplay = true,
isLocal = true,
OnSet = function(self, value)
local client = self:GetPlayer()
if (IsValid(client)) then
self.vars.genericdata = value
net.Start("ixCharacterVarChanged")
net.WriteUInt(self:GetID(), 32)
net.WriteString("genericdata")
net.WriteType(self.vars.genericdata)
net.Send(client)
end
end,
OnGet = function(self, default)
local genericdata = self.vars.genericdata
return genericdata
end,
OnAdjust = function(self, client, data, value, newData)
newData.genericdata = value
end
})
ix.char.RegisterVar("datafilelogs", {
field = "datafilelogs",
fieldType = ix.type.text,
default = {},
bNoDisplay = true,
bNoNetworking = true,
})
ix.char.RegisterVar("datafileviolations", {
field = "datafileviolations",
fieldType = ix.type.text,
default = {},
bNoDisplay = true,
bNoNetworking = true,
})
ix.char.RegisterVar("datafilemedicalrecords", {
field = "datafilemedicalrecords",
fieldType = ix.type.text,
default = {},
bNoDisplay = true,
bNoNetworking = true,
})
ix.char.RegisterVar("datapadnotes", {
field = "datapadnotes",
fieldType = ix.type.text,
default = "",
bNoDisplay = true,
bNoNetworking = true,
OnSet = function(self, value)
self.vars.datapadnotes = value
end,
OnGet = function(self, default)
local datapadnotes = self.vars.datapadnotes
return datapadnotes
end,
OnAdjust = function(self, client, data, value, newData)
newData.datapadnotes = value
end
})

View File

@@ -0,0 +1,15 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
PLUGIN.updatelist = {}
ix.util.IncludeDir("ixhl2rp/plugins/combineutilities/pda/derma", true)

View File

@@ -0,0 +1,530 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
local datafields = {"genericdata", "datafilelogs", "datafileviolations", "datafilemedicalrecords"}
function PLUGIN:SendFile(client, file)
timer.Simple(0.05, function()
netstream.Start(client, "OpenDatafileCl", file)
end)
end
-- Include new required data to datafiles of old characters
function PLUGIN:UpdateOldVortData(character, genericdata)
if (!character or !istable(genericdata)) then return end
genericdata.collarID = character:GetCollarID() or "N/A"
genericdata.cohesionPoints = genericdata.socialCredits or 0
genericdata.cohesionPointsDate = ix.config.Get("day").."/"..ix.config.Get("month").."/"..ix.config.Get("year")
genericdata.nulled = "NIEAKTYWNY"
genericdata.cid = "N/A"
genericdata.name = nil
if (character:HasFlags("N") or character:GetBackground() == "Kolaborator") then
genericdata.nulled = "AKTYWNY"
end
for _, v in pairs(character:GetInventory():GetItems()) do
if (table.HasValue({"Obroża Vortigaunta", "Obroża Vortigaunta (fałszywa)"}, v.name) and v:GetData("equip") == true) then
if (v:GetData("collarID", nil) and v:GetData("sterilizedCredits", nil)) then
genericdata.cohesionPoints = v:GetData("sterilizedCredits", 0)
end
end
end
character:SetGenericdata(genericdata)
character:Save()
character:GetPlayer():Notify("Nowy format został pomyślnie zastosowany dla twojego pliku danych.")
end
-- Search the collarID through the database
function PLUGIN:LookUpCollarID(client, id, bNotify)
if (!client or !id) then return end
id = string.sub(id, 2)
local query = mysql:Select("ix_characters")
query:Select("name")
query:Select("faction")
query:Select("id")
query:Select("collarID")
query:Select("background")
query:Where("collarID", id)
query:Where("schema", Schema and Schema.folder or "helix")
query:Callback(function(result)
if (!istable(result) or #result == 0) then
return
end
local resultFactionString = result[1].faction
if (resultFactionString != "vortigaunt") then
return
end
local dataSelect = mysql:Select("ix_characters_data")
dataSelect:Where("id", result[1].id)
dataSelect:WhereIn("key", datafields)
dataSelect:Callback(function(dataSelectResult)
if (!istable(dataSelectResult) or #dataSelectResult == 0) then
return
end
local file = {}
for _, v in ipairs(dataSelectResult) do
file[v.key] = util.JSONToTable(v.data or "")
file["charID"] = result[1].id
if (v.key == "genericdata") then
if file[v.key].name != result[1].name then
file[v.key].name = result[1].name
local updateQuery = mysql:Update("ix_characters_data")
updateQuery:Update("data", util.TableToJSON(file[v.key]) or "")
updateQuery:Where("id", result[1].id)
updateQuery:Where("key", "genericdata")
updateQuery:Execute()
end
end
end
if (bNotify) then
local author = client:IsDispatch() and "OVERWATCH" or (ix.faction.Get(client:Team()).idInspectionText or "Unit") .. " " .. string.upper(client:GetCombineTag())
ix.combineNotify:AddNotification("LOG:// " .. author .. " przeprowadza inspekcję tożsamości na " .. string.upper("zasobie biotycznym:") .. " #" .. result[1].collarID)
end
self:SendFile(client, file)
end)
dataSelect:Execute()
end)
query:Execute()
end
function PLUGIN:RefreshDatafile(client, id, bIsLocal, bCachedID, bNotify)
if !client then return end
if (client:Team() == FACTION_SERVERADMIN) then
bNotify = false
end
--If the player is trying to view his/her own datafile
if (bIsLocal) then
local character = client:GetCharacter()
local file = {}
file["genericdata"] = character:GetGenericdata()
file["datafileviolations"] = character:GetDatafileviolations()
file["datafilemedicalrecords"] = character:GetDatafilemedicalrecords()
file["datafilelogs"] = character:GetDatafilelogs()
file["charID"] = character:GetID()
if character:IsVortigaunt() and !file["genericdata"].cohesionPoints then
self:UpdateOldVortData(character, file["genericdata"])
end
self:SendFile(client, file)
return
end
local target = false
if (bCachedID) then
if isnumber(tonumber(id)) then
if ix.char.loaded[id] then
target = ix.char.loaded[id]
end
end
end
if !target then
-- Check for cached characters
if (tonumber(id) != nil and string.utf8len(tostring(id)) <= 5) then
-- id to cid comparison
for _, v in pairs(ix.char.loaded) do
local cid = v.GetCid and v:GetCid()
local genericdata = v:GetGenericdata()
if (v:IsVortigaunt() and v:GetCid() == id and genericdata.cid == "N/A") then return end
if (cid and id) then
if (tostring(cid) == id) then
target = v
break
end
end
end
elseif (id != nil and string.sub(id, 1, 1) == "!") then
id = string.sub(id, 2)
for _, v in pairs(ix.char.loaded) do
if (v:IsVortigaunt() and v:GetCollarID() == id) then
target = v
break
end
end
else
-- id to name comparison
for _, v in pairs(ix.char.loaded) do
local genericdata = v:GetGenericdata()
if string.find(v:GetName(), id) then
if (v:IsVortigaunt() and genericdata.cid == "N/A") then return end
target = v
break
end
end
end
end
-- Make sure further code isn't ran
if target then
local file = {}
file["genericdata"] = target:GetGenericdata()
file["datafileviolations"] = target:GetDatafileviolations()
file["datafilemedicalrecords"] = target:GetDatafilemedicalrecords()
file["datafilelogs"] = target:GetDatafilelogs()
file["charID"] = target:GetID()
if (target:IsVortigaunt() and !file["genericdata"].cohesionPoints) then
self:UpdateOldVortData(target, file["genericdata"])
end
if (bNotify) then
local author = client:IsDispatch() and "OVERWATCH" or (ix.faction.Get(client:Team()).idInspectionText or "Unit") .. " " .. string.upper(client:GetCombineTag())
if (target:IsVortigaunt()) then
if (file["genericdata"].cid == "N/A" and file["genericdata"].collarID != "N/A") then
ix.combineNotify:AddNotification("LOG:// " .. author .. " performing identity inspection on " .. string.upper("biotic asset collar:") .. " #" .. target:GetCollarID())
elseif (file["genericdata"].cid == "N/A" and file["genericdata"].collarID == "N/A") then
ix.combineNotify:AddNotification("LOG:// " .. author .. " performing identity inspection on " .. string.upper("biotic asset collar:") .. " #" .. target:GetFakeCollarID())
else
ix.combineNotify:AddNotification("LOG:// " .. author .. " przeprowadza inspekcję tożsamości na " .. string.upper("zasobie biotycznym o identyfikatorze:") .. " #" .. file["genericdata"].cid)
end
else
ix.combineNotify:AddNotification("LOG:// " .. author .. " przeprowadza inspekcję tożsamości na '" .. string.upper(target:GetName()) .. "', #" .. target:GetCid())
end
end
self:SendFile(client, file)
return
end
-- If no cached character, search in datafile
if (tonumber(id) != nil and string.utf8len( id ) <= 5) then
local query = mysql:Select("ix_characters")
query:Select("name")
query:Select("faction")
query:Select("id")
query:Select("cid")
query:Select("background")
query:Where("cid", id)
query:Where("schema", Schema and Schema.folder or "helix")
query:Callback(function(result)
if (!istable(result) or #result == 0) then
return
end
local resultFactionString = result[1].faction
if (resultFactionString == "overwatch" and client:Team() != FACTION_OVERWATCH) then
client:NotifyLocalized("Nie masz dostępu do tego pliku danych!")
return false
end
if (resultFactionString == "ota" or resultFactionString == "administrator" or resultFactionString == "guard") then
local character = client:GetCharacter()
if (client:Team() != FACTION_OVERWATCH and client:Team() != FACTION_OTA and character:GetClass() != FACTION_MCP and client:Team() != CLASS_CP_CMD and character:GetClass() != CLASS_CP_CPT and character:GetClass() != CLASS_CP_RL) then
if client:Team() != FACTION_ADMIN then
client:NotifyLocalized("Nie masz dostępu do tego pliku danych!")
return false
end
end
end
local dataSelect = mysql:Select("ix_characters_data")
dataSelect:Where("id", result[1].id)
dataSelect:WhereIn("key", datafields)
dataSelect:Callback(function(dataSelectResult)
if (!istable(dataSelectResult) or #dataSelectResult == 0) then
return
end
local file = {}
for _, v in ipairs(dataSelectResult) do
file[v.key] = util.JSONToTable(v.data or "")
file["charID"] = result[1].id
if (v.key == "genericdata") then
if (resultFactionString == "vortigaunt" and util.JSONToTable(v.data).cid == "N/A") then return end
if file[v.key].name != result[1].name then
file[v.key].name = result[1].name
local updateQuery = mysql:Update("ix_characters_data")
updateQuery:Update("data", util.TableToJSON(file[v.key]) or "")
updateQuery:Where("id", result[1].id)
updateQuery:Where("key", "genericdata")
updateQuery:Execute()
end
end
end
if (bNotify) then
local author = client:IsDispatch() and "OVERWATCH" or (ix.faction.Get(client:Team()).idInspectionText or "Unit") .. " " .. string.upper(client:GetCombineTag())
ix.combineNotify:AddNotification("LOG:// " .. author .. " przeprowadza inspekcję tożsamości na '" .. string.upper(result[1].name) .. "', #" .. result[1].cid)
end
self:SendFile(client, file)
end)
dataSelect:Execute()
end)
query:Execute()
else
if (string.sub(id, 1, 1) == "!") then
self:LookUpCollarID(client, id, bNotify)
end
local query = mysql:Select("ix_characters")
query:Select("id")
query:Select("name")
query:Select("faction")
query:Select("background")
query:Select("cid")
query:WhereLike("name", id)
query:Where("schema", Schema and Schema.folder or "helix")
query:Callback(function(result)
if (!istable(result) or #result == 0) then
return
end
local resultFactionString = result[1].faction
if (resultFactionString == "overwatch" and client:Team() != FACTION_OVERWATCH) then
client:NotifyLocalized("Nie masz dostępu do tego pliku danych!")
return false
end
if (resultFactionString == "ota" or resultFactionString == "administrator" or resultFactionString == "guard") then
local character = client:GetCharacter()
if (client:Team() != FACTION_OVERWATCH and client:Team() != FACTION_OTA and character:GetClass() != FACTION_MCP and client:Team() != CLASS_CP_CMD and character:GetClass() != CLASS_CP_CPT and character:GetClass() != CLASS_CP_RL) then
if client:Team() != FACTION_ADMIN then
client:NotifyLocalized("Nie masz dostępu do tego pliku danych!")
return false
end
end
end
local dataSelect = mysql:Select("ix_characters_data")
dataSelect:Where("id", result[1].id)
dataSelect:WhereIn("key", datafields)
dataSelect:Callback(function(dataSelectResult)
if (!istable(dataSelectResult) or #dataSelectResult == 0) then
return
end
local file = {}
for _, v in ipairs(dataSelectResult) do
file[v.key] = util.JSONToTable(v.data or "")
file["charID"] = result[1].id
if (v.key == "genericdata") then
if (resultFactionString == "vortigaunt" and util.JSONToTable(v.data).cid == "N/A") then return end
if file[v.key].name != result[1].name then
file[v.key].name = result[1].name
local updateQuery = mysql:Update("ix_characters_data")
updateQuery:Update("data", util.TableToJSON(file[v.key]) or "")
updateQuery:Where("id", result[1].id)
updateQuery:Where("key", "genericdata")
updateQuery:Execute()
end
end
end
if (bNotify) then
local author = client:IsDispatch() and "OVERWATCH" or (ix.faction.Get(client:Team()).idInspectionText or "Unit") .. " " .. string.upper(client:GetCombineTag())
ix.combineNotify:AddNotification("LOG:// " .. author .. " przeprowadza inspekcję tożsamości na '" .. string.upper(result[1].name) .. "', #" .. result[1].cid)
end
self:SendFile(client, file)
end)
dataSelect:Execute()
end)
query:Execute()
end
end
netstream.Hook("RequestCIDCreditsDatafile", function(client, cid)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
cid = Schema:ZeroNumber(cid, 5)
local housing = ix.plugin.list["housing"]
if !housing then return end
housing:LookUpCardItemIDByCID(tostring(cid), function(result)
local idCardID = result[1].idcard or false
if !result then return end
if !ix.item.instances[idCardID] then
ix.item.LoadItemByID(idCardID, false, function(item)
if !item then return end
local credits = item:GetData("credits", 0)
netstream.Start(client, "UpdateDatafileCredits", credits)
end)
else
local credits = ix.item.instances[idCardID]:GetData("credits", 0)
netstream.Start(client, "UpdateDatafileCredits", credits)
end
end)
end)
netstream.Hook("ixDatafileRequestTransactionLogs", function(client, cid)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
cid = Schema:ZeroNumber(cid, 5)
ix.plugin.list.cid:SelectTransactions(client, "cid", cid, ix.config.Get("TransactionLogDaysDatafile", 14), nil, function(result)
netstream.Start(client, "ixDatafileReplyTransactionLogs", result)
end)
end)
netstream.Hook("TerminalReportCrime", function(client, name, cid, text, activeTerminal)
if !text or !name or !cid then return false end
if string.len(text) <= 0 then client:Notify("Nie możesz wysłać pustego zgłoszenia.") return end
if cid != activeTerminal.activeCID then
return false
end
local timestamp = ix.date.GetFormatted("%d.%m.%Y")
local queryObj = mysql:Insert("ix_crimereports")
queryObj:Insert("message_poster", name)
queryObj:Insert("message_text", text)
queryObj:Insert("message_date", timestamp)
queryObj:Insert("message_cid", cid)
queryObj:Execute()
ix.combineNotify:AddImportantNotification("WRN:// Zgłoszenie złożone przez " .. name .. " #" .. cid, Color(0, 150, 255), client, activeTerminal:GetPos())
end)
function PLUGIN:GetCrimeReports(client, bArchived, bResolved, curCollect)
local query = mysql:Select("ix_crimereports")
query:Select("message_id")
query:Select("message_text")
query:Select("message_date")
query:Select("message_poster")
query:Select("message_cid")
query:Callback(function(result)
if (!istable(result) or #result == 0) then
return
end
local toSort = {}
for key, _ in pairs(result) do
local posterIsTable = string.find(result[key].message_poster, "{")
if posterIsTable then result[key].message_poster = util.JSONToTable(result[key].message_poster) end
if posterIsTable or (bArchived or bResolved) then
if bArchived and result[key].message_poster.archived then
toSort[#toSort + 1] = result[key]
continue
end
if bResolved and result[key].message_poster.resolved then
toSort[#toSort + 1] = result[key]
continue
end
continue
end
toSort[#toSort + 1] = result[key]
end
local toSend = {}
for i = curCollect, curCollect + 5 do
if toSort[i] then
toSend[#toSend + 1] = toSort[i]
end
end
netstream.Start(client, "ReplyCrimeReports", toSend)
end)
query:Execute()
end
netstream.Hook("GetCrimeReports", function(client, bArchived, bResolved, curCollect)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
PLUGIN:GetCrimeReports(client, bArchived, bResolved, curCollect)
end)
netstream.Hook("DeleteCrimeReport", function(client, key, bDatapad, lastUsedTab, curCollect)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
local queryObj = mysql:Delete("ix_crimereports")
queryObj:Where("message_id", key)
queryObj:Execute()
PLUGIN:GetCrimeReports(client, (lastUsedTab == "archived" and true or false), (lastUsedTab == "resolved" and true or false), curCollect)
end)
netstream.Hook("ResolveCrimeReport", function(client, key, poster, bUnResolve, lastUsedTab, curCollect)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Zgłoszenie o ID #" .. key .. " zostało uznane za " .. (bUnResolve and "nierozwiązane" or "rozwiązane") .. " przez " .. string.upper(author), Color(171, 222, 47))
local queryObj = mysql:Update("ix_crimereports")
queryObj:Where("message_id", key)
queryObj:Update("message_poster", util.TableToJSON({poster = (istable(poster) and poster.poster or poster), resolved = (!bUnResolve and true or false), archived = (istable(poster) and poster.archived or false)}))
queryObj:Execute()
PLUGIN:GetCrimeReports(client, (lastUsedTab == "archived" and true or false), (lastUsedTab == "resolved" and true or false), curCollect)
end)
netstream.Hook("ArchiveCrimeReport", function(client, key, poster, bUnArchive, lastUsedTab, curCollect)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Zgłoszenie o ID #" .. key .. (bUnArchive and " odarchiwizowano" or " zarchiwizowano") .. " przez " .. string.upper(author), Color(171, 222, 47))
local queryObj = mysql:Update("ix_crimereports")
queryObj:Where("message_id", key)
queryObj:Update("message_poster", util.TableToJSON({poster = (istable(poster) and poster.poster or poster), resolved = (istable(poster) and poster.resolved or false), archived = (!bUnArchive and true or false)}))
queryObj:Execute()
PLUGIN:GetCrimeReports(client, (lastUsedTab == "archived" and true or false), (lastUsedTab == "resolved" and true or false), curCollect)
end)
netstream.Hook("ResetDatafileToDefault", function(client, charID)
if !CAMI.PlayerHasAccess(client, "Helix - Basic Admin Commands") then return end
local character = ix.char.loaded[charID]
if !character then
client:NotifyLocalized("Właściciel postaci musi być online, aby reset zadziałał.")
return
end
local player = character:GetPlayer()
if !player then return end
PLUGIN:CreateDatafile(player)
end)

View File

@@ -0,0 +1,883 @@
--[[
| This file was obtained through the combined efforts
| of Madbluntz & Plymouth Antiquarian Society.
|
| Credits: lifestorm, Gregory Wayne Rossel JR.,
| Maloy, DrPepper10 @ RIP, Atle!
|
| Visit for more: https://plymouth.thetwilightzone.ru/
--]]
local PLUGIN = PLUGIN
function PLUGIN:DatabaseConnected()
local query = mysql:Create("ix_datapad")
query:Create("update_id", "INT(11) UNSIGNED NOT NULL AUTO_INCREMENT")
query:Create("update_text", "TEXT")
query:Create("update_date", "TEXT")
query:Create("update_poster", "TEXT")
query:PrimaryKey("update_id")
query:Execute()
query = mysql:Create("ix_comgroupmessages")
query:Create("message_id", "INT(11) UNSIGNED NOT NULL AUTO_INCREMENT")
query:Create("message_text", "TEXT")
query:Create("message_date", "TEXT")
query:Create("message_poster", "TEXT")
query:Create("message_groupid", "TEXT")
query:PrimaryKey("message_id")
query:Execute()
query = mysql:Create("ix_comgroupreplies")
query:Create("reply_id", "INT(11) UNSIGNED NOT NULL AUTO_INCREMENT")
query:Create("reply_text", "TEXT")
query:Create("reply_date", "TEXT")
query:Create("reply_poster", "TEXT")
query:Create("reply_parent", "TEXT")
query:Create("reply_groupid", "TEXT")
query:PrimaryKey("reply_id")
query:Execute()
query = mysql:Create("ix_camessaging")
query:Create("message_id", "INT(11) UNSIGNED NOT NULL AUTO_INCREMENT")
query:Create("message_text", "TEXT")
query:Create("message_date", "TEXT")
query:Create("message_poster", "TEXT")
query:Create("message_cid", "TEXT")
query:Create("message_reply", "TEXT")
query:PrimaryKey("message_id")
query:Execute()
query = mysql:Create("ix_crimereports")
query:Create("message_id", "INT(11) UNSIGNED NOT NULL AUTO_INCREMENT")
query:Create("message_text", "TEXT")
query:Create("message_date", "TEXT")
query:Create("message_poster", "TEXT")
query:Create("message_cid", "TEXT")
query:PrimaryKey("message_id")
query:Execute()
end
function PLUGIN:HasAccessToDatafile(client)
if !client or client and !IsValid(client) then return false end
local faction = ix.faction.Get(client:Team())
if (faction.alwaysDatafile or client:GetCharacter():HasFlags("U")) then
return true
elseif (client:HasActiveCombineSuit() or faction.allowDatafile) then
if (client:GetCharacter():GetInventory():HasItem("pda") or client:GetActiveWeapon():GetClass() == "weapon_datapad") then
return true
end
end
end
function PLUGIN:GetUpdates(client)
local query = mysql:Select("ix_datapad")
query:Select("update_id")
query:Select("update_text")
query:Select("update_date")
query:Select("update_poster")
query:Callback(function(result)
if (!istable(result)) then
return
end
if (!table.IsEmpty(PLUGIN.updatelist)) then
table.Empty(PLUGIN.updatelist)
end
PLUGIN.updatelist = result
end)
query:Execute()
self:GetActivePermits(client)
end
function PLUGIN:Refresh(client, text)
PLUGIN:GetUpdates(client)
timer.Simple(0.05, function()
netstream.Start(client, "OpenPDA", PLUGIN.updatelist, text)
end)
end
function PLUGIN:GetConsoleUpdates(client)
PLUGIN:GetUpdates(client)
end
function PLUGIN:CharacterVarChanged(character, key, oldValue, value)
local genericdata = character:GetGenericdata()
if (key == "name" and genericdata) then
genericdata.name = value
character:SetGenericdata(genericdata)
if (IsValid(character:GetPlayer())) then
character:Save()
end
end
end
netstream.Hook("ClearArchivedCrimeReports", function(client)
local character = client:GetCharacter()
if (!character:IsCombine()) then
return client:NotifyLocalized("Only combine can clear crime reports.")
elseif !client:IsCombineRankAbove("i1") then
return client:NotifyLocalized("Your rank must be above i1 to clear crime reports.")
end
local query = mysql:Select("ix_crimereports")
query:Select("message_id")
query:Select("message_text")
query:Select("message_date")
query:Select("message_poster")
query:Select("message_cid")
query:Callback(function(result)
if (!istable(result) or #result == 0) then
return
end
local newMessages = 0
local clearedMessages = 0
for _, v in pairs(result) do
local msgPoster = util.JSONToTable(v["message_poster"])
local isArchived = msgPoster["archived"]
if !isArchived then continue end
local date = v["message_date"]
local messageDay = date[1] != "0" and date[1] .. date[2] .. "d" or date[2] .. "d"
local messageMonth = date[4] != "0" and date[4] .. date[5] .. "m" or date[5] .. "m"
local messageYear = date[7] .. date[8] .. date[9] .. date[10] .. "y"
local totalMessageTime = ix.util.GetStringTime(messageDay .. messageMonth .. messageYear)
local currentDay = ix.date.GetFormatted("%d")[1] != "0" and ix.date.GetFormatted("%d")[1] .. ix.date.GetFormatted("%d")[2] .. "d" or ix.date.GetFormatted("%d")[2] .. "d"
local currentMonth = ix.date.GetFormatted("%m") != "0" and ix.date.GetFormatted("%m")[1] .. ix.date.GetFormatted("%m")[2] .. "m" or ix.date.GetFormatted("%m")[2] .. "m"
local currentYear = ix.date.GetFormatted("%Y") .. "y"
local currentTotalTime = ix.util.GetStringTime(currentDay .. currentMonth .. currentYear)
if (currentTotalTime - totalMessageTime) < (ix.config.Get("crimeReportArchiveTime", 1) * 604800) then
newMessages = newMessages + 1
continue
end
local queryObj = mysql:Delete("ix_crimereports")
queryObj:Where("message_id", v["message_id"])
queryObj:Execute()
clearedMessages = clearedMessages + 1
end
client:NotifyLocalized(clearedMessages > 0 and "Successfully cleared " .. clearedMessages .. " archived crime reports. " .. "There are " .. newMessages .. " new archived crime reports that can't be cleared yet." or newMessages and "All archived reports are not older than " .. ix.config.Get("crimeReportArchiveTime", 1) .. " week(s)" or "No archived crime reports found.")
end)
query:Execute()
end)
netstream.Hook("AddUpdate", function(client, text)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("LOG:// Pobieranie aktualizacji manifestu pliku danych Overwatch")
timer.Simple(1, function()
ix.combineNotify:AddNotification("NTC:// Nowy plik danych Aktualizacji został opublikowany przez " .. string.upper(author), Color(171, 222, 47))
end)
local timestamp = os.date( "%d.%m.%Y" )
local queryObj = mysql:Insert("ix_datapad")
queryObj:Insert("update_text", text)
queryObj:Insert("update_date", timestamp)
queryObj:Insert("update_poster", client:Name())
queryObj:Execute()
PLUGIN:Refresh(client)
end)
netstream.Hook("RemoveUpdate", function(client, id)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("LOG:// Pobieranie zaktualizowanego manifestu aktualizacji pliku danych Overwatch")
timer.Simple(1, function()
ix.combineNotify:AddNotification("NTC:// Plik danych Aktualizacji o ID #" .. id .. " został usunięty przez " .. string.upper(author), Color(171, 222, 47))
end)
local queryObj = mysql:Delete("ix_datapad")
queryObj:Where("update_id", id)
queryObj:Execute()
PLUGIN:Refresh(client)
end)
netstream.Hook("EditUpdate", function(client, id, newText)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("LOG:// Pobieranie zaktualizowanego manifestu aktualizacji pliku danych Overwatch")
timer.Simple(1, function()
ix.combineNotify:AddNotification("NTC:// Plik danych Aktualizacji o ID #" .. id .. " został zaaktualizowany przez " .. string.upper(author), Color(171, 222, 47))
end)
local queryObj = mysql:Update("ix_datapad")
queryObj:Where("update_id", id)
queryObj:Update("update_text", newText)
queryObj:Execute()
PLUGIN:Refresh(client)
end)
netstream.Hook("SetDatafileLoyaltyPointsServer", function(client, target, amount)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
local genericData = target:GetCharacter():GetGenericdata()
if (genericData.socialCredits) then
genericData.socialCredits = !genericData.combine and math.Clamp(amount, 0, 200) or amount
target:GetCharacter():SetGenericdata(genericData)
target:GetCharacter():Save()
end
end)
function PLUGIN:GetActiveShopPermits(client, appID)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
local dataSelect = mysql:Select("ix_apartments_"..game.GetMap())
dataSelect:Where("app_id", appID)
dataSelect:Callback(function(dataSelectResult)
if (!istable(dataSelectResult) or #dataSelectResult == 0) then
return
end
for _, v in ipairs(dataSelectResult) do
local data = util.JSONToTable(v.app_permits)
if data and !table.IsEmpty(data) then
netstream.Start(client, "CreateActiveShopPermitsDatapad", data)
end
end
end)
dataSelect:Execute()
end
function PLUGIN:GetActivePermits(client)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
local dataSelect = mysql:Select("ix_characters_data")
dataSelect:WhereIn("key", "genericdata")
dataSelect:Callback(function(dataSelectResult)
if (!istable(dataSelectResult) or #dataSelectResult == 0) then
return
end
local people = {}
for _, v in ipairs(dataSelectResult) do
local data = util.JSONToTable(v.data)
if data and data.permits and !table.IsEmpty(data.permits) then
for k2, v2 in pairs(data.permits) do
if isnumber(v2) and v2 <= os.time() then
data.permits[k2] = nil
end
end
if !table.IsEmpty(data.permits) then
people[v.id] = data
end
end
end
netstream.Start(client, "CreateActivePermitsDatapad", people)
end)
dataSelect:Execute()
end
netstream.Hook("GetActiveShopPermitsDatapad", function(client, appID)
PLUGIN:GetActiveShopPermits(client, appID)
end)
netstream.Hook("ToggleShopPermitDatapad", function(client, permit, bValue, appID)
local housing = ix.plugin.Get("housing")
if !housing then return end
if housing.apartments[appID].type != "shop" then return client:NotifyLocalized("To nie jest sklep!") end
housing.apartments[appID].permits[permit] = bValue
housing:UpdateApartment(appID)
housing:HandleShopPermitUpdate(appID, permit)
end)
netstream.Hook("GetActivePermitsDatapad", function(client)
PLUGIN:GetActivePermits(client)
end)
util.AddNetworkString("CreateActiveWagesDatapad")
function PLUGIN:GetActiveWages(client, curCollect)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
local dataSelect = mysql:Select("ix_characters_data")
dataSelect:WhereIn("key", "genericdata")
dataSelect:Limit(5)
dataSelect:Offset(curCollect)
dataSelect:Callback(function(dataSelectResult)
if (!istable(dataSelectResult) or #dataSelectResult == 0) then return end
local people = {}
local loyalists = {}
for _, v in ipairs(dataSelectResult) do
if !v.data then continue end
local data = util.JSONToTable(v.data)
if !data then continue end
local wages = data.wages and tonumber(data.wages)
if isnumber(wages) and wages > 0 then
people[v.id] = data
end
local socialCredits = data.socialCredits and tonumber(data.socialCredits)
local loyaltyStatus = data.loyaltyStatus and string.lower(data.loyaltyStatus)
if !data.socialCredits and !data.loyaltyStatus then continue end
if isnumber(socialCredits) and socialCredits >= 175 then
loyalists[v.id] = data
end
if isstring(loyaltyStatus) and loyaltyStatus != "brak" then
loyalists[v.id] = data
end
end
net.Start("CreateActiveWagesDatapad")
net.WriteTable(people)
net.WriteTable(loyalists)
net.Send(client)
end)
dataSelect:Execute()
end
netstream.Hook("GetActiveWagesDatapad", function(client, curCollect)
PLUGIN:GetActiveWages(client, curCollect)
end)
netstream.Hook("RemovePermitDatapad", function(client, genericdata, loggedAction)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
if (loggedAction != nil) then
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Dla podmiotu '" .. string.upper(genericdata.name or genericdata.collarID) .. "' " .. (loggedAction == "permit" and "plik danych Zezwolenia" or loggedAction and "Dopłata" or "Status Lojalności") .. " został cofnięty przez " .. string.upper(author), Color(171, 222, 47))
end
local cachedCharacter = ix.char.loaded[genericdata.id]
if (cachedCharacter) then
cachedCharacter:SetGenericdata(genericdata)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
return
end
end
local queryObj = mysql:Update("ix_characters_data")
queryObj:Where("id", genericdata.id)
queryObj:Where("key", "genericdata")
queryObj:Update("data", util.TableToJSON(genericdata))
queryObj:Execute()
end)
netstream.Hook("UpdateDatafileLogs", function(client, id, logs, key, subject)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
if (!client:IsCombineRankAbove("RL") and !client:GetCharacter():HasFlags("L")) then
client:Notify("Nie możesz usunąć tego logu, ponieważ nie masz wystarczająco wysokiej rangi lub nie nosisz mundur!")
return false
end
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Plik danych logu '" .. string.upper(subject) .. "' został usunięty przez " .. string.upper(author), Color(171, 222, 47))
local cachedCharacter = ix.char.loaded[id]
if (cachedCharacter) then
cachedCharacter:SetDatafilelogs(logs)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
return
end
end
local queryObj = mysql:Update("ix_characters_data")
queryObj:Where("id", id)
queryObj:Where("key", "datafilelogs")
queryObj:Update("data", util.TableToJSON(logs))
queryObj:Execute()
end)
netstream.Hook("UpdateDatafileMedical", function(client, id, logs, subject, isFromCMUPDA)
if (!PLUGIN:HasAccessToDatafile(client) and !isFromCMUPDA) then return end
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Plik danych wpisu 'MEDYCZNE' '" .. string.upper(subject) .. "' został usunięty przez " .. string.upper(author), Color(171, 222, 47))
local cachedCharacter = ix.char.loaded[id]
if (cachedCharacter) then
cachedCharacter:SetDatafilemedicalrecords(logs)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
return
end
end
local queryObj = mysql:Update("ix_characters_data")
queryObj:Where("id", id)
queryObj:Where("key", "datafilemedicalrecords")
queryObj:Update("data", util.TableToJSON(logs))
queryObj:Execute()
end)
netstream.Hook("UpdateDatafileViolations", function(client, id, logs, subject)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Plik danych wpisu 'WYROCZENIE' '" .. string.upper(subject) .. "' został usunięty przez " .. string.upper(author), Color(171, 222, 47))
local cachedCharacter = ix.char.loaded[id]
if (cachedCharacter) then
cachedCharacter:SetDatafileviolations(logs)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
return
end
end
local queryObj = mysql:Update("ix_characters_data")
queryObj:Where("id", id)
queryObj:Where("key", "datafileviolations")
queryObj:Update("data", util.TableToJSON(logs))
queryObj:Execute()
end)
netstream.Hook("DatafilePromoteDemote", function(client, id, name)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
local cachedCharacter = ix.char.loaded[id]
if (cachedCharacter) then
cachedCharacter:SetName(name)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
return
end
end
local queryObj = mysql:Update("ix_characters")
queryObj:Where("id", id)
queryObj:Update("name", name)
queryObj:Execute()
end)
function PLUGIN:CreateDatafile(client)
if (client:IsValid()) then
local character = client:GetCharacter()
local geneticAge = character:GetAge() or "N/A"
local geneticHeight = character:GetHeight() or "N/A"
local geneticEyecolor = character:GetEyeColor() or "N/A"
local standardCredits = 50
local designatedStatus = "N/A"
local anticitizen = false
if (string.utf8lower(character:GetBackground()) == "zwolennik") then
standardCredits = 60
elseif (string.utf8lower(character:GetBackground()) == "wyrzutek") then
standardCredits = 35
elseif (character:GetFaction() == FACTION_CP) then
standardCredits = 0
end
local genericData
if character:IsVortigaunt() then
genericData = {
id = character:GetID(),
cid = "N/A",
collarID = character:GetCollarID() or "N/A",
cohesionPoints = 0,
cohesionPointsDate = os.date("%d/%m/%Y"),
nulled = "NIEAKTYWNY",
geneticDesc = geneticAge .." | ".. geneticHeight,
occupation = "N/A",
occupationDate = os.date("%d/%m/%Y"),
designatedStatus = designatedStatus,
designatedStatusDate = os.date("%d/%m/%Y"),
permits = {},
bol = false,
anticitizen = anticitizen,
combine = false,
loyaltyStatus = "BRAK",
wages = 0,
bypassCommunion = false,
housing = false,
shop = false,
}
if character:GetBackground() == "Kolaborator" then
genericData.cid = character:GetCid()
end
else
genericData = {
id = character:GetID(),
name = character:GetName(),
cid = character:GetCid() or "N/A",
socialCredits = standardCredits,
socialCreditsDate = os.time(),
geneticDesc = geneticAge.." | "..geneticHeight.." | "..geneticEyecolor.." OCZY",
occupation = "N/A",
occupationDate = os.date("%d/%m/%Y"),
designatedStatus = designatedStatus,
designatedStatusDate = os.date("%d/%m/%Y"),
permits = {},
bol = false,
anticitizen = anticitizen,
combine = false,
loyaltyStatus = "BRAK",
wages = 0,
bypassCommunion = false,
housing = false,
shop = false,
}
end
if ix.faction.Get(client:Team()).isCombineFaction then
genericData.combine = true
end
if client:IsDispatch() then
genericData.combine = "overwatch"
end
local Timestamp = os.time()
local defaultLogs = {
[1] = {
text = "PRZENIESIONY DO DYSTRYKTU",
date = os.date( "%H:%M:%S - %d/%m/%Y" , Timestamp ),
poster = "Overwatch",
},
}
local defaultViolations = {}
local defaultMedicalRecords = {}
character:SetGenericdata(genericData)
character:SetDatafilelogs(defaultLogs)
character:SetDatafileviolations(defaultViolations)
character:SetDatafilemedicalrecords(defaultMedicalRecords)
character:SetHasDatafile(true)
character:Save()
end
end
netstream.Hook("OpenDatafile", function(client, id, bIsLocal)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
PLUGIN:RefreshDatafile(client, id, bIsLocal, nil, true)
end)
function PLUGIN:EditDatafile(client, genericdata, bBypass, bNoRefresh, action)
if (!bBypass and !PLUGIN:HasAccessToDatafile(client)) then return end
if (action) then
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Podmiot '" .. string.upper(genericdata.name or genericdata.collarID) .. "' " .. action .. " przez " .. string.upper(author), Color(171, 222, 47))
end
local cachedCharacter = ix.char.loaded[genericdata.id]
if (cachedCharacter) then
cachedCharacter:SetGenericdata(genericdata)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
if (!bNoRefresh) then
PLUGIN:RefreshDatafile(client, genericdata.id, nil, true)
end
return
end
end
local queryObj = mysql:Update("ix_characters_data")
queryObj:Where("id", genericdata.id)
queryObj:Where("key", "genericdata")
queryObj:Update("data", util.TableToJSON(genericdata))
queryObj:Execute()
if (!bNoRefresh) then
PLUGIN:RefreshDatafile(client, genericdata.cid, nil)
end
end
netstream.Hook("EditDatafile", function(client, genericdata, action)
PLUGIN:EditDatafile(client, genericdata, nil, nil, action)
end)
function PLUGIN:AddLog(client, logsTable, genericdata, posterName, points, text, bNoRefresh, bBypass, bGenericNote)
if (!bBypass and !PLUGIN:HasAccessToDatafile(client)) then return end
local Timestamp = os.time()
if (!bNoRefresh or bBypass) then
logsTable[#logsTable + 1] = {
text = text,
date = Timestamp,
points = points or nil,
poster = posterName
}
end
if (bGenericNote) then
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Plik danych wpisu 'UWAGA' '" .. string.upper(genericdata.name or genericdata.collarID) .. "' został dodany przez " .. string.upper(author), Color(171, 222, 47))
end
local cachedCharacter = ix.char.loaded[genericdata.id]
if (cachedCharacter) then
cachedCharacter:SetDatafilelogs(logsTable)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
if !bNoRefresh then
PLUGIN:RefreshDatafile(client, genericdata.id, nil, true)
end
return
end
end
local queryObj = mysql:Update("ix_characters_data")
queryObj:Where("id", genericdata.id)
queryObj:Where("key", "datafilelogs")
queryObj:Update("data", util.TableToJSON(logsTable))
queryObj:Execute()
if bNoRefresh then return end
PLUGIN:RefreshDatafile(client, genericdata.cid, nil)
end
netstream.Hook("AddLog", function(client, logsTable, genericdata, posterName, points, text, bNoRefresh, bGenericNote)
PLUGIN:AddLog(client, logsTable, genericdata, posterName, points, text, bNoRefresh, false, bGenericNote)
end)
netstream.Hook("AddViolation", function(client, violationsTable, genericdata, posterName, text, posterID)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
violationsTable[#violationsTable + 1] = {
text = text,
date = os.date("%d/%m/%Y"),
poster = posterName,
posterID = posterID
}
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Plik danych wpisu 'WYKROCZENIE' '" .. string.upper(genericdata.name or genericdata.collarID) .. "' został dodany przez " .. string.upper(author), Color(171, 222, 47))
local cachedCharacter = ix.char.loaded[genericdata.id]
if (cachedCharacter) then
cachedCharacter:SetDatafileviolations(violationsTable)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
PLUGIN:RefreshDatafile(client, genericdata.id, nil, true)
return
end
end
local queryObj = mysql:Update("ix_characters_data")
queryObj:Where("id", genericdata.id)
queryObj:Where("key", "datafileviolations")
queryObj:Update("data", util.TableToJSON(violationsTable))
queryObj:Execute()
PLUGIN:RefreshDatafile(client, genericdata.cid, nil)
end)
netstream.Hook("SetWagesDatafile", function(client, genericdata, wages)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
genericdata.wages = wages
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Dopłata '" .. string.upper(genericdata.name or genericdata.collarID) .. "' została zmieniona na " .. wages .. " przez " .. string.upper(author), Color(171, 222, 47))
local cachedCharacter = ix.char.loaded[genericdata.id]
if (cachedCharacter) then
cachedCharacter:SetGenericdata(genericdata)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
PLUGIN:RefreshDatafile(client, genericdata.id, nil, true)
return
end
end
local queryObj = mysql:Update("ix_characters_data")
queryObj:Where("id", genericdata.id)
queryObj:Where("key", "genericdata")
queryObj:Update("data", util.TableToJSON(genericdata))
queryObj:Execute()
PLUGIN:RefreshDatafile(client, genericdata.cid, nil)
end)
function PLUGIN:UpdateGenericData(genericdata)
local cachedCharacter = ix.char.loaded[genericdata.id]
if (cachedCharacter) then
cachedCharacter:SetGenericdata(genericdata)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
PLUGIN:RefreshDatafile(false, genericdata.id, nil, true)
return
end
end
local queryObj = mysql:Update("ix_characters_data")
queryObj:Where("id", genericdata.id)
queryObj:Where("key", "genericdata")
queryObj:Update("data", util.TableToJSON(genericdata))
queryObj:Execute()
end
netstream.Hook("SetLoyalistStatusDatafile", function(client, genericdata, status)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
genericdata.loyaltyStatus = status
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Status Lojalności '" .. string.upper(genericdata.name or genericdata.collarID) .. "' został zaktualizowany na '" .. status .. "' przez " .. string.upper(author), Color(171, 222, 47))
local cachedCharacter = ix.char.loaded[genericdata.id]
if (cachedCharacter) then
cachedCharacter:SetGenericdata(genericdata)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
PLUGIN:RefreshDatafile(client, genericdata.id, nil, true)
return
end
end
local queryObj = mysql:Update("ix_characters_data")
queryObj:Where("id", genericdata.id)
queryObj:Where("key", "genericdata")
queryObj:Update("data", util.TableToJSON(genericdata))
queryObj:Execute()
PLUGIN:RefreshDatafile(client, genericdata.cid, nil)
end)
netstream.Hook("SetBypassDatafile", function(client, genericdata, bBypass)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
genericdata.bypassCommunion = bBypass
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Dostęp do komunikatora '" .. string.upper(genericdata.name or genericdata.collarID) .. "' został " .. (bBypass and "włączony" or "wyłączony") .. " przez " .. string.upper(author), Color(171, 222, 47))
local cachedCharacter = ix.char.loaded[genericdata.id]
if (cachedCharacter) then
cachedCharacter:SetGenericdata(genericdata)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
PLUGIN:RefreshDatafile(client, genericdata.id, nil, true)
return
end
end
local queryObj = mysql:Update("ix_characters_data")
queryObj:Where("id", genericdata.id)
queryObj:Where("key", "genericdata")
queryObj:Update("data", util.TableToJSON(genericdata))
queryObj:Execute()
PLUGIN:RefreshDatafile(client, genericdata.cid, nil)
end)
netstream.Hook("AddMedicalRecord", function(client, medicalTable, genericdata, posterName, text, isFromCMUPDA)
if (!PLUGIN:HasAccessToDatafile(client) and !isFromCMUPDA) then return end
medicalTable[#medicalTable + 1] = {
text = text,
date = os.date("%d/%m/%Y"),
poster = posterName
}
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Plik danych wpisu 'MEDYCZNE' '" .. string.upper(genericdata.name or genericdata.collarID) .. "' został dodany przez " .. string.upper(author), Color(171, 222, 47))
local cachedCharacter = ix.char.loaded[genericdata.id]
if (cachedCharacter) then
cachedCharacter:SetDatafilemedicalrecords(medicalTable)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
PLUGIN:RefreshDatafile(client, genericdata.id, nil, true)
return
end
end
local queryObj = mysql:Update("ix_characters_data")
queryObj:Where("id", genericdata.id)
queryObj:Where("key", "datafilemedicalrecords")
queryObj:Update("data", util.TableToJSON(medicalTable))
queryObj:Execute()
PLUGIN:RefreshDatafile(client, genericdata.cid, nil)
end)
netstream.Hook("SetDatafilePermit", function(client, genericdata, permitsTable)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
genericdata.permits = permitsTable
local author = client:IsDispatch() and "Overwatch" or client:GetCombineTag()
ix.combineNotify:AddNotification("NTC:// Plik danych zezwoleń '" .. string.upper(genericdata.name or genericdata.collarID) .. "' został zaktualizowany przez " .. string.upper(author), Color(171, 222, 47))
local cachedCharacter = ix.char.loaded[genericdata.id]
if (cachedCharacter) then
cachedCharacter:SetGenericdata(genericdata)
if (IsValid(cachedCharacter:GetPlayer())) then
cachedCharacter:Save()
return
end
end
local queryObj = mysql:Update("ix_characters_data")
queryObj:Where("id", genericdata.id)
queryObj:Where("key", "genericdata")
queryObj:Update("data", util.TableToJSON(genericdata))
queryObj:Execute()
end)
netstream.Hook("GetPersonalNotesDatapad", function(client)
if (!PLUGIN:HasAccessToDatafile(client)) then return end
local character = client:GetCharacter()
if !character then return end
local notes = character:GetDatapadnotes()
if !notes then return end
netstream.Start(client, "ReplyPersonalNotesDatapad", notes)
end)
netstream.Hook("SavePersonalNotesDatapad", function(client, value)
local character = client:GetCharacter()
if !character then return end
character:SetDatapadnotes(value)
client:Notify("Zapisano notatki osobiste.")
end)