Revert our combat-only nameplates (SIN's Forever Combat Nameplates replaces them)
Reverts 1c33b428e, a7f630fbe and e0f252c1b: the /fb plates switch in ForeverBots, the PLATES add-on request, our server filter and its corpse fix. The next commit puts in SIN's Forever Combat Nameplates 3.0 in their place.
This commit is contained in:
@@ -381,10 +381,6 @@ public:
|
||||
if (flags & UNIT_FLAG3_ALREADY_SKINNED && unit->IsCreature() && !unit->ToCreature()->IsSkinnedBy(receiver))
|
||||
flags &= ~UNIT_FLAG3_ALREADY_SKINNED;
|
||||
|
||||
// Combat-only enemy nameplates: an NPC outside this viewer's fight shows its plain name (Player::SetCombatPlateFilter).
|
||||
if (receiver->HidesNameplateOf(unit))
|
||||
flags |= UNIT_FLAG3_FORCE_HIDE_NAMEPLATE;
|
||||
|
||||
return flags;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -971,7 +971,6 @@ void Player::Update(uint32 p_time)
|
||||
SetCanDelayTeleport(false);
|
||||
|
||||
UpdateParkedPet(p_time);
|
||||
UpdateCombatPlates(p_time);
|
||||
|
||||
// The pet remembered at login comes back a moment after the player is in the world, as a summon during play does. Created while the
|
||||
// Classic 1.60 client is still on its loading screen, the client froze on the pet (warlock demon out at logout, 20 Oct).
|
||||
@@ -25836,80 +25835,6 @@ bool Player::HaveAtClient(BaseEntity const* u) const
|
||||
return u == this || m_clientGUIDs.find(u->GetGUID()) != m_clientGUIDs.end();
|
||||
}
|
||||
|
||||
// Combat-only enemy nameplates: a plate is hidden for an attackable NPC that is in no live (unsuppressed) fight with this player, his
|
||||
// pet or a member of his group on this map. Standing near it or selecting it is not a fight. NPCs a script forces a plate on or off,
|
||||
// and units a player controls, keep what they have.
|
||||
bool Player::CombatPlateHidden(Unit const* unit, Pet const* pet) const
|
||||
{
|
||||
if (!_combatPlateOn || !unit->GetGUID().IsCreatureOrVehicle() || unit->IsControlledByPlayer())
|
||||
return false;
|
||||
if (unit->HasUnitFlag(UNIT_FLAG_FORCE_NAMEPLATE) || unit->HasUnitFlag3(UNIT_FLAG3_FORCE_HIDE_NAMEPLATE))
|
||||
return false;
|
||||
// A mob that died is no longer a valid attack target, and its plate came back as a large grey name over the corpse mid-fight
|
||||
// (Karrz 11-16, a Noxious Plaguebat in the Eastern Plaguelands). A corpse is out of every fight: an unfriendly one stays hidden.
|
||||
if (unit->IsAlive() ? !IsValidAttackTarget(unit) : IsFriendlyTo(unit))
|
||||
return false;
|
||||
auto fights = [unit](Unit const* side)
|
||||
{
|
||||
auto const& refs = side->GetCombatManager().GetPvECombatRefs();
|
||||
auto const itr = refs.find(unit->GetGUID());
|
||||
return itr != refs.end() && !itr->second->IsSuppressedFor(side);
|
||||
};
|
||||
if (fights(this) || (pet && fights(pet)))
|
||||
return false;
|
||||
if (Group const* group = GetGroup())
|
||||
for (GroupReference const& ref : group->GetMembers())
|
||||
if (Player const* member = ref.GetSource(); member && member != this && member->IsInMap(this))
|
||||
if (fights(member) || (member->GetPet() && fights(member->GetPet())))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Records the plate state of one NPC this client knows; true when it changed (the client needs the new flags).
|
||||
bool Player::RefreshCombatPlate(Unit const* unit, Pet const* pet)
|
||||
{
|
||||
if (CombatPlateHidden(unit, pet))
|
||||
return _combatPlateHidden.insert(unit->GetGUID()).second;
|
||||
return _combatPlateHidden.erase(unit->GetGUID()) != 0;
|
||||
}
|
||||
|
||||
// Four times a second while the filter is on (or just turned off): re-checks every NPC this client knows and sends the flags of
|
||||
// those that changed, so a mob that joins the fight gets its bar and one whose fight ended loses it.
|
||||
void Player::UpdateCombatPlates(uint32 diff)
|
||||
{
|
||||
if (!_combatPlateOn && !_combatPlateWanted && _combatPlateHidden.empty())
|
||||
return;
|
||||
if (_combatPlateTimer > diff && _combatPlateOn == _combatPlateWanted)
|
||||
{
|
||||
_combatPlateTimer -= diff;
|
||||
return;
|
||||
}
|
||||
_combatPlateTimer = 250;
|
||||
_combatPlateOn = _combatPlateWanted;
|
||||
|
||||
UF::ObjectData::Base objMask;
|
||||
UF::UnitData::Base unitMask;
|
||||
unitMask.MarkChanged(&UF::UnitData::Flags3);
|
||||
UpdateData data(GetMapId());
|
||||
Pet const* pet = GetPet();
|
||||
for (ObjectGuid const& guid : m_clientGUIDs)
|
||||
{
|
||||
if (!guid.IsCreatureOrVehicle())
|
||||
continue;
|
||||
if (Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid))
|
||||
if (RefreshCombatPlate(creature, pet))
|
||||
creature->BuildValuesUpdateForPlayerWithMask(&data, objMask.GetChangesMask(), unitMask.GetChangesMask(), this, false);
|
||||
}
|
||||
// NPCs gone from this client need no entry (they get a fresh check when they come back into view).
|
||||
std::erase_if(_combatPlateHidden, [this](ObjectGuid const& guid) { return !m_clientGUIDs.contains(guid); });
|
||||
if (data.HasData())
|
||||
{
|
||||
WorldPacket packet;
|
||||
data.BuildPacket(&packet);
|
||||
SendDirectMessage(&packet);
|
||||
}
|
||||
}
|
||||
|
||||
bool Player::IsNeverVisibleFor(WorldObject const* seer, bool allowServersideObjects) const
|
||||
{
|
||||
if (Unit::IsNeverVisibleFor(seer, allowServersideObjects))
|
||||
@@ -26122,9 +26047,6 @@ void Player::UpdateVisibilityOf(WorldObject* target)
|
||||
{
|
||||
if (CanSeeOrDetect(target, { .DistanceCheck = true }))
|
||||
{
|
||||
if (_combatPlateOn)
|
||||
if (Creature const* creature = target->ToCreature())
|
||||
RefreshCombatPlate(creature, GetPet()); // the create block carries the plate state from the start
|
||||
target->SendUpdateToPlayer(this);
|
||||
m_clientGUIDs.insert(target->GetGUID());
|
||||
|
||||
@@ -26250,9 +26172,6 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, std::set<WorldObjec
|
||||
m_clientGUIDs.insert(target->GetGUID());
|
||||
if (!Trinity::HeadlessPackets::Skip(this))
|
||||
{
|
||||
if (_combatPlateOn)
|
||||
if (Creature const* creature = target->ToCreature())
|
||||
RefreshCombatPlate(creature, GetPet()); // the create block carries the plate state from the start
|
||||
target->BuildCreateUpdateBlockForPlayer(&data, this);
|
||||
visibleNow.insert(target);
|
||||
}
|
||||
|
||||
@@ -2829,13 +2829,6 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
|
||||
|
||||
bool HaveAtClient(BaseEntity const* u) const;
|
||||
|
||||
// Combat-only enemy nameplates (asked for by the client's add-on): while on, a hostile NPC this player can see that is not in
|
||||
// a fight with him or his pet goes to his client with UNIT_FLAG3_FORCE_HIDE_NAMEPLATE, so the client draws its plain name;
|
||||
// one that joins the fight gets its health bar. Per viewer: other players see their own fights. Applied on the next update.
|
||||
void SetCombatPlateFilter(bool on) { _combatPlateWanted = on; }
|
||||
bool IsCombatPlateFilterOn() const { return _combatPlateOn; }
|
||||
bool HidesNameplateOf(Unit const* unit) const { return _combatPlateOn && _combatPlateHidden.contains(unit->GetGUID()); }
|
||||
|
||||
bool IsNeverVisibleFor(WorldObject const* seer, bool allowServersideObjects) const override;
|
||||
|
||||
bool IsVisibleGloballyFor(Player const* player) const;
|
||||
@@ -3582,15 +3575,6 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
|
||||
bool CanRequestSpellCast(SpellInfo const* spell, Unit const* castingUnit) const;
|
||||
|
||||
private:
|
||||
// Combat-only enemy nameplates (SetCombatPlateFilter).
|
||||
bool CombatPlateHidden(Unit const* unit, Pet const* pet) const;
|
||||
bool RefreshCombatPlate(Unit const* unit, Pet const* pet);
|
||||
void UpdateCombatPlates(uint32 diff);
|
||||
bool _combatPlateWanted = false; // what the client asked for
|
||||
bool _combatPlateOn = false; // in force (set on the player's update)
|
||||
uint32 _combatPlateTimer = 0;
|
||||
GuidUnorderedSet _combatPlateHidden; // the NPCs this client was told to hide the plate of
|
||||
|
||||
std::unique_ptr<SpellCastRequest> _pendingSpellCastRequest;
|
||||
void ExecutePendingSpellCastRequest();
|
||||
bool ProcessItemCast(SpellCastRequest& castRequest, SpellCastTargets const& targets);
|
||||
|
||||
@@ -1295,9 +1295,6 @@ bool WorldSession::IsAddonRegistered(std::string_view prefix) const
|
||||
void WorldSession::HandleUnregisterAllAddonPrefixesOpcode(WorldPackets::Chat::ChatUnregisterAllAddonPrefixes& /*packet*/) // empty packet
|
||||
{
|
||||
_registeredAddonPrefixes.clear();
|
||||
// A UI reload or an add-on turned off: combat-only nameplates are the add-on's to ask for again (Player::SetCombatPlateFilter).
|
||||
if (Player* player = GetPlayer())
|
||||
player->SetCombatPlateFilter(false);
|
||||
}
|
||||
|
||||
void WorldSession::HandleAddonRegisteredPrefixesOpcode(WorldPackets::Chat::ChatRegisterAddonPrefixes& packet)
|
||||
|
||||
Reference in New Issue
Block a user