Skip to content

Commit

Permalink
on_look.lua: add player id and fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
elsongabriel committed May 22, 2024
1 parent e8c3582 commit 659c659
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions data/scripts/eventcallbacks/player/on_look.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ function callback.playerOnLook(player, thing, position, distance)
description = string.format("%s\nDecays to: %d", description, decayId)
end
elseif thing:isCreature() then
local str = "%s\nHealth: %d / %d"
local str = "%s\n%s\nHealth: %d / %d"
if thing:isPlayer() and thing:getMaxMana() > 0 then
str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
end
description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
local pId = string.format("Player ID: %i", thing:getGuid())
description = string.format(str, description, pId, thing:getHealth(), thing:getMaxHealth())
end

description = string.format("%s\nPosition: (%d, %d, %d)", description, position.x, position.y, position.z)
Expand All @@ -76,7 +77,7 @@ function callback.playerOnLook(player, thing, position, distance)
description = string.format("%s\nSpeed: %d", description, speed)

if thing:isPlayer() then
description = string.format("%s\nIP: %s.", description, Game.convertIpToString(thing:getIp()))
description = string.format("%s\nIP: %s", description, Game.convertIpToString(thing:getIp()))
end
end
end
Expand Down

0 comments on commit 659c659

Please sign in to comment.