本文整理汇总了C++中IS_PLAYER_GUID函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_PLAYER_GUID函数的具体用法?C++ IS_PLAYER_GUID怎么用?C++ IS_PLAYER_GUID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IS_PLAYER_GUID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void CreatureTextMgr::BuildMonsterChat(WorldPacket *data, WorldObject* source, ChatType msgtype, char const* text, Language language, uint64 whisperGuid) const
{
if (!source)
return;
ChatMsg sendType = CHAT_MSG_MONSTER_SAY;
switch (msgtype)
{
case CHAT_TYPE_YELL:
sendType = CHAT_MSG_MONSTER_YELL;
break;
case CHAT_TYPE_TEXT_EMOTE:
sendType = CHAT_MSG_MONSTER_EMOTE;
break;
case CHAT_TYPE_BOSS_EMOTE:
sendType = CHAT_MSG_RAID_BOSS_EMOTE;
break;
case CHAT_TYPE_WHISPER:
if (whisperGuid)
sendType = CHAT_MSG_MONSTER_WHISPER;
else
{
sLog->outError("CreatureTextMgr: WorldObject(%s) TypeId %u GuidLow %u sent CHAT_TYPE_WHISPER with targetGuid 0. Ignoring.", source->GetName(), uint32(source->GetTypeId()), source->GetGUIDLow());
return;
}
break;
case CHAT_TYPE_BOSS_WHISPER:
if (whisperGuid)
sendType = CHAT_MSG_RAID_BOSS_WHISPER;
else
{
sLog->outError("CreatureTextMgr: WorldObject(%s) TypeId %u GuidLow %u sent CHAT_TYPE_BOSS_WHISPER with targetGuid 0. Ignoring.", source->GetName(), uint32(source->GetTypeId()), source->GetGUIDLow());
return;
}
break;
case CHAT_TYPE_SAY://default type
default:
break;
}
*data << (uint8)sendType;
*data << (uint32)language;
*data << (uint64)source->GetGUID();
*data << (uint32)0; // 2.1.0
*data << (uint32)(strlen(source->GetName())+1);
*data << source->GetName();
*data << (uint64)whisperGuid; // Unit Target
if (whisperGuid && !IS_PLAYER_GUID(whisperGuid)) //can only whisper players
{
sLog->outError("CreatureTextMgr: WorldObject(%s) TypeId %u GuidLow %u sent WHISPER msg to Non-Player target. Ignoring.", source->GetName(), uint32(source->GetTypeId()), source->GetGUIDLow());
return;
// *data << (uint32)1; // target name length
// *data << (uint8)0; // target name
}
*data << (uint32)(strlen(text)+1);
*data << text;
*data << (uint8)0; // ChatTag
}
示例2: HandlePetSpellAutocastOpcode
void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
{
;//sLog->outDetail("CMSG_PET_SPELL_AUTOCAST");
uint64 guid;
uint32 spellid;
uint8 state; //1 for on, 0 for off
recvPacket >> guid >> spellid >> state;
if (!_player->GetGuardianPet() && !_player->GetCharm())
return;
if (IS_PLAYER_GUID(guid))
return;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
return;
Creature* checkPet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
if (!checkPet || (checkPet != _player->GetGuardianPet() && checkPet != _player->GetCharm()))
{
sLog->outError("HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
return;
}
Unit::ControlSet petsSet;
if (checkPet->GetEntry() != GUID_ENPART(guid))
petsSet.insert(checkPet);
else
petsSet = _player->m_Controlled;
// Xinef: loop all pets with same entry (fixes partial state change for feral spirits)
for (Unit::ControlSet::const_iterator itr = petsSet.begin(); itr != petsSet.end(); ++itr)
{
Unit* pet = *itr;
if (checkPet->GetEntry() == GUID_ENPART(guid) && pet->GetEntry() != GUID_ENPART(guid))
continue;
// do not add not learned spells/ passive spells
if (!pet->HasSpell(spellid) || !spellInfo->IsAutocastable())
continue;
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
sLog->outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
continue;
}
if (pet->IsPet())
((Pet*)pet)->ToggleAutocast(spellInfo, state);
else
pet->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, state);
charmInfo->SetSpellAutocast(spellInfo, state);
}
}
示例3: GetCreatureOrPetOrVehicle
Creature* ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const& u, uint64 guid)
{
if (IS_PLAYER_GUID(guid))
return NULL;
if (IS_PET_GUID(guid))
return GetPet(guid);
return u.IsInWorld() ? u.GetMap()->GetCreature(guid) : NULL;
}
示例4: FindPlayer
Unit*
ObjectAccessor::GetUnit(WorldObject const &u, uint64 guid)
{
if(!guid)
return NULL;
if(IS_PLAYER_GUID(guid))
return FindPlayer(guid);
return GetCreatureOrPetOrVehicle(u, guid);
}
示例5:
void FollowMovementGenerator<Creature>::_updateSpeed(Creature* owner)
{
// pet only sync speed with owner
/// Make sure we are not in the process of a map change (IsInWorld)
if (!IS_PLAYER_GUID(owner->GetOwnerGUID()) || !owner->IsInWorld() || !i_target.isValid() || i_target->GetGUID() != owner->GetOwnerGUID())
return;
owner->UpdateSpeed(MOVE_RUN, true);
owner->UpdateSpeed(MOVE_WALK, true);
owner->UpdateSpeed(MOVE_SWIM, true);
}
示例6: AttackStart
void AttackStart(Unit* who)
{
if (me->ToTempSummon())
{
if (who->GetTypeId() == TYPEID_PLAYER || IS_PLAYER_GUID(who->GetOwnerGUID()))
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
summoner->GetAI()->DoAction(ACTION_INFORM);
return;
}
ScriptedAI::AttackStart(who);
}
示例7: FindPlayer
Unit*
ObjectAccessor::GetUnit(WorldObject const &u, uint64 guid)
{
if(!guid)
return NULL;
if(IS_PLAYER_GUID(guid))
return FindPlayer(guid);
if (!u.IsInWorld())
return NULL;
return u.GetMap()->GetCreatureOrPetOrVehicle(guid);
}
示例8: TC_LOG_DEBUG
void WorldSession::HandleGuildFinderDeclineRecruit(WorldPacket& recvPacket)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_LF_GUILD_DECLINE_RECRUIT");
ObjectGuid playerGuid;
recvPacket.ReadBitSeq<3, 4, 0, 1, 6, 2, 5, 7>(playerGuid);
recvPacket.ReadByteSeq<2, 6, 5, 1, 7, 0, 4, 3>(playerGuid);
if (!IS_PLAYER_GUID(playerGuid))
return;
sGuildFinderMgr->RemoveMembershipRequest(GUID_LOPART(playerGuid), GetPlayer()->GetGuildId());
}
示例9: SF_LOG_DEBUG
void WorldSession::HandleGuildFinderDeclineRecruit(WorldPacket& recvPacket)
{
SF_LOG_DEBUG("network", "WORLD: Received CMSG_LF_GUILD_DECLINE_RECRUIT");
ObjectGuid RecruitGUID;
recvPacket.ReadGuidMask(RecruitGUID, 6, 7, 3, 1, 2, 0, 4, 5);
recvPacket.ReadGuidBytes(RecruitGUID, 0, 7, 1, 6, 4, 3, 5, 2);
if (!IS_PLAYER_GUID(RecruitGUID))
return;
sGuildFinderMgr->RemoveMembershipRequest(GUID_LOPART(RecruitGUID), GetPlayer()->GetGuildId());
}
示例10: HandleNpcBotResetCommand
static bool HandleNpcBotResetCommand(ChatHandler* handler, const char* /*args*/)
{
Player* owner = handler->GetSession()->GetPlayer();
Player* master = NULL;
bool all = false;
uint64 guid = owner->GetTarget();
if (!guid)
{
handler->PSendSysMessage(".npcbot reset");
handler->PSendSysMessage("Reset selected npcbot, or all npcbots if used on self");
handler->SetSentErrorMessage(true);
return false;
}
if (IS_PLAYER_GUID(guid))
{
master = owner;
all = true;
}
else if (IS_CREATURE_GUID(guid))
{
if (Creature* cre = ObjectAccessor::GetCreature(*owner, guid))
master = cre->GetBotOwner();
}
if (master && master->GetGUID() == owner->GetGUID())
{
if (!master->HaveBot())
{
handler->PSendSysMessage("Npcbots are not found!");
handler->SetSentErrorMessage(true);
return false;
}
for (uint8 i = 0; i != master->GetMaxNpcBots(); ++i)
{
if (all)
master->RemoveBot(master->GetBotMap(i)->_Guid());
else if (master->GetBotMap(i)->_Guid() == guid)
{
master->RemoveBot(guid);
break;
}
}
handler->SetSentErrorMessage(true);
return true;
}
handler->PSendSysMessage(".npcbot reset");
handler->PSendSysMessage("Reset selected npcbot. Cannot be used in combat");
handler->SetSentErrorMessage(true);
return false;
}
示例11: BuildPacket
void
ObjectAccessor::WorldObjectChangeAccumulator::Visit(DynamicObjectMapType &m)
{
for(DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
uint64 guid = iter->getSource()->GetCasterGUID();
if(IS_PLAYER_GUID(guid))
{
//Caster may be NULL if DynObj is in removelist
if(Player *caster = FindPlayer(guid))
if (caster->GetUInt64Value(PLAYER_FARSIGHT) == iter->getSource()->GetGUID())
BuildPacket(caster);
}
}
}
示例12: EnterEvadeMode
void SmartAI::EnterEvadeMode()
{
// xinef: fixes strange jumps when charming SmartAI npc
if (!me->IsAlive() || me->IsInEvadeMode())
return;
if (IS_PLAYER_GUID(me->GetCharmerGUID()) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
{
me->AttackStop();
return;
}
me->RemoveEvadeAuras();
me->AddUnitState(UNIT_STATE_EVADE);
me->DeleteThreatList();
me->CombatStop(true);
me->LoadCreaturesAddon(true);
me->SetLootRecipient(NULL);
me->ResetPlayerDamageReq();
me->SetLastDamagedTime(0);
GetScript()->ProcessEventsFor(SMART_EVENT_EVADE);//must be after aura clear so we can cast spells from db
SetRun(mRun);
if (HasEscortState(SMART_ESCORT_ESCORTING))
{
AddEscortState(SMART_ESCORT_RETURNING);
ReturnToLastOOCPos();
}
else if (mFollowGuid)
{
if (Unit* target = ObjectAccessor::GetUnit(*me, mFollowGuid))
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
me->ClearUnitState(UNIT_STATE_EVADE);
// xinef: do not forget to reset scripts as we wont call reached home
GetScript()->OnReset();
}
else
{
me->GetMotionMaster()->MoveTargetedHome();
// xinef: do not forget to reset scripts as we wont call reached home
if (!me->HasUnitState(UNIT_STATE_EVADE))
GetScript()->OnReset();
}
}
示例13: GetOwnerGUID
GameObject::~GameObject()
{
if(m_uint32Values) // field array can be not exist if GameOBject not loaded
{
// crash possible at access to deleted GO in Unit::m_gameobj
uint64 owner_guid = GetOwnerGUID();
if(owner_guid)
{
Unit* owner = ObjectAccessor::GetUnit(*this,owner_guid);
if(owner)
owner->RemoveGameObject(this,false);
else if(!IS_PLAYER_GUID(owner_guid))
sLog.outError("Delete GameObject (GUID: %u Entry: %u ) that have references in not found creature %u GO list. Crash possible later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid));
}
}
}
示例14: HandleListAurasCommand
static bool HandleListAurasCommand(ChatHandler* handler, char const* /*args*/)
{
Unit* unit = handler->getSelectedUnit();
if (!unit)
{
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
handler->SetSentErrorMessage(true);
return false;
}
char const* talentStr = handler->GetTrinityString(LANG_TALENT);
char const* passiveStr = handler->GetTrinityString(LANG_PASSIVE);
Unit::AuraApplicationMap const& auras = unit->GetAppliedAuras();
handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, auras.size());
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
bool talent = GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0;
AuraApplication const* aurApp = itr->second;
Aura const* aura = aurApp->GetBase();
char const* name = aura->GetSpellInfo()->SpellName[handler->GetSessionDbcLocale()];
std::ostringstream ss_name;
ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r";
handler->PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (handler->GetSession() ? ss_name.str().c_str() : name),
aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(),
aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""),
(talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",
GUID_LOPART(aura->GetCasterGUID()));
}
for (uint16 i = 0; i < TOTAL_AURAS; ++i)
{
Unit::AuraEffectList const& auraList = unit->GetAuraEffectsByType(AuraType(i));
if (auraList.empty())
continue;
handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, auraList.size(), i);
for (Unit::AuraEffectList::const_iterator itr = auraList.begin(); itr != auraList.end(); ++itr)
handler->PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(), (*itr)->GetAmount());
}
return true;
}
示例15: HandleGameObjectDeleteCommand
//delete object by selection or guid
static bool HandleGameObjectDeleteCommand (ChatHandler* handler, const char* args)
{
// number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r
char* cId = handler->extractKeyFromLink((char*) args, "Hgameobject");
if (!cId)
return false;
uint32 lowguid = atoi(cId);
if (!lowguid)
return false;
GameObject* obj = NULL;
// by DB guid
if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid))
obj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, go_data->id);
if (!obj)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid);
handler->SetSentErrorMessage(true);
return false;
}
uint64 owner_guid = obj->GetOwnerGUID();
if (owner_guid)
{
Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), owner_guid);
if (!owner || !IS_PLAYER_GUID(owner_guid))
{
handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(owner_guid), obj->GetGUIDLow());
handler->SetSentErrorMessage(true);
return false;
}
owner->RemoveGameObject(obj, false);
}
obj->SetRespawnTime(0); // not save respawn time
obj->Delete();
obj->DeleteFromDB();
handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, obj->GetGUIDLow());
sLog->outSQLDev("DELETE FROM gameobject WHERE guid = %u;", obj->GetGUIDLow());
return true;
}