Core/Entities: Fix combat state setting when FFA PvP flag is set

Description:
Currently there is an issue, when you are in FFA areas, but you dont have PvP flag activated.

You should get the PvP-In-Combat delay timer, but instead you just get the usual timer as if you would not fight in PvP.

Reproduction:
1) Get two players in FFA area Gurubashi arena down in the battle area (.tele Gurubashi)

2) Fight each other

3) When stopping combat, the combat state will switch off immediately. But it is supposed to switch off after some delay, because it was a PvP fight.

Closes #11103

Signed-off-by: Duarte Duarte <[email protected]>
This commit is contained in:
Elron103
2014-01-13 17:03:43 +00:00
committed by Duarte Duarte
parent 80a398372d
commit 88ecc9533a
5 changed files with 13 additions and 12 deletions
+8 -8
View File
@@ -7284,8 +7284,8 @@ bool Player::RewardHonor(Unit* victim, uint32 groupsize, int32 honor, bool pvpto
{
// Check if allowed to receive it in current map
uint8 MapType = sWorld->getIntConfig(CONFIG_PVP_TOKEN_MAP_TYPE);
if ((MapType == 1 && !InBattleground() && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
|| (MapType == 2 && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
if ((MapType == 1 && !InBattleground() && !IsFFAPvP())
|| (MapType == 2 && !IsFFAPvP())
|| (MapType == 3 && !InBattleground()))
return true;
@@ -17347,7 +17347,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
Map* map = sMapMgr->CreateMap(mapId, this);
AreaTrigger const* areaTrigger = NULL;
bool check = false;
if (!map)
{
areaTrigger = sObjectMgr->GetGoBackTrigger(mapId);
@@ -17366,7 +17366,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
check = true;
}
}
if (check) // in case of special event when creating map...
{
if (areaTrigger) // ... if we have an areatrigger, then relocate to new map/coordinates.
@@ -17384,7 +17384,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
map = NULL;
}
}
if (!map)
{
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
@@ -17393,7 +17393,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
map = sMapMgr->CreateMap(mapId, this);
if (!map)
{
TC_LOG_ERROR("entities.player", "Player %s (guid: %d) Map: %u, X: %f, Y: %f, Z: %f, O: %f. Invalid default map coordinates or instance couldn't be created.", m_name, guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
TC_LOG_ERROR("entities.player", "Player %s (guid: %d) Map: %u, X: %f, Y: %f, Z: %f, O: %f. Invalid default map coordinates or instance couldn't be created.", m_name.c_str(), guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
return false;
}
}
@@ -21686,14 +21686,14 @@ void Player::UpdatePvPState(bool onlyFFA)
if (!pvpInfo.IsInNoPvPArea && !IsGameMaster()
&& (pvpInfo.IsInFFAPvPArea || sWorld->IsFFAPvPRealm()))
{
if (!HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
if (!IsFFAPvP())
{
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
for (ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
(*itr)->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
}
}
else if (HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
else if (IsFFAPvP())
{
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
for (ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
+1 -1
View File
@@ -11626,7 +11626,7 @@ bool Unit::IsServiceProvider() const
void Unit::SetInCombatWith(Unit* enemy)
{
Unit* eOwner = enemy->GetCharmerOrOwnerOrSelf();
if (eOwner->IsPvP())
if (eOwner->IsPvP() || eOwner->IsFFAPvP())
{
SetInCombatState(true, enemy);
return;
+1
View File
@@ -1404,6 +1404,7 @@ class Unit : public WorldObject
void GetPartyMembers(std::list<Unit*> &units);
bool IsContestedGuard() const;
bool IsPvP() const { return HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP); }
bool IsFFAPvP() const { return HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); }
void SetPvP(bool state);
uint32 GetCreatureType() const;
uint32 GetCreatureTypeMask() const;
+2 -2
View File
@@ -741,7 +741,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
playerStatus |= MEMBER_STATUS_DEAD;
}
if (player->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
if (player->IsFFAPvP())
playerStatus |= MEMBER_STATUS_PVP_FFA;
if (player->isAFK())
@@ -943,7 +943,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData)
playerStatus |= MEMBER_STATUS_DEAD;
}
if (player->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
if (player->IsFFAPvP())
playerStatus |= MEMBER_STATUS_PVP_FFA;
if (player->isAFK())
+1 -1
View File
@@ -3045,7 +3045,7 @@ void SpellMgr::LoadSpellInfoCorrections()
spellInfo->Effects[EFFECT_1].TriggerSpell = 42739;
break;
case 42436: // Drink! (Brewfest)
spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ANY);
spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ANY);
break;
case 59735:
spellInfo->Effects[EFFECT_1].TriggerSpell = 59736;