mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 15:46:18 +00:00
Fixed: Inconsistent EOL
This commit is contained in:
parent
c63d0cb87d
commit
e2655d95de
2 changed files with 1312 additions and 1312 deletions
File diff suppressed because it is too large
Load diff
|
@ -1,433 +1,433 @@
|
||||||
-- written by Syphox
|
-- written by Syphox
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.exist()
|
function M.exist()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local bit32 = {}
|
local bit32 = {}
|
||||||
local logic_and = {
|
local logic_and = {
|
||||||
[0] = { [0] = 0, 0, 0, 0},
|
[0] = { [0] = 0, 0, 0, 0},
|
||||||
[1] = { [0] = 0, 1, 0, 1},
|
[1] = { [0] = 0, 1, 0, 1},
|
||||||
[2] = { [0] = 0, 0, 2, 2},
|
[2] = { [0] = 0, 0, 2, 2},
|
||||||
[3] = { [0] = 0, 1, 2, 3},
|
[3] = { [0] = 0, 1, 2, 3},
|
||||||
}
|
}
|
||||||
|
|
||||||
local function checkint32( name, argidx, x, level )
|
local function checkint32( name, argidx, x, level )
|
||||||
local n = tonumber( x )
|
local n = tonumber( x )
|
||||||
if not n then
|
if not n then
|
||||||
error( string.format(
|
error( string.format(
|
||||||
"bad argument #%d to '%s' (number expected, got %s)",
|
"bad argument #%d to '%s' (number expected, got %s)",
|
||||||
argidx, name, type( x )
|
argidx, name, type( x )
|
||||||
), level + 1 )
|
), level + 1 )
|
||||||
end
|
end
|
||||||
return math.floor( n ) % 0x100000000
|
return math.floor( n ) % 0x100000000
|
||||||
end
|
end
|
||||||
|
|
||||||
local function comb( name, args, nargs, s, t )
|
local function comb( name, args, nargs, s, t )
|
||||||
for i = 1, nargs do
|
for i = 1, nargs do
|
||||||
args[i] = checkint32( name, i, args[i], 3 )
|
args[i] = checkint32( name, i, args[i], 3 )
|
||||||
end
|
end
|
||||||
local pow = 1
|
local pow = 1
|
||||||
local ret = 0
|
local ret = 0
|
||||||
for b = 0, 31, 2 do
|
for b = 0, 31, 2 do
|
||||||
local c = s
|
local c = s
|
||||||
for i = 1, nargs do
|
for i = 1, nargs do
|
||||||
c = t[c][args[i] % 4]
|
c = t[c][args[i] % 4]
|
||||||
args[i] = math.floor( args[i] / 4 )
|
args[i] = math.floor( args[i] / 4 )
|
||||||
end
|
end
|
||||||
ret = ret + c * pow
|
ret = ret + c * pow
|
||||||
pow = pow * 4
|
pow = pow * 4
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
function bit32.btest( ... )
|
function bit32.btest( ... )
|
||||||
return comb( 'btest', { ... }, select( '#', ... ), 3, logic_and ) ~= 0
|
return comb( 'btest', { ... }, select( '#', ... ), 3, logic_and ) ~= 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function targetIsInSameTeam()
|
local function targetIsInSameTeam()
|
||||||
if(getDbProp('UI:VARIABLES:IS_TEAM_PRESENT')~=0)then
|
if(getDbProp('UI:VARIABLES:IS_TEAM_PRESENT')~=0)then
|
||||||
for i=0,7 do
|
for i=0,7 do
|
||||||
local groupEntityUID = getDbProp('SERVER:GROUP:' .. tostring(i) ..':UID')
|
local groupEntityUID = getDbProp('SERVER:GROUP:' .. tostring(i) ..':UID')
|
||||||
if(groupEntityUID == getDbProp('UI:VARIABLES:TARGET:UID'))then
|
if(groupEntityUID == getDbProp('UI:VARIABLES:TARGET:UID'))then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function targetIsInSameGuild()
|
local function targetIsInSameGuild()
|
||||||
if(getDbProp('SERVER:GUILD:NAME')~=0)then
|
if(getDbProp('SERVER:GUILD:NAME')~=0)then
|
||||||
local nbMember = getNbGuildMembers();
|
local nbMember = getNbGuildMembers();
|
||||||
for i=0,(nbMember-1) do
|
for i=0,(nbMember-1) do
|
||||||
if(getGuildMemberName(i) == getTargetName())then
|
if(getGuildMemberName(i) == getTargetName())then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function targetIsInSameLeague()
|
local function targetIsInSameLeague()
|
||||||
local targetLeague = getDbProp('SERVER:Entities:E' .. getTargetSlot() .. ':P25')
|
local targetLeague = getDbProp('SERVER:Entities:E' .. getTargetSlot() .. ':P25')
|
||||||
local playerLeague = getDbProp('SERVER:Entities:E0:P25')
|
local playerLeague = getDbProp('SERVER:Entities:E0:P25')
|
||||||
if(targetLeague == playerLeague and playerLeague ~= 0)then
|
if(targetLeague == playerLeague and playerLeague ~= 0)then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- no way found yet
|
-- no way found yet
|
||||||
local function targetIsInSameOpFight()
|
local function targetIsInSameOpFight()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 1=duel, 2=unk, 3=arena, 4=unk, 5=gvg (pr), 6=unk, 7=tagged(mara), 8=unk, 9=tp safezone, 10=safe zone related
|
-- 1=duel, 2=unk, 3=arena, 4=unk, 5=gvg (pr), 6=unk, 7=tagged(mara), 8=unk, 9=tp safezone, 10=safe zone related
|
||||||
function M.checkPvPMode()
|
function M.checkPvPMode()
|
||||||
local targetProp = getDbProp('SERVER:Entities:E' .. getTargetSlot() .. ':P23')
|
local targetProp = getDbProp('SERVER:Entities:E' .. getTargetSlot() .. ':P23')
|
||||||
local playerProp = getDbProp('SERVER:Entities:E0:P23')
|
local playerProp = getDbProp('SERVER:Entities:E0:P23')
|
||||||
local pvp_mode = {1,3,5,7}
|
local pvp_mode = {1,3,5,7}
|
||||||
for i=1,8 do
|
for i=1,8 do
|
||||||
if(bit32.btest(targetProp, 2^(i-1)) and bit32.btest(playerProp, 2^(i-1)))then
|
if(bit32.btest(targetProp, 2^(i-1)) and bit32.btest(playerProp, 2^(i-1)))then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.PvPLogo()
|
function M.PvPLogo()
|
||||||
local targetProp = getDbProp('SERVER:Entities:E' .. getTargetSlot() .. ':P23')
|
local targetProp = getDbProp('SERVER:Entities:E' .. getTargetSlot() .. ':P23')
|
||||||
for i=1,8 do
|
for i=1,8 do
|
||||||
if(bit32.btest(targetProp, 2^(i-1)))then
|
if(bit32.btest(targetProp, 2^(i-1)))then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.isEnemy()
|
function M.isEnemy()
|
||||||
if(isTargetPlayer() and M.checkPvPMode())then
|
if(isTargetPlayer() and M.checkPvPMode())then
|
||||||
if(targetIsInSameGuild())then
|
if(targetIsInSameGuild())then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if(targetIsInSameTeam())then
|
if(targetIsInSameTeam())then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if(targetIsInSameLeague())then
|
if(targetIsInSameLeague())then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local function TJauge(val)
|
local function TJauge(val)
|
||||||
local jvalue = getDbProp("UI:VARIABLES:BARS:TARGET:" .. val) / 1.27
|
local jvalue = getDbProp("UI:VARIABLES:BARS:TARGET:" .. val) / 1.27
|
||||||
if(jvalue < 0)then
|
if(jvalue < 0)then
|
||||||
jvalue = 0
|
jvalue = 0
|
||||||
end
|
end
|
||||||
setDbProp("UI:VARIABLES:BARS:TARGET:" .. val .. "_PERCENT", math.floor(jvalue))
|
setDbProp("UI:VARIABLES:BARS:TARGET:" .. val .. "_PERCENT", math.floor(jvalue))
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.UpdateJauge()
|
function M.UpdateJauge()
|
||||||
local bars = {"HP", "SAP", "STA"}
|
local bars = {"HP", "SAP", "STA"}
|
||||||
for k,v in pairs(bars) do
|
for k,v in pairs(bars) do
|
||||||
TJauge(v)
|
TJauge(v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.teamInvite(uiID)
|
function M.teamInvite(uiID)
|
||||||
runAH(nil, 'talk', 'mode=0|text=/invite '.. getUI('ui:interface:' .. uiID).title)
|
runAH(nil, 'talk', 'mode=0|text=/invite '.. getUI('ui:interface:' .. uiID).title)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.updateFLinvB(uiID)
|
function M.updateFLinvB(uiID)
|
||||||
if(uiID==nil)then
|
if(uiID==nil)then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local tUI = getUI('ui:interface:' .. uiID .. ':header_closed:invite_button')
|
local tUI = getUI('ui:interface:' .. uiID .. ':header_closed:invite_button')
|
||||||
if(getUI('ui:interface:' .. uiID .. ':header_closed:online').texture ~= 'w_online.tga')then
|
if(getUI('ui:interface:' .. uiID .. ':header_closed:online').texture ~= 'w_online.tga')then
|
||||||
if(tUI.texture == 'invt.tga')then
|
if(tUI.texture == 'invt.tga')then
|
||||||
tUI.texture = ''
|
tUI.texture = ''
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if(tUI.texture == '')then
|
if(tUI.texture == '')then
|
||||||
tUI.texture = 'invt.tga'
|
tUI.texture = 'invt.tga'
|
||||||
tUI.x = -52
|
tUI.x = -52
|
||||||
tUI.y = 0
|
tUI.y = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.invToGuild(ply)
|
function M.invToGuild(ply)
|
||||||
ply = getUI('ui:interface:add_guild'):find('edit_text').hardtext:split(">")[2]
|
ply = getUI('ui:interface:add_guild'):find('edit_text').hardtext:split(">")[2]
|
||||||
if(ply ~= '')then
|
if(ply ~= '')then
|
||||||
runAH(nil, 'talk', 'mode=0|text=/guildinvite ' .. ply)
|
runAH(nil, 'talk', 'mode=0|text=/guildinvite ' .. ply)
|
||||||
end
|
end
|
||||||
runAH(nil, 'leave_modal', '')
|
runAH(nil, 'leave_modal', '')
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.teamInviteFromGuild(uiID)
|
function M.teamInviteFromGuild(uiID)
|
||||||
runAH(nil, 'talk', 'mode=0|text=/invite ' .. getGuildMemberName(tonumber(uiID:split(":m")[2])))
|
runAH(nil, 'talk', 'mode=0|text=/invite ' .. getGuildMemberName(tonumber(uiID:split(":m")[2])))
|
||||||
end
|
end
|
||||||
|
|
||||||
local tGuild = 'ui:interface:guild:content:tab_guild:list_member:guild_members'
|
local tGuild = 'ui:interface:guild:content:tab_guild:list_member:guild_members'
|
||||||
function M.updateGLinvB()
|
function M.updateGLinvB()
|
||||||
if(getUI('ui:interface:guild').active)then
|
if(getUI('ui:interface:guild').active)then
|
||||||
-- if get #id from member template, it creates too many instances and game will crash. bad coded from ryzom dev
|
-- if get #id from member template, it creates too many instances and game will crash. bad coded from ryzom dev
|
||||||
for v = 0, (getNbGuildMembers()-1) do
|
for v = 0, (getNbGuildMembers()-1) do
|
||||||
local uiTexture = getUI(tGuild .. ":" .. tGuild .. ":m" .. v .. ':online')
|
local uiTexture = getUI(tGuild .. ":" .. tGuild .. ":m" .. v .. ':online')
|
||||||
local tUI = getUI(tGuild .. ":" .. tGuild .. ":m" .. v .. ':invite_button')
|
local tUI = getUI(tGuild .. ":" .. tGuild .. ":m" .. v .. ':invite_button')
|
||||||
if(getUI("ui:interface:player").title ~= getUI(tGuild .. ":" .. tGuild .. ":m" .. v .. ":name").hardtext)then
|
if(getUI("ui:interface:player").title ~= getUI(tGuild .. ":" .. tGuild .. ":m" .. v .. ":name").hardtext)then
|
||||||
if(uiTexture.texture ~= 'w_online.tga')then
|
if(uiTexture.texture ~= 'w_online.tga')then
|
||||||
if(tUI.texture == 'invt.tga')then
|
if(tUI.texture == 'invt.tga')then
|
||||||
tUI.texture = ''
|
tUI.texture = ''
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if(tUI.texture == '')then
|
if(tUI.texture == '')then
|
||||||
tUI.texture = 'invt.tga'
|
tUI.texture = 'invt.tga'
|
||||||
tUI.x = -22
|
tUI.x = -22
|
||||||
tUI.y = 0
|
tUI.y = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- fix the invite button in guild tab, because it sometimes disappear
|
-- fix the invite button in guild tab, because it sometimes disappear
|
||||||
-- the button appear for the player with higher grade than member
|
-- the button appear for the player with higher grade than member
|
||||||
local invB = getUI('ui:interface:guild:content:tab_guild_i:invite')
|
local invB = getUI('ui:interface:guild:content:tab_guild_i:invite')
|
||||||
if(getGuildMemberGrade(v) ~= 'Member')then
|
if(getGuildMemberGrade(v) ~= 'Member')then
|
||||||
if(invB.active == false)then
|
if(invB.active == false)then
|
||||||
invB.active = true
|
invB.active = true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
invB.active = false
|
invB.active = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.updateMemberCount()
|
function M.updateMemberCount()
|
||||||
-- fix the new guild tab
|
-- fix the new guild tab
|
||||||
local mcount = getUI('ui:interface:guild:content:tab_guild_i:member_count')
|
local mcount = getUI('ui:interface:guild:content:tab_guild_i:member_count')
|
||||||
if(getUI('ui:interface:guild').active)then
|
if(getUI('ui:interface:guild').active)then
|
||||||
if(tonumber(mcount.hardtext) ~= getNbGuildMembers())then
|
if(tonumber(mcount.hardtext) ~= getNbGuildMembers())then
|
||||||
mcount.hardtext = getNbGuildMembers()
|
mcount.hardtext = getNbGuildMembers()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.updateFPS()
|
function M.updateFPS()
|
||||||
local fpsUI = getUI('ui:interface:compass:frame:fps')
|
local fpsUI = getUI('ui:interface:compass:frame:fps')
|
||||||
if(fpsUI==nil)then return end;
|
if(fpsUI==nil)then return end;
|
||||||
local fps = getDbProp('UI:VARIABLES:FPS')
|
local fps = getDbProp('UI:VARIABLES:FPS')
|
||||||
fpsUI.hardtext = fps;
|
fpsUI.hardtext = fps;
|
||||||
local colRGB = '255 81 81 255'
|
local colRGB = '255 81 81 255'
|
||||||
if(fps >= 30)then
|
if(fps >= 30)then
|
||||||
colRGB = '155 255 81 255'
|
colRGB = '155 255 81 255'
|
||||||
elseif(fps >= 20)then
|
elseif(fps >= 20)then
|
||||||
colRGB = '249 255 81 255'
|
colRGB = '249 255 81 255'
|
||||||
end
|
end
|
||||||
fpsUI.color = colRGB
|
fpsUI.color = colRGB
|
||||||
end
|
end
|
||||||
|
|
||||||
function string:split(Pattern)
|
function string:split(Pattern)
|
||||||
local Results = {}
|
local Results = {}
|
||||||
local Start = 1
|
local Start = 1
|
||||||
local SplitStart, SplitEnd = string.find(self, Pattern, Start)
|
local SplitStart, SplitEnd = string.find(self, Pattern, Start)
|
||||||
while(SplitStart)do
|
while(SplitStart)do
|
||||||
table.insert(Results, string.sub(self, Start, SplitStart-1))
|
table.insert(Results, string.sub(self, Start, SplitStart-1))
|
||||||
Start = SplitEnd+1
|
Start = SplitEnd+1
|
||||||
SplitStart, SplitEnd = string.find(self, Pattern, Start)
|
SplitStart, SplitEnd = string.find(self, Pattern, Start)
|
||||||
end
|
end
|
||||||
table.insert(Results, string.sub(self, Start))
|
table.insert(Results, string.sub(self, Start))
|
||||||
return Results
|
return Results
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.sysinfo(txt, mtd)
|
function M.sysinfo(txt, mtd)
|
||||||
if(mtd==nil)then mtd='SYS' end;
|
if(mtd==nil)then mtd='SYS' end;
|
||||||
displaySystemInfo(ucstring(tostring(txt)), mtd);
|
displaySystemInfo(ucstring(tostring(txt)), mtd);
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.showTargetPercent()
|
function M.showTargetPercent()
|
||||||
local targetUI = getUI('ui:interface:target')
|
local targetUI = getUI('ui:interface:target')
|
||||||
local playerUI = getUI('ui:interface:player')
|
local playerUI = getUI('ui:interface:player')
|
||||||
local contentUI = targetUI:find("content")
|
local contentUI = targetUI:find("content")
|
||||||
local clawImg = targetUI:find("slot_claw")
|
local clawImg = targetUI:find("slot_claw")
|
||||||
local targetTitle = targetUI:find("target_title")
|
local targetTitle = targetUI:find("target_title")
|
||||||
local playerTitle = playerUI:find("player_title")
|
local playerTitle = playerUI:find("player_title")
|
||||||
local wgTargetConside = targetUI:find("conside")
|
local wgTargetConside = targetUI:find("conside")
|
||||||
local wgTargetLevel = targetUI:find("target_level")
|
local wgTargetLevel = targetUI:find("target_level")
|
||||||
targetTitle.color = "255 255 255 255"
|
targetTitle.color = "255 255 255 255"
|
||||||
playerTitle.color = targetTitle.color
|
playerTitle.color = targetTitle.color
|
||||||
|
|
||||||
if (isTargetUser() or
|
if (isTargetUser() or
|
||||||
(isTargetPlayer() and
|
(isTargetPlayer() and
|
||||||
not M.isEnemy()))then
|
not M.isEnemy()))then
|
||||||
wgTargetConside.active = false
|
wgTargetConside.active = false
|
||||||
contentUI.h = 55
|
contentUI.h = 55
|
||||||
contentUI.y = -24
|
contentUI.y = -24
|
||||||
clawImg.active = false
|
clawImg.active = false
|
||||||
else
|
else
|
||||||
if(not isTargetPlayer() and
|
if(not isTargetPlayer() and
|
||||||
not M.checkPvPMode() and
|
not M.checkPvPMode() and
|
||||||
getTargetLevel() > 0)then
|
getTargetLevel() > 0)then
|
||||||
if(clawImg.texture ~= "claw.tga")then
|
if(clawImg.texture ~= "claw.tga")then
|
||||||
clawImg.texture = "claw.tga"
|
clawImg.texture = "claw.tga"
|
||||||
clawImg.x = 7
|
clawImg.x = 7
|
||||||
clawImg.y = -6
|
clawImg.y = -6
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(targetUI.title == "")then
|
if(targetUI.title == "")then
|
||||||
wgTargetConside.active = false
|
wgTargetConside.active = false
|
||||||
clawImg.active = false
|
clawImg.active = false
|
||||||
end
|
end
|
||||||
contentUI.h = 18
|
contentUI.h = 18
|
||||||
contentUI.y = -26
|
contentUI.y = -26
|
||||||
end
|
end
|
||||||
|
|
||||||
if(getTargetLevelForce() > 0 and
|
if(getTargetLevelForce() > 0 and
|
||||||
not isTargetPlayer())then
|
not isTargetPlayer())then
|
||||||
if(getTargetLevel() > 0)then
|
if(getTargetLevel() > 0)then
|
||||||
--fix campfire, do not show claw
|
--fix campfire, do not show claw
|
||||||
if(tostring(getTargetSheet())~="object_campfire_28_b.creature")then
|
if(tostring(getTargetSheet())~="object_campfire_28_b.creature")then
|
||||||
wgTargetConside.active = true
|
wgTargetConside.active = true
|
||||||
clawImg.active = true
|
clawImg.active = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if(getTargetLevel() <= 0 or isTargetNPC())then
|
if(getTargetLevel() <= 0 or isTargetNPC())then
|
||||||
wgTargetConside.active = false
|
wgTargetConside.active = false
|
||||||
wgTargetLevel.active = false
|
wgTargetLevel.active = false
|
||||||
wgTargetLevel.hardtext = ""
|
wgTargetLevel.hardtext = ""
|
||||||
clawImg.active = false
|
clawImg.active = false
|
||||||
wgTargetConside.texture = "blank_n.tga"
|
wgTargetConside.texture = "blank_n.tga"
|
||||||
end
|
end
|
||||||
|
|
||||||
if((isTargetUser() or isTargetPlayer()) and M.PvPLogo())then
|
if((isTargetUser() or isTargetPlayer()) and M.PvPLogo())then
|
||||||
if(clawImg.texture ~= "pvp.tga")then
|
if(clawImg.texture ~= "pvp.tga")then
|
||||||
clawImg.texture = "pvp.tga"
|
clawImg.texture = "pvp.tga"
|
||||||
clawImg.x = 0
|
clawImg.x = 0
|
||||||
clawImg.y = 5
|
clawImg.y = 5
|
||||||
end
|
end
|
||||||
clawImg.active = true
|
clawImg.active = true
|
||||||
wgTargetConside.active = false
|
wgTargetConside.active = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.newConsider()
|
function M.newConsider()
|
||||||
local targetWindow = getUI("ui:interface:target")
|
local targetWindow = getUI("ui:interface:target")
|
||||||
local clawImg = targetWindow:find("slot_claw")
|
local clawImg = targetWindow:find("slot_claw")
|
||||||
local targetTitle = targetWindow:find("target_title")
|
local targetTitle = targetWindow:find("target_title")
|
||||||
local wgTargetLevel = targetWindow:find("target_level")
|
local wgTargetLevel = targetWindow:find("target_level")
|
||||||
local wgTargetConside = targetWindow:find("conside")
|
local wgTargetConside = targetWindow:find("conside")
|
||||||
local wgImpossible = targetWindow:find("impossible")
|
local wgImpossible = targetWindow:find("impossible")
|
||||||
local wgSlotRing = targetWindow:find("slot_ring")
|
local wgSlotRing = targetWindow:find("slot_ring")
|
||||||
local wgToolTip = targetWindow:find("target_tooltip")
|
local wgToolTip = targetWindow:find("target_tooltip")
|
||||||
local pvpMode = false
|
local pvpMode = false
|
||||||
|
|
||||||
local maxDiffLevel = 10
|
local maxDiffLevel = 10
|
||||||
if not pvpMode then
|
if not pvpMode then
|
||||||
for gm = 0, 7 do
|
for gm = 0, 7 do
|
||||||
if getDbProp("SERVER:GROUP:" .. tostring(gm) .. ":PRESENT") ~= 0 then
|
if getDbProp("SERVER:GROUP:" .. tostring(gm) .. ":PRESENT") ~= 0 then
|
||||||
maxDiffLevel = maxDiffLevel + 10
|
maxDiffLevel = maxDiffLevel + 10
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local impossible = (getTargetLevel() - getPlayerLevel() > maxDiffLevel)
|
local impossible = (getTargetLevel() - getPlayerLevel() > maxDiffLevel)
|
||||||
|
|
||||||
wgSlotRing.active = false
|
wgSlotRing.active = false
|
||||||
wgTargetConside.active = false
|
wgTargetConside.active = false
|
||||||
wgImpossible.active = false
|
wgImpossible.active = false
|
||||||
wgTargetConside.texture = "blank_n.tga"
|
wgTargetConside.texture = "blank_n.tga"
|
||||||
|
|
||||||
if impossible then
|
if impossible then
|
||||||
-- targeted object is too hard too beat, display a skull
|
-- targeted object is too hard too beat, display a skull
|
||||||
wgTargetLevel.active = false
|
wgTargetLevel.active = false
|
||||||
wgTargetConside.active = false
|
wgTargetConside.active = false
|
||||||
wgImpossible.texture = "skull_imp.tga"
|
wgImpossible.texture = "skull_imp.tga"
|
||||||
clawImg.active = false
|
clawImg.active = false
|
||||||
wgImpossible.active = true
|
wgImpossible.active = true
|
||||||
wgImpossible.color = "255 255 255 255"
|
wgImpossible.color = "255 255 255 255"
|
||||||
--wgImpossible.color = "255 50 50 255"
|
--wgImpossible.color = "255 50 50 255"
|
||||||
wgTargetLevel.hardtext = ""
|
wgTargetLevel.hardtext = ""
|
||||||
else
|
else
|
||||||
--fix campfire, do not show, claw, lvl and consider
|
--fix campfire, do not show, claw, lvl and consider
|
||||||
if(tostring(getTargetSheet())=="object_campfire_28_b.creature")then
|
if(tostring(getTargetSheet())=="object_campfire_28_b.creature")then
|
||||||
wgTargetConside.active = false
|
wgTargetConside.active = false
|
||||||
wgTargetLevel.active = false
|
wgTargetLevel.active = false
|
||||||
wgTargetLevel.hardtext = ""
|
wgTargetLevel.hardtext = ""
|
||||||
clawImg.active = false
|
clawImg.active = false
|
||||||
wgTargetConside.texture = "blank_n.tga"
|
wgTargetConside.texture = "blank_n.tga"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- player can see the level of the targeted creature, but not from NPC's
|
-- player can see the level of the targeted creature, but not from NPC's
|
||||||
if(not isTargetNPC())then
|
if(not isTargetNPC())then
|
||||||
wgTargetLevel.active = true
|
wgTargetLevel.active = true
|
||||||
wgTargetConside.active = true
|
wgTargetConside.active = true
|
||||||
wgImpossible.active = false
|
wgImpossible.active = false
|
||||||
wgImpossible.texture = "blank_n.tga"
|
wgImpossible.texture = "blank_n.tga"
|
||||||
|
|
||||||
wgTargetLevel.hardtext = tostring(getTargetLevel())
|
wgTargetLevel.hardtext = tostring(getTargetLevel())
|
||||||
wgTargetLevel.color = "255 255 255 255"
|
wgTargetLevel.color = "255 255 255 255"
|
||||||
wgImpossible.color = "255 255 255 255"
|
wgImpossible.color = "255 255 255 255"
|
||||||
end
|
end
|
||||||
|
|
||||||
local image={ 'b1', 'b2', 'b3', 'b4', 'b5', 'g1', 'g2', 'g3', 'g4', 'g5', 'ge1', 'ge2', 'ge3', 'ge4', 'ge5', 'r1', 'r2', 'r3', 'r4', 'r5', 'l1', 'l2', 'l3', 'l4', 'l5', 'l5', 'l5' }
|
local image={ 'b1', 'b2', 'b3', 'b4', 'b5', 'g1', 'g2', 'g3', 'g4', 'g5', 'ge1', 'ge2', 'ge3', 'ge4', 'ge5', 'r1', 'r2', 'r3', 'r4', 'r5', 'l1', 'l2', 'l3', 'l4', 'l5', 'l5', 'l5' }
|
||||||
|
|
||||||
if(getTargetLevel()<10)then
|
if(getTargetLevel()<10)then
|
||||||
wgTargetConside.texture = 'consider_gr.tga'
|
wgTargetConside.texture = 'consider_gr.tga'
|
||||||
end
|
end
|
||||||
|
|
||||||
for k,v in pairs(image) do
|
for k,v in pairs(image) do
|
||||||
if(getTargetLevel()>=tonumber(k .. 0))then
|
if(getTargetLevel()>=tonumber(k .. 0))then
|
||||||
wgTargetConside.texture = 'consider_' .. v .. '.tga'
|
wgTargetConside.texture = 'consider_' .. v .. '.tga'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- based on the 'level force', set a colored ring around the level
|
-- based on the 'level force', set a colored ring around the level
|
||||||
local levelForce = getTargetLevelForce()
|
local levelForce = getTargetLevelForce()
|
||||||
|
|
||||||
wgImpossible.active = true
|
wgImpossible.active = true
|
||||||
if levelForce < 6 then
|
if levelForce < 6 then
|
||||||
wgToolTip.tooltip = i18n.get("uittConsiderTargetLevel")
|
wgToolTip.tooltip = i18n.get("uittConsiderTargetLevel")
|
||||||
elseif levelForce == 6 then
|
elseif levelForce == 6 then
|
||||||
-- Named creature
|
-- Named creature
|
||||||
wgImpossible.color = "255 255 255 255"
|
wgImpossible.color = "255 255 255 255"
|
||||||
--wgImpossible.color = "191 225 254 255"
|
--wgImpossible.color = "191 225 254 255"
|
||||||
wgImpossible.texture = "skull_imp.tga"
|
wgImpossible.texture = "skull_imp.tga"
|
||||||
wgImpossible.active = true
|
wgImpossible.active = true
|
||||||
wgToolTip.tooltip = i18n.get("uittConsiderNamedOrMiniBoss")
|
wgToolTip.tooltip = i18n.get("uittConsiderNamedOrMiniBoss")
|
||||||
wgTargetLevel.hardtext = ""
|
wgTargetLevel.hardtext = ""
|
||||||
elseif levelForce == 7 then
|
elseif levelForce == 7 then
|
||||||
-- Boss
|
-- Boss
|
||||||
wgImpossible.color = "255 255 255 255"
|
wgImpossible.color = "255 255 255 255"
|
||||||
--wgImpossible.color = "222 191 254 255"
|
--wgImpossible.color = "222 191 254 255"
|
||||||
wgImpossible.texture = "skull_imp.tga"
|
wgImpossible.texture = "skull_imp.tga"
|
||||||
wgImpossible.active = true
|
wgImpossible.active = true
|
||||||
wgToolTip.tooltip = i18n.get("uittConsiderNamedOrMiniBoss")
|
wgToolTip.tooltip = i18n.get("uittConsiderNamedOrMiniBoss")
|
||||||
wgTargetLevel.hardtext = ""
|
wgTargetLevel.hardtext = ""
|
||||||
elseif levelForce == 8 then
|
elseif levelForce == 8 then
|
||||||
-- Mini-Boss
|
-- Mini-Boss
|
||||||
wgImpossible.color = "255 255 255 255"
|
wgImpossible.color = "255 255 255 255"
|
||||||
--wgImpossible.color = "254 191 191 255"
|
--wgImpossible.color = "254 191 191 255"
|
||||||
wgImpossible.texture = "skull_imp.tga"
|
wgImpossible.texture = "skull_imp.tga"
|
||||||
wgImpossible.active = true
|
wgImpossible.active = true
|
||||||
wgTargetLevel.hardtext = ""
|
wgTargetLevel.hardtext = ""
|
||||||
wgTargetConside.active = false
|
wgTargetConside.active = false
|
||||||
if isTargetNPC() then
|
if isTargetNPC() then
|
||||||
wgToolTip.tooltip = i18n.get("uittConsiderBossNpc")
|
wgToolTip.tooltip = i18n.get("uittConsiderBossNpc")
|
||||||
else
|
else
|
||||||
wgToolTip.tooltip = i18n.get("uittConsiderBoss")
|
wgToolTip.tooltip = i18n.get("uittConsiderBoss")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if impossible then
|
if impossible then
|
||||||
wgToolTip.tooltip = concatUCString(wgToolTip.tooltip, ucstring("\n"), i18n.get("uittConsiderUnknownLevel"))
|
wgToolTip.tooltip = concatUCString(wgToolTip.tooltip, ucstring("\n"), i18n.get("uittConsiderUnknownLevel"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
Loading…
Reference in a new issue