Various Cleanups (game P)

This commit is contained in:
Schmoozerd 2012-07-19 21:51:30 +02:00
parent 94795f2bff
commit 98e1efd435
17 changed files with 3642 additions and 3615 deletions

View file

@ -207,7 +207,7 @@ void WorldSession::HandlePetAction(WorldPacket& recv_data)
{
pet->SetInFront(unit_target);
if (unit_target->GetTypeId() == TYPEID_PLAYER)
pet->SendCreateUpdateToPlayer( (Player*)unit_target );
pet->SendCreateUpdateToPlayer((Player*)unit_target);
}
else if (Unit* unit_target2 = spell->m_targets.getUnitTarget())
{
@ -416,7 +416,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recv_data)
uint32 spell_id_0 = UNIT_ACTION_BUTTON_ACTION(data[0]);
UnitActionBarEntry const* actionEntry_1 = charmInfo->GetActionBarEntry(position[1]);
if (!actionEntry_1 || spell_id_0 != actionEntry_1->GetAction() ||
act_state_0 != actionEntry_1->GetType())
act_state_0 != actionEntry_1->GetType())
return;
}
@ -426,7 +426,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recv_data)
uint32 spell_id_1 = UNIT_ACTION_BUTTON_ACTION(data[1]);
UnitActionBarEntry const* actionEntry_0 = charmInfo->GetActionBarEntry(position[0]);
if (!actionEntry_0 || spell_id_1 != actionEntry_0->GetAction() ||
act_state_1 != actionEntry_0->GetType())
act_state_1 != actionEntry_0->GetType())
return;
}
}
@ -436,7 +436,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recv_data)
uint32 spell_id = UNIT_ACTION_BUTTON_ACTION(data[i]);
uint8 act_state = UNIT_ACTION_BUTTON_TYPE(data[i]);
DETAIL_LOG( "Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position[i], spell_id, uint32(act_state));
DETAIL_LOG("Player %s has changed pet spell action. Position: %u, Spell: %u, State: 0x%X", _player->GetName(), position[i], spell_id, uint32(act_state));
// if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add
if (!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id)))
@ -478,10 +478,10 @@ void WorldSession::HandlePetRename(WorldPacket& recv_data)
recv_data >> isdeclined;
Pet* pet = _player->GetMap()->GetPet(petGuid);
// check it!
// check it!
if (!pet || pet->getPetType() != HUNTER_PET ||
!pet->HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ||
pet->GetOwnerGuid() != _player->GetObjectGuid() || !pet->GetCharmInfo())
!pet->HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ||
pet->GetOwnerGuid() != _player->GetObjectGuid() || !pet->GetCharmInfo())
return;
PetNameInvalidReason res = ObjectMgr::CheckPetName(name);
@ -527,7 +527,7 @@ void WorldSession::HandlePetRename(WorldPacket& recv_data)
CharacterDatabase.escape_string(declinedname.name[i]);
CharacterDatabase.PExecute("DELETE FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber());
CharacterDatabase.PExecute("INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u','%u','%s','%s','%s','%s','%s')",
pet->GetCharmInfo()->GetPetNumber(), _player->GetGUIDLow(), declinedname.name[0].c_str(), declinedname.name[1].c_str(), declinedname.name[2].c_str(), declinedname.name[3].c_str(), declinedname.name[4].c_str());
pet->GetCharmInfo()->GetPetNumber(), _player->GetGUIDLow(), declinedname.name[0].c_str(), declinedname.name[1].c_str(), declinedname.name[2].c_str(), declinedname.name[3].c_str(), declinedname.name[4].c_str());
}
CharacterDatabase.escape_string(name);
@ -620,7 +620,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
}
if (pet->isCharmed())
// state can be used as boolean
// state can be used as boolean
pet->GetCharmInfo()->ToggleCreatureAutocast(spellid, state);
else
((Pet*)pet)->ToggleAutocast(spellid, state);