Skip to content

Commit

Permalink
Adjust logic of party type chat in PrintToArea()
Browse files Browse the repository at this point in the history
We were checking for an alliance even if the players party wasn't in one.

Fixes LandSandBoat#4583
  • Loading branch information
TeoTwawki committed Oct 5, 2023
1 parent 85150c0 commit b96eb0b
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/map/lua/lua_baseentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,18 +356,25 @@ void CLuaBaseEntity::PrintToArea(std::string const& message, sol::object const&
}
else if (messageRange == MESSAGE_AREA_PARTY)
{
int8 packetData[8]{};
if (PChar->PParty->m_PAlliance)
if (PChar->PParty)
{
ref<uint32>(packetData, 0) = PChar->PParty->m_PAlliance->m_AllianceID;
int8 packetData[8]{};
auto partyID = PChar->PParty->GetPartyID();
auto chatMsg = MSG_CHAT_PARTY;

if (PChar->PParty->m_PAlliance)
{
partyID = PChar->PParty->m_PAlliance->m_AllianceID;
chatMsg = MSG_CHAT_ALLIANCE;
}

ref<uint32>(packetData, 0) = partyID;
ref<uint32>(packetData, 4) = 0; // No ID so that the PChar sees the message too
message::send(MSG_CHAT_ALLIANCE, packetData, sizeof packetData, new CChatMessagePacket(PChar, messageLook, message, name));
message::send(chatMsg, packetData, sizeof packetData, new CChatMessagePacket(PChar, messageLook, message, name));
}
else if (PChar->PParty)
else // No ID doesn't handle solo w/no trusts.
{
ref<uint32>(packetData, 0) = PChar->PParty->GetPartyID();
ref<uint32>(packetData, 4) = 0; // No ID so that the PChar sees the message too
message::send(MSG_CHAT_PARTY, packetData, sizeof packetData, new CChatMessagePacket(PChar, messageLook, message, name));
PChar->loc.zone->PushPacket(PChar, CHAR_INRANGE_SELF, new CChatMessagePacket(PChar, messageLook, message, name));
}
}
else if (messageRange == MESSAGE_AREA_YELL)
Expand Down

0 comments on commit b96eb0b

Please sign in to comment.