Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lua] Correct homepoint bit checking for teleport rejection #6224

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions scripts/globals/homepoint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,11 @@ xi.homepoint.onEventUpdate = function(player, csid, option, npc)

player:setTeleportMenu(xi.teleport.type.HOMEPOINT, favs)
elseif choice == selection.TELEPORT then
local hpIndex = bit.rshift(option, 16)
local origin = player:getLocalVar('originIndex')
local index = bit.band(bit.rshift(option, 16), 0xFF)
local hpBit = index % 32
local hpSet = math.floor(index / 32)

if not player:hasTeleport(xi.teleport.type.HOMEPOINT, hpIndex, math.floor(origin / 32)) then
if not player:hasTeleport(xi.teleport.type.HOMEPOINT, hpBit, hpSet) then
print(string.format("Player %s tried to teleport to an HP without it's destination being unlocked", player:getName()))
player:release()
end
Expand Down
Loading