mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/PacketIO: Updated and enabled SMSG_SET_FACTION_STANDING
This commit is contained in:
@@ -174,35 +174,24 @@ void ReputationMgr::SendForceReactions()
|
||||
|
||||
void ReputationMgr::SendState(FactionState const* faction)
|
||||
{
|
||||
uint32 count = 1;
|
||||
|
||||
WorldPacket data(SMSG_SET_FACTION_STANDING, 17);
|
||||
data << float(0);
|
||||
data << uint8(_sendFactionIncreased);
|
||||
_sendFactionIncreased = false; // Reset
|
||||
|
||||
size_t p_count = data.wpos();
|
||||
data << uint32(count);
|
||||
|
||||
data << uint32(faction->ReputationListID);
|
||||
data << uint32(faction->Standing);
|
||||
|
||||
WorldPackets::Reputation::SetFactionStanding setFactionStanding;
|
||||
setFactionStanding.ReferAFriendBonus = 0.0f;
|
||||
setFactionStanding.BonusFromAchievementSystem = 0.0f;
|
||||
setFactionStanding.Faction.emplace_back(int32(faction->ReputationListID), faction->Standing);
|
||||
for (FactionStateList::iterator itr = _factions.begin(); itr != _factions.end(); ++itr)
|
||||
{
|
||||
if (itr->second.needSend)
|
||||
{
|
||||
itr->second.needSend = false;
|
||||
if (itr->second.ReputationListID != faction->ReputationListID)
|
||||
{
|
||||
data << uint32(itr->second.ReputationListID);
|
||||
data << uint32(itr->second.Standing);
|
||||
++count;
|
||||
}
|
||||
setFactionStanding.Faction.emplace_back(int32(itr->second.ReputationListID), itr->second.Standing);
|
||||
}
|
||||
}
|
||||
|
||||
data.put<uint32>(p_count, count);
|
||||
_player->SendDirectMessage(&data);
|
||||
setFactionStanding.ShowVisual = _sendFactionIncreased;
|
||||
_player->SendDirectMessage(setFactionStanding.Write());
|
||||
|
||||
_sendFactionIncreased = false; // Reset
|
||||
}
|
||||
|
||||
void ReputationMgr::SendInitialReputations()
|
||||
|
||||
@@ -50,3 +50,24 @@ WorldPacket const* WorldPackets::Reputation::SetForcedReactions::Write()
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Reputation::FactionStandingData const& factionStanding)
|
||||
{
|
||||
data << int32(factionStanding.Index);
|
||||
data << int32(factionStanding.Standing);
|
||||
return data;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Reputation::SetFactionStanding::Write()
|
||||
{
|
||||
_worldPacket << float(ReferAFriendBonus);
|
||||
_worldPacket << float(BonusFromAchievementSystem);
|
||||
_worldPacket << uint32(Faction.size());
|
||||
for (FactionStandingData const& factionStanding : Faction)
|
||||
_worldPacket << factionStanding;
|
||||
|
||||
_worldPacket.WriteBit(ShowVisual);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -69,6 +69,28 @@ namespace WorldPackets
|
||||
|
||||
std::vector<ForcedReaction> Reactions;
|
||||
};
|
||||
|
||||
struct FactionStandingData
|
||||
{
|
||||
FactionStandingData() { }
|
||||
FactionStandingData(int32 index, int32 standing) : Index(index), Standing(standing) { }
|
||||
|
||||
int32 Index = 0;
|
||||
int32 Standing = 0;
|
||||
};
|
||||
|
||||
class SetFactionStanding final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
SetFactionStanding() : ServerPacket(SMSG_SET_FACTION_STANDING) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
float ReferAFriendBonus = 0.0f;
|
||||
float BonusFromAchievementSystem = 0.0f;
|
||||
std::vector<FactionStandingData> Faction;
|
||||
bool ShowVisual = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1573,7 +1573,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_DUNGEON_DIFFICULTY, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FACTION_AT_WAR, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FACTION_NOT_VISIBLE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FACTION_STANDING, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FACTION_STANDING, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FACTION_VISIBLE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FLAT_SPELL_MODIFIER, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FORCED_REACTIONS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
|
||||
Reference in New Issue
Block a user