108 lines
3.3 KiB
Lua
108 lines
3.3 KiB
Lua
local UtilLib = require("BenUtils")
|
|
local BenUtils = UtilLib.new()
|
|
|
|
-- Globals
|
|
|
|
-- End Globals
|
|
|
|
-- Utility Functions
|
|
-- End utility functions
|
|
|
|
-- Mod functions
|
|
|
|
---@param PlayerName string
|
|
function GiveCrystalsToPlayer(PlayerName, ...)
|
|
local args = table.pack(...)
|
|
---@type ACrabPS
|
|
local player = BenUtils.GetPlayerStateByName(PlayerName)
|
|
if player and #args == 1 then
|
|
player.Crystals = tonumber(args[1]) or player.Crystals
|
|
end
|
|
end
|
|
|
|
function SetAllPerks100()
|
|
local crabs = FindAllOf("CrabPS")
|
|
|
|
if crabs then
|
|
---@param v ACrabPS
|
|
for i, v in ipairs(crabs) do
|
|
print(string.format("Crab with ID: %s", v.PlayerNamePrivate:ToString()))
|
|
if v.PlayerNamePrivate:ToString() == "Aztec" then
|
|
---@param wmod FCrabWeaponMod
|
|
v.WeaponMods:ForEach(function(index, wmod)
|
|
---@class mod FCrabWeaponMod
|
|
local mod = wmod:get()
|
|
if mod.InventoryInfo.Level <= 100 then
|
|
mod.InventoryInfo.Level = 100
|
|
end
|
|
end)
|
|
---@param wmod FCrabAbilityMod
|
|
v.AbilityMods:ForEach(function(index, wmod)
|
|
---@class mod FCrabAbilityMod
|
|
local mod = wmod:get()
|
|
if mod.InventoryInfo.Level <= 100 then
|
|
mod.InventoryInfo.Level = 100
|
|
end
|
|
end)
|
|
---@param wmod FCrabMeleeMod
|
|
v.MeleeMods:ForEach(function(index, wmod)
|
|
---@class mod FCrabMeleeMod
|
|
local mod = wmod:get()
|
|
if mod.InventoryInfo.Level <= 100 then
|
|
mod.InventoryInfo.Level = 100
|
|
end
|
|
end)
|
|
---@param wmod FCrabPerk
|
|
v.Perks:ForEach(function(index, wmod)
|
|
---@class mod FCrabPerk
|
|
local mod = wmod:get()
|
|
if mod.InventoryInfo.Level <= 100 then
|
|
mod.InventoryInfo.Level = 100
|
|
end
|
|
end)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
---@param PlayerName string
|
|
function RollTheDice(PlayerName, ...)
|
|
print("[BenUtil] Got chat command rtd from " .. PlayerName)
|
|
local args = table.pack(...)
|
|
for k, v in ipairs(args) do
|
|
print(string.format("[BenUtil] Arg: %s", v))
|
|
end
|
|
-- print(string.format("[BenUtil] %d arguments sent", args.n))
|
|
---@type ACrabPC
|
|
local player = FindFirstOf("CrabPC")
|
|
player:ServerSendChatMessage(BenUtils.StringToFString("You rolled the dice"))
|
|
end
|
|
|
|
-- End mod functions
|
|
|
|
-- Register Hooks and Keybinds
|
|
|
|
RegisterKeyBind(Key.F1, function()
|
|
ExecuteInGameThread(function()
|
|
local msg = BenUtils.StringToFString("Fuck cheese")
|
|
---@type ACrabPC
|
|
local player = FindFirstOf("CrabPC")
|
|
player:ServerSendChatMessage(msg)
|
|
end)
|
|
end)
|
|
|
|
-- RegisterKeyBind(Key.F2, function()
|
|
-- print("[BenUtils] Money Money Money\n")
|
|
-- ExecuteInGameThread(function()
|
|
-- GibCrystals()
|
|
-- end)
|
|
-- end)
|
|
|
|
|
|
|
|
BenUtils.RegisterCommand("rtd", RollTheDice)
|
|
BenUtils.RegisterCommand("dosh", GiveCrystalsToPlayer)
|
|
BenUtils.RegisterCommand("cheat", SetAllPerks100)
|
|
|
|
-- Finish Hooks and Keybinds
|