Skip to content

Commit 72917d4

Browse files
authored
fix: onLook nil value (opentibiabr#2856)
Showing nil on look monsters and npcs.
1 parent 3d483fc commit 72917d4

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

data/scripts/eventcallbacks/player/on_look.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,16 @@ function callback.playerOnLook(player, thing, position, distance)
6060
description = string.format("%s\nDecays to: %d", description, decayId)
6161
end
6262
elseif thing:isCreature() then
63-
local str, pId = "%s\n%s\nHealth: %d / %d"
63+
local str, id = "%s\n%s\nHealth: %d / %d"
6464
if thing:isPlayer() and thing:getMaxMana() > 0 then
65-
pId = string.format("Player ID: %i", thing:getGuid())
65+
id = string.format("Player ID: %i", thing:getGuid())
6666
str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
67+
elseif thing:isMonster() then
68+
id = string.format("Monster ID: %i", thing:getId())
69+
elseif thing:isNpc() then
70+
id = string.format("NPC ID: %i", thing:getId())
6771
end
68-
description = string.format(str, description, pId, thing:getHealth(), thing:getMaxHealth())
72+
description = string.format(str, description, id, thing:getHealth(), thing:getMaxHealth())
6973
end
7074

7175
description = string.format("%s\nPosition: (%d, %d, %d)", description, position.x, position.y, position.z)

0 commit comments

Comments
 (0)