[8098] Support uint32 spell ids in code.

* Propertly work with uint32 spell ids in player action bar
* Fix in same time bug with not save equipment set button with id==0
* Merge misc field in character_action and playercreateinfo_action to action field as 3 byte
* Propertly load uint32 spell ids from character_spell
* Fixed types for some pet/creature related structure for spell id storing.
This commit is contained in:
VladimirMangos 2009-06-30 07:37:36 +04:00
parent c24e041794
commit 1baec77845
21 changed files with 638 additions and 565 deletions

View file

@ -34,17 +34,18 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
CHECK_PACKET_SIZE(recv_data, 8+2+2+8);
uint64 guid1;
uint16 spellid;
uint16 flag;
uint32 data;
uint64 guid2;
recv_data >> guid1; //pet guid
recv_data >> spellid;
recv_data >> flag; //delete = 0x0700 CastSpell = C100
recv_data >> data;
recv_data >> guid2; //tag guid
uint32 spellid = UNIT_ACTION_BUTTON_ACTION(data);
uint8 flag = UNIT_ACTION_BUTTON_TYPE(data); //delete = 0x07 CastSpell = C1
// used also for charmed creature
Unit* pet= ObjectAccessor::GetUnit(*_player, guid1);
sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), flag, spellid, uint32(GUID_LOPART(guid2)) );
sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)) );
if(!pet)
{
sLog.outError( "Pet %u not exist.", uint32(GUID_LOPART(guid1)) );
@ -72,7 +73,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
switch(flag)
{
case ACT_COMMAND: //0x0700
case ACT_COMMAND: //0x07
switch(spellid)
{
case COMMAND_STAY: //flat=1792 //STAY
@ -121,7 +122,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
pet->SendPetAIReaction(guid1);
}
}
else // charmed player
else // charmed player
{
pet->Attack(TargetUnit,true);
pet->SendPetAIReaction(guid1);
@ -143,10 +144,10 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
_player->Uncharm();
break;
default:
sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", flag, spellid);
sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
}
break;
case ACT_REACTION: // 0x600
case ACT_REACTION: // 0x6
switch(spellid)
{
case REACT_PASSIVE: //passive
@ -156,9 +157,9 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
break;
}
break;
case ACT_DISABLED: // 0x8100 spell (disabled), ignore
case ACT_PASSIVE: // 0x0100
case ACT_ENABLED: // 0xC100 spell
case ACT_DISABLED: // 0x81 spell (disabled), ignore
case ACT_PASSIVE: // 0x01
case ACT_ENABLED: // 0xC1 spell
{
Unit* unit_target = NULL;
if (((Creature*)pet)->GetGlobalCooldown() > 0)
@ -258,7 +259,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
break;
}
default:
sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", flag, spellid);
sLog.outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid);
}
}
@ -309,9 +310,6 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
sLog.outDetail( "HandlePetSetAction. CMSG_PET_SET_ACTION" );
uint64 petguid;
uint32 position;
uint16 spell_id;
uint16 act_state;
uint8 count;
recv_data >> petguid;
@ -339,11 +337,16 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
count = (recv_data.size() == 24) ? 2 : 1;
for(uint8 i = 0; i < count; ++i)
{
recv_data >> position;
recv_data >> spell_id;
recv_data >> act_state;
uint32 position;
uint32 data;
sLog.outDetail( "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position, spell_id, act_state);
recv_data >> position;
recv_data >> data;
uint32 spell_id = UNIT_ACTION_BUTTON_ACTION(data);
uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data);
sLog.outDetail( "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position, spell_id, uint32(act_state));
//ignore invalid position
if(position >= MAX_UNIT_ACTION_BAR_INDEX)
@ -516,10 +519,9 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
sLog.outDetail("CMSG_PET_SPELL_AUTOCAST");
uint64 guid;
uint16 spellid;
uint16 spellid2; //maybe second spell, automatically toggled off when first toggled on?
uint32 spellid;
uint8 state; //1 for on, 0 for off
recvPacket >> guid >> spellid >> spellid2 >> state;
recvPacket >> guid >> spellid >> state;
if(!_player->GetPet() && !_player->GetCharm())
return;