本文整理汇总了C++中CheckStableMaster函数的典型用法代码示例。如果您正苦于以下问题:C++ CheckStableMaster函数的具体用法?C++ CheckStableMaster怎么用?C++ CheckStableMaster使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckStableMaster函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendStableResult
void WorldSession::HandleStablePet(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_PET");
uint64 npcGUID;
recv_data >> npcGUID;
if (!GetPlayer()->isAlive())
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
if (!CheckStableMaster(npcGUID))
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Pet* pet = _player->GetPet();
// can't place in stable dead pet
if (!pet||!pet->isAlive()||pet->getPetType() != HUNTER_PET)
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
// _stablePetCallback = CharacterDatabase.AsyncPQuery("SELECT owner, slot, id FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot ",
// _player->GetGUIDLow(), PET_SLOT_HUNTER_FIRST, PET_SLOT_HUNTER_LAST);
}
示例2: HandleUnstablePet
void WorldSession::HandleUnstablePet(WorldPacket& recvData)
{
ObjectGuid npcGUID;
uint32 petnumber;
recvData >> npcGUID >> petnumber;
if (!CheckStableMaster(npcGUID))
{
SendPetStableResult(STABLE_ERR_STABLE);
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_ENTRY);
stmt->setUInt64(0, _player->GetGUID().GetCounter());
stmt->setUInt32(1, petnumber);
stmt->setUInt8(2, PET_SAVE_FIRST_STABLE_SLOT);
stmt->setUInt8(3, PET_SAVE_LAST_STABLE_SLOT);
_queryProcessor.AddQuery(CharacterDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&WorldSession::HandleUnstablePetCallback, this, petnumber, std::placeholders::_1)));
}
示例3: HandleStableSwapPet
void WorldSession::HandleStableSwapPet(WorldPacket& recvData)
{
ObjectGuid npcGUID;
uint32 petId;
recvData >> npcGUID >> petId;
if (!CheckStableMaster(npcGUID))
{
SendPetStableResult(STABLE_ERR_STABLE);
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Pet* pet = _player->GetPet();
if (!pet || pet->getPetType() != HUNTER_PET)
{
SendPetStableResult(STABLE_ERR_STABLE);
return;
}
// Find swapped pet slot in stable
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SLOT_BY_ID);
stmt->setUInt64(0, _player->GetGUID().GetCounter());
stmt->setUInt32(1, petId);
_stableSwapCallback.SetParam(petId);
_stableSwapCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
}
示例4: HandleStableSwapPet
void WorldSession::HandleStableSwapPet(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_SWAP_PET.");
uint64 npcGUID;
uint32 pet_number;
recv_data >> npcGUID >> pet_number;
if (!CheckStableMaster(npcGUID))
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Pet* pet = _player->GetPet();
if (!pet || pet->getPetType() != HUNTER_PET)
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
// find swapped pet slot in stable
_stableSwapCallback.SetParam(pet_number);
_stableSwapCallback.SetFutureResult(
CharacterDatabase.PQuery("SELECT slot, entry FROM character_pet WHERE owner = '%u' AND id = '%u'",
_player->GetGUIDLow(), pet_number)
);
}
示例5: TC_LOG_DEBUG
void WorldSession::HandleUnstablePet(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recv CMSG_UNSTABLE_PET.");
uint64 npcGUID;
uint32 petnumber;
recvData >> npcGUID >> petnumber;
if (!CheckStableMaster(npcGUID))
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_ENTRY);
stmt->setUInt32(0, _player->GetGUIDLow());
stmt->setUInt32(1, petnumber);
stmt->setUInt8(2, PET_SAVE_FIRST_STABLE_SLOT);
stmt->setUInt8(3, PET_SAVE_LAST_STABLE_SLOT);
_unstablePetCallback.SetParam(petnumber);
_unstablePetCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
}
示例6: defined
void WorldSession::HandleBuyStableSlot(WorldPacket & recvData)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_BUY_STABLE_SLOT.");
#endif
uint64 npcGUID;
recvData >> npcGUID;
if (!CheckStableMaster(npcGUID))
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if (GetPlayer()->m_stableSlots < MAX_PET_STABLES)
{
StableSlotPricesEntry const* SlotPrice = sStableSlotPricesStore.LookupEntry(GetPlayer()->m_stableSlots+1);
if (_player->HasEnoughMoney(SlotPrice->Price))
{
++GetPlayer()->m_stableSlots;
_player->ModifyMoney(-int32(SlotPrice->Price));
SendStableResult(STABLE_SUCCESS_BUY_SLOT);
}
else
SendStableResult(STABLE_ERR_MONEY);
}
else
SendStableResult(STABLE_ERR_STABLE);
}
示例7: HandleRequestStabledPets
void WorldSession::HandleRequestStabledPets(WorldPackets::NPC::RequestStabledPets& packet)
{
if (!CheckStableMaster(packet.StableMaster))
return;
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// remove mounts this fix bug where getting pet from stable while mounted deletes pet.
if (GetPlayer()->IsMounted())
GetPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED);
SendStablePet(packet.StableMaster);
}
示例8: HandleStableSwapPet
void WorldSession::HandleStableSwapPet(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_SWAP_PET.");
ObjectGuid guid;
uint32 petId;
uint8 new_slot;
recvData >> petId >> new_slot;
guid[3] = recvData.ReadBit();
guid[2] = recvData.ReadBit();
guid[0] = recvData.ReadBit();
guid[7] = recvData.ReadBit();
guid[5] = recvData.ReadBit();
guid[6] = recvData.ReadBit();
guid[1] = recvData.ReadBit();
guid[4] = recvData.ReadBit();
recvData.ReadByteSeq(guid[5]);
recvData.ReadByteSeq(guid[3]);
recvData.ReadByteSeq(guid[1]);
recvData.ReadByteSeq(guid[7]);
recvData.ReadByteSeq(guid[4]);
recvData.ReadByteSeq(guid[0]);
recvData.ReadByteSeq(guid[6]);
recvData.ReadByteSeq(guid[2]);
if (!CheckStableMaster(guid))
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
PetData* t_pet = _player->GetPetDatabyGuid(petId);
if(!t_pet)
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
HandleStableSwapPetCallback(t_pet,new_slot);
}
示例9: HandleListStabledPetsOpcode
void WorldSession::HandleListStabledPetsOpcode(WorldPacket & recv_data) {
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv MSG_LIST_STABLED_PETS");
uint64 npcGUID;
recv_data >> npcGUID;
if (!CheckStableMaster(npcGUID))
return;
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// remove mounts this fix bug where getting pet from stable while mounted deletes pet.
if (GetPlayer()->IsMounted())
GetPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED);
SendStablePet(npcGUID);
}
示例10: HandleStableSwapPet
void WorldSession::HandleStableSwapPet(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_SWAP_PET.");
uint64 npcGUID;
uint32 pet_number;
uint8 new_slot;
recv_data >> new_slot >> pet_number >> npcGUID;
if (!CheckStableMaster(npcGUID))
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Pet* pet = _player->GetPet();
/* if (!pet || pet->getPetType() != HUNTER_PET)
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
*/
//If we move the pet already summoned...
if (pet && pet->GetCharmInfo() && pet->GetCharmInfo()->GetPetNumber() == pet_number)
_player->RemovePet(pet, PET_SLOT_ACTUAL_PET_SLOT);
//If we move to the pet already summoned...
if (pet && GetPlayer()->_currentPetSlot == new_slot)
_player->RemovePet(pet, PET_SLOT_ACTUAL_PET_SLOT);
// find swapped pet slot in stable
_stableSwapCallback.SetParam(new_slot);
_stableSwapCallback.SetFutureResult(
CharacterDatabase.AsyncPQuery("SELECT slot, entry, id FROM character_pet WHERE owner = '%u' AND id = '%u'",
_player->GetGUIDLow(), pet_number)
);
}
示例11: TC_LOG_DEBUG
void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS");
ObjectGuid npcGUID;
recvData >> npcGUID;
if (!CheckStableMaster(npcGUID))
return;
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// remove mounts this fix bug where getting pet from stable while mounted deletes pet.
if (GetPlayer()->IsMounted())
GetPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED);
SendStablePet(npcGUID);
}
示例12: HandleStableChangeSlot
void WorldSession::HandleStableChangeSlot(WorldPacket & recv_data)
{
sLog->outDebug("WORLD: Recv CMSG_STABLE_CHANGE_SLOT.");
uint32 pet_number;
uint64 npcGUID;
uint8 new_slot;
recv_data >> pet_number >> npcGUID >> new_slot;
if (!CheckStableMaster(npcGUID))
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
if(new_slot > MAX_PET_STABLES)
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Pet* pet = _player->GetPet();
//If we move the pet already summoned...
if(pet && pet->GetCharmInfo() && pet->GetCharmInfo()->GetPetNumber() == pet_number)
_player->RemovePet(pet, PET_SLOT_ACTUAL_PET_SLOT);
//If we move to the pet already summoned...
if(pet && GetPlayer()->m_currentPetSlot == new_slot)
_player->RemovePet(pet, PET_SLOT_ACTUAL_PET_SLOT);
m_stableChangeSlotCallback.SetParam(new_slot);
m_stableChangeSlotCallback.SetFutureResult(
CharacterDatabase.PQuery("SELECT slot,entry,id FROM character_pet WHERE owner = '%u' AND id = '%u'",
_player->GetGUIDLow(), pet_number)
);
}
示例13: SendPetStableResult
void WorldSession::HandleStablePet(WorldPacket& recvData)
{
ObjectGuid npcGUID;
recvData >> npcGUID;
if (!GetPlayer()->IsAlive())
{
SendPetStableResult(STABLE_ERR_STABLE);
return;
}
if (!CheckStableMaster(npcGUID))
{
SendPetStableResult(STABLE_ERR_STABLE);
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Pet* pet = _player->GetPet();
// can't place in stable dead pet
if (!pet || !pet->IsAlive() || pet->getPetType() != HUNTER_PET)
{
SendPetStableResult(STABLE_ERR_STABLE);
return;
}
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SLOTS);
stmt->setUInt64(0, _player->GetGUID().GetCounter());
stmt->setUInt8(1, PET_SAVE_FIRST_STABLE_SLOT);
stmt->setUInt8(2, PET_SAVE_LAST_STABLE_SLOT);
_queryProcessor.AddQuery(CharacterDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&WorldSession::HandleStablePetCallback, this, std::placeholders::_1)));
}
示例14: HandleStableSwapPet
void WorldSession::HandleStableSwapPet(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_SWAP_PET.");
uint64 npcGUID;
uint32 pet_number;
uint8 new_slot;
recvData >> new_slot >> pet_number >> npcGUID;
if (!CheckStableMaster(npcGUID))
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Pet* pet = _player->GetPet();
/*
if (!pet || pet->getPetType() != HUNTER_PET)
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
*/
//If we move the pet already summoned...
if (pet && pet->GetCharmInfo() && pet->GetCharmInfo()->GetPetNumber() == pet_number)
_player->RemovePet(pet, PET_SAVE_AS_CURRENT);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHARACTER_SELECT_PET_SLOT_BY_ID);
stmt->setUInt32(0, _player->GetGUIDLow());
stmt->setUInt32(1, pet_number);
_stableSwapCallback.SetParam(new_slot);
_stableSwapCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
}
示例15: HandleUnstablePet
void WorldSession::HandleUnstablePet(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_UNSTABLE_PET.");
uint64 npcGUID;
uint32 petnumber;
recv_data >> npcGUID >> petnumber;
if (!CheckStableMaster(npcGUID))
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
// remove fake death
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
_unstablePetCallback.SetParam(petnumber);
_unstablePetCallback.SetFutureResult(
CharacterDatabase.AsyncPQuery("SELECT entry FROM character_pet WHERE owner = '%u' AND id = '%u' AND slot >='%u' AND slot <= '%u'",
_player->GetGUIDLow(), petnumber, PET_SAVE_FIRST_STABLE_SLOT, PET_SAVE_LAST_STABLE_SLOT)
);
}