mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[9187] Fixed problem with non-attackable pes/totems at arenas
... and other FFA areas. Problem is result chnages in related flags work after old 3.x switch. * Added high-level functions for FFAPvP state set for unit * Apply FFA PvP to all controlled units also at set, and at summon/load
This commit is contained in:
parent
6704929d56
commit
cc062f16ac
9 changed files with 45 additions and 15 deletions
|
|
@ -7879,7 +7879,7 @@ bool Unit::IsHostileTo(Unit const* unit) const
|
|||
return false;
|
||||
|
||||
// PvP FFA state
|
||||
if(pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
|
||||
if(pTester->IsFFAPvP() && pTarget->IsFFAPvP())
|
||||
return true;
|
||||
|
||||
//= PvP states
|
||||
|
|
@ -7991,7 +7991,7 @@ bool Unit::IsFriendlyTo(Unit const* unit) const
|
|||
return true;
|
||||
|
||||
// PvP FFA state
|
||||
if(pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
|
||||
if(pTester->IsFFAPvP() && pTarget->IsFFAPvP())
|
||||
return false;
|
||||
|
||||
//= PvP states
|
||||
|
|
@ -12755,6 +12755,9 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id)
|
|||
if(IsPvP())
|
||||
pet->SetPvP(true);
|
||||
|
||||
if(IsFFAPvP())
|
||||
pet->SetFFAPvP(true);
|
||||
|
||||
uint32 level = (creatureTarget->getLevel() < (getLevel() - 5)) ? (getLevel() - 5) : creatureTarget->getLevel();
|
||||
|
||||
if(!pet->InitStatsForLevel(level))
|
||||
|
|
@ -12985,6 +12988,23 @@ void Unit::SetPvP( bool state )
|
|||
CallForAllControlledUnits(SetPvPHelper(state),true,true,true);
|
||||
}
|
||||
|
||||
struct SetFFAPvPHelper
|
||||
{
|
||||
explicit SetFFAPvPHelper(bool _state) : state(_state) {}
|
||||
void operator()(Unit* unit) const { unit->SetFFAPvP(state); }
|
||||
bool state;
|
||||
};
|
||||
|
||||
void Unit::SetFFAPvP( bool state )
|
||||
{
|
||||
if(state)
|
||||
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||
else
|
||||
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||
|
||||
CallForAllControlledUnits(SetFFAPvPHelper(state),true,true,true);
|
||||
}
|
||||
|
||||
void Unit::KnockBackFrom(Unit* target, float horizintalSpeed, float verticalSpeed)
|
||||
{
|
||||
float angle = this == target ? GetOrientation() + M_PI : target->GetAngle(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue