本文整理汇总了C++中MapPersistentState::SetGORespawnTime方法的典型用法代码示例。如果您正苦于以下问题:C++ MapPersistentState::SetGORespawnTime方法的具体用法?C++ MapPersistentState::SetGORespawnTime怎么用?C++ MapPersistentState::SetGORespawnTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapPersistentState
的用法示例。
在下文中一共展示了MapPersistentState::SetGORespawnTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadGameobjectRespawnTimes
void MapPersistentStateManager::LoadGameobjectRespawnTimes()
{
// remove outdated data
CharacterDatabase.DirectExecute("DELETE FROM gameobject_respawn WHERE respawntime <= UNIX_TIMESTAMP(NOW())");
uint32 count = 0;
QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, resettime FROM gameobject_respawn LEFT JOIN instance ON instance = id");
if(!result)
{
barGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString(">> Loaded 0 gameobject respawn time.");
return;
}
barGoLink bar((int)result->GetRowCount());
do
{
Field *fields = result->Fetch();
bar.step();
uint32 loguid = fields[0].GetUInt32();
uint64 respawn_time = fields[1].GetUInt64();
uint32 mapId = fields[2].GetUInt32();
uint32 instanceId = fields[3].GetUInt32();
time_t resetTime = (time_t)fields[4].GetUInt64();
GameObjectData const* data = sObjectMgr.GetGOData(loguid);
if (!data)
continue;
if (mapId != data->mapid)
continue;
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (!mapEntry || (mapEntry->Instanceable() != (instanceId != 0)))
continue;
MapPersistentState* state = AddPersistentState(mapEntry, instanceId, resetTime, mapEntry->IsDungeon(), true);
if (!state)
continue;
state->SetGORespawnTime(loguid, time_t(respawn_time));
++count;
} while (result->NextRow());
delete result;
sLog.outString(">> Loaded %u gameobject respawn times", count);
sLog.outString();
}
示例2: LoadGameobjectRespawnTimes
void MapPersistentStateManager::LoadGameobjectRespawnTimes()
{
// remove outdated data
CharacterDatabase.DirectExecute("DELETE FROM gameobject_respawn WHERE respawntime <= UNIX_TIMESTAMP(NOW())");
uint32 count = 0;
// 0 1 2 3 4 5 6
QueryResult* result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime, encountersMask FROM gameobject_respawn LEFT JOIN instance ON instance = id");
if (!result)
{
BarGoLink bar(1);
bar.step();
sLog.outString(">> Loaded 0 gameobject respawn time.");
sLog.outString();
return;
}
BarGoLink bar(result->GetRowCount());
do
{
Field* fields = result->Fetch();
bar.step();
uint32 loguid = fields[0].GetUInt32();
uint64 respawn_time = fields[1].GetUInt64();
uint32 mapId = fields[2].GetUInt32();
uint32 instanceId = fields[3].GetUInt32();
uint8 difficulty = fields[4].GetUInt8();
time_t resetTime = (time_t)fields[5].GetUInt64();
uint32 completedEncounters = fields[6].GetUInt32();
GameObjectData const* data = sObjectMgr.GetGOData(loguid);
if (!data)
continue;
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
if (!mapEntry)
continue;
if (instanceId) // In instance - mapId must be data->mapid and mapEntry must be Instanceable
{
if (mapId != data->mapid || !mapEntry->Instanceable())
continue;
}
else // Not in instance, mapEntry must not be Instanceable
{
if (mapEntry->Instanceable())
continue;
}
if (difficulty >= (!mapEntry->Instanceable() ? REGULAR_DIFFICULTY + 1 : MAX_DIFFICULTY))
continue;
MapPersistentState* state = AddPersistentState(mapEntry, instanceId, Difficulty(difficulty), resetTime, mapEntry->IsDungeon(), true, true, completedEncounters);
if (!state)
continue;
state->SetGORespawnTime(loguid, time_t(respawn_time));
++count;
}
while (result->NextRow());
delete result;
sLog.outString(">> Loaded %u gameobject respawn times", count);
sLog.outString();
}