aboutsummaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/GameObject.cpp4
-rw-r--r--src/game/MiscHandler.cpp4
-rw-r--r--src/game/ObjectMgr.cpp16
-rw-r--r--src/game/Player.cpp9
-rw-r--r--src/game/Player.h46
-rw-r--r--src/game/SharedDefines.h15
-rw-r--r--src/game/Spell.cpp2
-rw-r--r--src/game/SpellAuras.cpp14
-rw-r--r--src/game/Unit.cpp11
-rw-r--r--src/game/Unit.h32
10 files changed, 77 insertions, 76 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
index 99fe5f725bc..58ffb787a15 100644
--- a/src/game/GameObject.cpp
+++ b/src/game/GameObject.cpp
@@ -969,7 +969,7 @@ void GameObject::Use(Unit* user)
// fallback, will always work
player->TeleportTo(GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(),TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET);
}
- player->SetStandState(PLAYER_STATE_SIT_LOW_CHAIR+info->chair.height);
+ player->SetStandState(UNIT_STAND_STATE_SIT_LOW_CHAIR+info->chair.height);
return;
}
//big gun, its a spell/aura
@@ -1280,7 +1280,7 @@ void GameObject::Use(Unit* user)
WorldPacket data(SMSG_ENABLE_BARBER_SHOP, 0);
player->GetSession()->SendPacket(&data);
- player->SetStandState(PLAYER_STATE_SIT_LOW_CHAIR+info->barberChair.chairheight);
+ player->SetStandState(UNIT_STAND_STATE_SIT_LOW_CHAIR+info->barberChair.chairheight);
return;
}
default:
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index 255d8e5fd4d..eda08ebcd25 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -306,7 +306,7 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ )
// not set flags if player can't free move to prevent lost state at logout cancel
if(GetPlayer()->CanFreeMove())
{
- GetPlayer()->SetStandState(PLAYER_STATE_SIT);
+ GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT);
WorldPacket data( SMSG_FORCE_MOVE_ROOT, (8+4) ); // guess size
data.append(GetPlayer()->GetPackGUID());
@@ -346,7 +346,7 @@ void WorldSession::HandleLogoutCancelOpcode( WorldPacket & /*recv_data*/ )
SendPacket( &data );
//! Stand Up
- GetPlayer()->SetStandState(PLAYER_STATE_NONE);
+ GetPlayer()->SetStandState(UNIT_STAND_STATE_STAND);
//! DISABLE_ROTATE
GetPlayer()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index 898299dc076..39220b87f75 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -5859,10 +5859,10 @@ void ObjectMgr::LoadGameobjectInfo()
break;
}
case GAMEOBJECT_TYPE_CHAIR: //7
- if(goInfo->chair.height > 2)
+ if(goInfo->chair.height > (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR) )
{
- sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data1=%u but correct chair height in range 0..2.",
- id,goInfo->type,goInfo->chair.height);
+ sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data1=%u but correct chair height in range 0..%i.",
+ id,goInfo->type,goInfo->chair.height,UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR);
// prevent client and server unexpected work
const_cast<GameObjectInfo*>(goInfo)->chair.height = 0;
@@ -5957,6 +5957,16 @@ void ObjectMgr::LoadGameobjectInfo()
}
break;
}
+ case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
+ if(goInfo->barberChair.chairheight > (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR) )
+ {
+ sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data1=%u but correct chair height in range 0..%i.",
+ id,goInfo->type,goInfo->barberChair.chairheight,UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR);
+
+ // prevent client and server unexpected work
+ const_cast<GameObjectInfo*>(goInfo)->barberChair.chairheight = 0;
+ }
+ break;
}
}
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 7bf2deff3e8..63a06d79036 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -2487,7 +2487,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
// 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);
- SetByteValue(UNIT_FIELD_BYTES_1, 2, 0x00); // one form stealth modified bytes
+ RemoveStandFlags(UNIT_STAND_FLAGS_ALL); // 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
@@ -3938,7 +3938,8 @@ void Player::BuildPlayerRepop()
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, (float)1.0); //see radius of death player?
- SetByteValue(UNIT_FIELD_BYTES_1, 3, PLAYER_STATE_FLAG_ALWAYS_STAND);
+ // set and clear other
+ SetByteValue(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND);
}
void Player::SendDelayResponse(const uint32 ml_seconds)
@@ -15888,9 +15889,9 @@ void Player::SaveToDB()
uint32 tmp_displayid = GetDisplayId();
// Set player sit state to standing on save, also stealth and shifted form
- SetByteValue(UNIT_FIELD_BYTES_1, 0, 0); // stand state
+ SetStandState(UNIT_STAND_STATE_STAND); // stand state
+ RemoveStandFlags(UNIT_STAND_FLAGS_ALL); // stand flags?
SetByteValue(UNIT_FIELD_BYTES_2, 3, 0); // shapeshift
- SetByteValue(UNIT_FIELD_BYTES_1, 3, 0); // stand flags?
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
SetDisplayId(GetNativeDisplayId());
diff --git a/src/game/Player.h b/src/game/Player.h
index c6b99cefe70..8d6a486e3b8 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -376,52 +376,6 @@ enum DrunkenState
DRUNKEN_SMASHED = 3
};
-enum PlayerStateType
-{
- /*
- PLAYER_STATE_DANCE
- PLAYER_STATE_SLEEP
- PLAYER_STATE_SIT
- PLAYER_STATE_STAND
- PLAYER_STATE_READYUNARMED
- PLAYER_STATE_WORK
- PLAYER_STATE_POINT(DNR)
- PLAYER_STATE_NONE // not used or just no state, just standing there?
- PLAYER_STATE_STUN
- PLAYER_STATE_DEAD
- PLAYER_STATE_KNEEL
- PLAYER_STATE_USESTANDING
- PLAYER_STATE_STUN_NOSHEATHE
- PLAYER_STATE_USESTANDING_NOSHEATHE
- PLAYER_STATE_WORK_NOSHEATHE
- PLAYER_STATE_SPELLPRECAST
- PLAYER_STATE_READYRIFLE
- PLAYER_STATE_WORK_NOSHEATHE_MINING
- PLAYER_STATE_WORK_NOSHEATHE_CHOPWOOD
- PLAYER_STATE_AT_EASE
- PLAYER_STATE_READY1H
- PLAYER_STATE_SPELLKNEELSTART
- PLAYER_STATE_SUBMERGED
- */
-
- PLAYER_STATE_NONE = 0,
- PLAYER_STATE_SIT = 1,
- PLAYER_STATE_SIT_CHAIR = 2,
- PLAYER_STATE_SLEEP = 3,
- PLAYER_STATE_SIT_LOW_CHAIR = 4,
- PLAYER_STATE_SIT_MEDIUM_CHAIR = 5,
- PLAYER_STATE_SIT_HIGH_CHAIR = 6,
- PLAYER_STATE_DEAD = 7,
- PLAYER_STATE_KNEEL = 8,
-
- PLAYER_STATE_FORM_ALL = 0x00FF0000,
-
- PLAYER_STATE_FLAG_ALWAYS_STAND = 0x01, // byte 4
- PLAYER_STATE_FLAG_CREEP = 0x02000000,
- PLAYER_STATE_FLAG_UNTRACKABLE = 0x04000000,
- PLAYER_STATE_FLAG_ALL = 0xFF000000,
-};
-
enum PlayerFlags
{
PLAYER_FLAGS_GROUP_LEADER = 0x00000001,
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index 51f6f1488fe..abd601e3851 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -1986,13 +1986,14 @@ enum CorpseDynFlags
};
// Passive Spell codes explicit used in code
-#define SPELL_ID_GENERIC_LEARN 483
-#define SPELL_ID_GENERIC_LEARN_PET 55884 // used for learning mounts and companions
-#define SPELL_ID_PASSIVE_BATTLE_STANCE 2457
-#define SPELL_ID_PASSIVE_RESURRECTION_SICKNESS 15007
-#define SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s 6119
-#define SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s 6123
-#define SPELL_ID_AUTOSHOT 75 // used for checks in other spells interruption
+#define SPELL_ID_GENERIC_LEARN 483
+#define SPELL_ID_GENERIC_LEARN_PET 55884 // used for learning mounts and companions
+#define SPELL_ID_PASSIVE_BATTLE_STANCE 2457
+#define SPELL_ID_PASSIVE_RESURRECTION_SICKNESS 15007
+#define SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_5s 6119
+#define SPELL_ID_WEAPON_SWITCH_COOLDOWN_1_0s 6123
+#define SPELL_ID_AUTOSHOT 75 // used for checks in other spells interruption
+#define SPELL_ID_SHADOWMELD 58984 // used for check ignore stealth stance state
enum WeatherType
{
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 4f658bb1c08..ce5a70fb851 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1033,7 +1033,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
else if(m_customAttr & SPELL_ATTR_CU_AURA_CC)
{
if(!unit->IsStandState())
- unit->SetStandState(PLAYER_STATE_NONE);
+ unit->SetStandState(UNIT_STAND_STATE_STAND);
}
}
}
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index fdb8fe316f5..bdff9779297 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -831,7 +831,7 @@ void Aura::_AddAura()
{
// Sitdown on apply aura req seated
if (m_spellProto->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED && !m_target->IsSitState())
- m_target->SetStandState(PLAYER_STATE_SIT);
+ m_target->SetStandState(UNIT_STAND_STATE_SIT);
// register aura diminishing on apply
if (getDiminishGroup() != DIMINISHING_NONE )
@@ -3317,7 +3317,8 @@ void Aura::HandleModStealth(bool apply, bool Real)
// only at real aura add
if(Real)
{
- m_target->SetByteValue(UNIT_FIELD_BYTES_1, 2, 0x02);
+ if(GetId()!=SPELL_ID_SHADOWMELD)
+ m_target->SetStandFlags(UNIT_STAND_FLAGS_CREEP);
if(m_target->GetTypeId()==TYPEID_PLAYER)
m_target->SetFlag(PLAYER_FIELD_BYTES2, 0x2000);
@@ -3338,7 +3339,8 @@ void Aura::HandleModStealth(bool apply, bool Real)
// if last SPELL_AURA_MOD_STEALTH and no GM invisibility
if(!m_target->HasAuraType(SPELL_AURA_MOD_STEALTH) && m_target->GetVisibility()!=VISIBILITY_OFF)
{
- m_target->SetByteValue(UNIT_FIELD_BYTES_1, 2, 0x00);
+ if(GetId()!=SPELL_ID_SHADOWMELD)
+ m_target->RemoveStandFlags(UNIT_STAND_FLAGS_CREEP);
if(m_target->GetTypeId()==TYPEID_PLAYER)
m_target->RemoveFlag(PLAYER_FIELD_BYTES2, 0x2000);
@@ -5148,9 +5150,9 @@ void Aura::HandleAuraEmpathy(bool apply, bool Real)
void Aura::HandleAuraUntrackable(bool apply, bool Real)
{
if(apply)
- m_target->SetFlag(UNIT_FIELD_BYTES_1, PLAYER_STATE_FLAG_UNTRACKABLE);
+ m_target->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_UNTRACKABLE);
else
- m_target->RemoveFlag(UNIT_FIELD_BYTES_1, PLAYER_STATE_FLAG_UNTRACKABLE);
+ m_target->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_UNTRACKABLE);
}
void Aura::HandleAuraModPacify(bool apply, bool Real)
@@ -5320,7 +5322,7 @@ void Aura::HandleSpiritOfRedemption( bool apply, bool Real )
// set stand state (expected in this form)
if(!m_target->IsStandState())
- m_target->SetStandState(PLAYER_STATE_NONE);
+ m_target->SetStandState(UNIT_STAND_STATE_STAND);
}
m_target->SetHealth(1);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 5fd2fa69bc5..8573018ab47 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -9064,7 +9064,7 @@ void Unit::SetInCombatWith(Unit* enemy)
void Unit::CombatStart(Unit* target)
{
if(!target->IsStandState()/* && !target->hasUnitState(UNIT_STAT_STUNNED)*/)
- target->SetStandState(PLAYER_STATE_NONE);
+ target->SetStandState(UNIT_STAND_STATE_STAND);
if(!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER
&& !((Creature*)target)->HasReactState(REACT_PASSIVE) && ((Creature*)target)->AI())
@@ -11214,15 +11214,16 @@ void Unit::SetConfused(bool apply, uint64 casterGUID, uint32 spellID)
bool Unit::IsSitState() const
{
uint8 s = getStandState();
- return s == PLAYER_STATE_SIT_CHAIR || s == PLAYER_STATE_SIT_LOW_CHAIR ||
- s == PLAYER_STATE_SIT_MEDIUM_CHAIR || s == PLAYER_STATE_SIT_HIGH_CHAIR ||
- s == PLAYER_STATE_SIT;
+ return
+ s == UNIT_STAND_STATE_SIT_CHAIR || s == UNIT_STAND_STATE_SIT_LOW_CHAIR ||
+ s == UNIT_STAND_STATE_SIT_MEDIUM_CHAIR || s == UNIT_STAND_STATE_SIT_HIGH_CHAIR ||
+ s == UNIT_STAND_STATE_SIT;
}
bool Unit::IsStandState() const
{
uint8 s = getStandState();
- return !IsSitState() && s != PLAYER_STATE_SLEEP && s != PLAYER_STATE_KNEEL;
+ return !IsSitState() && s != UNIT_STAND_STATE_SLEEP && s != UNIT_STAND_STATE_KNEEL;
}
void Unit::SetStandState(uint8 state)
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 08b1b8c2bf6..315f2c074a1 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -130,6 +130,35 @@ enum SpellFacingFlags
#define BASE_MAXDAMAGE 2.0f
#define BASE_ATTACK_TIME 2000
+// byte value (UNIT_FIELD_BYTES_1,0)
+enum UnitStandStateType
+{
+ UNIT_STAND_STATE_STAND = 0,
+ UNIT_STAND_STATE_SIT = 1,
+ UNIT_STAND_STATE_SIT_CHAIR = 2,
+ UNIT_STAND_STATE_SLEEP = 3,
+ UNIT_STAND_STATE_SIT_LOW_CHAIR = 4,
+ UNIT_STAND_STATE_SIT_MEDIUM_CHAIR = 5,
+ UNIT_STAND_STATE_SIT_HIGH_CHAIR = 6,
+ UNIT_STAND_STATE_DEAD = 7,
+ UNIT_STAND_STATE_KNEEL = 8
+};
+
+// byte flag value (UNIT_FIELD_BYTES_1,2)
+enum UnitStandFlags
+{
+ UNIT_STAND_FLAGS_CREEP = 0x02,
+ UNIT_STAND_FLAGS_ALL = 0xFF
+};
+
+// byte flags value (UNIT_FIELD_BYTES_1,3)
+enum UnitBytes1_Flags
+{
+ UNIT_BYTE1_FLAG_ALWAYS_STAND = 0x01,
+ UNIT_BYTE1_FLAG_UNTRACKABLE = 0x04,
+ UNIT_BYTE1_FLAG_ALL = 0xFF
+};
+
// high byte (3 from 0..3) of UNIT_FIELD_BYTES_2
enum ShapeshiftForm
{
@@ -937,6 +966,9 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
bool IsStandState() const;
void SetStandState(uint8 state);
+ void SetStandFlags(uint8 flags) { SetByteFlag(UNIT_FIELD_BYTES_1, 2,flags); }
+ void RemoveStandFlags(uint8 flags) { RemoveByteFlag(UNIT_FIELD_BYTES_1, 2,flags); }
+
bool IsMounted() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT ); }
uint32 GetMountID() const { return GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID); }
void Mount(uint32 mount);