|
|
@ -105,6 +105,10 @@ end
|
|
|
|
-- Function to return GMCP value
|
|
|
|
-- Function to return GMCP value
|
|
|
|
function checkGMCPValue(key)
|
|
|
|
function checkGMCPValue(key)
|
|
|
|
local result, value = CallPlugin(GMCPPluginID,"gmcpval", key)
|
|
|
|
local result, value = CallPlugin(GMCPPluginID,"gmcpval", key)
|
|
|
|
|
|
|
|
if result ~= 0 then
|
|
|
|
|
|
|
|
dnote( ("%s: checkGMCPValue for %s did not return any data."):format(Prepend, key)
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
end
|
|
|
|
return value
|
|
|
|
return value
|
|
|
|
end
|
|
|
|
end
|
|
|
|
-- Return true if tonumber() is not nil
|
|
|
|
-- Return true if tonumber() is not nil
|
|
|
@ -120,6 +124,7 @@ end
|
|
|
|
EqCheck = { Debug=false, Level=0 }
|
|
|
|
EqCheck = { Debug=false, Level=0 }
|
|
|
|
function EqCheck.IsPlaying()
|
|
|
|
function EqCheck.IsPlaying()
|
|
|
|
if not IsConnected() then return false end
|
|
|
|
if not IsConnected() then return false end
|
|
|
|
|
|
|
|
if not checkGMCPValue("char.status.state") then return false end
|
|
|
|
local state = tonumber(checkGMCPValue("char.status.state"))
|
|
|
|
local state = tonumber(checkGMCPValue("char.status.state"))
|
|
|
|
if not state then
|
|
|
|
if not state then
|
|
|
|
return false
|
|
|
|
return false
|
|
|
@ -153,6 +158,10 @@ end
|
|
|
|
Character = { }
|
|
|
|
Character = { }
|
|
|
|
Player_MT = { __index = Character }
|
|
|
|
Player_MT = { __index = Character }
|
|
|
|
function Character.New()
|
|
|
|
function Character.New()
|
|
|
|
|
|
|
|
if not (checkGMCPValue("char.base.name") or checkGMCPValue("char.status.level") or checkGMCPValue("char.status.level")) then
|
|
|
|
|
|
|
|
dnote(("%s: Character.New() failed to create character object. Missing GMCP data was detected."):format(Prepend))
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
end
|
|
|
|
local player = {
|
|
|
|
local player = {
|
|
|
|
Name = checkGMCPValue("char.base.name"),
|
|
|
|
Name = checkGMCPValue("char.base.name"),
|
|
|
|
LastLevel = checkGMCPValue("char.status.level"),
|
|
|
|
LastLevel = checkGMCPValue("char.status.level"),
|
|
|
@ -164,6 +173,7 @@ function Character.New()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
function Character:Level()
|
|
|
|
function Character:Level()
|
|
|
|
if not checkGMCPValue("char.status.level") then
|
|
|
|
if not checkGMCPValue("char.status.level") then
|
|
|
|
|
|
|
|
dnote(("%s: Character:Level() did not return any GMCP data. Attempting to call the GMCP data."):format(Prepend))
|
|
|
|
Send_GMCP_Packet("request char")
|
|
|
|
Send_GMCP_Packet("request char")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
dnote(("%s Character:Level() returns: %d"):format(Prepend, tonumber(checkGMCPValue("char.status.level"))))
|
|
|
|
dnote(("%s Character:Level() returns: %d"):format(Prepend, tonumber(checkGMCPValue("char.status.level"))))
|
|
|
@ -171,6 +181,7 @@ function Character:Level()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
function Character:TierLevel()
|
|
|
|
function Character:TierLevel()
|
|
|
|
if not checkGMCPValue("char.base.tier") then
|
|
|
|
if not checkGMCPValue("char.base.tier") then
|
|
|
|
|
|
|
|
dnote(("%s: Character:TierLevel() did not return any GMCP data. Attempting to call the GMCP data."):format(Prepend))
|
|
|
|
Send_GMCP_Packet("request char")
|
|
|
|
Send_GMCP_Packet("request char")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
dnote(("%s Character:TierLevel() returns: %d"):format(Prepend, (tonumber(checkGMCPValue("char.base.tier"))*10)))
|
|
|
|
dnote(("%s Character:TierLevel() returns: %d"):format(Prepend, (tonumber(checkGMCPValue("char.base.tier"))*10)))
|
|
|
@ -178,6 +189,7 @@ function Character:TierLevel()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
function Character:EffectiveLevel()
|
|
|
|
function Character:EffectiveLevel()
|
|
|
|
if not checkGMCPValue("char") then
|
|
|
|
if not checkGMCPValue("char") then
|
|
|
|
|
|
|
|
dnote(("%s: Character:EffectiveLevel() did not return any GMCP data. Attempting to call the GMCP data."):format(Prepend))
|
|
|
|
Send_GMCP_Packet("request char")
|
|
|
|
Send_GMCP_Packet("request char")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
dnote(("%s Character:EffectiveLevel() returns: %d"):format(Prepend, (self:Level()+self:TierLevel())))
|
|
|
|
dnote(("%s Character:EffectiveLevel() returns: %d"):format(Prepend, (self:Level()+self:TierLevel())))
|
|
|
|