这篇教程C++ CheckStableMaster函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CheckStableMaster函数的典型用法代码示例。如果您正苦于以下问题:C++ CheckStableMaster函数的具体用法?C++ CheckStableMaster怎么用?C++ CheckStableMaster使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CheckStableMaster函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: SendStableResultvoid 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);}
开发者ID:Xion1,项目名称:SkyFireEMU,代码行数:35,
示例2: HandleUnstablePetvoid 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)));}
开发者ID:Delicate90,项目名称:TrinityCore,代码行数:26,
示例3: HandleStableSwapPetvoid 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));}
开发者ID:Palabola,项目名称:WoD,代码行数:35,
示例4: HandleStableSwapPetvoid 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) );}
开发者ID:A-Shox,项目名称:TrinityCore,代码行数:33,
示例5: TC_LOG_DEBUGvoid 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));}
开发者ID:oMadMano,项目名称:MistyWorld_6xx,代码行数:28,
示例6: definedvoid 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);}
开发者ID:lineagedr,项目名称:azerothcore-wotlk,代码行数:34,
示例7: HandleRequestStabledPetsvoid 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);}
开发者ID:Delicate90,项目名称:TrinityCore,代码行数:15,
示例8: HandleStableSwapPetvoid 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);}
开发者ID:beyourself,项目名称:Wow-4.3.4,代码行数:46,
示例9: HandleListStabledPetsOpcodevoid 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);}
开发者ID:Bootz,项目名称:DeepshjirRepack,代码行数:19,
示例10: HandleStableSwapPetvoid 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) );}
开发者ID:Xion1,项目名称:SkyFireEMU,代码行数:42,
示例11: TC_LOG_DEBUGvoid 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);}
开发者ID:DSlayerMan,项目名称:VortexCore434,代码行数:20,
示例12: HandleStableChangeSlotvoid 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) );}
开发者ID:BaseAdrian,项目名称:SkyFireEMU,代码行数:41,
示例13: SendPetStableResultvoid 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)));}
开发者ID:Delicate90,项目名称:TrinityCore,代码行数:39,
示例14: HandleStableSwapPetvoid 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));}
开发者ID:SkyFireArchives,项目名称:SkyFireEMU_406a,代码行数:39,
示例15: HandleUnstablePetvoid 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) );}
开发者ID:A-Shox,项目名称:TrinityCore,代码行数:24,
示例16: SendStableResultvoid WorldSession::HandleStablePet(WorldPacket & recv_data){ sLog.outDebug("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_STAT_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; } uint32 free_slot = 1; QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT owner,slot,id FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot ", _player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT); if (result) { do { Field *fields = result->Fetch(); uint32 slot = fields[1].GetUInt32(); // slots ordered in query, and if not equal then free if (slot != free_slot) break; // this slot not free, skip ++free_slot; }while (result->NextRow()); } WorldPacket data(SMSG_STABLE_RESULT, 1); if (free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots) { _player->RemovePet(pet,PetSaveMode(free_slot)); SendStableResult(STABLE_SUCCESS_STABLE); } else SendStableResult(STABLE_ERR_STABLE);}
开发者ID:InkVisible,项目名称:wow,代码行数:62,
示例17: HandleStableSwapPetvoid WorldSession::HandleStableSwapPet(WorldPacket & recv_data){ sLog.outDebug("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 QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT slot,entry FROM character_pet WHERE owner = '%u' AND id = '%u'", _player->GetGUIDLow(),pet_number); if (!result) { SendStableResult(STABLE_ERR_STABLE); return; } Field *fields = result->Fetch(); uint32 slot = fields[0].GetUInt32(); uint32 creature_id = fields[1].GetUInt32(); if (!creature_id) { SendStableResult(STABLE_ERR_STABLE); return; } CreatureInfo const* creatureInfo = sObjectMgr.GetCreatureTemplate(creature_id); if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets())) { // if problem in exotic pet if (creatureInfo && creatureInfo->isTameable(true)) SendStableResult(STABLE_ERR_EXOTIC); else SendStableResult(STABLE_ERR_STABLE); return; } // move alive pet to slot or delete dead pet _player->RemovePet(pet,pet->isAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED); // summon unstabled pet Pet *newpet = new Pet(_player); if (!newpet->LoadPetFromDB(_player,creature_id,pet_number)) { delete newpet; SendStableResult(STABLE_ERR_STABLE); } else SendStableResult(STABLE_SUCCESS_UNSTABLE);}
开发者ID:InkVisible,项目名称:wow,代码行数:70,
示例18: TC_LOG_DEBUGvoid WorldSession::HandleSetPetSlot(WorldPacket& recvPacket) // Come stable your pet! :){ uint8 petSlot; uint32 petNumber; ObjectGuid guid; recvPacket >> petNumber >> petSlot; guid[3] = recvPacket.ReadBit(); guid[2] = recvPacket.ReadBit(); guid[0] = recvPacket.ReadBit(); guid[7] = recvPacket.ReadBit(); guid[5] = recvPacket.ReadBit(); guid[6] = recvPacket.ReadBit(); guid[1] = recvPacket.ReadBit(); guid[4] = recvPacket.ReadBit(); recvPacket.ReadByteSeq(guid[5]); recvPacket.ReadByteSeq(guid[3]); recvPacket.ReadByteSeq(guid[1]); recvPacket.ReadByteSeq(guid[7]); recvPacket.ReadByteSeq(guid[4]); recvPacket.ReadByteSeq(guid[0]); recvPacket.ReadByteSeq(guid[6]); recvPacket.ReadByteSeq(guid[2]); TC_LOG_DEBUG("network", "CMSG_SET_PET_SLOT with guid : " UI64FMTD " and pet slot : %u and pet number : %u", (uint64)guid, petSlot, petNumber); if (!GetPlayer()->IsAlive()) { SendStableResult(STABLE_ERR_STABLE); return; } if (!CheckStableMaster(guid)) { 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; } PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SLOTS); stmt->setUInt32(0, _player->GetGUIDLow()); stmt->setUInt8(1, PET_SAVE_FIRST_STABLE_SLOT); stmt->setUInt8(2, PET_SAVE_LAST_STABLE_SLOT); _stablePetCallback = CharacterDatabase.AsyncQuery(stmt);}
开发者ID:BravadoToDeath,项目名称:ArkCORE-NG,代码行数:61,
示例19: TC_LOG_DEBUGvoid WorldSession::HandleStableChangeSlot(WorldPacket& recvData){ TC_LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_CHANGE_SLOT"); uint32 PetGUID; uint8 petnumber; ObjectGuid npcGUID; recvData >> PetGUID >> petnumber; recvData.ReadGuidMask(npcGUID, 5, 7, 3, 2, 6, 1, 0, 4); recvData.ReadGuidBytes(npcGUID, 0, 3, 2, 6, 5, 7, 4, 1); if (!CheckStableMaster(npcGUID)) { SendStableResult(STABLE_ERR_STABLE); return; } // remove fake death if (GetPlayer()->HasUnitState(UNIT_STATE_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); PetSlots temp = GetPlayer()->GetSession()->checkPets(petnumber, PetGUID); if (!GetPlayer()->GetPet()) { if (!GetPlayer()->GetSession()->movePet(petnumber, PetGUID)) { SendStableResult(STABLE_ERR_INVALID_SLOT); // Something whent wrong. return; } WorldPacket data(SMSG_PET_SLOT_UPDATED, 16); data << uint32(PetGUID); data << uint32(temp.slot); data << uint32(temp.entry); data << uint32(petnumber); SendPacket(&data); } else if (GetPlayer()->GetPet() && (GetPlayer()->GetPetSlot() != petnumber && GetPlayer()->GetPet()->GetCharmInfo()->GetPetNumber() != PetGUID)) { if (!GetPlayer()->GetSession()->movePet(petnumber, PetGUID)) { SendStableResult(STABLE_ERR_INVALID_SLOT); // Something whent wrong. return; } WorldPacket data(SMSG_PET_SLOT_UPDATED, 16); data << uint32(PetGUID); data << uint32(temp.slot); data << uint32(temp.entry); data << uint32(petnumber); SendPacket(&data); } else { SendStableResult(STABLE_ERR_INVALID_SLOT); // Dont reorder the active pet. return; } SQLTransaction trans = CharacterDatabase.BeginTransaction(); PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID); stmt2->setUInt8(0, petnumber); stmt2->setUInt32(1, _player->GetGUIDLow()); stmt2->setUInt32(2, PetGUID); trans->Append(stmt2); if ((temp.entry > 0 || temp.name.length() > 0) && temp.entry != PetGUID) // || temp.slot != _player->GetSlot()) { stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID); stmt2->setUInt8(0, temp.slot); stmt2->setUInt32(1, _player->GetGUIDLow()); stmt2->setUInt32(2, temp.entry); trans->Append(stmt2); } CharacterDatabase.CommitTransaction(trans); SendStableResult(STABLE_SUCCESS_STABLE); return;}
开发者ID:Caydan,项目名称:WoWSCore548,代码行数:85,
示例20: HandleUnstablePetvoid WorldSession::HandleUnstablePet(WorldPacket & recv_data){ sLog.outDebug("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); uint32 creature_id = 0; { QueryResult_AutoPtr result = CharacterDatabase.PQuery("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); if (result) { Field *fields = result->Fetch(); creature_id = fields[0].GetUInt32(); } } if (!creature_id) { SendStableResult(STABLE_ERR_STABLE); return; } CreatureInfo const* creatureInfo = sObjectMgr.GetCreatureTemplate(creature_id); if (!creatureInfo || !creatureInfo->isTameable(_player->CanTameExoticPets())) { // if problem in exotic pet if (creatureInfo && creatureInfo->isTameable(true)) SendStableResult(STABLE_ERR_EXOTIC); else SendStableResult(STABLE_ERR_STABLE); return; } Pet* pet = _player->GetPet(); if (pet && pet->isAlive()) { SendStableResult(STABLE_ERR_STABLE); return; } // delete dead pet if (pet) _player->RemovePet(pet,PET_SAVE_AS_DELETED); Pet *newpet = new Pet(_player, HUNTER_PET); if (!newpet->LoadPetFromDB(_player,creature_id,petnumber)) { delete newpet; newpet = NULL; SendStableResult(STABLE_ERR_STABLE); return; } SendStableResult(STABLE_SUCCESS_UNSTABLE);}
开发者ID:InkVisible,项目名称:wow,代码行数:69,
注:本文中的CheckStableMaster函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CheckState函数代码示例 C++ CheckShutdown函数代码示例 |