mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[7905] Implement ACTION_T_SET_SHEATH for creature event ai make possibility set ranged fire state.
Also related cleanup code in field cases and player Player::SetSheath.
This commit is contained in:
parent
2fc277fdb6
commit
b83f32fc19
10 changed files with 38 additions and 10 deletions
|
|
@ -81,7 +81,13 @@ void WorldSession::HandleSetSheathedOpcode( WorldPacket & recv_data )
|
|||
|
||||
//sLog.outDebug( "WORLD: Recvd CMSG_SETSHEATHED Message guidlow:%u value1:%u", GetPlayer()->GetGUIDLow(), sheathed );
|
||||
|
||||
GetPlayer()->SetSheath(sheathed);
|
||||
if(sheathed >= MAX_SHEATH_STATE)
|
||||
{
|
||||
sLog.outError("Unknown sheath state %u ??",sheathed);
|
||||
return;
|
||||
}
|
||||
|
||||
GetPlayer()->SetSheath(SheathState(sheathed));
|
||||
}
|
||||
|
||||
void WorldSession::SendAttackStop(Unit const* enemy)
|
||||
|
|
|
|||
|
|
@ -256,7 +256,7 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data )
|
|||
m_regenHealth = GetCreatureInfo()->RegenHealth;
|
||||
|
||||
// creatures always have melee weapon ready if any
|
||||
SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE );
|
||||
SetSheath(SHEATH_STATE_MELEE);
|
||||
|
||||
SelectLevel(GetCreatureInfo());
|
||||
if (team == HORDE)
|
||||
|
|
|
|||
|
|
@ -783,6 +783,11 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
|||
cell_lock->Visit(cell_lock, grid_creature_searcher, *m_creature->GetMap());
|
||||
break;
|
||||
}
|
||||
case ACTION_T_SET_SHEATH:
|
||||
{
|
||||
m_creature->SetSheath(SheathState(action.set_sheath.sheath));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ enum EventAI_ActionType
|
|||
ACTION_T_DIE = 37, // No Params
|
||||
ACTION_T_ZONE_COMBAT_PULSE = 38, // No Params
|
||||
ACTION_T_CALL_FOR_HELP = 39, // Radius
|
||||
|
||||
ACTION_T_SET_SHEATH = 40, // Sheath (0-passive,1-melee,2-ranged)
|
||||
ACTION_T_END,
|
||||
};
|
||||
|
||||
|
|
@ -364,6 +364,11 @@ struct CreatureEventAI_Action
|
|||
{
|
||||
uint32 radius;
|
||||
} call_for_help;
|
||||
// ACTION_T_SET_SHEATH = 40
|
||||
struct
|
||||
{
|
||||
uint32 sheath;
|
||||
} set_sheath;
|
||||
// RAW
|
||||
struct
|
||||
{
|
||||
|
|
|
|||
|
|
@ -641,6 +641,13 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
|
|||
if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.update_template.creatureId))
|
||||
sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses non-existant creature entry %u.", i, j+1, action.update_template.creatureId);
|
||||
break;
|
||||
case ACTION_T_SET_SHEATH:
|
||||
if (action.set_sheath.sheath >= MAX_SHEATH_STATE)
|
||||
{
|
||||
sLog.outErrorDb("CreatureEventAI: Event %u Action %u uses wrong sheath state %u.", i, j+1, action.set_sheath.sheath);
|
||||
action.set_sheath.sheath = SHEATH_STATE_UNARMED;
|
||||
}
|
||||
break;
|
||||
case ACTION_T_EVADE: //No Params
|
||||
case ACTION_T_FLEE_FOR_ASSIST: //No Params
|
||||
case ACTION_T_DIE: //No Params
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
|||
break;
|
||||
case HUNTER_PET:
|
||||
SetUInt32Value(UNIT_FIELD_BYTES_0, 0x02020100);
|
||||
SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE);
|
||||
SetSheath(SHEATH_STATE_MELEE);
|
||||
SetByteValue(UNIT_FIELD_BYTES_2, 2, fields[9].GetBool() ? UNIT_RENAME_NOT_ALLOWED : UNIT_RENAME_ALLOWED);
|
||||
|
||||
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
|
||||
|
|
@ -783,7 +783,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
|||
if(cinfo->type == CREATURE_TYPE_BEAST)
|
||||
{
|
||||
SetUInt32Value(UNIT_FIELD_BYTES_0, 0x02020100);
|
||||
SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE );
|
||||
SetSheath(SHEATH_STATE_MELEE);
|
||||
SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_ALLOWED);
|
||||
SetUInt32Value(UNIT_MOD_CAST_SPEED, creature->GetUInt32Value(UNIT_MOD_CAST_SPEED));
|
||||
}
|
||||
|
|
@ -1756,7 +1756,7 @@ bool Pet::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint3
|
|||
if(!InitEntry(Entry))
|
||||
return false;
|
||||
|
||||
SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE);
|
||||
SetSheath(SHEATH_STATE_MELEE);
|
||||
|
||||
if(getPetType() == MINI_PET) // always non-attackable
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
|
|
|
|||
|
|
@ -7913,7 +7913,7 @@ void Player::SetVirtualItemSlot( uint8 i, Item* item)
|
|||
}
|
||||
}
|
||||
|
||||
void Player::SetSheath( uint32 sheathed )
|
||||
void Player::SetSheath( SheathState sheathed )
|
||||
{
|
||||
switch (sheathed)
|
||||
{
|
||||
|
|
@ -7939,7 +7939,7 @@ void Player::SetSheath( uint32 sheathed )
|
|||
SetVirtualItemSlot(2,NULL);
|
||||
break;
|
||||
}
|
||||
SetByteValue(UNIT_FIELD_BYTES_2, 0, sheathed); // this must visualize Sheath changing for other players...
|
||||
Unit::SetSheath(sheathed); // this must visualize Sheath changing for other players...
|
||||
}
|
||||
|
||||
uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap ) const
|
||||
|
|
|
|||
|
|
@ -963,7 +963,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
/*********************************************************/
|
||||
|
||||
void SetVirtualItemSlot( uint8 i, Item* item);
|
||||
void SetSheath( uint32 sheathed );
|
||||
void SetSheath( SheathState sheathed ); // overwrite Unit version
|
||||
uint8 FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap ) const;
|
||||
uint32 GetItemCount( uint32 item, bool inBankAlso = false, Item* skipItem = NULL ) const;
|
||||
Item* GetItemByGuid( uint64 guid ) const;
|
||||
|
|
|
|||
|
|
@ -191,6 +191,8 @@ enum SheathState
|
|||
SHEATH_STATE_RANGED = 2 // prepared ranged weapon
|
||||
};
|
||||
|
||||
#define MAX_SHEATH_STATE 3
|
||||
|
||||
// byte (1 from 0..3) of UNIT_FIELD_BYTES_2
|
||||
enum UnitBytes2_Flags
|
||||
{
|
||||
|
|
@ -918,6 +920,9 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
void ApplyAttackTimePercentMod(WeaponAttackType att,float val, bool apply);
|
||||
void ApplyCastTimePercentMod(float val, bool apply);
|
||||
|
||||
SheathState GetSheath() const { return SheathState(GetByteValue(UNIT_FIELD_BYTES_2, 0)); }
|
||||
virtual void SetSheath( SheathState sheathed ) { SetByteValue(UNIT_FIELD_BYTES_2, 0, sheathed); }
|
||||
|
||||
// faction template id
|
||||
uint32 getFaction() const { return GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE); }
|
||||
void setFaction(uint32 faction) { SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction ); }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7904"
|
||||
#define REVISION_NR "7905"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue