mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
100
gamemodes/helix/plugins/staffqol/cl_plugin.lua
Normal file
100
gamemodes/helix/plugins/staffqol/cl_plugin.lua
Normal file
@@ -0,0 +1,100 @@
|
||||
--[[
|
||||
| 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.testSoundOrigin = false
|
||||
|
||||
net.Receive("ixPlyGetInfo", function()
|
||||
local info = net.ReadTable()
|
||||
|
||||
local ixPlyGetInfo = vgui.Create("ixPlyGetInfo")
|
||||
ixPlyGetInfo:Populate(info)
|
||||
end)
|
||||
|
||||
net.Receive("ixSendFindItemInfo", function()
|
||||
local info = net.ReadTable()
|
||||
|
||||
local ixFindItemInfo = vgui.Create("ixFindItemInfo")
|
||||
ixFindItemInfo:Populate(info)
|
||||
end)
|
||||
|
||||
net.Receive("ixCharBanAreYouSure", function()
|
||||
local name = net.ReadString()
|
||||
local charID = net.ReadString()
|
||||
Derma_Query("Êtes-vous sûr de vouloir ban "..name.." '#"..charID.."'", "Ban "..name,
|
||||
"Confirmer", function()
|
||||
net.Start("ixCharBanAreYouSure")
|
||||
net.SendToServer()
|
||||
end, "Annuler")
|
||||
end)
|
||||
|
||||
ix.option.Add("espShow3DtestSoundOrigin", ix.type.bool, true, {
|
||||
category = "Observateur",
|
||||
hidden = function()
|
||||
return !CAMI.PlayerHasAccess(LocalPlayer(), "Helix - Observer", nil)
|
||||
end
|
||||
})
|
||||
|
||||
function PLUGIN:HUDPaint()
|
||||
self:DrawPoints("testSoundOrigin")
|
||||
end
|
||||
|
||||
function PLUGIN:DrawPoints(type)
|
||||
local client = LocalPlayer()
|
||||
|
||||
local drawESP = ix.option.Get("espShow3D"..type, true) and client:GetMoveType() == MOVETYPE_NOCLIP and
|
||||
!client:InVehicle() and CAMI.PlayerHasAccess(client, "Helix - Observer", nil)
|
||||
|
||||
if (drawESP) and self[type] and isvector(self[type]) then
|
||||
local scrW, scrH = ScrW(), ScrH()
|
||||
local marginX, marginY = scrH * .1, scrH * .1
|
||||
|
||||
local screenPosition = self[type]:ToScreen()
|
||||
local x, y = math.Clamp(screenPosition.x, marginX, scrW - marginX), math.Clamp(screenPosition.y, marginY, scrH - marginY)
|
||||
|
||||
local alpha = 255
|
||||
local size = 10
|
||||
local drawColor = color_white
|
||||
|
||||
surface.SetDrawColor(drawColor.r, drawColor.g, drawColor.b, alpha)
|
||||
surface.SetFont("ixGenericFont")
|
||||
surface.DrawRect(x - size / 2, y - size / 2, size, size)
|
||||
ix.util.DrawText("3D Test Sound "..(type:find("Location") and "Heard From" or "Origin"), x, y - (size + 5), ColorAlpha(drawColor, alpha), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, nil, alpha)
|
||||
end
|
||||
end
|
||||
|
||||
net.Receive("ixSync3dSoundTestOrigin", function()
|
||||
local origin = net.ReadVector()
|
||||
if !origin then return end
|
||||
|
||||
PLUGIN.testSoundOrigin = origin
|
||||
end)
|
||||
|
||||
net.Receive("ixPlay3DSound", function()
|
||||
local soundPath = net.ReadString()
|
||||
local range = net.ReadUInt(8)
|
||||
local soundFile = Sound( soundPath )
|
||||
local position = net.ReadVector()
|
||||
|
||||
if !soundFile then return end
|
||||
if !range then return end
|
||||
|
||||
local vector = (position != Vector( 0, 0, 0 ) and position) or PLUGIN.testSoundOrigin
|
||||
|
||||
if !vector then PLUGIN:NotifyLackOfLocation() return end
|
||||
if !isvector(vector) then PLUGIN:NotifyLackOfLocation() return end
|
||||
|
||||
sound.Play( soundFile, vector, range, 100, 1 )
|
||||
end)
|
||||
|
||||
function PLUGIN:NotifyLackOfLocation()
|
||||
LocalPlayer():Notify("You did not set a /Play3DSoundTestOrigin location!")
|
||||
end
|
||||
392
gamemodes/helix/plugins/staffqol/derma/cl_finditeminfo.lua
Normal file
392
gamemodes/helix/plugins/staffqol/derma/cl_finditeminfo.lua
Normal file
@@ -0,0 +1,392 @@
|
||||
--[[
|
||||
| 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 = {}
|
||||
|
||||
local padding = SScaleMin(10 / 3)
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(Color(63, 58, 115, 220))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
Derma_DrawBackgroundBlur( this, 1 )
|
||||
end
|
||||
|
||||
self.content = self:Add("EditablePanel")
|
||||
self.content:SetSize(SScaleMin(700 / 3), SScaleMin(600 / 3))
|
||||
self.content:Center()
|
||||
self.content:MakePopup()
|
||||
self.content.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
Schema:AllowMessage(self.content)
|
||||
|
||||
self:CreateTopBar()
|
||||
|
||||
self.innerSelf = self.content:Add("DScrollPanel")
|
||||
self.innerSelf:Dock(FILL)
|
||||
|
||||
self.partWidths = {}
|
||||
self.parts = {}
|
||||
self.rows = {}
|
||||
self.excluded = {}
|
||||
self.info = false
|
||||
self.scrollers = {}
|
||||
end
|
||||
|
||||
function PANEL:CreateTopBar()
|
||||
self.topbar = self.content:Add("Panel")
|
||||
self.topbar:SetSize(self:GetWide(), SScaleMin(50 / 3))
|
||||
self.topbar:Dock(TOP)
|
||||
self.topbar:DockMargin(0, 0, 0, padding)
|
||||
self.topbar.Paint = function( this, w, h )
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
self.titleText = self.topbar:Add("DLabel")
|
||||
self.titleText:SetFont("CharCreationBoldTitleNoClamp")
|
||||
self.titleText:Dock(LEFT)
|
||||
self.titleText:SetText(L("qolItemsInfo"))
|
||||
self.titleText:DockMargin(SScaleMin(10 / 3), 0, 0, 0)
|
||||
self.titleText:SetContentAlignment(4)
|
||||
self.titleText:SizeToContents()
|
||||
|
||||
local exit = self.topbar:Add("DImageButton")
|
||||
exit:SetImage("willardnetworks/tabmenu/navicons/exit.png")
|
||||
exit:SetSize(SScaleMin(20 / 3), SScaleMin(20 / 3))
|
||||
exit:DockMargin(0, SScaleMin(15 / 3), SScaleMin(10 / 3), SScaleMin(15 / 3))
|
||||
exit:Dock(RIGHT)
|
||||
exit.DoClick = function()
|
||||
self:Remove()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
end
|
||||
|
||||
local divider = self.topbar:Add("Panel")
|
||||
self:CreateDivider(divider)
|
||||
end
|
||||
|
||||
function PANEL:CreateDivider(parent)
|
||||
parent:SetSize(1, self.topbar:GetTall())
|
||||
parent:Dock(RIGHT)
|
||||
parent:DockMargin(SScaleMin(5 / 3), padding, padding + SScaleMin(5 / 3), padding)
|
||||
parent.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(Color(111, 111, 136, (255 / 100 * 30)))
|
||||
surface.DrawLine(0, 0, 0, h)
|
||||
end
|
||||
end
|
||||
|
||||
local sortingMembers = {
|
||||
invID = true,
|
||||
name = true,
|
||||
origin = true,
|
||||
itemID = true,
|
||||
owner = true
|
||||
}
|
||||
|
||||
function PANEL:Populate(info)
|
||||
self.info = info
|
||||
local count = 0
|
||||
for itemID, itemInfo in SortedPairsByMemberValue(info, "itemID") do
|
||||
count = count + 1
|
||||
|
||||
self:CreateRow(count, itemID, itemInfo)
|
||||
end
|
||||
|
||||
self:AllowMultipleScroll()
|
||||
|
||||
self:CreateBring()
|
||||
|
||||
local bottompanel = self.content:Add("Panel")
|
||||
bottompanel:Dock(BOTTOM)
|
||||
bottompanel:SetSize(self.content:GetWide(), SScaleMin(50 / 3))
|
||||
|
||||
local itemNames = {}
|
||||
for _, v in pairs(info) do
|
||||
if !v.name then continue end
|
||||
if itemNames[v.name] then continue end
|
||||
itemNames[v.name] = true
|
||||
end
|
||||
|
||||
local excludeItems = bottompanel:Add("DButton")
|
||||
excludeItems:Dock(LEFT)
|
||||
excludeItems:SetFont("MenuFontNoClamp")
|
||||
excludeItems:SetText(L("qolExcludeItems"))
|
||||
excludeItems:SizeToContents()
|
||||
excludeItems:SetWide(bottompanel:GetWide() / 2)
|
||||
excludeItems.DoClick = function()
|
||||
local dmenu = DermaMenu()
|
||||
dmenu:MakePopup()
|
||||
dmenu:SetPos(input.GetCursorPos())
|
||||
|
||||
for name, _ in pairs(itemNames) do
|
||||
dmenu:AddOption(name, function()
|
||||
for _, v in pairs(self.rows) do
|
||||
if v.itemName and v.itemName == name then
|
||||
if v:GetTall() != 0 then
|
||||
v:SetTall(0)
|
||||
self.excluded[name] = true
|
||||
else
|
||||
v:SetTall(SScaleMin(90 / 3))
|
||||
self.excluded[name] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
for _, v in pairs(dmenu:GetChildren()[1]:GetChildren()) do
|
||||
local tickorx = v:Add("DImage")
|
||||
tickorx:Dock(RIGHT)
|
||||
tickorx:DockMargin(0, 3, 3, 3)
|
||||
tickorx:SetWide(v:GetTall() - 6)
|
||||
v:SetWide(v:GetWide() + v:GetTall() + 3)
|
||||
if !self.excluded[v:GetText()] then
|
||||
tickorx:SetImage("materials/willardnetworks/charselect/check.png")
|
||||
else
|
||||
tickorx:SetImage("materials/willardnetworks/charselect/delete.png")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local sortBy = bottompanel:Add("DButton")
|
||||
sortBy:Dock(FILL)
|
||||
sortBy:SetFont("MenuFontNoClamp")
|
||||
sortBy:SetText(L("qolSorting"))
|
||||
sortBy.DoClick = function()
|
||||
local dmenu = DermaMenu()
|
||||
dmenu:MakePopup()
|
||||
dmenu:SetPos(input.GetCursorPos())
|
||||
|
||||
for member, _ in pairs(sortingMembers) do
|
||||
dmenu:AddOption(member, function()
|
||||
count = 0
|
||||
for _, v in pairs(self.rows) do
|
||||
v:Remove()
|
||||
self.partWidths = {}
|
||||
self.parts = {}
|
||||
self.rows = {}
|
||||
self.scrollers = {}
|
||||
end
|
||||
|
||||
for itemID, itemInfo in SortedPairsByMemberValue(info, member) do
|
||||
count = count + 1
|
||||
|
||||
local row = self:CreateRow(count, itemID, itemInfo)
|
||||
if self.excluded[itemInfo.name] then
|
||||
if row:GetTall() != 0 then
|
||||
row:SetTall(0)
|
||||
end
|
||||
end
|
||||
|
||||
self:AllowMultipleScroll()
|
||||
end
|
||||
|
||||
self:CreateBring()
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:AllowMultipleScroll()
|
||||
for _, v in pairs(self.scrollers) do
|
||||
v.Think = function(this)
|
||||
local FrameRate = VGUIFrameTime() - this.FrameTime
|
||||
this.FrameTime = VGUIFrameTime()
|
||||
|
||||
if ( this.btnRight:IsDown() ) then
|
||||
this.OffsetX = this.OffsetX + ( 800 * FrameRate )
|
||||
this:InvalidateLayout( true )
|
||||
|
||||
for _, v2 in pairs(self.scrollers) do
|
||||
if v2 == this then continue end
|
||||
|
||||
v2.OffsetX = v2.OffsetX + ( 800 * FrameRate )
|
||||
v2:InvalidateLayout( true )
|
||||
end
|
||||
end
|
||||
|
||||
if ( this.btnLeft:IsDown() ) then
|
||||
this.OffsetX = this.OffsetX - ( 800 * FrameRate )
|
||||
this:InvalidateLayout( true )
|
||||
|
||||
for _, v2 in pairs(self.scrollers) do
|
||||
if v2 == this then continue end
|
||||
|
||||
v2.OffsetX = v2.OffsetX - ( 800 * FrameRate )
|
||||
v2:InvalidateLayout( true )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateBring()
|
||||
for _, v in pairs(self.rows) do
|
||||
if v.parts["wPosition"] then
|
||||
if tostring(self.info[v.itemID].wPosition) != "N/A" and self.info[v.itemID].entID then
|
||||
local bring = v.parts["wPosition"].bottomPart:Add("DButton")
|
||||
bring:Dock(FILL)
|
||||
bring:DockMargin(0, 0, padding, SScaleMin(20 / 3))
|
||||
bring:SetFont("MenuFontBoldNoClamp")
|
||||
bring:SetText("Bring")
|
||||
bring:SizeToContents()
|
||||
bring.DoClick = function()
|
||||
Derma_Query("Êtes-vous sûr de vouloir d'apporter le joueur / l'item / le stockage dans lequel il se trouve, le cas échéant ?", "Amener le joueur/item/stockage",
|
||||
"Confirmer Opération", function()
|
||||
net.Start("ixBringItemOrContainer")
|
||||
net.WriteVector(Vector(self.info[v.itemID].wPosition))
|
||||
net.WriteInt(tonumber(self.info[v.itemID].entID), 17)
|
||||
net.WriteInt(v.itemID, 17)
|
||||
net.WriteString(self.info[v.itemID].origin)
|
||||
net.SendToServer()
|
||||
end, "Annuler")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateRow(count, itemID, itemInfo)
|
||||
local row = self.innerSelf:Add("Panel")
|
||||
row:DockMargin(padding, 0, padding, 0)
|
||||
row:DockPadding(padding, 0, padding, 0)
|
||||
row:SetTall(SScaleMin(90 / 3))
|
||||
row:Dock(TOP)
|
||||
row.itemName = itemInfo.name
|
||||
row.itemID = itemID
|
||||
self.rows[#self.rows + 1] = row
|
||||
row.parts = {}
|
||||
|
||||
row.Paint = function(this, w, h)
|
||||
if (count % 2 == 0) then
|
||||
surface.SetDrawColor(0, 0, 0, 75)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
else
|
||||
surface.SetDrawColor(Color(111, 111, 136, (255 / 100 * 15)))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
end
|
||||
|
||||
local rowScroll = row:Add("DHorizontalScroller")
|
||||
rowScroll:Dock(FILL)
|
||||
self.scrollers[#self.scrollers + 1] = rowScroll
|
||||
|
||||
for type, info in pairs(itemInfo) do
|
||||
if type == "itemID" then continue end
|
||||
if type == "entID" then continue end
|
||||
|
||||
row.parts[type] = self:CreatePart(itemID, type, info)
|
||||
rowScroll:AddPanel(row.parts[type])
|
||||
end
|
||||
|
||||
for _, part in pairs(self.parts) do
|
||||
part:SetWide(self.partWidths[part.type])
|
||||
end
|
||||
|
||||
return row
|
||||
end
|
||||
|
||||
function PANEL:GetName(name)
|
||||
if name == "data" then return L("qolItemsInfoData") end
|
||||
if name == "invID" then return L("qolItemsInfoInvID") end
|
||||
if name == "name" then return L("qolItemsInfoName") end
|
||||
if name == "origin" then return L("qolItemsInfoOrigin") end
|
||||
if name == "wPosition" then return L("qolItemsInfoWPosition") end
|
||||
if name == "owner" then return L("qolItemsInfoOwner") end
|
||||
end
|
||||
|
||||
function PANEL:CreatePart(itemID, name, info)
|
||||
local part = vgui.Create("Panel")
|
||||
part:Dock(LEFT)
|
||||
part.type = name
|
||||
if name == "name" then
|
||||
part:SetZPos( 0 )
|
||||
elseif name == "owner" then
|
||||
part:SetZPos(1)
|
||||
elseif name == "invID" then
|
||||
part:SetZPos(2)
|
||||
elseif name == "origin" then
|
||||
part:SetZPos(3)
|
||||
elseif name == "wPosition" then
|
||||
part:SetZPos(4)
|
||||
elseif name == "data" then
|
||||
part:SetZPos(5)
|
||||
end
|
||||
|
||||
local title = part:Add("DLabel")
|
||||
title:Dock(TOP)
|
||||
title:SetText(self:GetName(name))
|
||||
title:SetFont("MenuFontBoldNoClamp")
|
||||
title:SizeToContents()
|
||||
title:DockMargin(0, SScaleMin(20 / 3), 0, 0)
|
||||
|
||||
local horizontalDiv = part:Add("DShape")
|
||||
horizontalDiv:Dock(TOP)
|
||||
horizontalDiv:SetType("Rect")
|
||||
horizontalDiv:SetColor(Color(111, 111, 136, (255 / 100 * 30)))
|
||||
horizontalDiv:SetTall(1)
|
||||
horizontalDiv:DockMargin(0, SScaleMin(2), 0, SScaleMin(2))
|
||||
|
||||
part.bottomPart = part:Add("Panel")
|
||||
part.bottomPart:Dock(FILL)
|
||||
|
||||
local content = part.bottomPart:Add(name == "wPosition" and "DButton" or "DLabel")
|
||||
content:Dock(LEFT)
|
||||
content:DockMargin(0, 0, padding, SScaleMin(20 / 3))
|
||||
content:SetFont("MenuFontBoldNoClamp")
|
||||
local text = tostring(info)..(name == "name" and " #"..itemID or "")
|
||||
if !text then text = "N/A" end
|
||||
if text == "0" and name == "invID" then text = "Inventaire du monde" end
|
||||
if istable(info) then
|
||||
text = ""
|
||||
for key, value in pairs(info) do
|
||||
text = text..Schema:FirstToUpper(key)..": "..(!value and "N/A" or istable(value) and table.ToString(value) or tostring(value) or "N/A").." | "
|
||||
end
|
||||
end
|
||||
|
||||
content:SetText((text == "" and "N/A" or name == "wPosition" and text != "N/A" and "Go to" or text))
|
||||
content:SizeToContents()
|
||||
if name == "wPosition" then
|
||||
content:SetWide(content:GetWide() + SScaleMin(10 / 3))
|
||||
end
|
||||
|
||||
if name == "wPosition" then
|
||||
content.DoClick = function()
|
||||
if text == "N/A" or text == "" or !text then return end
|
||||
|
||||
if isvector(Vector(text)) then
|
||||
net.Start("ixGoToItemPos")
|
||||
net.WriteVector(Vector(text))
|
||||
net.SendToServer()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
part:SetWide(math.max(content:GetWide(), title:GetWide()) + (padding * 2))
|
||||
self.parts[#self.parts + 1] = part
|
||||
|
||||
local partWidth = self.partWidths[name]
|
||||
|
||||
if partWidth then
|
||||
self.partWidths[name] = math.max(part:GetWide(), self.partWidths[name])
|
||||
else
|
||||
self.partWidths[name] = part:GetWide()
|
||||
end
|
||||
|
||||
return part
|
||||
end
|
||||
|
||||
vgui.Register("ixFindItemInfo", PANEL, "EditablePanel")
|
||||
263
gamemodes/helix/plugins/staffqol/derma/cl_plygetinfo.lua
Normal file
263
gamemodes/helix/plugins/staffqol/derma/cl_plygetinfo.lua
Normal file
@@ -0,0 +1,263 @@
|
||||
--[[
|
||||
| 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 = {}
|
||||
|
||||
local padding = SScaleMin(10 / 3)
|
||||
|
||||
function PANEL:Init()
|
||||
self:SetSize(ScrW(), ScrH())
|
||||
self.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(Color(63, 58, 115, 220))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
|
||||
Derma_DrawBackgroundBlur( this, 1 )
|
||||
end
|
||||
|
||||
self.content = self:Add("EditablePanel")
|
||||
self.content:SetSize(SScaleMin(700 / 3), SScaleMin(600 / 3))
|
||||
self.content:Center()
|
||||
self.content:MakePopup()
|
||||
self.content.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
Schema:AllowMessage(self.content)
|
||||
|
||||
self:CreateTopBar()
|
||||
|
||||
self.innerSelf = self.content:Add("DScrollPanel")
|
||||
self.innerSelf:Dock(FILL)
|
||||
end
|
||||
|
||||
function PANEL:CreateTopBar()
|
||||
self.topbar = self.content:Add("Panel")
|
||||
self.topbar:SetSize(self:GetWide(), SScaleMin(50 / 3))
|
||||
self.topbar:Dock(TOP)
|
||||
self.topbar:DockMargin(0, 0, 0, padding)
|
||||
self.topbar.Paint = function( this, w, h )
|
||||
surface.SetDrawColor(0, 0, 0, 130)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
|
||||
self.titleText = self.topbar:Add("DLabel")
|
||||
self.titleText:SetFont("CharCreationBoldTitleNoClamp")
|
||||
self.titleText:Dock(LEFT)
|
||||
self.titleText:SetText(L("qolPlyInfo"))
|
||||
self.titleText:DockMargin(SScaleMin(10 / 3), 0, 0, 0)
|
||||
self.titleText:SetContentAlignment(4)
|
||||
self.titleText:SizeToContents()
|
||||
|
||||
local exit = self.topbar:Add("DImageButton")
|
||||
exit:SetImage("willardnetworks/tabmenu/navicons/exit.png")
|
||||
exit:SetSize(SScaleMin(20 / 3), SScaleMin(20 / 3))
|
||||
exit:DockMargin(0, SScaleMin(15 / 3), SScaleMin(10 / 3), SScaleMin(15 / 3))
|
||||
exit:Dock(RIGHT)
|
||||
exit.DoClick = function()
|
||||
self:Remove()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
end
|
||||
|
||||
local divider = self.topbar:Add("Panel")
|
||||
self:CreateDivider(divider)
|
||||
end
|
||||
|
||||
function PANEL:CreateDivider(parent)
|
||||
parent:SetSize(1, self.topbar:GetTall())
|
||||
parent:Dock(RIGHT)
|
||||
parent:DockMargin(SScaleMin(5 / 3), padding, padding + SScaleMin(5 / 3), padding)
|
||||
parent.Paint = function(this, w, h)
|
||||
surface.SetDrawColor(Color(111, 111, 136, (255 / 100 * 30)))
|
||||
surface.DrawLine(0, 0, 0, h)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:Populate(plyInfo)
|
||||
steamworks.RequestPlayerInfo( plyInfo.player.steamID64, function( steamName )
|
||||
local miscInfo = self.innerSelf:Add("Panel")
|
||||
miscInfo:Dock(TOP)
|
||||
|
||||
local characters = miscInfo:Add("DLabel")
|
||||
characters:SetFont("WNBleedingTextNoClamp")
|
||||
characters:Dock(LEFT)
|
||||
characters:SetText(steamName.."'s "..L("qolCharacters"))
|
||||
characters:DockMargin(padding, 0, 0, padding)
|
||||
characters:SetContentAlignment(4)
|
||||
characters:SizeToContents()
|
||||
|
||||
local divider = miscInfo:Add("Panel")
|
||||
self:CreateDivider(divider)
|
||||
divider:Dock(LEFT)
|
||||
divider:DockMargin(padding, 0, padding, padding)
|
||||
|
||||
local otherInfo = miscInfo:Add("DLabel")
|
||||
otherInfo:Dock(LEFT)
|
||||
otherInfo:SetFont("WNBleedingTextNoClamp")
|
||||
otherInfo:SetText(L("qolHP")..": "..plyInfo.player.curHp..", "..L("qolArmor")..": "..plyInfo.player.curArmor..", "..L("qolPlayerFlags")..": "..(plyInfo.player.playerFlags == "" and "N/A" or plyInfo.player.playerFlags))
|
||||
otherInfo:DockMargin(0, 0, 0, padding)
|
||||
otherInfo:SetContentAlignment(4)
|
||||
otherInfo:SizeToContents()
|
||||
|
||||
miscInfo:SetTall(characters:GetTall() + SScaleMin(10 / 3))
|
||||
|
||||
local count = 0
|
||||
for charID, charInfo in pairs(plyInfo) do
|
||||
if !isnumber(charID) then continue end
|
||||
count = count + 1
|
||||
|
||||
self:CreateCharRow(count, charID, charInfo)
|
||||
end
|
||||
|
||||
local bottompanel = self.content:Add("Panel")
|
||||
bottompanel:Dock(BOTTOM)
|
||||
bottompanel:SetSize(self.content:GetWide(), SScaleMin(50 / 3))
|
||||
|
||||
local copySteamID = bottompanel:Add("DButton")
|
||||
copySteamID:Dock(LEFT)
|
||||
copySteamID:SetFont("MenuFontNoClamp")
|
||||
copySteamID:SetText(L("qolCopySteamID"))
|
||||
copySteamID:SizeToContents()
|
||||
copySteamID:SetWide(bottompanel:GetWide() / 2)
|
||||
copySteamID.DoClick = function()
|
||||
SetClipboardText( plyInfo.player.steamID )
|
||||
LocalPlayer():NotifyLocalized(L("qolCopiedSteamID"))
|
||||
end
|
||||
|
||||
local seeWhitelists = bottompanel:Add("DButton")
|
||||
seeWhitelists:Dock(FILL)
|
||||
seeWhitelists:SetFont("MenuFontNoClamp")
|
||||
seeWhitelists:SetText(L("qolSeeWhitelists"))
|
||||
seeWhitelists.DoClick = function()
|
||||
if self.popup and IsValid(self.popup) then
|
||||
self.popup:Remove()
|
||||
end
|
||||
|
||||
self.popup = vgui.Create("DFrame")
|
||||
DFrameFixer(self.popup)
|
||||
self.popup:SetTitle(L("qolSeeWhitelists").." - "..steamName)
|
||||
self.popup:MakePopup()
|
||||
self.popup:SetSize(self.content:GetWide(), self.content:GetTall() - SScaleMin(100 / 3))
|
||||
local x, y = self.content:GetPos()
|
||||
self.popup:SetPos(x, y + SScaleMin(50 / 3))
|
||||
|
||||
local scrollWhitelists = self.popup:Add("DScrollPanel")
|
||||
scrollWhitelists:Dock(FILL)
|
||||
|
||||
if !plyInfo.player then return end
|
||||
if !plyInfo.player.whitelists then return end
|
||||
if !plyInfo.player.whitelists.ixhl2rp then return end
|
||||
|
||||
for whitelist, _ in pairs(plyInfo.player.whitelists.ixhl2rp) do
|
||||
local whitelistName = scrollWhitelists:Add("DLabel")
|
||||
whitelistName:Dock(TOP)
|
||||
whitelistName:SetContentAlignment(5)
|
||||
whitelistName:SetText(string.utf8upper(whitelist))
|
||||
whitelistName:SetFont("MenuFontBoldNoClamp")
|
||||
whitelistName:SizeToContents()
|
||||
whitelistName:DockMargin(0, SScaleMin(20 / 3), 0, 0)
|
||||
end
|
||||
end
|
||||
end )
|
||||
end
|
||||
|
||||
function PANEL:Think()
|
||||
if self.popup and IsValid(self.popup) then
|
||||
self.popup:MoveToFront()
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:CreateCharRow(count, charID, charInfo)
|
||||
local row = self.innerSelf:Add("Panel")
|
||||
row:DockMargin(padding, 0, padding, 0)
|
||||
row:DockPadding(padding, 0, padding, 0)
|
||||
row:SetTall(SScaleMin(90 / 3))
|
||||
row:Dock(TOP)
|
||||
|
||||
row.Paint = function(this, w, h)
|
||||
if (count % 2 == 0) then
|
||||
surface.SetDrawColor(0, 0, 0, 75)
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
else
|
||||
surface.SetDrawColor(Color(111, 111, 136, (255 / 100 * 15)))
|
||||
surface.DrawRect(0, 0, w, h)
|
||||
end
|
||||
end
|
||||
|
||||
local rowScroll = row:Add("DHorizontalScroller")
|
||||
rowScroll:Dock(FILL)
|
||||
|
||||
for type, info in pairs(charInfo) do
|
||||
local part = self:CreatePart(type, info)
|
||||
rowScroll:AddPanel(part)
|
||||
end
|
||||
end
|
||||
|
||||
function PANEL:GetName(id)
|
||||
if id == 1 then return L("qolName") end
|
||||
if id == 2 then return L("qolLanguages") end
|
||||
if id == 3 then return L("qolFlags") end
|
||||
if id == 4 then return L("qolTempFlags") end
|
||||
if id == 5 then return L("qolGroupName") end
|
||||
end
|
||||
|
||||
function PANEL:CreatePart(name, info)
|
||||
local part = vgui.Create("Panel")
|
||||
part:Dock(LEFT)
|
||||
|
||||
local title = part:Add("DLabel")
|
||||
title:Dock(TOP)
|
||||
title:SetText(self:GetName(name))
|
||||
title:SetFont("MenuFontBoldNoClamp")
|
||||
title:SizeToContents()
|
||||
title:DockMargin(0, SScaleMin(20 / 3), 0, 0)
|
||||
|
||||
local horizontalDiv = part:Add("DShape")
|
||||
horizontalDiv:Dock(TOP)
|
||||
horizontalDiv:SetType("Rect")
|
||||
horizontalDiv:SetColor(Color(111, 111, 136, (255 / 100 * 30)))
|
||||
horizontalDiv:SetTall(1)
|
||||
horizontalDiv:DockMargin(0, SScaleMin(2), 0, SScaleMin(2))
|
||||
|
||||
local content = part:Add("DLabel")
|
||||
content:Dock(BOTTOM)
|
||||
content:DockMargin(0, 0, padding, SScaleMin(20 / 3))
|
||||
content:SetFont("MenuFontBoldNoClamp")
|
||||
local text = info
|
||||
if istable(info) then
|
||||
if name == 2 then
|
||||
text = ""
|
||||
for _, langID in pairs(info) do
|
||||
local lang = ix.languages:FindByID(langID)
|
||||
|
||||
if text == "" then
|
||||
text = lang.name
|
||||
else
|
||||
text = text..", "..lang.name
|
||||
end
|
||||
end
|
||||
elseif name == 4 then
|
||||
text = ""
|
||||
for flag, _ in pairs(info) do
|
||||
text = text..flag
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
content:SetText((text == "" and "N/A" or text))
|
||||
content:SizeToContents()
|
||||
|
||||
part:SetWide(math.max(content:GetWide(), title:GetWide()) + (padding * 2))
|
||||
|
||||
return part
|
||||
end
|
||||
|
||||
vgui.Register("ixPlyGetInfo", PANEL, "EditablePanel")
|
||||
342
gamemodes/helix/plugins/staffqol/sh_plugin.lua
Normal file
342
gamemodes/helix/plugins/staffqol/sh_plugin.lua
Normal file
@@ -0,0 +1,342 @@
|
||||
--[[
|
||||
| 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.name = "Staff QOL"
|
||||
PLUGIN.author = "Fruity"
|
||||
PLUGIN.description = "PlyGetInfo, toolgun stuff, logging and other misc."
|
||||
|
||||
ix.util.Include("cl_plugin.lua")
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
|
||||
ix.lang.AddTable("english", {
|
||||
cmdPlyGetInfo = "Displays character list, individual languages, flags (perm and temp) and other misc info.",
|
||||
qolPlyInfo = "Player Information",
|
||||
qolCharacters = "Characters",
|
||||
qolCopiedSteamID = "You have copied the SteamID.",
|
||||
qolCopySteamID = "Copy SteamID",
|
||||
qolHP = "HP",
|
||||
qolArmor = "Armor",
|
||||
qolPlayerFlags = "Playerflags",
|
||||
qolName = "Name",
|
||||
qolLanguages = "Languages",
|
||||
qolFlags = "Flags",
|
||||
qolTempFlags = "TempFlags",
|
||||
qolGroupName = "Group Name",
|
||||
qolSeeWhitelists = "See Whitelists",
|
||||
qolFindItem = "Find item by name on map/in inventory/in db",
|
||||
qolItemsInfo = "Items found",
|
||||
qolItemsInfoData = "Data",
|
||||
qolItemsInfoInvID = "Inventory ID",
|
||||
qolItemsInfoName = "Name of Item",
|
||||
qolItemsInfoOwner = "Owner",
|
||||
qolItemsInfoOrigin = "Origin",
|
||||
qolItemsInfoWPosition = "World Position",
|
||||
qolExcludeItems = "Include/Exclude Items",
|
||||
qolSorting = "Sorting",
|
||||
qolFindItemById = "Find item by name on map/in inventory/in db using an ID",
|
||||
})
|
||||
|
||||
ix.lang.AddTable("french", {
|
||||
cmdPlyGetInfo = "Affiche la liste des personnages, les langues individuelles, les drapeaux (perm et temp) et d'autres informations diverses",
|
||||
qolPlyInfo = "Informations sur le joueur",
|
||||
qolCharacters = "Personnages",
|
||||
qolCopiedSteamID = "Vous avez copié le SteamID",
|
||||
qolCopySteamID = "Copie du SteamID",
|
||||
qolHP = "HP",
|
||||
qolArmor = "Armure",
|
||||
qolPlayerFlags = "Playerflags",
|
||||
qolName = "Nom",
|
||||
qolLanguages = "Langues",
|
||||
qolFlags = "Drapeaux",
|
||||
qolTempFlags = "TempFlags",
|
||||
qolGroupName = "Nom du groupe",
|
||||
qolSeeWhitelists = "Voir les listes blanches",
|
||||
qolFindItem = "Trouver un objet par son nom sur la carte/l'inventaire/la base de données",
|
||||
qolItemsInfo = "Articles trouvés",
|
||||
qolItemsInfoData = "Données",
|
||||
qolItemsInfoInvID = "Inventory ID",
|
||||
qolItemsInfoName = "Nom de l'article",
|
||||
qolItemsInfoOwner = "Propriétaire",
|
||||
qolItemsInfoOrigin = "Origine",
|
||||
qolItemsInfoWPosition = "Position mondiale",
|
||||
qolExcludeItems = "Inclure/Exclure des éléments",
|
||||
qolSorting = "Triage",
|
||||
qolFindItemById = "Trouver un élément par son nom sur la carte/l'inventaire/la base de données en utilisant un ID",
|
||||
})
|
||||
|
||||
ix.command.Add("PlyGetInfo", {
|
||||
description = "@cmdPlyGetInfo",
|
||||
adminOnly = true,
|
||||
arguments = ix.type.player,
|
||||
OnRun = function(self, client, target)
|
||||
if (target and IsValid(target)) then
|
||||
local tempFlags = target:GetLocalVar("tempFlags") or {}
|
||||
local characters = target.ixCharList or {}
|
||||
local info = {}
|
||||
|
||||
for _, character in pairs(characters) do
|
||||
local charInfo = ix.char.loaded[character]
|
||||
|
||||
if !charInfo.vars then continue end
|
||||
|
||||
local vars = charInfo.vars
|
||||
local name = vars.name or "N/A"
|
||||
local languages = vars.languages or {}
|
||||
local flags = vars.data["f"] or ""
|
||||
local group = charInfo.GetGroup and charInfo:GetGroup() or {}
|
||||
local groupname = group.name or "N/A"
|
||||
local miscInfo = {
|
||||
curHp = target:Health(),
|
||||
curArmor = target:Armor(),
|
||||
steamID = target:SteamID(),
|
||||
steamID64 = target:SteamID64(),
|
||||
playerFlags = target:GetData("playerFlags", "N/A"),
|
||||
whitelists = target:GetData("whitelists", {})
|
||||
}
|
||||
|
||||
info[character] = {
|
||||
[1] = name,
|
||||
[2] = languages,
|
||||
[3] = flags,
|
||||
[4] = tempFlags,
|
||||
[5] = groupname
|
||||
}
|
||||
|
||||
info.player = miscInfo
|
||||
end
|
||||
|
||||
net.Start( "ixPlyGetInfo" )
|
||||
net.WriteTable(info)
|
||||
net.Send(client)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
--[[
|
||||
ix.command.Add("FindItem", {
|
||||
description = "@qolFindItem",
|
||||
adminOnly = true,
|
||||
arguments = ix.type.text,
|
||||
OnRun = function(self, client, sSearch)
|
||||
PLUGIN:FindItem(client, sSearch)
|
||||
end
|
||||
})
|
||||
--]]
|
||||
|
||||
ix.command.Add("FindItemById", {
|
||||
description = "@qolFindItemById",
|
||||
adminOnly = true,
|
||||
arguments = ix.type.number,
|
||||
OnRun = function(self, client, id)
|
||||
PLUGIN:FindItem(client, tonumber(id))
|
||||
end
|
||||
})
|
||||
|
||||
properties.Add("ixFloppyDiscSeePassword", {
|
||||
MenuLabel = "Voir mot de passe",
|
||||
Order = 401,
|
||||
MenuIcon = "icon16/eye.png",
|
||||
|
||||
Filter = function(self, entity, client)
|
||||
if (entity:GetClass() != "ix_item") then return false end
|
||||
if (!CAMI.PlayerHasAccess(client, "Helix - Basic Admin Commands")) then return false end
|
||||
local itemTable = entity:GetItemTable()
|
||||
if !itemTable or itemTable and !istable(itemTable) then return false end
|
||||
if !itemTable.uniqueID then return false end
|
||||
if itemTable.uniqueID != "floppydisk" then return false end
|
||||
|
||||
return true
|
||||
end,
|
||||
|
||||
Action = function(self, entity)
|
||||
self:MsgStart()
|
||||
net.WriteEntity(entity)
|
||||
self:MsgEnd()
|
||||
end,
|
||||
|
||||
Receive = function(self, length, client)
|
||||
local entity = net.ReadEntity()
|
||||
|
||||
if (!IsValid(entity)) then return end
|
||||
if (!self:Filter(entity, client)) then return end
|
||||
|
||||
if !entity.ixItemID then return false end
|
||||
|
||||
if !ix.item.instances[entity.ixItemID] then return false end
|
||||
if !ix.item.instances[entity.ixItemID].data then return false end
|
||||
|
||||
local password = ix.item.instances[entity.ixItemID].data["password"] or "N/A"
|
||||
|
||||
client:Notify(password)
|
||||
|
||||
ix.log.Add(client, "getFloppyDiskPassword", entity:EntIndex(), password)
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("CharBan", {
|
||||
description = "@cmdCharBan",
|
||||
privilege = "Ban Character",
|
||||
arguments = {
|
||||
ix.type.string,
|
||||
bit.bor(ix.type.number, ix.type.optional)
|
||||
},
|
||||
adminOnly = true,
|
||||
OnRun = function(self, client, sTarget, minutes)
|
||||
PLUGIN:BanSomeone(client, sTarget, minutes)
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("CharPK", {
|
||||
description = "Ban perm. un personnage",
|
||||
privilege = "Ban Character",
|
||||
arguments = {
|
||||
ix.type.string
|
||||
},
|
||||
adminOnly = true,
|
||||
OnRun = function(self, client, sTarget)
|
||||
PLUGIN:BanSomeone(client, sTarget)
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("BringContainer", {
|
||||
description = "TP un stockage",
|
||||
arguments = {
|
||||
ix.type.number
|
||||
},
|
||||
adminOnly = true,
|
||||
OnRun = function(self, client, nEntIndex)
|
||||
if !nEntIndex or nEntIndex and !isnumber(nEntIndex) then
|
||||
client:Notify("Invalide ID")
|
||||
return false
|
||||
end
|
||||
|
||||
local entity = Entity(nEntIndex)
|
||||
if entity and IsValid(entity) then
|
||||
local inv = entity.GetInventory and entity:GetInventory()
|
||||
local isContainer = inv and inv.vars and inv.vars.isContainer
|
||||
local data = ix.container.stored[entity:GetModel():lower()]
|
||||
|
||||
if !isContainer or !data then
|
||||
client:Notify("Ceci n'est pas un stockage !")
|
||||
return false
|
||||
end
|
||||
|
||||
entity:SetPos(client:GetPos())
|
||||
client:Notify("Vous avez TP le stockage "..data.name.." avec l'index #"..nEntIndex)
|
||||
|
||||
ix.log.Add(client, "ixBringContainer", data.name or "N/A", nEntIndex)
|
||||
else
|
||||
client:Notify("Invalide entity")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("ForceCharFallover", {
|
||||
description = "Forcefully 'fallover' a character.",
|
||||
arguments = {
|
||||
ix.type.player,
|
||||
bit.bor(ix.type.number, ix.type.optional)
|
||||
},
|
||||
adminOnly = true,
|
||||
OnRun = function(self, client, target, time)
|
||||
if (!target:Alive() or target:GetMoveType() == MOVETYPE_NOCLIP) then
|
||||
return "@notNow"
|
||||
end
|
||||
|
||||
if (time and time > 0) then
|
||||
time = math.Clamp(time, 1, 60)
|
||||
end
|
||||
|
||||
if (!IsValid(target.ixRagdoll)) then
|
||||
target:SetRagdolled(true, time)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("Play3DSoundTestOrigin", {
|
||||
description = "Définit l'origine du son joué lors de l'exécution de la commande Test3DSound.",
|
||||
adminOnly = true,
|
||||
OnRun = function(self, client)
|
||||
local trace = client:GetEyeTraceNoCursor()
|
||||
if !trace then return end
|
||||
local hitPos = trace.HitPos
|
||||
if !hitPos then return end
|
||||
local vector = Vector(hitPos)
|
||||
if !isvector(vector) then return end
|
||||
|
||||
net.Start("ixSync3dSoundTestOrigin")
|
||||
net.WriteVector(vector)
|
||||
net.Send(client)
|
||||
end
|
||||
})
|
||||
|
||||
ix.command.Add("Play3DSound", {
|
||||
description = "Jouez un son de votre emplacement en vous basant sur la gamme (20-150) donnée.",
|
||||
arguments = {
|
||||
ix.type.string,
|
||||
bit.bor(ix.type.number, ix.type.optional)
|
||||
},
|
||||
privilege = "Basic Admin Commands",
|
||||
OnRun = function(self, client, sound, range)
|
||||
range = math.Clamp(range or 75, 20, 150)
|
||||
local players = player.GetAll()
|
||||
|
||||
net.Start("ixPlay3DSound")
|
||||
net.WriteString(sound)
|
||||
net.WriteUInt(range, 8)
|
||||
net.WriteVector(client:GetPos())
|
||||
net.Send(players)
|
||||
end,
|
||||
indicator = "chatPerforming"
|
||||
})
|
||||
|
||||
ix.command.Add("Play3DSoundTest", {
|
||||
description = "Test de lecture d'un son à partir de l'emplacement Play3DSoundTestOrigin basé sur la plage (20-150) donnée.",
|
||||
arguments = {
|
||||
ix.type.string,
|
||||
bit.bor(ix.type.number, ix.type.optional)
|
||||
},
|
||||
privilege = "Basic Admin Commands",
|
||||
OnRun = function(self, client, sound, range)
|
||||
range = math.Clamp(range or 75, 20, 150)
|
||||
|
||||
net.Start("ixPlay3DSound")
|
||||
net.WriteString(sound)
|
||||
net.WriteUInt(range, 8)
|
||||
net.Send(client)
|
||||
end,
|
||||
indicator = "chatPerforming"
|
||||
})
|
||||
|
||||
local CHAR = ix.meta.character
|
||||
function CHAR:Ban(time)
|
||||
time = tonumber(time)
|
||||
|
||||
hook.Run("OnCharacterBanned", self, time or true)
|
||||
|
||||
if (time) then
|
||||
-- If time is provided, adjust it so it becomes the un-ban time.
|
||||
time = os.time() + math.max(math.ceil(time), 60)
|
||||
end
|
||||
|
||||
-- Mark the character as banned and kick the character back to menu.
|
||||
self:SetData("banned", time or true)
|
||||
|
||||
for _, v in pairs(player.GetAll()) do
|
||||
local char = v:GetCharacter()
|
||||
if !char then continue end
|
||||
|
||||
local id = char:GetID()
|
||||
if id and id != self:GetID() then continue end
|
||||
self:Kick()
|
||||
end
|
||||
end
|
||||
408
gamemodes/helix/plugins/staffqol/sv_plugin.lua
Normal file
408
gamemodes/helix/plugins/staffqol/sv_plugin.lua
Normal file
@@ -0,0 +1,408 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
util.AddNetworkString("ixPlyGetInfo")
|
||||
util.AddNetworkString("ixSendFindItemInfo")
|
||||
util.AddNetworkString("ixGoToItemPos")
|
||||
util.AddNetworkString("ixBringItemOrContainer")
|
||||
util.AddNetworkString("ixCharBanAreYouSure")
|
||||
util.AddNetworkString("ixSync3dSoundTestOrigin")
|
||||
util.AddNetworkString("ixPlay3DSound")
|
||||
|
||||
ix.log.AddType("contextMenuUsed", function(client, name)
|
||||
return string.format("%s a utilisé une option de menu contextuel portant ce nom : %s", client:GetName(), name)
|
||||
end)
|
||||
|
||||
ix.log.AddType("knockedOut", function(client, text)
|
||||
return string.format("%s a été mis hors jeu à cause de : %s", client:GetName(), text)
|
||||
end, FLAG_DANGER)
|
||||
|
||||
ix.log.AddType("qolDeathLog", function(client, text)
|
||||
return string.format("%s vient d'être tué à cause de : %s", client:GetName(), text)
|
||||
end, FLAG_DANGER)
|
||||
|
||||
ix.log.AddType("itemBreakageDurability", function(item, name, player)
|
||||
return string.format("%s détenu par %s s'est cassé à cause d'un usage.", name, player:GetName())
|
||||
end)
|
||||
|
||||
ix.log.AddType("getFloppyDiskPassword", function(client, entID, password)
|
||||
return string.format("%s vient de révéler le mot de passe de la disquette '#%d' avec le mot de passe '%s'", client:GetName(), entID, password)
|
||||
end)
|
||||
|
||||
ix.log.AddType("ixBringItem", function(client, invType, id)
|
||||
return string.format("%s vient d'apporter un objet'#%s' sur %s", client:GetName(), id, invType)
|
||||
end)
|
||||
|
||||
ix.log.AddType("ixBanCharacter", function(client, name, id)
|
||||
return string.format("%s vient de bannir un personnage avec le nom %s '#%s'", client:GetName(), name, id)
|
||||
end)
|
||||
|
||||
ix.log.AddType("ixBringContainer", function(client, name, id)
|
||||
return string.format("%s vient d'apporter un stockage avec le nom %s '#%s'", client:GetName(), name, id)
|
||||
end)
|
||||
|
||||
|
||||
function PLUGIN:InitPostEntity()
|
||||
if !properties then return end
|
||||
if !properties.List then return end
|
||||
|
||||
for key, _ in pairs(properties.List) do
|
||||
local receive = properties.List[key].Receive
|
||||
|
||||
--luacheck: ignore 122
|
||||
properties.List[key].Receive = function(this, length, client)
|
||||
receive(this, length, client)
|
||||
|
||||
ix.log.Add(client, "contextMenuUsed", key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PopulateListByItemEntity(client, sSearch)
|
||||
for _, ent in pairs(ents.FindByClass( "ix_item" )) do
|
||||
if !IsValid(ent) then continue end
|
||||
|
||||
local id = ent.ixItemID
|
||||
if !id then continue end
|
||||
if isnumber(sSearch) and id != sSearch then continue end
|
||||
|
||||
local itemTable = ix.item.instances[id]
|
||||
if !itemTable or itemTable and !istable(itemTable) then continue end
|
||||
if !itemTable.name then continue end
|
||||
local uniqueID = itemTable.uniqueID
|
||||
if !uniqueID then continue end
|
||||
local nameList = ix.item.list[uniqueID].name or false
|
||||
if !nameList then continue end
|
||||
|
||||
if !ix.util.StringMatches(nameList, tostring(sSearch)) and sSearch != id then continue end
|
||||
|
||||
client.findItemList[id] = {
|
||||
invID = itemTable.invID,
|
||||
name = nameList or itemTable.name,
|
||||
wPosition = ent:GetPos(),
|
||||
data = itemTable.data,
|
||||
origin = "world",
|
||||
itemID = tonumber(id),
|
||||
owner = itemTable:GetOwner() or "World",
|
||||
entID = ent:EntIndex()
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PopulateListByContainerEntity(client, sSearch)
|
||||
for _, ent2 in pairs(ents.FindByClass( "ix_container" )) do
|
||||
if !IsValid(ent2) then continue end
|
||||
|
||||
for _, item in pairs(ent2:GetInventory():GetItems()) do
|
||||
local id = item.id
|
||||
if !id then continue end
|
||||
if isnumber(sSearch) and id != sSearch then continue end
|
||||
local uniqueID = item.uniqueID
|
||||
if !uniqueID then continue end
|
||||
local nameList = ix.item.list[uniqueID].name or false
|
||||
if !nameList then continue end
|
||||
|
||||
if !ix.util.StringMatches(nameList, tostring(sSearch)) and sSearch != id then continue end
|
||||
|
||||
client.findItemList[id] = {
|
||||
invID = item.invID,
|
||||
name = nameList or item.name,
|
||||
wPosition = ent2:GetPos(),
|
||||
data = item.data,
|
||||
origin = "container",
|
||||
itemID = tonumber(id),
|
||||
owner = "Container",
|
||||
entID = ent2:EntIndex()
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PopulateListByLoadedChars(client, sSearch)
|
||||
for _, char in pairs(ix.char.loaded) do
|
||||
if !char:GetInventory() then continue end
|
||||
|
||||
for _, item in pairs(char:GetInventory():GetItems()) do
|
||||
local id = item.id
|
||||
if !id then return end
|
||||
if isnumber(sSearch) and id != sSearch then continue end
|
||||
local uniqueID = item.uniqueID
|
||||
if !uniqueID then continue end
|
||||
|
||||
if !ix.util.StringMatches(item.name, tostring(sSearch)) and sSearch != id then continue end
|
||||
local charPos = char:GetPlayer()
|
||||
if IsValid(charPos) then charPos = charPos:GetPos() end
|
||||
|
||||
local nameList = ix.item.list[uniqueID].name or false
|
||||
if !nameList then continue end
|
||||
|
||||
|
||||
client.findItemList[id] = {
|
||||
invID = item.invID,
|
||||
name = nameList or item.name,
|
||||
wPosition = charPos or "N/A",
|
||||
data = item.data,
|
||||
origin = "character",
|
||||
itemID = tonumber(id),
|
||||
owner = char:GetName(),
|
||||
entID = char:GetPlayer():EntIndex()
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:FindItem(client, sSearch)
|
||||
local query = mysql:Select("ix_items")
|
||||
query:Select("item_id")
|
||||
query:Select("unique_id")
|
||||
query:Select("character_id")
|
||||
query:Select("inventory_id")
|
||||
query:Select("data")
|
||||
if isnumber(sSearch) then
|
||||
query:Where("item_id", sSearch)
|
||||
else
|
||||
query:WhereLike("unique_id", sSearch)
|
||||
end
|
||||
|
||||
query:Callback(function(result)
|
||||
client.findItemList = {}
|
||||
|
||||
self:PopulateListByItemEntity(client, sSearch)
|
||||
self:PopulateListByContainerEntity(client, sSearch)
|
||||
self:PopulateListByLoadedChars(client, sSearch)
|
||||
|
||||
if (istable(result)) then
|
||||
local data2 = util.JSONToTable(result[1].data or "[]")
|
||||
|
||||
for key, v in pairs(result) do
|
||||
if client.findItemList[tonumber(result[key].item_id)] then continue end
|
||||
if tonumber(v.inventory_id) == 0 then continue end
|
||||
|
||||
client.findItemList[tonumber(result[key].item_id)] = {
|
||||
invID = tonumber(v.inventory_id),
|
||||
name = ix.item.list[v.unique_id].name,
|
||||
wPosition = "N/A",
|
||||
data = data2,
|
||||
origin = "database/offline",
|
||||
itemID = tonumber(result[key].item_id),
|
||||
owner = "N/A"
|
||||
}
|
||||
end
|
||||
|
||||
-- so we can get the name of the character owning the inventory
|
||||
self:TranslateInventoryID(client)
|
||||
end
|
||||
|
||||
|
||||
end)
|
||||
|
||||
query:Execute()
|
||||
end
|
||||
|
||||
function PLUGIN:TranslateInventoryID(client)
|
||||
for itemID, tItem in pairs(client.findItemList) do
|
||||
local nInvID = tItem.invID
|
||||
if !nInvID then continue end
|
||||
|
||||
if tonumber(nInvID) == 0 then continue end
|
||||
|
||||
local query = mysql:Select("ix_inventories")
|
||||
query:Select("inventory_id")
|
||||
query:Select("character_id")
|
||||
query:Select("inventory_type")
|
||||
query:Where("inventory_id", nInvID)
|
||||
query:Callback(function(result)
|
||||
if (istable(result)) then
|
||||
for _, tResult in pairs(result) do
|
||||
if !tResult.character_id then continue end
|
||||
if tonumber(tResult.character_id) == 0 then
|
||||
local isBag = (ix.item.list[tResult.inventory_type] and ix.item.list[tResult.inventory_type].isBag)
|
||||
if tResult.inventory_type:find("container") or isBag then
|
||||
if isBag then
|
||||
client.findItemList[itemID].owner = "Bag"
|
||||
else
|
||||
client.findItemList[itemID].owner = "Container"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local query2 = mysql:Select("ix_characters")
|
||||
query2:Select("id")
|
||||
query2:Select("name")
|
||||
query2:Where("id", tResult.character_id)
|
||||
query2:Limit(1)
|
||||
query2:Callback(function(result2)
|
||||
if (istable(result2)) then
|
||||
client.findItemList[itemID].owner = result2[#result2].name
|
||||
end
|
||||
end)
|
||||
|
||||
query2:Execute()
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
query:Execute()
|
||||
end
|
||||
|
||||
net.Start("ixSendFindItemInfo")
|
||||
net.WriteTable(client.findItemList)
|
||||
net.Send(client)
|
||||
|
||||
timer.Simple(1, function()
|
||||
if IsValid(client) then
|
||||
client.findItemList = nil
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function PLUGIN:BanSomeone(client, sTarget, minutes)
|
||||
if (minutes) then
|
||||
minutes = os.time() + math.max(math.ceil(tonumber(minutes * 60)), 60)
|
||||
end
|
||||
|
||||
local found = false
|
||||
for _, target in pairs(ix.char.loaded) do
|
||||
if found then break end
|
||||
if (target.GetPlayer and !target:GetPlayer()) or (target:GetPlayer() and !IsValid(target:GetPlayer())) then continue end
|
||||
local name = target:GetName()
|
||||
if !ix.util.StringMatches(name, sTarget) then continue end
|
||||
|
||||
self:AreYouSure(client, target:GetID(), minutes, name)
|
||||
|
||||
found = true
|
||||
end
|
||||
|
||||
if found then return end
|
||||
|
||||
local query = mysql:Select("ix_characters")
|
||||
query:Select("id")
|
||||
query:Select("name")
|
||||
query:Select("cid")
|
||||
query:WhereLike("name", sTarget)
|
||||
query:Limit(1)
|
||||
query:Callback(function(result)
|
||||
if (!result or !istable(result) or #result == 0) then
|
||||
client:Notify("Character not found in database!")
|
||||
return
|
||||
end
|
||||
|
||||
if !result[1].id then return end
|
||||
|
||||
self:AreYouSure(client, result[1].id, minutes, result[1].name, result[1].cid)
|
||||
end)
|
||||
|
||||
query:Execute()
|
||||
end
|
||||
|
||||
function PLUGIN:AreYouSure(client, charID, minutes, name, cid)
|
||||
client.banningCharID = charID
|
||||
client.banningMinutes = minutes
|
||||
client.banningCID = cid
|
||||
client.banningName = name
|
||||
|
||||
net.Start("ixCharBanAreYouSure")
|
||||
net.WriteString(name)
|
||||
net.WriteString(charID)
|
||||
net.Send(client)
|
||||
end
|
||||
|
||||
function PLUGIN:Confirm(client, charID, minutes)
|
||||
local char = ix.char.loaded[tonumber(charID)]
|
||||
if char and char.GetPlayer and char:GetPlayer() and IsValid(char:GetPlayer()) then
|
||||
char:Ban(minutes)
|
||||
char:Save()
|
||||
|
||||
char:GetPlayer():Notify("Votre personnage "..char:GetName().." a été banni.")
|
||||
client:Notify("Le personnage "..char:GetName().." a été banni.")
|
||||
|
||||
ix.log.Add(client, "ixBanCharacter", char:GetName(), char:GetID())
|
||||
self:VoidClientInfo(client)
|
||||
return
|
||||
end
|
||||
|
||||
if char then
|
||||
minutes = tonumber(minutes)
|
||||
|
||||
hook.Run("OnCharacterBanned", char, minutes or true)
|
||||
|
||||
if (minutes) then
|
||||
-- If time is provided, adjust it so it becomes the un-ban time.
|
||||
minutes = os.time() + math.max(math.ceil(minutes), 60)
|
||||
end
|
||||
|
||||
-- Mark the character as banned and kick the character back to menu.
|
||||
char:SetData("banned", minutes or true)
|
||||
end
|
||||
|
||||
local query2 = mysql:Select("ix_characters_data")
|
||||
query2:Select("data")
|
||||
query2:Where("id", charID)
|
||||
query2:Where("key", "data")
|
||||
query2:Limit(1)
|
||||
query2:Callback(function(result2)
|
||||
if (!result2 or !istable(result2) or #result2 == 0) then return end
|
||||
|
||||
local data = util.JSONToTable(result2[1].data)
|
||||
data.banned = minutes or true
|
||||
|
||||
local queryObj = mysql:Update("ix_characters_data")
|
||||
queryObj:Where("id", charID)
|
||||
queryObj:Where("key", "data")
|
||||
queryObj:Update("data", util.TableToJSON(data))
|
||||
queryObj:Execute()
|
||||
|
||||
hook.Run("OnCharacterBannedByID", charID, data.banned)
|
||||
|
||||
client:Notify("The character "..(client.banningName or "N/A").." a été banni..")
|
||||
local name, id = client.banningName, client.banningCharID
|
||||
ix.log.Add(client, "ixBanCharacter", name, id)
|
||||
self:VoidClientInfo(client)
|
||||
end)
|
||||
|
||||
query2:Execute()
|
||||
end
|
||||
|
||||
function PLUGIN:VoidClientInfo(client)
|
||||
client.banningCharID = nil
|
||||
client.banningMinutes = nil
|
||||
client.banningCID = nil
|
||||
client.banningName = nil
|
||||
end
|
||||
|
||||
net.Receive("ixGoToItemPos", function(len, client)
|
||||
if !CAMI.PlayerHasAccess(client, "Helix - Basic Admin Commands") then return false end
|
||||
local vector = net.ReadVector()
|
||||
if !isvector(vector) then return false end
|
||||
|
||||
client:SetPos(vector)
|
||||
end)
|
||||
|
||||
net.Receive("ixBringItemOrContainer", function(len, client)
|
||||
if !CAMI.PlayerHasAccess(client, "Helix - Basic Admin Commands") then return false end
|
||||
local vector = net.ReadVector()
|
||||
local entIndex = net.ReadInt(17)
|
||||
local itemID = net.ReadInt(17)
|
||||
local origin = net.ReadString()
|
||||
if !isvector(vector) then return false end
|
||||
|
||||
if !IsValid(Entity(entIndex)) then return end
|
||||
Entity(entIndex):SetPos(client:GetPos())
|
||||
|
||||
ix.log.Add(client, "ixBringItem", origin, itemID)
|
||||
end)
|
||||
|
||||
net.Receive("ixCharBanAreYouSure", function(len, client)
|
||||
if !CAMI.PlayerHasAccess(client, "Helix - Basic Admin Commands") then return false end
|
||||
PLUGIN:Confirm(client, client.banningCharID, client.banningMinutes)
|
||||
end)
|
||||
Reference in New Issue
Block a user