本文整理汇总了C++中PlayerbotAI::GetCreature方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerbotAI::GetCreature方法的具体用法?C++ PlayerbotAI::GetCreature怎么用?C++ PlayerbotAI::GetCreature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerbotAI
的用法示例。
在下文中一共展示了PlayerbotAI::GetCreature方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetWorldObject
WorldObject* LootObject::GetWorldObject(Player* bot)
{
Refresh(bot, guid);
PlayerbotAI* ai = bot->GetPlayerbotAI();
Creature *creature = ai->GetCreature(guid);
if (creature && creature->getDeathState() == CORPSE)
return creature;
GameObject* go = ai->GetGameObject(guid);
if (go && go->isSpawned())
return go;
return NULL;
}
示例2: Refresh
void LootObject::Refresh(Player* bot, ObjectGuid guid)
{
skillId = SKILL_NONE;
reqSkillValue = 0;
reqItem = NULL;
this->guid = ObjectGuid();
PlayerbotAI* ai = bot->GetPlayerbotAI();
Creature *creature = ai->GetCreature(guid);
if (creature && creature->getDeathState() == CORPSE)
{
if (creature->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE))
this->guid = guid;
if (creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE))
{
skillId = creature->GetCreatureTemplate()->GetRequiredLootSkill();
uint32 targetLevel = creature->getLevel();
reqSkillValue = targetLevel < 10 ? 0 : targetLevel < 20 ? (targetLevel - 10) * 10 : targetLevel * 5;
if (bot->HasSkill(skillId) && bot->GetSkillValue(skillId) >= reqSkillValue)
this->guid = guid;
}
return;
}
GameObject* go = ai->GetGameObject(guid);
if (go && go->isSpawned())
{
uint32 lockId = go->GetGOInfo()->GetLockId();
LockEntry const *lockInfo = sLockStore.LookupEntry(lockId);
if (!lockInfo)
return;
// TODO: remove?
/*for(uint32 i = 0; i < 6; ++i)
{
if (go->GetGOInfo()->questItems[i])
{
this->guid = guid;
return;
}
}*/
for (int i = 0; i < 8; ++i)
{
switch (lockInfo->Type[i])
{
case LOCK_KEY_ITEM:
if (lockInfo->Index[i] > 0)
{
reqItem = lockInfo->Index[i];
this->guid = guid;
}
break;
case LOCK_KEY_SKILL:
if (SkillByLockType(LockType(lockInfo->Index[i])) > 0)
{
skillId = SkillByLockType(LockType(lockInfo->Index[i]));
reqSkillValue = lockInfo->Skill[i];
this->guid = guid;
}
break;
default:
break;
}
}
}
}