Core/Util: Fixed "value" name in Optional struct to follow code style

This commit is contained in:
Shauren
2014-11-20 01:17:45 +01:00
parent abff9de719
commit 4764c3ea77
15 changed files with 141 additions and 151 deletions
+19 -28
View File
@@ -3168,6 +3168,7 @@ void Player::SendKnownSpells()
WorldPackets::Spell::SendKnownSpells knownSpells;
knownSpells.InitialLogin = false; /// @todo
knownSpells.KnownSpells.reserve(m_spells.size());
for (PlayerSpellMap::value_type const& spell : m_spells)
{
if (spell.second->state == PLAYERSPELL_REMOVED)
@@ -22980,8 +22981,6 @@ void Player::SendInitialPacketsBeforeAddToMap()
/// Pass 'this' as argument because we're not stored in ObjectAccessor yet
GetSocial()->SendSocialList(this);
// guild bank list wtf?
/// SMSG_SPELL_CATEGORY_COOLDOWN
GetSession()->SendSpellCategoryCooldowns();
@@ -22991,7 +22990,6 @@ void Player::SendInitialPacketsBeforeAddToMap()
// SMSG_SET_PROFICIENCY
// SMSG_SET_PCT_SPELL_MODIFIER
// SMSG_SET_FLAT_SPELL_MODIFIER
// SMSG_UPDATE_AURA_DURATION
/// SMSG_TALENTS_INFO
SendTalentsInfoData();
@@ -22999,10 +22997,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
SendKnownSpells();
/// SMSG_SEND_UNLEARN_SPELLS
{
WorldPackets::Spell::SendUnlearnSpells packet;
SendDirectMessage(packet.Write());
}
SendDirectMessage(WorldPackets::Spell::SendUnlearnSpells().Write());
/// SMSG_ACTION_BUTTONS
SendInitialActionButtons();
@@ -23019,29 +23014,25 @@ void Player::SendInitialPacketsBeforeAddToMap()
m_achievementMgr->SendAllAchievementData(this);
/// SMSG_LOGIN_SETTIMESPEED
{
static float const TimeSpeed = 0.01666667f;
WorldPackets::Misc::LoginSetTimeSpeed packet;
packet.NewSpeed = TimeSpeed;
packet.GameTime = sWorld->GetGameTime();
packet.ServerTime = sWorld->GetGameTime();
packet.GameTimeHolidayOffset = 0; /// @todo
packet.ServerTimeHolidayOffset = 0; /// @todo
SendDirectMessage(packet.Write());
}
static float const TimeSpeed = 0.01666667f;
WorldPackets::Misc::LoginSetTimeSpeed loginSetTimeSpeed;
loginSetTimeSpeed.NewSpeed = TimeSpeed;
loginSetTimeSpeed.GameTime = sWorld->GetGameTime();
loginSetTimeSpeed.ServerTime = sWorld->GetGameTime();
loginSetTimeSpeed.GameTimeHolidayOffset = 0; /// @todo
loginSetTimeSpeed.ServerTimeHolidayOffset = 0; /// @todo
SendDirectMessage(loginSetTimeSpeed.Write());
/// SMSG_WORLD_SERVER_INFO
{
WorldPackets::Misc::WorldServerInfo packet;
packet.IneligibleForLootMask.Clear(); /// @todo
packet.WeeklyReset = sWorld->GetNextWeeklyQuestsResetTime() - WEEK;
packet.InstanceGroupSize.Clear(); /// @todo
packet.IsTournamentRealm = 0; /// @todo
packet.RestrictedAccountMaxLevel.Clear(); /// @todo
packet.RestrictedAccountMaxMoney.Clear(); /// @todo
packet.DifficultyID = GetMap()->GetDifficulty();
SendDirectMessage(packet.Write());
}
WorldPackets::Misc::WorldServerInfo worldServerInfo;
worldServerInfo.IneligibleForLootMask.Clear(); /// @todo
worldServerInfo.WeeklyReset = sWorld->GetNextWeeklyQuestsResetTime() - WEEK;
worldServerInfo.InstanceGroupSize.Clear(); /// @todo
worldServerInfo.IsTournamentRealm = 0; /// @todo
worldServerInfo.RestrictedAccountMaxLevel.Clear(); /// @todo
worldServerInfo.RestrictedAccountMaxMoney.Clear(); /// @todo
worldServerInfo.DifficultyID = GetMap()->GetDifficulty();
SendDirectMessage(worldServerInfo.Write());
// SMSG_TALENTS_INFO x 2 for pet (unspent points and talents in separate packets...)
// SMSG_PET_GUIDS
+4 -6
View File
@@ -4850,7 +4850,7 @@ void Unit::SendSpellDamageImmune(Unit* target, uint32 spellId)
void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo)
{
TC_LOG_DEBUG("entities.unit", "WORLD: Sending SMSG_ATTACKERSTATEUPDATE");
WorldPackets::Combat::AttackerStateUpdate packet;
packet.HitInfo = damageInfo->HitInfo;
packet.AttackerGUID = damageInfo->attacker->GetGUID();
@@ -4859,7 +4859,7 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo)
int32 overkill = damageInfo->damage - damageInfo->target->GetHealth();
packet.OverDamage = (overkill < 0 ? -1 : overkill);
WorldPackets::Combat::SubDamage& subDmg = packet.SubDmg.value;
WorldPackets::Combat::SubDamage& subDmg = packet.SubDmg.Value;
subDmg.SchoolMask = damageInfo->damageSchoolMask; // School of sub damage
subDmg.FDamage = damageInfo->damage; // sub damage
subDmg.Damage = damageInfo->damage; // Sub Damage
@@ -15926,12 +15926,11 @@ void Unit::SendThreatListUpdate()
{
if (!getThreatManager().isThreatListEmpty())
{
uint32 count = getThreatManager().getThreatList().size();
TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message");
WorldPackets::Combat::ThreatUpdate packet;
packet.UnitGUID = GetGUID();
ThreatContainer::StorageType const &tlist = getThreatManager().getThreatList();
packet.ThreatList.reserve(tlist.size());
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
WorldPackets::Combat::ThreatInfo info;
@@ -15947,13 +15946,12 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference)
{
if (!getThreatManager().isThreatListEmpty())
{
uint32 count = getThreatManager().getThreatList().size();
TC_LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message");
WorldPackets::Combat::HighestThreatUpdate packet;
packet.UnitGUID = GetGUID();
packet.HighestThreatGUID = pHostileReference->getUnitGuid();
ThreatContainer::StorageType const &tlist = getThreatManager().getThreatList();
packet.ThreatList.reserve(tlist.size());
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
WorldPackets::Combat::ThreatInfo info;
+9 -9
View File
@@ -1482,23 +1482,23 @@ void Guild::SendQueryResponse(WorldSession* session)
response.GuildGuid = GetGUID();
response.Info.HasValue = true;
response.Info.value.GuildGUID = GetGUID();
response.Info.value.VirtualRealmAddress = GetVirtualRealmAddress();
response.Info.Value.GuildGUID = GetGUID();
response.Info.Value.VirtualRealmAddress = GetVirtualRealmAddress();
response.Info.value.EmblemStyle = m_emblemInfo.GetStyle();
response.Info.value.EmblemColor = m_emblemInfo.GetColor();
response.Info.value.BorderStyle = m_emblemInfo.GetBorderStyle();
response.Info.value.BorderColor = m_emblemInfo.GetBorderColor();
response.Info.value.BackgroundColor = m_emblemInfo.GetBackgroundColor();
response.Info.Value.EmblemStyle = m_emblemInfo.GetStyle();
response.Info.Value.EmblemColor = m_emblemInfo.GetColor();
response.Info.Value.BorderStyle = m_emblemInfo.GetBorderStyle();
response.Info.Value.BorderColor = m_emblemInfo.GetBorderColor();
response.Info.Value.BackgroundColor = m_emblemInfo.GetBackgroundColor();
for (uint8 i = 0; i < _GetRanksSize(); ++i)
{
WorldPackets::Guild::QueryGuildInfoResponse::GuildInfo::GuildInfoRank info
(m_ranks[i].GetId(), i, m_ranks[i].GetName());
response.Info.value.Ranks.insert(info);
response.Info.Value.Ranks.insert(info);
}
response.Info.value.GuildName = m_name;
response.Info.Value.GuildName = m_name;
session->SendPacket(response.Write());
TC_LOG_DEBUG("guild", "SMSG_GUILD_QUERY_RESPONSE [%s]", session->GetPlayerInfo().c_str());
+8 -8
View File
@@ -27,20 +27,20 @@ void WorldSession::SendAuthResponse(uint8 code, bool queued, uint32 queuePos)
response.SuccessInfo.HasValue = code == AUTH_OK;
response.Result = code;
response.WaitInfo.HasValue = queued;
response.WaitInfo.value.WaitCount = queuePos;
response.WaitInfo.Value.WaitCount = queuePos;
if (code == AUTH_OK)
{
response.SuccessInfo.value.AccountExpansionLevel = Expansion();
response.SuccessInfo.value.ActiveExpansionLevel = Expansion();
response.SuccessInfo.value.VirtualRealmAddress = GetVirtualRealmAddress();
response.SuccessInfo.Value.AccountExpansionLevel = Expansion();
response.SuccessInfo.Value.ActiveExpansionLevel = Expansion();
response.SuccessInfo.Value.VirtualRealmAddress = GetVirtualRealmAddress();
std::string realmName = sObjectMgr->GetRealmName(realmHandle.Index);
// Send current home realm. Also there is no need to send it later in realm queries.
response.SuccessInfo.value.VirtualRealms.emplace_back(GetVirtualRealmAddress(), true, false, realmName, realmName);
response.SuccessInfo.Value.VirtualRealms.emplace_back(GetVirtualRealmAddress(), true, false, realmName, realmName);
response.SuccessInfo.value.AvailableClasses = &sObjectMgr->GetClassExpansionRequirements();
response.SuccessInfo.value.AvailableRaces = &sObjectMgr->GetRaceExpansionRequirements();
response.SuccessInfo.Value.AvailableClasses = &sObjectMgr->GetClassExpansionRequirements();
response.SuccessInfo.Value.AvailableRaces = &sObjectMgr->GetRaceExpansionRequirements();
}
SendPacket(response.Write());
@@ -60,7 +60,7 @@ void WorldSession::SendAuthWaitQue(uint32 position)
{
response.WaitInfo.HasValue = true;
response.SuccessInfo.HasValue = false;
response.WaitInfo.value.WaitCount = position;
response.WaitInfo.Value.WaitCount = position;
response.Result = AUTH_WAIT_QUEUE;
}
+13 -13
View File
@@ -1787,7 +1787,7 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(PreparedQueryResult res
if (factionChangeInfo->SkinID.HasValue)
{
playerBytes &= ~uint32(0xFF);
playerBytes |= factionChangeInfo->SkinID.value;
playerBytes |= factionChangeInfo->SkinID.Value;
}
else
factionChangeInfo->SkinID.Set(uint8(playerBytes & 0xFF));
@@ -1795,7 +1795,7 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(PreparedQueryResult res
if (factionChangeInfo->FaceID.HasValue)
{
playerBytes &= ~(uint32(0xFF) << 8);
playerBytes |= uint32(factionChangeInfo->FaceID.value) << 8;
playerBytes |= uint32(factionChangeInfo->FaceID.Value) << 8;
}
else
factionChangeInfo->FaceID.Set(uint8((playerBytes2 >> 8) & 0xFF));
@@ -1803,7 +1803,7 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(PreparedQueryResult res
if (factionChangeInfo->HairStyleID.HasValue)
{
playerBytes &= ~(uint32(0xFF) << 16);
playerBytes |= uint32(factionChangeInfo->HairStyleID.value) << 16;
playerBytes |= uint32(factionChangeInfo->HairStyleID.Value) << 16;
}
else
factionChangeInfo->HairStyleID.Set(uint8((playerBytes2 >> 16) & 0xFF));
@@ -1811,7 +1811,7 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(PreparedQueryResult res
if (factionChangeInfo->HairColorID.HasValue)
{
playerBytes &= ~(uint32(0xFF) << 24);
playerBytes |= uint32(factionChangeInfo->HairColorID.value) << 24;
playerBytes |= uint32(factionChangeInfo->HairColorID.Value) << 24;
}
else
factionChangeInfo->HairColorID.Set(uint8((playerBytes2 >> 24) & 0xFF));
@@ -1819,7 +1819,7 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(PreparedQueryResult res
if (factionChangeInfo->FacialHairStyleID.HasValue)
{
playerBytes2 &= ~0xFF;
playerBytes2 |= factionChangeInfo->FacialHairStyleID.value;
playerBytes2 |= factionChangeInfo->FacialHairStyleID.Value;
}
else
factionChangeInfo->FacialHairStyleID.Set(uint8(playerBytes2 & 0xFF));
@@ -2514,14 +2514,14 @@ void WorldSession::SendCharFactionChange(ResponseCodes result, WorldPackets::Cha
if (result == RESPONSE_SUCCESS)
{
packet.Display.HasValue = true;
packet.Display.value.Name = factionChangeInfo->Name;
packet.Display.value.SexID = factionChangeInfo->SexID;
packet.Display.value.SkinID = factionChangeInfo->SkinID.value;
packet.Display.value.HairColorID = factionChangeInfo->HairColorID.value;
packet.Display.value.HairStyleID = factionChangeInfo->HairStyleID.value;
packet.Display.value.FacialHairStyleID = factionChangeInfo->FacialHairStyleID.value;
packet.Display.value.FaceID = factionChangeInfo->FaceID.value;
packet.Display.value.RaceID = factionChangeInfo->RaceID;
packet.Display.Value.Name = factionChangeInfo->Name;
packet.Display.Value.SexID = factionChangeInfo->SexID;
packet.Display.Value.SkinID = factionChangeInfo->SkinID.Value;
packet.Display.Value.HairColorID = factionChangeInfo->HairColorID.Value;
packet.Display.Value.HairStyleID = factionChangeInfo->HairStyleID.Value;
packet.Display.Value.FacialHairStyleID = factionChangeInfo->FacialHairStyleID.Value;
packet.Display.Value.FaceID = factionChangeInfo->FaceID.Value;
packet.Display.Value.RaceID = factionChangeInfo->RaceID;
}
SendPacket(packet.Write());
@@ -65,20 +65,20 @@ WorldPacket const* WorldPackets::Auth::AuthResponse::Write()
if (SuccessInfo.HasValue)
{
_worldPacket << uint32(SuccessInfo.value.VirtualRealmAddress);
_worldPacket << uint32(SuccessInfo.value.VirtualRealms.size());
_worldPacket << uint32(SuccessInfo.value.TimeRemain);
_worldPacket << uint32(SuccessInfo.value.TimeOptions);
_worldPacket << uint32(SuccessInfo.value.TimeRested);
_worldPacket << uint8(SuccessInfo.value.ActiveExpansionLevel);
_worldPacket << uint8(SuccessInfo.value.AccountExpansionLevel);
_worldPacket << uint32(SuccessInfo.value.TimeSecondsUntilPCKick);
_worldPacket << uint32(SuccessInfo.value.AvailableRaces->size());
_worldPacket << uint32(SuccessInfo.value.AvailableClasses->size());
_worldPacket << uint32(SuccessInfo.value.Templates.size());
_worldPacket << uint32(SuccessInfo.value.CurrencyID);
_worldPacket << uint32(SuccessInfo.Value.VirtualRealmAddress);
_worldPacket << uint32(SuccessInfo.Value.VirtualRealms.size());
_worldPacket << uint32(SuccessInfo.Value.TimeRemain);
_worldPacket << uint32(SuccessInfo.Value.TimeOptions);
_worldPacket << uint32(SuccessInfo.Value.TimeRested);
_worldPacket << uint8(SuccessInfo.Value.ActiveExpansionLevel);
_worldPacket << uint8(SuccessInfo.Value.AccountExpansionLevel);
_worldPacket << uint32(SuccessInfo.Value.TimeSecondsUntilPCKick);
_worldPacket << uint32(SuccessInfo.Value.AvailableRaces->size());
_worldPacket << uint32(SuccessInfo.Value.AvailableClasses->size());
_worldPacket << uint32(SuccessInfo.Value.Templates.size());
_worldPacket << uint32(SuccessInfo.Value.CurrencyID);
for (auto& realm : SuccessInfo.value.VirtualRealms)
for (auto& realm : SuccessInfo.Value.VirtualRealms)
{
_worldPacket << uint32(realm.RealmAddress);
_worldPacket.WriteBit(realm.IsLocal);
@@ -89,19 +89,19 @@ WorldPacket const* WorldPackets::Auth::AuthResponse::Write()
_worldPacket.WriteString(realm.RealmNameNormalized);
}
for (auto& race : *SuccessInfo.value.AvailableRaces)
for (auto& race : *SuccessInfo.Value.AvailableRaces)
{
_worldPacket << uint8(race.first); /// the current race
_worldPacket << uint8(race.second); /// the required Expansion
}
for (auto& klass : *SuccessInfo.value.AvailableClasses)
for (auto& klass : *SuccessInfo.Value.AvailableClasses)
{
_worldPacket << uint8(klass.first); /// the current class
_worldPacket << uint8(klass.second); /// the required Expansion
}
for (auto& templat : SuccessInfo.value.Templates)
for (auto& templat : SuccessInfo.Value.Templates)
{
_worldPacket << uint32(templat.TemplateSetId);
_worldPacket << uint32(templat.TemplateClasses.size());
@@ -117,23 +117,23 @@ WorldPacket const* WorldPackets::Auth::AuthResponse::Write()
_worldPacket.WriteString(templat.Description);
}
_worldPacket.WriteBit(SuccessInfo.value.IsExpansionTrial);
_worldPacket.WriteBit(SuccessInfo.value.ForceCharacterTemplate);
_worldPacket.WriteBit(SuccessInfo.value.NumPlayersHorde != 0);
_worldPacket.WriteBit(SuccessInfo.value.NumPlayersAlliance != 0);
_worldPacket.WriteBit(SuccessInfo.value.IsVeteranTrial);
_worldPacket.WriteBit(SuccessInfo.Value.IsExpansionTrial);
_worldPacket.WriteBit(SuccessInfo.Value.ForceCharacterTemplate);
_worldPacket.WriteBit(SuccessInfo.Value.NumPlayersHorde.HasValue);
_worldPacket.WriteBit(SuccessInfo.Value.NumPlayersAlliance.HasValue);
_worldPacket.WriteBit(SuccessInfo.Value.IsVeteranTrial);
if (SuccessInfo.value.NumPlayersHorde)
_worldPacket << uint16(SuccessInfo.value.NumPlayersHorde);
if (SuccessInfo.Value.NumPlayersHorde.HasValue)
_worldPacket << uint16(SuccessInfo.Value.NumPlayersHorde.Value);
if (SuccessInfo.value.NumPlayersAlliance)
_worldPacket << uint16(SuccessInfo.value.NumPlayersAlliance);
if (SuccessInfo.Value.NumPlayersAlliance.HasValue)
_worldPacket << uint16(SuccessInfo.Value.NumPlayersAlliance.Value);
}
if (WaitInfo.HasValue)
{
_worldPacket << uint32(WaitInfo.value.WaitCount);
_worldPacket.WriteBit(WaitInfo.value.HasFCM);
_worldPacket << uint32(WaitInfo.Value.WaitCount);
_worldPacket.WriteBit(WaitInfo.Value.HasFCM);
}
_worldPacket.FlushBits();
@@ -118,8 +118,8 @@ namespace WorldPackets
bool IsExpansionTrial = false;
bool ForceCharacterTemplate = false; ///< forces the client to always use a character template when creating a new character. @see Templates. @todo implement
uint16 NumPlayersHorde = 0; ///< number of horde players in this realm. @todo implement
uint16 NumPlayersAlliance = 0; ///< number of alliance players in this realm. @todo implement
Optional<uint16> NumPlayersHorde; ///< number of horde players in this realm. @todo implement
Optional<uint16> NumPlayersAlliance; ///< number of alliance players in this realm. @todo implement
bool IsVeteranTrial = false; ///< @todo research
};
@@ -200,7 +200,7 @@ void WorldPackets::Character::CreateChar::Read()
_worldPacket >> CreateInfo->OutfitId;
CreateInfo->Name = _worldPacket.ReadString(nameLength);
if (CreateInfo->TemplateSet.HasValue)
_worldPacket >> CreateInfo->TemplateSet.value;
_worldPacket >> CreateInfo->TemplateSet.Value;
}
WorldPacket const* WorldPackets::Character::CharacterCreateResponse::Write()
@@ -234,7 +234,7 @@ WorldPacket const* WorldPackets::Character::CharacterRenameResult::Write()
_worldPacket.WriteBits(Name.length(), 6);
if (Guid.HasValue)
_worldPacket << Guid.value;
_worldPacket << Guid.Value;
_worldPacket.WriteString(Name);
return &_worldPacket;
@@ -274,19 +274,19 @@ void WorldPackets::Character::CharRaceOrFactionChange::Read()
RaceOrFactionChangeInfo->Name = _worldPacket.ReadString(nameLength);
if (RaceOrFactionChangeInfo->SkinID.HasValue)
_worldPacket >> RaceOrFactionChangeInfo->SkinID.value;
_worldPacket >> RaceOrFactionChangeInfo->SkinID.Value;
if (RaceOrFactionChangeInfo->HairColorID.HasValue)
_worldPacket >> RaceOrFactionChangeInfo->HairColorID.value;
_worldPacket >> RaceOrFactionChangeInfo->HairColorID.Value;
if (RaceOrFactionChangeInfo->HairStyleID.HasValue)
_worldPacket >> RaceOrFactionChangeInfo->HairStyleID.value;
_worldPacket >> RaceOrFactionChangeInfo->HairStyleID.Value;
if (RaceOrFactionChangeInfo->FacialHairStyleID.HasValue)
_worldPacket >> RaceOrFactionChangeInfo->FacialHairStyleID.value;
_worldPacket >> RaceOrFactionChangeInfo->FacialHairStyleID.Value;
if (RaceOrFactionChangeInfo->FaceID.HasValue)
_worldPacket >> RaceOrFactionChangeInfo->FaceID.value;
_worldPacket >> RaceOrFactionChangeInfo->FaceID.Value;
}
WorldPacket const* WorldPackets::Character::CharFactionChangeResult::Write()
@@ -298,15 +298,15 @@ WorldPacket const* WorldPackets::Character::CharFactionChangeResult::Write()
if (Display.HasValue)
{
_worldPacket.WriteBits(Display.value.Name.length(), 6);
_worldPacket << uint8(Display.value.SexID);
_worldPacket << uint8(Display.value.SkinID);
_worldPacket << uint8(Display.value.HairColorID);
_worldPacket << uint8(Display.value.HairStyleID);
_worldPacket << uint8(Display.value.FacialHairStyleID);
_worldPacket << uint8(Display.value.FaceID);
_worldPacket << uint8(Display.value.RaceID);
_worldPacket.WriteString(Display.value.Name);
_worldPacket.WriteBits(Display.Value.Name.length(), 6);
_worldPacket << uint8(Display.Value.SexID);
_worldPacket << uint8(Display.Value.SkinID);
_worldPacket << uint8(Display.Value.HairColorID);
_worldPacket << uint8(Display.Value.HairStyleID);
_worldPacket << uint8(Display.Value.FacialHairStyleID);
_worldPacket << uint8(Display.Value.FaceID);
_worldPacket << uint8(Display.Value.RaceID);
_worldPacket.WriteString(Display.Value.Name);
}
return &_worldPacket;
@@ -87,7 +87,7 @@ WorldPacket const* WorldPackets::Combat::AIReaction::Write()
WorldPacket const* WorldPackets::Combat::AttackerStateUpdate::Write()
{
if (_worldPacket.WriteBit(LogData.HasValue))
_worldPacket << LogData.value;
_worldPacket << LogData.Value;
// Placeholder for size which will be calculated at the end based on packet size
// Client uses this size to copy remaining packet to another CDataStore
@@ -101,14 +101,15 @@ WorldPacket const* WorldPackets::Combat::AttackerStateUpdate::Write()
_worldPacket << OverDamage;
if (_worldPacket.WriteBit(SubDmg.HasValue))
{
_worldPacket << SubDmg.value.SchoolMask;
_worldPacket << SubDmg.value.FDamage;
_worldPacket << SubDmg.value.Damage;
if (HitInfo & (HITINFO_FULL_ABSORB|HITINFO_PARTIAL_ABSORB))
_worldPacket << SubDmg.value.Absorbed;
if (HitInfo & (HITINFO_FULL_RESIST|HITINFO_PARTIAL_RESIST))
_worldPacket << SubDmg.value.Resisted;
_worldPacket << SubDmg.Value.SchoolMask;
_worldPacket << SubDmg.Value.FDamage;
_worldPacket << SubDmg.Value.Damage;
if (HitInfo & (HITINFO_FULL_ABSORB | HITINFO_PARTIAL_ABSORB))
_worldPacket << SubDmg.Value.Absorbed;
if (HitInfo & (HITINFO_FULL_RESIST | HITINFO_PARTIAL_RESIST))
_worldPacket << SubDmg.Value.Resisted;
}
_worldPacket << VictimState;
_worldPacket << AttackerState;
_worldPacket << MeleeSpellID;
@@ -135,7 +136,7 @@ WorldPacket const* WorldPackets::Combat::AttackerStateUpdate::Write()
_worldPacket << Unk;
// Update size placeholder
_worldPacket.put<int32>(pos-sizeof(int32), _worldPacket.wpos()-pos);
_worldPacket.put<int32>(pos - sizeof(int32), _worldPacket.wpos() - pos);
return &_worldPacket;
}
+11 -11
View File
@@ -33,16 +33,16 @@ WorldPacket const* WorldPackets::Guild::QueryGuildInfoResponse::Write()
if (Info.HasValue)
{
_worldPacket << Info.value.GuildGUID;
_worldPacket << uint32(Info.value.VirtualRealmAddress);
_worldPacket << uint32(Info.value.Ranks.size());
_worldPacket << uint32(Info.value.EmblemStyle);
_worldPacket << uint32(Info.value.EmblemColor);
_worldPacket << uint32(Info.value.BorderStyle);
_worldPacket << uint32(Info.value.BorderColor);
_worldPacket << uint32(Info.value.BackgroundColor);
_worldPacket << Info.Value.GuildGUID;
_worldPacket << uint32(Info.Value.VirtualRealmAddress);
_worldPacket << uint32(Info.Value.Ranks.size());
_worldPacket << uint32(Info.Value.EmblemStyle);
_worldPacket << uint32(Info.Value.EmblemColor);
_worldPacket << uint32(Info.Value.BorderStyle);
_worldPacket << uint32(Info.Value.BorderColor);
_worldPacket << uint32(Info.Value.BackgroundColor);
for (GuildInfo::GuildInfoRank const& rank : Info.value.Ranks)
for (GuildInfo::GuildInfoRank const& rank : Info.Value.Ranks)
{
_worldPacket << uint32(rank.RankID);
_worldPacket << uint32(rank.RankOrder);
@@ -51,8 +51,8 @@ WorldPacket const* WorldPackets::Guild::QueryGuildInfoResponse::Write()
_worldPacket.WriteString(rank.RankName);
}
_worldPacket.WriteBits(Info.value.GuildName.size(), 7);
_worldPacket.WriteString(Info.value.GuildName);
_worldPacket.WriteBits(Info.Value.GuildName.size(), 7);
_worldPacket.WriteString(Info.Value.GuildName);
}
_worldPacket.FlushBits();
@@ -89,16 +89,16 @@ WorldPacket const* WorldPackets::Misc::WorldServerInfo::Write()
_worldPacket.WriteBit(RestrictedAccountMaxMoney.HasValue);
if (IneligibleForLootMask.HasValue)
_worldPacket << uint32(IneligibleForLootMask.value);
_worldPacket << uint32(IneligibleForLootMask.Value);
if (InstanceGroupSize.HasValue)
_worldPacket << uint32(InstanceGroupSize.value);
_worldPacket << uint32(InstanceGroupSize.Value);
if (RestrictedAccountMaxLevel.HasValue)
_worldPacket << uint32(RestrictedAccountMaxLevel.value);
_worldPacket << uint32(RestrictedAccountMaxLevel.Value);
if (RestrictedAccountMaxMoney.HasValue)
_worldPacket << uint32(RestrictedAccountMaxMoney.value);
_worldPacket << uint32(RestrictedAccountMaxMoney.Value);
_worldPacket.FlushBits();
@@ -231,7 +231,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Movement::MovementSpline&
}
if (movementSpline.SplineFilter.HasValue)
data << movementSpline.SplineFilter.value;
data << movementSpline.SplineFilter.Value;
return data;
}
@@ -97,10 +97,10 @@ void WorldPackets::Query::QueryPlayerName::Read()
Hint.NativeRealmAddress.HasValue = _worldPacket.ReadBit();
if (Hint.VirtualRealmAddress.HasValue)
_worldPacket >> Hint.VirtualRealmAddress.value;
_worldPacket >> Hint.VirtualRealmAddress.Value;
if (Hint.NativeRealmAddress.HasValue)
_worldPacket >> Hint.NativeRealmAddress.value;
_worldPacket >> Hint.NativeRealmAddress.Value;
}
WorldPacket const* WorldPackets::Query::QueryPlayerNameResponse::Write()
@@ -43,22 +43,22 @@ WorldPacket const* WorldPackets::System::FeatureSystemStatus::Write()
if (EuropaTicketSystemStatus.HasValue)
{
_worldPacket.WriteBit(EuropaTicketSystemStatus.value.UnkBit0);
_worldPacket.WriteBit(EuropaTicketSystemStatus.value.UnkBit1);
_worldPacket.WriteBit(EuropaTicketSystemStatus.value.TicketSystemEnabled);
_worldPacket.WriteBit(EuropaTicketSystemStatus.value.SubmitBugEnabled);
_worldPacket.WriteBit(EuropaTicketSystemStatus.Value.UnkBit0);
_worldPacket.WriteBit(EuropaTicketSystemStatus.Value.UnkBit1);
_worldPacket.WriteBit(EuropaTicketSystemStatus.Value.TicketSystemEnabled);
_worldPacket.WriteBit(EuropaTicketSystemStatus.Value.SubmitBugEnabled);
_worldPacket << uint32(EuropaTicketSystemStatus.value.ThrottleState.MaxTries);
_worldPacket << uint32(EuropaTicketSystemStatus.value.ThrottleState.PerMilliseconds);
_worldPacket << uint32(EuropaTicketSystemStatus.value.ThrottleState.TryCount);
_worldPacket << uint32(EuropaTicketSystemStatus.value.ThrottleState.LastResetTimeBeforeNow);
_worldPacket << uint32(EuropaTicketSystemStatus.Value.ThrottleState.MaxTries);
_worldPacket << uint32(EuropaTicketSystemStatus.Value.ThrottleState.PerMilliseconds);
_worldPacket << uint32(EuropaTicketSystemStatus.Value.ThrottleState.TryCount);
_worldPacket << uint32(EuropaTicketSystemStatus.Value.ThrottleState.LastResetTimeBeforeNow);
}
if (SessionAlert.HasValue)
{
_worldPacket << int32(SessionAlert.value.Delay);
_worldPacket << int32(SessionAlert.value.Period);
_worldPacket << int32(SessionAlert.value.DisplayTime);
_worldPacket << int32(SessionAlert.Value.Delay);
_worldPacket << int32(SessionAlert.Value.Period);
_worldPacket << int32(SessionAlert.Value.DisplayTime);
}
_worldPacket.FlushBits();
+4 -4
View File
@@ -33,21 +33,21 @@
template<typename T>
struct Optional
{
Optional() : value(), HasValue(false) { }
Optional() : Value(), HasValue(false) { }
T value;
T Value;
bool HasValue;
inline void Set(T const& v)
{
HasValue = true;
value = v;
Value = v;
}
inline void Clear()
{
HasValue = false;
value = T();
Value = T();
}
};