mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-13 10:52:28 +00:00
Use PlayerState to generate stun particles
This commit is contained in:
parent
103d808925
commit
bf4ff03641
@ -2858,10 +2858,7 @@ void Bot::SaveTimers() {
|
||||
bool Bot::Process()
|
||||
{
|
||||
if(IsStunned() && stunned_timer.Check())
|
||||
{
|
||||
this->stunned = false;
|
||||
this->stunned_timer.Disable();
|
||||
}
|
||||
Mob::UnStun();
|
||||
|
||||
if(!GetBotOwner())
|
||||
return false;
|
||||
|
||||
@ -10347,7 +10347,6 @@ void Client::Handle_OP_PlayerStateRemove(const EQApplicationPacket *app)
|
||||
PlayerState_Struct *ps = (PlayerState_Struct *)app->pBuffer;
|
||||
RemovePlayerState(ps->state);
|
||||
|
||||
// We should probably save it server side, but for now this works
|
||||
entity_list.QueueClients(this, app, true);
|
||||
}
|
||||
|
||||
|
||||
@ -197,10 +197,8 @@ bool Client::Process() {
|
||||
instalog = true;
|
||||
}
|
||||
|
||||
if (IsStunned() && stunned_timer.Check()) {
|
||||
this->stunned = false;
|
||||
this->stunned_timer.Disable();
|
||||
}
|
||||
if (IsStunned() && stunned_timer.Check())
|
||||
Mob::UnStun();
|
||||
|
||||
if(!m_CheatDetectMoved)
|
||||
{
|
||||
|
||||
@ -173,6 +173,18 @@ enum class NumHit { // Numhits type
|
||||
OffensiveSpellProcs = 11 // Offensive buff procs
|
||||
};
|
||||
|
||||
enum class PlayerState : uint32 {
|
||||
None = 0,
|
||||
Open = 1,
|
||||
WeaponSheathed = 2,
|
||||
Aggressive = 4,
|
||||
ForcedAggressive = 8,
|
||||
InstrumentEquipped = 16,
|
||||
Stunned = 32,
|
||||
PrimaryWeaponEquipped = 64,
|
||||
SecondaryWeaponEquipped = 128
|
||||
};
|
||||
|
||||
//this is our internal representation of the BUFF struct, can put whatever we want in it
|
||||
struct Buffs_Struct {
|
||||
uint16 spellid;
|
||||
|
||||
@ -1236,10 +1236,7 @@ void Merc::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho) {
|
||||
bool Merc::Process()
|
||||
{
|
||||
if(IsStunned() && stunned_timer.Check())
|
||||
{
|
||||
this->stunned = false;
|
||||
this->stunned_timer.Disable();
|
||||
}
|
||||
Mob::UnStun();
|
||||
|
||||
if (GetDepop())
|
||||
{
|
||||
|
||||
31
zone/mob.cpp
31
zone/mob.cpp
@ -148,7 +148,7 @@ Mob::Mob(const char* in_name,
|
||||
size = in_size;
|
||||
base_size = size;
|
||||
runspeed = in_runspeed;
|
||||
PlayerState = 0;
|
||||
m_PlayerState = 0;
|
||||
|
||||
|
||||
// sanity check
|
||||
@ -916,7 +916,7 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
|
||||
ns->spawn.class_ = class_;
|
||||
ns->spawn.gender = gender;
|
||||
ns->spawn.level = level;
|
||||
ns->spawn.PlayerState = PlayerState;
|
||||
ns->spawn.PlayerState = m_PlayerState;
|
||||
ns->spawn.deity = deity;
|
||||
ns->spawn.animation = 0;
|
||||
ns->spawn.findable = findable?1:0;
|
||||
@ -5423,3 +5423,30 @@ bool Mob::CanClassEquipItem(uint32 item_id)
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
void Mob::SendAddPlayerState(PlayerState new_state)
|
||||
{
|
||||
auto app = new EQApplicationPacket(OP_PlayerStateAdd, sizeof(PlayerState_Struct));
|
||||
auto ps = (PlayerState_Struct *)app->pBuffer;
|
||||
|
||||
ps->spawn_id = GetID();
|
||||
ps->state = static_cast<uint32>(new_state);
|
||||
|
||||
AddPlayerState(ps->state);
|
||||
entity_list.QueueClients(nullptr, app);
|
||||
safe_delete(app);
|
||||
}
|
||||
|
||||
void Mob::SendRemovePlayerState(PlayerState old_state)
|
||||
{
|
||||
auto app = new EQApplicationPacket(OP_PlayerStateRemove, sizeof(PlayerState_Struct));
|
||||
auto ps = (PlayerState_Struct *)app->pBuffer;
|
||||
|
||||
ps->spawn_id = GetID();
|
||||
ps->state = static_cast<uint32>(old_state);
|
||||
|
||||
RemovePlayerState(ps->state);
|
||||
entity_list.QueueClients(nullptr, app);
|
||||
safe_delete(app);
|
||||
}
|
||||
|
||||
|
||||
10
zone/mob.h
10
zone/mob.h
@ -1026,10 +1026,12 @@ protected:
|
||||
uint32 follow_dist;
|
||||
bool no_target_hotkey;
|
||||
|
||||
uint32 PlayerState;
|
||||
uint32 GetPlayerState() { return PlayerState; }
|
||||
void AddPlayerState(uint32 new_state) { PlayerState |= new_state; }
|
||||
void RemovePlayerState(uint32 old_state) { PlayerState &= ~old_state; }
|
||||
uint32 m_PlayerState;
|
||||
uint32 GetPlayerState() { return m_PlayerState; }
|
||||
void AddPlayerState(uint32 new_state) { m_PlayerState |= new_state; }
|
||||
void RemovePlayerState(uint32 old_state) { m_PlayerState &= ~old_state; }
|
||||
void SendAddPlayerState(PlayerState new_state);
|
||||
void SendRemovePlayerState(PlayerState old_state);
|
||||
|
||||
uint8 gender;
|
||||
uint16 race;
|
||||
|
||||
@ -569,8 +569,7 @@ bool NPC::Process()
|
||||
{
|
||||
if (IsStunned() && stunned_timer.Check())
|
||||
{
|
||||
this->stunned = false;
|
||||
this->stunned_timer.Disable();
|
||||
Mob::UnStun();
|
||||
this->spun_timer.Disable();
|
||||
}
|
||||
|
||||
|
||||
@ -4708,7 +4708,7 @@ void Mob::Stun(int duration)
|
||||
{
|
||||
stunned = true;
|
||||
stunned_timer.Start(duration);
|
||||
SendStunAppearance();
|
||||
SendAddPlayerState(PlayerState::Stunned);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4716,6 +4716,7 @@ void Mob::UnStun() {
|
||||
if(stunned && stunned_timer.Enabled()) {
|
||||
stunned = false;
|
||||
stunned_timer.Disable();
|
||||
SendRemovePlayerState(PlayerState::Stunned);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user