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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions modules/phoenix/lua/beta_gm_commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ local commands =
'uptime',
'immortal',
'reset',
'spawnmob',
'gotoname'
}

for _, name in ipairs(commands) do
Expand Down
39 changes: 39 additions & 0 deletions modules/phoenix/lua/debuginfo.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
-----------------------------------
-- func: debuginfo
-- desc: Prints zone, position, level, and target information for testing.
-----------------------------------
---@type TCommand
local commandObj = {}

commandObj.cmdprops =
{
permission = 0,
parameters = '',
}

commandObj.onTrigger = function(player)
local zone = player:getZone()

if not zone then
player:printToPlayer('Error: Unable to retrieve zone information.', xi.msg.channel.SYSTEM_3)
return
end

player:printToPlayer(string.format('Zone: %s (%i) Pos: X %.2f Y %.2f Z %.2f Rot %i',
zone:getName(), zone:getID(), player:getXPos(), player:getYPos(), player:getZPos(), player:getRotPos()),
xi.msg.channel.SYSTEM_3)

player:printToPlayer(string.format('Level: %i Job: %i/%i HP: %i/%i MP: %i/%i',
player:getMainLvl(), player:getMainJob(), player:getSubJob(),
player:getHP(), player:getMaxHP(), player:getMP(), player:getMaxMP()),
xi.msg.channel.SYSTEM_3)

local target = player:getCursorTarget()
if target ~= nil then
player:printToPlayer(string.format('Target: %s ID: %i Pos: X %.2f Y %.2f Z %.2f',
target:getName(), target:getID(), target:getXPos(), target:getYPos(), target:getZPos()),
xi.msg.channel.SYSTEM_3)
end
end

return commandObj
47 changes: 47 additions & 0 deletions modules/phoenix/lua/restrict_job_changes.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
-----------------------------------
-- Prevents !changejob and !changesjob from being used to switch a player
-- into SCH, DNC, RUN, or GEO.
-----------------------------------
require('modules/module_utils')
-----------------------------------
local m = Module:new('restrict_job_changes')

local blockedJobs =
{
[xi.job.SCH] = true,
[xi.job.DNC] = true,
[xi.job.RUN] = true,
[xi.job.GEO] = true,
}

local function isBlockedJob(jobId)
if jobId == nil then
return false
end

local resolvedJobId = tonumber(jobId) or xi.job[string.upper(jobId)]

return blockedJobs[resolvedJobId] == true
end

m:addOverride('xi.commands.changejob.onTrigger', function(player, jobId, level, master)
if isBlockedJob(jobId) then
player:printToPlayer('That job is not allowed to be changed to.')
player:printToPlayer('!changejob <jobID> (level) (master: 0/1)')
return
end

super(player, jobId, level, master)
end)

m:addOverride('xi.commands.changesjob.onTrigger', function(player, jobId, level)
if isBlockedJob(jobId) then
player:printToPlayer('That job is not allowed to be changed to.')
player:printToPlayer('!changesjob <jobID> (level)')
return
end

super(player, jobId, level)
end)

return m
Loading