tibia-client/modules/gamelib/creature.lua

108 lines
3.0 KiB
Lua
Raw Normal View History

2012-06-26 00:13:30 +02:00
-- @docclass Creature
-- @docconsts @{
SkullNone = 0
SkullYellow = 1
SkullGreen = 2
SkullWhite = 3
SkullRed = 4
SkullBlack = 5
SkullOrange = 6
ShieldNone = 0
ShieldWhiteYellow = 1
ShieldWhiteBlue = 2
ShieldBlue = 3
ShieldYellow = 4
ShieldBlueSharedExp = 5
ShieldYellowSharedExp = 6
ShieldBlueNoSharedExpBlink = 7
ShieldYellowNoSharedExpBlink = 8
ShieldBlueNoSharedExp = 9
ShieldYellowNoSharedExp = 10
EmblemNone = 0
EmblemGreen = 1
EmblemRed = 2
EmblemBlue = 3
2012-06-26 00:13:30 +02:00
-- @}
function getSkullImagePath(skullId)
local path
if skullId == SkullYellow then
path = '/images/game/skulls/skull_yellow'
elseif skullId == SkullGreen then
path = '/images/game/skulls/skull_green'
elseif skullId == SkullWhite then
path = '/images/game/skulls/skull_white'
elseif skullId == SkullRed then
path = '/images/game/skulls/skull_red'
elseif skullId == SkullBlack then
path = '/images/game/skulls/skull_black'
elseif skullId == SkullOrange then
path = '/images/game/skulls/skull_orange'
end
return path
end
function getShieldImagePathAndBlink(shieldId)
2013-01-17 19:57:03 +01:00
local path, blink
if shieldId == ShieldWhiteYellow then
path, blink = '/images/game/shields/shield_yellow_white', false
elseif shieldId == ShieldWhiteBlue then
path, blink = '/images/game/shields//shield_blue_white', false
elseif shieldId == ShieldBlue then
path, blink = '/images/game/shields//shield_blue', false
elseif shieldId == ShieldYellow then
path, blink = '/images/game/shields//shield_yellow', false
elseif shieldId == ShieldBlueSharedExp then
path, blink = '/images/game/shields//shield_blue_shared', false
elseif shieldId == ShieldYellowSharedExp then
path, blink = '/images/game/shields//shield_yellow_shared', false
elseif shieldId == ShieldBlueNoSharedExpBlink then
path, blink = '/images/game/shields//shield_blue_not_shared', true
elseif shieldId == ShieldYellowNoSharedExpBlink then
path, blink = '/images/game/shields//shield_yellow_not_shared', true
elseif shieldId == ShieldBlueNoSharedExp then
path, blink = '/images/game/shields//shield_blue_not_shared', false
elseif shieldId == ShieldYellowNoSharedExp then
path, blink = '/images/game/shields//shield_yellow_not_shared', false
end
2013-01-17 19:57:03 +01:00
return path, blink
end
function getEmblemImagePath(emblemId)
local path
if emblemId == EmblemGreen then
path = '/images/game/emblems/emblem_green'
elseif emblemId == EmblemRed then
path = '/images/game/emblems/emblem_red'
elseif emblemId == EmblemBlue then
path = '/images/game/emblems/emblem_blue'
end
return path
end
function Creature:onSkullChange(skullId)
local imagePath = getSkullImagePath(skullId)
if imagePath then
self:setSkullTexture(imagePath)
end
end
function Creature:onShieldChange(shieldId)
local imagePath, blink = getShieldImagePathAndBlink(shieldId)
if imagePath then
self:setShieldTexture(imagePath, blink)
end
end
function Creature:onEmblemChange(emblemId)
local imagePath = getEmblemImagePath(emblemId)
if imagePath then
self:setEmblemTexture(imagePath)
end
end