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

Core: Add Open Moghouse #6910

Draft
wants to merge 6 commits into
base: base
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
33 changes: 33 additions & 0 deletions scripts/globals/moghouse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,39 @@ xi.moghouse.trySetMusic = function(player)
end
end

xi.moghouse.visitationNPCOnTrigger = function(player, npc, csid, ahtUrhganArg)
if player:getPartySize() > 1 then
for _, member in ipairs(player:getParty()) do
if member:getID() == 1 and member:isInMogHouse() then
player:printToPlayer(string.format('Client limitation: Players with ID 1 (%s) seemingly cannot be visited in their Mog House', member:getName()), xi.msg.channel.SYSTEM_3, '')
end
end
end

player:startEvent(csid, player:getNation(), ahtUrhganArg)
end

xi.moghouse.visitationNPCOnEventFinish = function(player, csid, option, visitationCSID)
if option == 0 or option == utils.EVENT_CANCELLED_OPTION then
return
end

if csid ~= visitationCSID then
return
end

if player:getPartySize() < 2 then
return
end

for _, member in ipairs(player:getParty()) do
if member:getID() == option then
player:gotoPlayer(member:getName())
return
end
end
end

xi.moghouse.onMoghouseZoneIn = function(player, prevZone)
local cs = -1

Expand Down
1 change: 0 additions & 1 deletion scripts/zones/Aht_Urhgan_Whitegate/DefaultActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ return {
['Wazyih'] = { event = 699 },
['Zaranf'] = { event = 668 },
['Zarfhid'] = { event = 220 },
['Zhamwaa'] = { event = 500 },
['Zubyahn'] = { event = 674 },
['Zwinam'] = { event = 682 },
['Zyfhil'] = { event = 653 },
Expand Down
17 changes: 17 additions & 0 deletions scripts/zones/Aht_Urhgan_Whitegate/npcs/Zhamwaa.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-----------------------------------
-- Area: Aht Urhgan Whitegate
-- NPC: Zhamwaa
-- !pos -103.323 0.001 -76.504 50
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
xi.moghouse.visitationNPCOnTrigger(player, npc, 500, 7)
end

entity.onEventFinish = function(player, csid, option)
xi.moghouse.visitationNPCOnEventFinish(player, csid, option, 500)
end

return entity
1 change: 0 additions & 1 deletion scripts/zones/Al_Zahbi/DefaultActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ return {
['Gaweesh'] = { event = 258 },
['Hadibal'] = { event = 245 },
['Iphaaf'] = { event = 254 },
['Krujaal'] = { event = 0 },
['Mihli_Aliapoh'] = { event = 267 },
['Najaaj'] = { event = 241 },
['Najelith'] = { event = 269 },
Expand Down
17 changes: 17 additions & 0 deletions scripts/zones/Al_Zahbi/npcs/Krujaal.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-----------------------------------
-- Area: Al Zahbi
-- NPC: Krujaal
-- !pos 36.522 0.000 -63.198 48
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
xi.moghouse.visitationNPCOnTrigger(player, npc, 0, 7)
end

entity.onEventFinish = function(player, csid, option)
xi.moghouse.visitationNPCOnEventFinish(player, csid, option, 0)
end

return entity
2 changes: 0 additions & 2 deletions scripts/zones/Bastok_Markets/DefaultActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ return {
['Epione'] = { event = 130 },
['Foss'] = { event = 270 },
['Gwill'] = { event = 113 },
['Hildith'] = { event = 488 },
['Horatius'] = { event = 110 },
['Julio'] = { event = 275 },
['Ken'] = { event = 361 },
['Lame_Deer'] = { event = 129 },
['Lavinia'] = { event = 123 },
['Loulia'] = { event = 487 },
['Marin'] = { event = 361 },
['Matthias'] = { event = 499 },
['Michea'] = { event = 125 },
Expand Down
17 changes: 17 additions & 0 deletions scripts/zones/Bastok_Markets/npcs/Hildith.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-----------------------------------
-- Area: Bastok Markets
-- NPC: Hildith
-- !pos -176.664 -8.000 25.158 235
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
xi.moghouse.visitationNPCOnTrigger(player, npc, 488)
end

entity.onEventFinish = function(player, csid, option)
xi.moghouse.visitationNPCOnEventFinish(player, csid, option, 488)
end

return entity
17 changes: 17 additions & 0 deletions scripts/zones/Bastok_Markets/npcs/Loulia.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-----------------------------------
-- Area: Bastok Markets
-- NPC: Loulia
-- !pos -176.212 -8.000 -25.049 235
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
xi.moghouse.visitationNPCOnTrigger(player, npc, 487)
end

entity.onEventFinish = function(player, csid, option)
xi.moghouse.visitationNPCOnEventFinish(player, csid, option, 487)
end

return entity
1 change: 0 additions & 1 deletion scripts/zones/Bastok_Mines/DefaultActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ return {
['Gregory'] = { event = 256 },
['Gumbah'] = { event = 52 },
['Hound_Nose'] = { event = 132 },
['Leonie'] = { event = 568 },
['Medicine_Eagle'] = { event = 25 },
['Mydon'] = { event = 20 },
['Nangst'] = { event = 24 },
Expand Down
17 changes: 17 additions & 0 deletions scripts/zones/Bastok_Mines/npcs/Leonie.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-----------------------------------
-- Area: Bastok Mines
-- NPC: Leonie
-- !pos 118.871 0.996 -83.916 234
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
xi.moghouse.visitationNPCOnTrigger(player, npc, 568)
end

entity.onEventFinish = function(player, csid, option)
xi.moghouse.visitationNPCOnEventFinish(player, csid, option, 568)
end

return entity
18 changes: 13 additions & 5 deletions scripts/zones/Northern_San_dOria/npcs/Pulloie.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
-----------------------------------
-- Area: Northern San d'Oria
-- NPC: Pulloie
-- !pos 132.847 -0.199 -2.627 231
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
if player:getNation() == 0 then
player:startEvent(595)
else
player:startEvent(598)
end
-- TODO:
-- if player:getNation() == 0 then
-- player:startEvent(595)
-- else
-- player:startEvent(598)
-- end

xi.moghouse.visitationNPCOnTrigger(player, npc, 838)
end

entity.onEventFinish = function(player, csid, option)
xi.moghouse.visitationNPCOnEventFinish(player, csid, option, 838)
end

return entity
1 change: 0 additions & 1 deletion scripts/zones/Port_Bastok/DefaultActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ return {
['Tilian'] = { event = 100 },
['Trilok'] = { event = 44 },
['Varden'] = { event = 141 },
['Wurteh'] = { event = 95 },
['Yazan'] = { event = 190 },
['Zeldaff'] = { event = 30 },
}
18 changes: 18 additions & 0 deletions scripts/zones/Port_Bastok/npcs/Wurteh.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-----------------------------------
-- Area: Port Bastok
-- NPC: Wurteh
-- !pos 72.782 8.499 -242.102 236
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
-- TODO: What is csid 95?
xi.moghouse.visitationNPCOnTrigger(player, npc, 382)
end

entity.onEventFinish = function(player, csid, option)
xi.moghouse.visitationNPCOnEventFinish(player, csid, option, 382)
end

return entity
1 change: 0 additions & 1 deletion scripts/zones/Port_San_dOria/DefaultActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ return {
['Miene'] = { event = 553 },
['Noquerelle'] = { event = 583 },
['Parcarin'] = { event = 566 },
['Phersula'] = { event = 775 },
['Portaure'] = { event = 651 },
['Prietta'] = { event = 596 },
['Rielle'] = { event = 564 },
Expand Down
17 changes: 17 additions & 0 deletions scripts/zones/Port_San_dOria/npcs/Phersula.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-----------------------------------
-- Area: Port San d'Oria
-- NPC: Phersula
-- !pos 80.316 -15.999 -134.112 232
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
xi.moghouse.visitationNPCOnTrigger(player, npc, 775)
end

entity.onEventFinish = function(player, csid, option)
xi.moghouse.visitationNPCOnEventFinish(player, csid, option, 775)
end

return entity
1 change: 0 additions & 1 deletion scripts/zones/Port_Windurst/DefaultActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ return {
['Ada'] = { event = 44 },
['Aigneis'] = { event = 192 },
['Baladanzo'] = { event = 354 },
['Boronene'] = { event = 638 },
['Breanainn'] = { event = 182 },
['Calixte'] = { event = 46 },
['Chakwaina'] = { event = 350 },
Expand Down
17 changes: 17 additions & 0 deletions scripts/zones/Port_Windurst/npcs/Boronene.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-----------------------------------
-- Area: Port Windurst
-- NPC: Boronene
-- !pos 201.651 -12.000 229.584 240
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
xi.moghouse.visitationNPCOnTrigger(player, npc, 638)
end

entity.onEventFinish = function(player, csid, option)
xi.moghouse.visitationNPCOnEventFinish(player, csid, option, 638)
end

return entity
1 change: 0 additions & 1 deletion scripts/zones/Southern_San_dOria/DefaultActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ return {
['Estiliphire'] = { event = 897 },
['Femitte'] = { event = 661 },
['Foletta'] = { event = 666 },
['Fulchia'] = { event = 587 },
['Gizel'] = { event = 676 },
['Guilboire'] = { event = 657 },
['Hae_Jakhya'] = { event = 610 },
Expand Down
18 changes: 18 additions & 0 deletions scripts/zones/Southern_San_dOria/npcs/Fulchia.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-----------------------------------
-- Area: Northern San d'Oria
-- NPC: Fulchia
-- !pos 158.522 -1.999 164.928 230
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
-- TODO: 585, 587?
xi.moghouse.visitationNPCOnTrigger(player, npc, 893)
end

entity.onEventFinish = function(player, csid, option)
xi.moghouse.visitationNPCOnEventFinish(player, csid, option, 893)
end

return entity
1 change: 0 additions & 1 deletion scripts/zones/Windurst_Walls/DefaultActions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ return {
['Purere'] = { event = 311 },
['Quentin'] = { event = 334 },
['Shantotto'] = { event = 164 },
['Shinchai-Tocchai'] = { event = 505 },
['Six_of_Diamonds'] = { event = 265 },
['Suhie-Kaihie'] = { event = 291 },
['Takoda'] = { event = 332 },
Expand Down
18 changes: 18 additions & 0 deletions scripts/zones/Windurst_Walls/npcs/Shinchai-Tocchai.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-----------------------------------
-- Area: Windurst Walls
-- NPC: Shinchai-Tocchai
-- !pos -220.551 0.999 -116.916 239
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
-- Caps: 505, 0, 3, 1, 300, 2600, 1543, 1411472642, 128
xi.moghouse.visitationNPCOnTrigger(player, npc, 505)
end

entity.onEventFinish = function(player, csid, option)
xi.moghouse.visitationNPCOnEventFinish(player, csid, option, 505)
end

return entity
6 changes: 4 additions & 2 deletions scripts/zones/Windurst_Waters/npcs/Machitata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- Area: Windurst Waters
-- NPC: Machitata
-- Involved in Quest: Hat in Hand
-- !pos 163 0 -22 238
-- !pos 164.230 0.999 -25.400 238
-----------------------------------
local ID = zones[xi.zone.WINDURST_WATERS]
-----------------------------------
Expand All @@ -17,14 +17,16 @@ entity.onTrigger = function(player, npc)
player:messageSpecial(ID.text.YOU_SHOW_OFF_THE, 0, xi.ki.NEW_MODEL_HAT)
player:startEvent(58)
else
player:startEvent(526)
xi.moghouse.visitationNPCOnTrigger(player, npc, 984)
end
end

entity.onEventFinish = function(player, csid, option, npc)
if csid == 58 then
player:setCharVar('QuestHatInHand_var', utils.mask.setBit(player:getCharVar('QuestHatInHand_var'), 0, true))
player:incrementCharVar('QuestHatInHand_count', 1)
else
xi.moghouse.visitationNPCOnEventFinish(player, csid, option, 984)
end
end

Expand Down
1 change: 0 additions & 1 deletion scripts/zones/Windurst_Woods/DefaultActions.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
-- local ID = zones[xi.zone.WINDURST_WOODS]

return {
['Abby_Jalunshi'] = { event = 798 },
['Aja-Panja'] = { event = 247 },
['An_Polaali'] = { event = 44 },
['An_Shanaa'] = { event = 45 },
Expand Down
17 changes: 17 additions & 0 deletions scripts/zones/Windurst_Woods/npcs/Abby_Jalunshi.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-----------------------------------
-- Area: Windurst Woods
-- NPC: Abby Jalunshi
-- !pos -101.895 -4.000 36.172 241
-----------------------------------
---@type TNpcEntity
local entity = {}

entity.onTrigger = function(player, npc)
xi.moghouse.visitationNPCOnTrigger(player, npc, 798)
end

entity.onEventFinish = function(player, csid, option)
xi.moghouse.visitationNPCOnEventFinish(player, csid, option, 798)
end

return entity
8 changes: 6 additions & 2 deletions src/map/entities/baseentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,13 @@ void CBaseEntity::ResetLocalVars()
m_localVars.clear();
}

uint32 CBaseEntity::GetLocalVar(const std::string& var)
uint32 CBaseEntity::GetLocalVar(const std::string& var) const
{
return m_localVars[var];
if (const auto it = m_localVars.find(var); it != m_localVars.end())
{
return it->second;
}
return 0;
}

std::map<std::string, uint32>& CBaseEntity::GetLocalVars()
Expand Down
Loading