mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[6993] Fixing FFA PvP player flags for 3.0.3
This commit is contained in:
parent
695a630cf3
commit
18fb4db8f2
6 changed files with 24 additions and 21 deletions
|
|
@ -809,7 +809,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
|
||||||
|
|
||||||
// Set FFA PvP for non GM in non-rest mode
|
// Set FFA PvP for non GM in non-rest mode
|
||||||
if(sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_RESTING) )
|
if(sWorld.IsFFAPvPRealm() && !pCurrChar->isGameMaster() && !pCurrChar->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_RESTING) )
|
||||||
pCurrChar->SetFlag(PLAYER_FLAGS,PLAYER_FLAGS_FFA_PVP);
|
pCurrChar->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
|
|
||||||
if(pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
|
if(pCurrChar->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP))
|
||||||
pCurrChar->SetContestedPvP();
|
pCurrChar->SetContestedPvP();
|
||||||
|
|
|
||||||
|
|
@ -808,7 +808,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data)
|
||||||
GetPlayer()->SetRestType(REST_TYPE_IN_TAVERN);
|
GetPlayer()->SetRestType(REST_TYPE_IN_TAVERN);
|
||||||
|
|
||||||
if(sWorld.IsFFAPvPRealm())
|
if(sWorld.IsFFAPvPRealm())
|
||||||
GetPlayer()->RemoveFlag(PLAYER_FLAGS,PLAYER_FLAGS_FFA_PVP);
|
GetPlayer()->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1983,7 +1983,7 @@ void Player::SetGameMaster(bool on)
|
||||||
setFaction(35);
|
setFaction(35);
|
||||||
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
|
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
|
||||||
|
|
||||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP);
|
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
ResetContestedPvP();
|
ResetContestedPvP();
|
||||||
|
|
||||||
getHostilRefManager().setOnlineOfflineState(false);
|
getHostilRefManager().setOnlineOfflineState(false);
|
||||||
|
|
@ -1997,7 +1997,7 @@ void Player::SetGameMaster(bool on)
|
||||||
|
|
||||||
// restore FFA PvP Server state
|
// restore FFA PvP Server state
|
||||||
if(sWorld.IsFFAPvPRealm())
|
if(sWorld.IsFFAPvPRealm())
|
||||||
SetFlag(PLAYER_FLAGS,PLAYER_FLAGS_FFA_PVP);
|
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
|
|
||||||
// restore FFA PvP area state, remove not allowed for GM mounts
|
// restore FFA PvP area state, remove not allowed for GM mounts
|
||||||
UpdateArea(m_areaUpdateId);
|
UpdateArea(m_areaUpdateId);
|
||||||
|
|
@ -2372,9 +2372,10 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
||||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE ); // must be set
|
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE ); // must be set
|
||||||
|
|
||||||
// cleanup player flags (will be re-applied if need at aura load), to avoid have ghost flag without ghost aura, for example.
|
// cleanup player flags (will be re-applied if need at aura load), to avoid have ghost flag without ghost aura, for example.
|
||||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK | PLAYER_FLAGS_DND | PLAYER_FLAGS_GM | PLAYER_FLAGS_GHOST | PLAYER_FLAGS_FFA_PVP);
|
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK | PLAYER_FLAGS_DND | PLAYER_FLAGS_GM | PLAYER_FLAGS_GHOST);
|
||||||
|
|
||||||
SetByteValue(UNIT_FIELD_BYTES_1, 2, 0x00); // one form stealth modified bytes
|
SetByteValue(UNIT_FIELD_BYTES_1, 2, 0x00); // one form stealth modified bytes
|
||||||
|
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP | UNIT_BYTE2_FLAG_SANCTUARY);
|
||||||
|
|
||||||
// restore if need some important flags
|
// restore if need some important flags
|
||||||
SetUInt32Value(PLAYER_FIELD_BYTES2, 0 ); // flags empty by default
|
SetUInt32Value(PLAYER_FIELD_BYTES2, 0 ); // flags empty by default
|
||||||
|
|
@ -6197,14 +6198,14 @@ void Player::UpdateArea(uint32 newArea)
|
||||||
if(area && (area->flags & AREA_FLAG_ARENA))
|
if(area && (area->flags & AREA_FLAG_ARENA))
|
||||||
{
|
{
|
||||||
if(!isGameMaster())
|
if(!isGameMaster())
|
||||||
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP);
|
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// remove ffa flag only if not ffapvp realm
|
// remove ffa flag only if not ffapvp realm
|
||||||
// removal in sanctuaries and capitals is handled in zone update
|
// removal in sanctuaries and capitals is handled in zone update
|
||||||
if(HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP) && !sWorld.IsFFAPvPRealm())
|
if(HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && !sWorld.IsFFAPvPRealm())
|
||||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP);
|
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateAreaDependentAuras(newArea);
|
UpdateAreaDependentAuras(newArea);
|
||||||
|
|
@ -6260,7 +6261,7 @@ void Player::UpdateZone(uint32 newZone)
|
||||||
{
|
{
|
||||||
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
|
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
|
||||||
if(sWorld.IsFFAPvPRealm())
|
if(sWorld.IsFFAPvPRealm())
|
||||||
RemoveFlag(PLAYER_FLAGS,PLAYER_FLAGS_FFA_PVP);
|
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -6274,7 +6275,7 @@ void Player::UpdateZone(uint32 newZone)
|
||||||
InnEnter(time(0),GetMapId(),0,0,0);
|
InnEnter(time(0),GetMapId(),0,0,0);
|
||||||
|
|
||||||
if(sWorld.IsFFAPvPRealm())
|
if(sWorld.IsFFAPvPRealm())
|
||||||
RemoveFlag(PLAYER_FLAGS,PLAYER_FLAGS_FFA_PVP);
|
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
}
|
}
|
||||||
else // anywhere else
|
else // anywhere else
|
||||||
{
|
{
|
||||||
|
|
@ -6288,7 +6289,7 @@ void Player::UpdateZone(uint32 newZone)
|
||||||
SetRestType(REST_TYPE_NO);
|
SetRestType(REST_TYPE_NO);
|
||||||
|
|
||||||
if(sWorld.IsFFAPvPRealm())
|
if(sWorld.IsFFAPvPRealm())
|
||||||
SetFlag(PLAYER_FLAGS,PLAYER_FLAGS_FFA_PVP);
|
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // not in tavern (leave city then)
|
else // not in tavern (leave city then)
|
||||||
|
|
@ -6298,7 +6299,7 @@ void Player::UpdateZone(uint32 newZone)
|
||||||
|
|
||||||
// Set player to FFA PVP when not in rested environment.
|
// Set player to FFA PVP when not in rested environment.
|
||||||
if(sWorld.IsFFAPvPRealm())
|
if(sWorld.IsFFAPvPRealm())
|
||||||
SetFlag(PLAYER_FLAGS,PLAYER_FLAGS_FFA_PVP);
|
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -417,16 +417,18 @@ enum PlayerFlags
|
||||||
PLAYER_FLAGS_GM = 0x00000008,
|
PLAYER_FLAGS_GM = 0x00000008,
|
||||||
PLAYER_FLAGS_GHOST = 0x00000010,
|
PLAYER_FLAGS_GHOST = 0x00000010,
|
||||||
PLAYER_FLAGS_RESTING = 0x00000020,
|
PLAYER_FLAGS_RESTING = 0x00000020,
|
||||||
PLAYER_FLAGS_FFA_PVP = 0x00000080,
|
PLAYER_FLAGS_UNK7 = 0x00000040,
|
||||||
|
PLAYER_FLAGS_UNK8 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state
|
||||||
PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards
|
PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards
|
||||||
PLAYER_FLAGS_IN_PVP = 0x00000200,
|
PLAYER_FLAGS_IN_PVP = 0x00000200,
|
||||||
PLAYER_FLAGS_HIDE_HELM = 0x00000400,
|
PLAYER_FLAGS_HIDE_HELM = 0x00000400,
|
||||||
PLAYER_FLAGS_HIDE_CLOAK = 0x00000800,
|
PLAYER_FLAGS_HIDE_CLOAK = 0x00000800,
|
||||||
PLAYER_FLAGS_UNK1 = 0x00001000, // played long time
|
PLAYER_FLAGS_UNK13 = 0x00001000, // played long time
|
||||||
PLAYER_FLAGS_UNK2 = 0x00002000, // played too long time
|
PLAYER_FLAGS_UNK14 = 0x00002000, // played too long time
|
||||||
PLAYER_FLAGS_UNK3 = 0x00008000, // strange visual effect (2.0.1), looks like PLAYER_FLAGS_GHOST flag
|
PLAYER_FLAGS_UNK15 = 0x00004000,
|
||||||
PLAYER_FLAGS_UNK4 = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary
|
PLAYER_FLAGS_UNK16 = 0x00008000, // strange visual effect (2.0.1), looks like PLAYER_FLAGS_GHOST flag
|
||||||
PLAYER_FLAGS_UNK5 = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
|
PLAYER_FLAGS_UNK17 = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary
|
||||||
|
PLAYER_FLAGS_UNK18 = 0x00020000, // taxi benchmark mode (on/off) (2.0.1)
|
||||||
PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually)
|
PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6239,7 +6239,7 @@ bool Unit::IsHostileTo(Unit const* unit) const
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// PvP FFA state
|
// PvP FFA state
|
||||||
if(pTester->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP) && pTarget->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP))
|
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))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//= PvP states
|
//= PvP states
|
||||||
|
|
@ -6348,7 +6348,7 @@ bool Unit::IsFriendlyTo(Unit const* unit) const
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// PvP FFA state
|
// PvP FFA state
|
||||||
if(pTester->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP) && pTarget->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_FFA_PVP))
|
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))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//= PvP states
|
//= PvP states
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "6992"
|
#define REVISION_NR "6993"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue