本文整理汇总了C++中GameObject::GetGoState方法的典型用法代码示例。如果您正苦于以下问题:C++ GameObject::GetGoState方法的具体用法?C++ GameObject::GetGoState怎么用?C++ GameObject::GetGoState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameObject
的用法示例。
在下文中一共展示了GameObject::GetGoState方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdatePillars
void BattlegroundRV::UpdatePillars()
{
GameObject* test = GetBgMap()->GetGameObject(BgObjects[BG_RV_OBJECT_PILAR_1]);
if (!test)
return;
if (test->GetGoState() == GO_STATE_READY)
{
for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_GEAR_2; ++i)
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
go->SetGoState(GO_STATE_ACTIVE);
for (uint8 i = BG_RV_OBJECT_PILAR_2; i <= BG_RV_OBJECT_PULLEY_2; ++i)
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
go->SetGoState(GO_STATE_READY);
}
else
{
for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_GEAR_2; ++i)
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
go->SetGoState(GO_STATE_READY);
for (uint8 i = BG_RV_OBJECT_PILAR_2; i <= BG_RV_OBJECT_PULLEY_2; ++i)
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
go->SetGoState(GO_STATE_ACTIVE);
}
}
示例2: FissureSurge
bool instance_onyxias_lair::FissureSurge(Creature *onyxia)
{
if (m_liveLavaFissures[0].empty() && m_liveLavaFissures[1].empty() && m_liveLavaFissures[2].empty())
return false;
GameObject *firstFissure = NULL;
GameObject *secondFissure = NULL;
for (int liveList=0; liveList < 3; liveList++)
{
if (!m_liveLavaFissures[liveList].empty())
{
GameObject *fissure = m_liveLavaFissures[liveList].front();
m_liveLavaFissures[liveList].pop_front();
if (liveList == 1 && firstFissure != NULL && firstFissure->IsWithinDist2d(fissure->GetPositionX(),fissure->GetPositionY(),10))
continue;
if (liveList == 2 && secondFissure != NULL && secondFissure->IsWithinDist2d(fissure->GetPositionX(),fissure->GetPositionY(),10))
continue;
if (fissure->GetGoState() == GO_STATE_READY)
{
onyxia->CastSpell(fissure->GetPositionX(),fissure->GetPositionY(),fissure->GetPositionZ(),SPELL_ERUPTION,true);
if (liveList == 0)
firstFissure = fissure;
else if (liveList == 1)
secondFissure = fissure;
} else
m_liveLavaFissures[liveList].push_back(fissure);
}
}
return true;
}
示例3: OnUpdate
void OnUpdate(GameObject* go, uint32 diff)
{
if (opened == 1)
{
if (tQuestCredit <= ((float)diff/8))
{
opened = 0;
aPlayer->KilledMonsterCredit(35830, 0);
if (spawnKind == 3)
{
if (Creature* spawnedCreature = go->SummonCreature(NPC_RAMPAGING_WORGEN_2, wx, wy, z, angle, TEMPSUMMON_TIMED_DESPAWN, SUMMON1_TTL))
{
spawnedCreature->SetPhaseMask(6, 1);
spawnedCreature->Respawn(1);
spawnedCreature->getThreatManager().resetAllAggro();
aPlayer->AddThreat(spawnedCreature, 1.0f);
spawnedCreature->AddThreat(aPlayer, 1.0f);
}
}
}
else tQuestCredit -= ((float)diff/8);
}
if (DoorTimer <= diff)
{
if (go->GetGoState() == GO_STATE_ACTIVE)
go->SetGoState(GO_STATE_READY);
DoorTimer = DOOR_TIMER;
}
else
DoorTimer -= diff;
}
示例4: _ScriptProcessDoor
inline void Map::_ScriptProcessDoor(Object* source, Object* target, const ScriptInfo* scriptInfo) const
{
bool bOpen = false;
ObjectGuid::LowType guid = scriptInfo->ToggleDoor.GOGuid;
int32 nTimeToToggle = std::max(15, int32(scriptInfo->ToggleDoor.ResetDelay));
switch (scriptInfo->command)
{
case SCRIPT_COMMAND_OPEN_DOOR: bOpen = true; break;
case SCRIPT_COMMAND_CLOSE_DOOR: break;
default:
TC_LOG_ERROR("scripts", "%s unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo().c_str());
return;
}
if (!guid)
TC_LOG_ERROR("scripts", "%s door guid is not specified.", scriptInfo->GetDebugInfo().c_str());
else if (!source)
TC_LOG_ERROR("scripts", "%s source object is NULL.", scriptInfo->GetDebugInfo().c_str());
else if (!source->isType(TYPEMASK_UNIT))
{
TC_LOG_ERROR("scripts", "%s source object is not unit (TypeId: %u, Entry: %u, %s), skipping.", scriptInfo->GetDebugInfo().c_str(),
source->GetTypeId(), source->GetEntry(), source->GetGUID().ToString().c_str());
}
else
{
WorldObject* wSource = dynamic_cast <WorldObject*> (source);
if (!wSource)
{
TC_LOG_ERROR("scripts", "%s source object could not be cast to world object (TypeId: %u, Entry: %u, %s), skipping.",
scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUID().ToString().c_str());
}
else
{
GameObject* pDoor = _FindGameObject(wSource, guid);
if (!pDoor)
TC_LOG_ERROR("scripts", "%s gameobject was not found (guid: " UI64FMTD ").", scriptInfo->GetDebugInfo().c_str(), guid);
else if (pDoor->GetGoType() != GAMEOBJECT_TYPE_DOOR)
{
TC_LOG_ERROR("scripts", "%s gameobject is not a door (GoType: %u, Entry: %u, %s).",
scriptInfo->GetDebugInfo().c_str(), pDoor->GetGoType(), pDoor->GetEntry(), pDoor->GetGUID().ToString().c_str());
}
else if (bOpen == (pDoor->GetGoState() == GO_STATE_READY))
{
pDoor->UseDoorOrButton(nTimeToToggle);
if (target && target->isType(TYPEMASK_GAMEOBJECT))
{
GameObject* goTarget = target->ToGameObject();
if (goTarget && goTarget->GetGoType() == GAMEOBJECT_TYPE_BUTTON)
goTarget->UseDoorOrButton(nTimeToToggle);
}
}
}
}
}
示例5: CheckContainmentSpheres
bool CheckContainmentSpheres(bool removePrison = false)
{
for (uint32 i = ANOMALUS_CONTAINMET_SPHERE; i < (ANOMALUS_CONTAINMET_SPHERE + DATA_CONTAINMENT_SPHERES); ++i)
{
GameObject* containmentSpheres = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(i));
if (!containmentSpheres || containmentSpheres->GetGoState() != GO_STATE_ACTIVE)
return false;
}
if (removePrison)
RemovePrison(true);
return true;
}
示例6: HandleGameObjectInfoCommand
//show info of gameobject
static bool HandleGameObjectInfoCommand(ChatHandler* handler, char const* args)
{
uint32 entry = 0;
uint32 type = 0;
uint32 displayId = 0;
std::string name;
uint32 lootId = 0;
GameObject* gameObject = nullptr;
if (!*args)
{
if (WorldObject* object = handler->getSelectedObject())
{
entry = object->GetEntry();
if (object->GetTypeId() == TYPEID_GAMEOBJECT)
gameObject = object->ToGameObject();
}
}
else
entry = atoi((char*)args);
GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!gameObjectInfo)
return false;
type = gameObjectInfo->type;
displayId = gameObjectInfo->displayId;
name = gameObjectInfo->name;
if (type == GAMEOBJECT_TYPE_CHEST)
lootId = gameObjectInfo->chest.lootId;
else if (type == GAMEOBJECT_TYPE_FISHINGHOLE)
lootId = gameObjectInfo->fishinghole.lootId;
handler->PSendSysMessage(LANG_GOINFO_ENTRY, entry);
handler->PSendSysMessage(LANG_GOINFO_TYPE, type);
handler->PSendSysMessage(LANG_GOINFO_LOOTID, lootId);
handler->PSendSysMessage(LANG_GOINFO_DISPLAYID, displayId);
if (gameObject)
{
handler->PSendSysMessage("LootMode: %u", gameObject->GetLootMode());
handler->PSendSysMessage("LootState: %u", gameObject->getLootState());
handler->PSendSysMessage("GOState: %u", gameObject->GetGoState());
handler->PSendSysMessage("PhaseMask: %u", gameObject->GetPhaseMask());
handler->PSendSysMessage("IsLootEmpty: %u", gameObject->loot.empty());
handler->PSendSysMessage("IsLootLooted: %u", gameObject->loot.isLooted());
}
handler->PSendSysMessage(LANG_GOINFO_NAME, name.c_str());
return true;
}
示例7: initialize
bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info)
{
ModelList::const_iterator it = model_list.find(info.Displayid);
if (it == model_list.end())
return false;
G3D::AABox mdl_box(it->second.bound);
// ignore models with no bounds
if (mdl_box == G3D::AABox::zero())
{
sLog->outError("GameObject model %s has zero bounds, loading skipped", it->second.name.c_str());
return false;
}
iModel = ((VMAP::VMapManager2*)VMAP::VMapFactory::createOrGetVMapManager())->acquireModelInstance(sWorld->GetDataPath() + "vmaps/", it->second.name);
if (!iModel)
return false;
name = it->second.name;
//flags = VMAP::MOD_M2;
//adtId = 0;
//ID = 0;
iPos = Vector3(go.GetPositionX(), go.GetPositionY(), go.GetPositionZ());
// pussywizard:
phasemask = (go.GetGoState() == GO_STATE_READY || go.IsTransport()) ? go.GetPhaseMask() : 0;
iScale = go.GetFloatValue(OBJECT_FIELD_SCALE_X);
iInvScale = 1.f / iScale;
G3D::Matrix3 iRotation = G3D::Matrix3::fromEulerAnglesZYX(go.GetOrientation(), 0, 0);
iInvRot = iRotation.inverse();
// transform bounding box:
mdl_box = AABox(mdl_box.low() * iScale, mdl_box.high() * iScale);
AABox rotated_bounds;
for (int i = 0; i < 8; ++i)
rotated_bounds.merge(iRotation * mdl_box.corner(i));
iBound = rotated_bounds + iPos;
#ifdef SPAWN_CORNERS
// test:
for (int i = 0; i < 8; ++i)
{
Vector3 pos(iBound.corner(i));
const_cast<GameObject&>(go).SummonCreature(1, pos.x, pos.y, pos.z, 0, TEMPSUMMON_MANUAL_DESPAWN);
}
#endif
owner = &go;
return true;
}
示例8: GOUse_go_door_lever_dm
bool GOUse_go_door_lever_dm(Player* pPlayer, GameObject* pGo)
{
ScriptedInstance* pInstance = (ScriptedInstance*)pGo->GetInstanceData();
if (!pInstance)
return false;
GameObject* pGoDoor = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_DEFIAS_DOOR));
if (pGoDoor && pGoDoor->GetGoState() == 1)
return false;
return true;
}
示例9: DoorClose
// some doors aren't despawned so we cannot handle their closing in gameobject::update()
// it would be nice to correctly implement GO_ACTIVATED state and open/close doors in gameobject code
void BattleGround::DoorClose(ObjectGuid guid)
{
GameObject* obj = GetBgMap()->GetGameObject(guid);
if (obj)
{
// if doors are open, close it
if (obj->getLootState() == GO_ACTIVATED && obj->GetGoState() != GO_STATE_READY)
{
// change state to allow door to be closed
obj->SetLootState(GO_READY);
obj->UseDoorOrButton(RESPAWN_ONE_DAY);
}
}
else
sLog.outError("BattleGround: Door %s not found (cannot close doors)", guid.GetString().c_str());
}
示例10: Aggro
void Aggro(Unit* who)
{
DoScriptText(SAY_MALGANIS_AGGRO, m_creature);
if (Creature* pArthas = GetClosestCreatureWithEntry(m_creature, NPC_ARTHAS, 150.0f))
Arthas = pArthas;
if (m_pInstance)
{
GameObject* pGate = m_pInstance->instance->GetGameObject(m_pInstance->GetData64(DATA_GO_MAL_GATE2));
if (pGate && !pGate->GetGoState())
{
pGate->SetGoState(GO_STATE_READY);
}
}
}
示例11: CheckContainmentSpheres
bool CheckContainmentSpheres(bool remove_prison = false)
{
ContainmentSphereGUIDs[0] = instance->GetGuidData(ANOMALUS_CONTAINMENT_SPHERE);
ContainmentSphereGUIDs[1] = instance->GetGuidData(ORMOROKS_CONTAINMENT_SPHERE);
ContainmentSphereGUIDs[2] = instance->GetGuidData(TELESTRAS_CONTAINMENT_SPHERE);
for (uint8 i = 0; i < DATA_CONTAINMENT_SPHERES; ++i)
{
GameObject* ContainmentSphere = ObjectAccessor::GetGameObject(*me, ContainmentSphereGUIDs[i]);
if (!ContainmentSphere)
return false;
if (ContainmentSphere->GetGoState() != GO_STATE_ACTIVE)
return false;
}
if (remove_prison)
RemovePrison(true);
return true;
}
示例12: DoorClose
//some doors aren't despawned so we cannot handle their closing in gameobject::update()
//it would be nice to correctly implement GO_ACTIVATED state and open/close doors in gameobject code
void BattleGround::DoorClose(uint32 type)
{
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
if(obj)
{
//if doors are open, close it
if( obj->getLootState() == GO_ACTIVATED && !obj->GetGoState() )
{
//change state to allow door to be closed
obj->SetLootState(GO_READY);
obj->UseDoorOrButton(RESPAWN_ONE_DAY);
}
}
else
{
sLog.outError("BattleGround: Door object not found (cannot close doors)");
}
}
示例13: Update
void instance_maraudon::Update(uint32 uiDiff)
{
if (m_uiSpawnTimer <= uiDiff)
{
m_uiSpawnTimer = 5000;
GameObject* pGo = instance->GetGameObject(m_uiLarvaSpewerGUID);
if (!pGo || pGo->GetGoState() == GO_STATE_ACTIVE)
return;
Map::PlayerList const& L = instance->GetPlayers();
if (L.isEmpty())
return;
bool spawn = false;
for (Map::PlayerList::const_iterator i = L.begin(); i != L.end(); ++i)
{
Player* P = i->getSource();
if (P && P->isAlive() && P->GetDistance(pGo) <= 45.0f)
{
spawn = true;
break;
}
}
if (spawn)
{
float coord_dif[2];
for (int i = 0; i < 2; i++)
coord_dif[i] = (float)urand(-3,4);
if (Creature* C = pGo->SummonCreature(NPC_LARVA,pGo->GetPositionX()+coord_dif[0],pGo->GetPositionY()+coord_dif[1],pGo->GetPositionZ(),pGo->GetOrientation(),TEMPSUMMON_CORPSE_TIMED_DESPAWN,3000))
C->SetInCombatWithZone();
//Unit* target = C->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0);
//if (target && C->AI())
// C->AI()->AttackStart(target);
}
}
else
m_uiSpawnTimer -= uiDiff;
}
示例14: Dragonspireroomcheck
void Dragonspireroomcheck()
{
Creature* mob = NULL;
GameObject* rune = NULL;
for (uint8 i = 0; i < 7; ++i)
{
bool _mobAlive = false;
rune = instance->GetGameObject(go_roomrunes[i]);
if (!rune)
continue;
if (rune->GetGoState() == GO_STATE_ACTIVE)
{
for (uint8 ii = 0; ii < 5; ++ii)
{
mob = instance->GetCreature(runecreaturelist[i][ii]);
if (mob && mob->IsAlive())
_mobAlive = true;
}
}
if (!_mobAlive && rune->GetGoState() == GO_STATE_ACTIVE)
{
HandleGameObject(ObjectGuid::Empty, false, rune);
switch (rune->GetEntry())
{
case GO_HALL_RUNE_1:
SetBossState(DATA_HALL_RUNE_1, DONE);
break;
case GO_HALL_RUNE_2:
SetBossState(DATA_HALL_RUNE_2, DONE);
break;
case GO_HALL_RUNE_3:
SetBossState(DATA_HALL_RUNE_3, DONE);
break;
case GO_HALL_RUNE_4:
SetBossState(DATA_HALL_RUNE_4, DONE);
break;
case GO_HALL_RUNE_5:
SetBossState(DATA_HALL_RUNE_5, DONE);
break;
case GO_HALL_RUNE_6:
SetBossState(DATA_HALL_RUNE_6, DONE);
break;
case GO_HALL_RUNE_7:
SetBossState(DATA_HALL_RUNE_7, DONE);
break;
default:
break;
}
}
}
if (GetBossState(DATA_HALL_RUNE_1) == DONE && GetBossState(DATA_HALL_RUNE_2) == DONE && GetBossState(DATA_HALL_RUNE_3) == DONE &&
GetBossState(DATA_HALL_RUNE_4) == DONE && GetBossState(DATA_HALL_RUNE_5) == DONE && GetBossState(DATA_HALL_RUNE_6) == DONE &&
GetBossState(DATA_HALL_RUNE_7) == DONE)
{
SetBossState(DATA_DRAGONSPIRE_ROOM, DONE);
if (GameObject* door1 = instance->GetGameObject(go_emberseerin))
HandleGameObject(ObjectGuid::Empty, true, door1);
if (GameObject* door2 = instance->GetGameObject(go_doors))
HandleGameObject(ObjectGuid::Empty, true, door2);
}
}
示例15: CheckPathAccurate
bool TerrainInfo::CheckPathAccurate(float srcX, float srcY, float srcZ, float& dstX, float& dstY, float& dstZ, Unit* mover, bool onlyLOS ) const
{
float tstX = dstX;
float tstY = dstY;
float tstZ = dstZ;
// check by standart way. may be not need path checking?
if (!mover && CheckPath(srcX, srcY, srcZ, tstX, tstY, tstZ) && IsNextZcoordOK(tstX, tstY, tstZ, 5.0f))
{
DEBUG_LOG("TerrainInfo::CheckPathAccurate vmaps hit! delta is %f %f %f",dstX - tstX,dstY - tstY,dstZ - tstZ);
dstX = tstX;
dstY = tstY;
dstZ = tstZ + 0.1f;
return true;
}
const float distance = sqrt((dstY - srcY)*(dstY - srcY) + (dstX - srcX)*(dstX - srcX));
const float DELTA = 0.5f;
const uint8 numChecks = ceil(fabs(distance/DELTA));
const float DELTA_X = (dstX-srcX)/numChecks;
const float DELTA_Y = (dstY-srcY)/numChecks;
const float DELTA_Z = (dstZ-srcZ)/numChecks;
float lastGoodX = srcX;
float lastGoodY = srcY;
float lastGoodZ = srcZ;
uint32 errorsCount = 0;
uint32 goodCount = 0;
uint32 vmaperrorsCount = 0;
std::set<GameObject*> inLOSGOList;
bool bGOCheck = false;
if (mover)
{
std::list<GameObject*> tempTargetGOList;
MaNGOS::GameObjectInRangeCheck check(mover, tstX, tstY, tstZ, distance + 2.0f *mover->GetObjectBoundingRadius());
MaNGOS::GameObjectListSearcher<MaNGOS::GameObjectInRangeCheck> searcher(tempTargetGOList, check);
Cell::VisitAllObjects(mover, searcher, 2*mover->GetObjectBoundingRadius());
if (!tempTargetGOList.empty())
{
for(std::list<GameObject*>::iterator iter = tempTargetGOList.begin(); iter != tempTargetGOList.end(); ++iter)
{
GameObject* pGo = *iter;
if (!pGo || !pGo->IsInWorld())
continue;
// Not require check GO's, if his not in path
// first fast check
if (pGo->GetPositionX() > std::max(srcX, dstX)
|| pGo->GetPositionX() < std::min(srcX, dstX)
|| pGo->GetPositionY() > std::max(srcY, dstY)
|| pGo->GetPositionY() < std::min(srcY, dstY))
continue;
// don't check very small and very large objects
if (pGo->GetDeterminativeSize(true) < mover->GetObjectBoundingRadius() * 0.5f ||
pGo->GetDeterminativeSize(false) > mover->GetObjectBoundingRadius() * 100.0f)
continue;
// second check by angle
float angle = mover->GetAngle(pGo) - mover->GetAngle(dstX, dstY);
if (abs(sin(angle)) * pGo->GetExactDist2d(srcX, srcY) > pGo->GetObjectBoundingRadius() * 0.5f)
continue;
bool bLOSBreak = false;
switch (pGo->GetGoType())
{
case GAMEOBJECT_TYPE_TRAP:
case GAMEOBJECT_TYPE_SPELL_FOCUS:
case GAMEOBJECT_TYPE_MO_TRANSPORT:
case GAMEOBJECT_TYPE_CAMERA:
case GAMEOBJECT_TYPE_FISHINGNODE:
case GAMEOBJECT_TYPE_SUMMONING_RITUAL:
case GAMEOBJECT_TYPE_SPELLCASTER:
case GAMEOBJECT_TYPE_FISHINGHOLE:
case GAMEOBJECT_TYPE_CAPTURE_POINT:
break;
case GAMEOBJECT_TYPE_DOOR:
if (pGo->isSpawned() && pGo->GetGoState() == GO_STATE_READY)
bLOSBreak = true;
break;
case GAMEOBJECT_TYPE_TRANSPORT:
if (pGo->isSpawned() && pGo->GetGoState() == GO_STATE_ACTIVE)
bLOSBreak = true;
break;
case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
if (!pGo->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED))
bLOSBreak = true;
break;
default:
if (pGo->isSpawned())
bLOSBreak = true;
break;
}
if (bLOSBreak)
inLOSGOList.insert(pGo);
}
}
//.........这里部分代码省略.........