本文整理汇总了C++中UpdateDoorState函数的典型用法代码示例。如果您正苦于以下问题:C++ UpdateDoorState函数的具体用法?C++ UpdateDoorState怎么用?C++ UpdateDoorState使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UpdateDoorState函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveToDB
bool InstanceScript::SetBossState(uint32 id, EncounterState state)
{
if(id < bosses.size())
{
BossInfo *bossInfo = &bosses[id];
if(bossInfo->state == TO_BE_DECIDED) // loading
{
bossInfo->state = state;
return false;
}
else
{
if(bossInfo->state == state)
return false;
if(state == DONE)
for(MinionSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
if((*i)->isWorldBoss() && (*i)->isAlive())
return false;
bossInfo->state = state;
SaveToDB();
}
for(uint32 type = 0; type < MAX_DOOR_TYPES; ++type)
for(DoorSet::iterator i = bossInfo->door[type].begin(); i != bossInfo->door[type].end(); ++i)
UpdateDoorState(*i);
for(MinionSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
UpdateMinionState(*i, state);
return true;
}
return false;
}
示例2: SaveToDB
bool InstanceData::SetBossState(uint32 id, EncounterState state)
{
if (id < bosses.size())
{
BossInfo *bossInfo = &bosses[id];
if (bossInfo->state == TO_BE_DECIDED) // loading
{
bossInfo->state = state;
//sLog.outError("Inialize boss %u state as %u.", id, (uint32)state);
return false;
}
else
{
if (bossInfo->state == state)
return false;
bossInfo->state = state;
SaveToDB();
}
for (uint32 type = 0; type < MAX_DOOR_TYPES; ++type)
for (DoorSet::iterator i = bossInfo->door[type].begin(); i != bossInfo->door[type].end(); ++i)
UpdateDoorState(*i);
for (MinionSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
UpdateMinionState(*i, state);
return true;
}
return false;
}
示例3: SaveToDB
bool InstanceScript::SetBossState(uint32 id, EncounterState state)
{
if (id < bosses.size())
{
BossInfo* bossInfo = &bosses[id];
if (bossInfo->state == TO_BE_DECIDED) // loading
{
bossInfo->state = state;
SaveToDB();
//TC_LOG_ERROR("misc", "Inialize boss %u state as %u.", id, (uint32)state);
return false;
}
else
{
if (bossInfo->state == state)
return false;
if (state == DONE)
for (MinionSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
if ((*i)->isWorldBoss() && (*i)->IsAlive())
return false;
bossInfo->state = state;
SaveToDB();
}
for (uint32 type = 0; type < MAX_DOOR_TYPES; ++type)
for (DoorSet::iterator i = bossInfo->door[type].begin(); i != bossInfo->door[type].end(); ++i)
UpdateDoorState(*i);
for (MinionSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
UpdateMinionState(*i, state);
// call method to check wether a guild challenge can be completed
if(bossInfo == &bosses.back() && state == DONE)
{
Guild* guild = nullptr;
for(Map::PlayerList::const_iterator itr = instance->GetPlayers().begin(); itr != instance->GetPlayers().end();++itr)
{
if(guild != itr->GetSource()->GetGuild())
guild = itr->GetSource()->GetGuild();
if(guild)
guild->GetChallengesMgr()->CheckInstanceChallenge(this, itr->GetSource()->GetGroup());
}
}
return true;
}
return false;
}
示例4: TC_LOG_DEBUG
bool InstanceScript::SetBossState(uint32 id, EncounterState state)
{
if (id < bosses.size())
{
BossInfo* bossInfo = &bosses[id];
if (bossInfo->state == TO_BE_DECIDED) // loading
{
bossInfo->state = state;
TC_LOG_DEBUG("scripts", "InstanceScript: Initialize boss %u state as %s (map %u, %u).", id, GetBossStateName(state), instance->GetId(), instance->GetInstanceId());
return false;
}
else
{
if (bossInfo->state == state)
return false;
if (bossInfo->state == DONE)
{
TC_LOG_ERROR("map", "InstanceScript: Tried to set instance boss %u state from %s back to %s for map %u, instance id %u. Blocked!", id, GetBossStateName(bossInfo->state), GetBossStateName(state), instance->GetId(), instance->GetInstanceId());
return false;
}
if (state == DONE)
for (GuidSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
if (Creature* minion = instance->GetCreature(*i))
if (minion->isWorldBoss() && minion->IsAlive())
return false;
bossInfo->state = state;
SaveToDB();
}
for (uint32 type = 0; type < MAX_DOOR_TYPES; ++type)
for (GuidSet::iterator i = bossInfo->door[type].begin(); i != bossInfo->door[type].end(); ++i)
if (GameObject* door = instance->GetGameObject(*i))
UpdateDoorState(door);
for (GuidSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
if (Creature* minion = instance->GetCreature(*i))
UpdateMinionState(minion, state);
UpdateSpawnGroups();
return true;
}
return false;
}
示例5: UpdateDoorState
void InstanceData::AddDoor(GameObject *door, bool add)
{
DoorInfoMap::iterator lower = doors.lower_bound(door->GetEntry());
DoorInfoMap::iterator upper = doors.upper_bound(door->GetEntry());
if (lower == upper)
return;
for (DoorInfoMap::iterator itr = lower; itr != upper; ++itr)
{
if (add)
itr->second.bossInfo->door[itr->second.type].insert(door);
else
itr->second.bossInfo->door[itr->second.type].erase(door);
}
if (add)
UpdateDoorState(door);
}
示例6: switch
void InstanceScript::AddDoor(GameObject* door, bool add)
{
DoorInfoMap::iterator lower = doors.lower_bound(door->GetEntry());
DoorInfoMap::iterator upper = doors.upper_bound(door->GetEntry());
if (lower == upper)
return;
for (DoorInfoMap::iterator itr = lower; itr != upper; ++itr)
{
DoorInfo const& data = itr->second;
if (add)
{
data.bossInfo->door[data.type].insert(door);
switch (data.boundary)
{
default:
case BOUNDARY_NONE:
break;
case BOUNDARY_N:
case BOUNDARY_S:
data.bossInfo->boundary[data.boundary] = door->GetPositionX();
break;
case BOUNDARY_E:
case BOUNDARY_W:
data.bossInfo->boundary[data.boundary] = door->GetPositionY();
break;
case BOUNDARY_NW:
case BOUNDARY_SE:
data.bossInfo->boundary[data.boundary] = door->GetPositionX() + door->GetPositionY();
break;
case BOUNDARY_NE:
case BOUNDARY_SW:
data.bossInfo->boundary[data.boundary] = door->GetPositionX() - door->GetPositionY();
break;
}
}
else
data.bossInfo->door[data.type].erase(door);
}
if (add)
UpdateDoorState(door);
}
示例7: switch
void InstanceScript::AddDoor(GameObject* door, bool add)
{
DoorInfoMapBounds range = doors.equal_range(door->GetEntry());
if (range.first == range.second)
return;
for (; range.first != range.second; ++range.first)
{
DoorInfo const& data = range.first->second;
if (add)
{
data.bossInfo->door[data.type].insert(door);
switch (data.boundary)
{
default:
case BOUNDARY_NONE:
break;
case BOUNDARY_N:
case BOUNDARY_S:
data.bossInfo->boundary[data.boundary] = door->GetPositionX();
break;
case BOUNDARY_E:
case BOUNDARY_W:
data.bossInfo->boundary[data.boundary] = door->GetPositionY();
break;
case BOUNDARY_NW:
case BOUNDARY_SE:
data.bossInfo->boundary[data.boundary] = door->GetPositionX() + door->GetPositionY();
break;
case BOUNDARY_NE:
case BOUNDARY_SW:
data.bossInfo->boundary[data.boundary] = door->GetPositionX() - door->GetPositionY();
break;
}
}
else
data.bossInfo->door[data.type].erase(door);
}
if (add)
UpdateDoorState(door);
}
示例8: UpdateDoorState
void InstanceScript::AddDoor(GameObject* door, bool add)
{
DoorInfoMapBounds range = doors.equal_range(door->GetEntry());
if (range.first == range.second)
return;
for (; range.first != range.second; ++range.first)
{
DoorInfo const& data = range.first->second;
if (add)
{
data.bossInfo->door[data.type].insert(door->GetGUID());
}
else
data.bossInfo->door[data.type].erase(door->GetGUID());
}
if (add)
UpdateDoorState(door);
}
示例9: SaveToDB
bool InstanceScript::SetBossState(uint32 id, EncounterState state)
{
if (id < bosses.size())
{
BossInfo* bossInfo = &bosses[id];
if (bossInfo->state == TO_BE_DECIDED) // loading
{
bossInfo->state = state;
//TC_LOG_ERROR("misc", "Inialize boss %u state as %u.", id, (uint32)state);
return false;
}
else
{
if (bossInfo->state == state)
return false;
if (state == DONE)
for (MinionSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
if (Creature* minion = instance->GetCreature(*i))
if (minion->isWorldBoss() && minion->IsAlive())
return false;
bossInfo->state = state;
SaveToDB();
}
for (uint32 type = 0; type < MAX_DOOR_TYPES; ++type)
for (DoorSet::iterator i = bossInfo->door[type].begin(); i != bossInfo->door[type].end(); ++i)
if (GameObject* door = instance->GetGameObject(*i))
UpdateDoorState(door);
for (MinionSet::iterator i = bossInfo->minion.begin(); i != bossInfo->minion.end(); ++i)
if (Creature* minion = instance->GetCreature(*i))
UpdateMinionState(minion, state);
return true;
}
return false;
}