本文整理汇总了C++中GetMSTimeDiffToNow函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMSTimeDiffToNow函数的具体用法?C++ GetMSTimeDiffToNow怎么用?C++ GetMSTimeDiffToNow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetMSTimeDiffToNow函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getMSTime
void MapManager::LoadTransportNPCs()
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6 7
QueryResult result = WorldDatabase.Query("SELECT guid, npc_entry, transport_entry, TransOffsetX, TransOffsetY, TransOffsetZ, TransOffsetO, emote FROM creature_transport");
if (!result)
{
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!");
return;
}
uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 guid = fields[0].GetInt32();
uint32 entry = fields[1].GetInt32();
uint32 transportEntry = fields[2].GetInt32();
float tX = fields[3].GetFloat();
float tY = fields[4].GetFloat();
float tZ = fields[5].GetFloat();
float tO = fields[6].GetFloat();
uint32 anim = fields[7].GetInt32();
for (MapManager::TransportSet::iterator itr = m_Transports.begin(); itr != m_Transports.end(); ++itr)
{
if ((*itr)->GetEntry() == transportEntry)
{
(*itr)->AddNPCPassenger(guid, entry, tX, tY, tZ, tO, anim);
break;
}
}
++count;
}
while (result->NextRow());
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
开发者ID:Aristoo,项目名称:TrinityCore,代码行数:42,代码来源:Transport.cpp
示例2: getMSTime
void TicketMgr::LoadTickets()
{
uint32 oldMSTime = getMSTime();
for (GmTicketList::const_iterator itr = _ticketList.begin(); itr != _ticketList.end(); ++itr)
delete itr->second;
_ticketList.clear();
_lastTicketId = 0;
_openTicketCount = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GM_TICKETS);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!");
return;
}
uint32 count = 0;
do
{
Field* fields = result->Fetch();
GmTicket* ticket = new GmTicket();
if (!ticket->LoadFromDB(fields))
{
delete ticket;
continue;
}
if (!ticket->IsClosed())
++_openTicketCount;
// Update max ticket id if necessary
uint32 id = ticket->GetId();
if (_lastTicketId < id)
_lastTicketId = id;
_ticketList[id] = ticket;
++count;
} while (result->NextRow());
TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
开发者ID:smaitlx,项目名称:Origin-Engine,代码行数:45,代码来源:TicketMgr.cpp
示例3: getMSTime
void CreatureTextMgr::LoadCreatureTexts()
{
uint32 oldMSTime = getMSTime();
mTextMap.clear(); // for reload case
mTextRepeatMap.clear(); //reset all currently used temp texts
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_LOAD_CRETEXT);
PreparedQueryResult result = WorldDatabase.Query(stmt);
if(!result)
{
sLog->outString(">> Loaded 0 ceature texts. DB table `creature_texts` is empty.");
sLog->outString();
return;
}
uint32 textCount = 0;
uint32 creatureCount = 0;
do
{
Field* fields = result->Fetch();
CreatureTextEntry temp;
temp.entry = fields[0].GetUInt32();
temp.group = fields[1].GetUInt8();
temp.id = fields[2].GetUInt8();
temp.text = fields[3].GetString();
temp.type = ChatMsg(fields[4].GetUInt8());
temp.lang = Language(fields[5].GetUInt8());
temp.probability = fields[6].GetFloat();
temp.emote = Emote(fields[7].GetUInt32());
temp.duration = fields[8].GetUInt32();
temp.sound = fields[9].GetUInt32();
if(temp.sound)
{
if(!sSoundEntriesStore.LookupEntry(temp.sound)){
sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);
temp.sound = 0;
}
}
if(!GetLanguageDescByID(temp.lang))
{
sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));
temp.lang = LANG_UNIVERSAL;
}
if(temp.type >= MAX_CHAT_MSG_TYPE)
{
sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));
temp.type = CHAT_MSG_SAY;
}
if(temp.emote)
{
if(!sEmotesStore.LookupEntry(temp.emote))
{
sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote));
temp.emote = EMOTE_ONESHOT_NONE;
}
}
//entry not yet added, add empty TextHolder (list of groups)
if(mTextMap.find(temp.entry) == mTextMap.end())
{
++creatureCount;
CreatureTextHolder TextHolder;
mTextMap[temp.entry] = TextHolder;
}
//group not yet added, add empty TextGroup (list of texts)
if(mTextMap[temp.entry].find(temp.group) == mTextMap[temp.entry].end())
{
CreatureTextGroup TextGroup;
mTextMap[temp.entry][temp.group] = TextGroup;
}
//add the text into our entry's group
mTextMap[temp.entry][temp.group].push_back(temp);
++textCount;
} while(result->NextRow());
sLog->outString(">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
开发者ID:Darkelmo,项目名称:MythCore,代码行数:83,代码来源:CreatureTextMgr.cpp
示例4: getMSTime
void CreatureTextMgr::LoadCreatureTexts()
{
uint32 oldMSTime = getMSTime();
mTextMap.clear(); // for reload case
mTextRepeatMap.clear(); //reset all currently used temp texts
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_TEXT);
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
{
TC_LOG_INFO("server.loading", ">> Loaded 0 ceature texts. DB table `creature_text` is empty.");
return;
}
uint32 textCount = 0;
do
{
Field* fields = result->Fetch();
CreatureTextEntry temp;
temp.entry = fields[0].GetUInt32();
temp.group = fields[1].GetUInt8();
temp.id = fields[2].GetUInt8();
temp.type = ChatMsg(fields[3].GetUInt8());
temp.lang = Language(fields[4].GetUInt8());
temp.probability = fields[5].GetFloat();
temp.duration = fields[6].GetUInt32();
temp.BroadcastTextId = fields[7].GetUInt32();
temp.TextRange = CreatureTextRange(fields[8].GetUInt8());
if (!GetLanguageDescByID(temp.lang))
{
TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));
temp.lang = LANG_UNIVERSAL;
}
if (temp.type >= MAX_CHAT_MSG_TYPE)
{
TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));
temp.type = CHAT_MSG_SAY;
}
if (temp.BroadcastTextId)
{
if (!sObjectMgr->GetBroadcastText(temp.BroadcastTextId))
{
TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has non-existing or incompatible BroadcastTextId %u.", temp.entry, temp.group, temp.id, temp.BroadcastTextId);
temp.BroadcastTextId = 0;
}
}
if (temp.TextRange > TEXT_RANGE_WORLD)
{
TC_LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has incorrect TextRange %u.", temp.entry, temp.group, temp.id, temp.TextRange);
temp.TextRange = TEXT_RANGE_NORMAL;
}
// add the text into our entry's group
mTextMap[temp.entry][temp.group].push_back(temp);
++textCount;
}
while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %u creature texts for " SZFMTD " creatures in %u ms", textCount, mTextMap.size(), GetMSTimeDiffToNow(oldMSTime));
}
开发者ID:qadll52001314,项目名称:loa,代码行数:70,代码来源:CreatureTextMgr.cpp
示例5: getMSTime
void AuctionHouseMgr::LoadAuctions()
{
uint32 oldMSTime = getMSTime();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONS);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
return;
}
uint32 count = 0;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
do
{
Field* fields = result->Fetch();
AuctionEntry* aItem = new AuctionEntry();
if (!aItem->LoadFromDB(fields))
{
aItem->DeleteFromDB(trans);
delete aItem;
continue;
}
GetAuctionsMap(aItem->factionTemplateId)->AddAuction(aItem);
count++;
} while (result->NextRow());
CharacterDatabase.CommitTransaction(trans);
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
开发者ID:Alexdeath,项目名称:FaceCore,代码行数:38,代码来源:AuctionHouseMgr.cpp
示例6: getMSTime
void PoolMgr::LoadFromDB()
{
// Pool templates
{
uint32 oldMSTime = getMSTime();
QueryResult result = WorldDatabase.Query("SELECT entry, max_limit FROM pool_template");
if (!result)
{
mPoolTemplate.clear();
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 object pools. DB table `pool_template` is empty.");
return;
}
uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 pool_id = fields[0].GetUInt32();
PoolTemplateData& pPoolTemplate = mPoolTemplate[pool_id];
pPoolTemplate.MaxLimit = fields[1].GetUInt32();
++count;
}
while (result->NextRow());
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Creatures
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creatures Pooling Data...");
{
uint32 oldMSTime = getMSTime();
// 1 2 3
QueryResult result = WorldDatabase.Query("SELECT guid, pool_entry, chance FROM pool_creature");
if (!result)
{
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty.");
}
else
{
uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
uint32 pool_id = fields[1].GetUInt32();
float chance = fields[2].GetFloat();
CreatureData const* data = sObjectMgr->GetCreatureData(guid);
if (!data)
{
sLog->outError(LOG_FILTER_SQL, "`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id);
continue;
}
if (pool_id > max_pool_id)
{
sLog->outError(LOG_FILTER_SQL, "`pool_creature` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
continue;
}
if (chance < 0 || chance > 100)
{
sLog->outError(LOG_FILTER_SQL, "`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id);
continue;
}
PoolTemplateData* pPoolTemplate = &mPoolTemplate[pool_id];
PoolObject plObject = PoolObject(guid, chance);
PoolGroup<Creature>& cregroup = mPoolCreatureGroups[pool_id];
cregroup.SetPoolId(pool_id);
cregroup.AddEntry(plObject, pPoolTemplate->MaxLimit);
SearchPair p(guid, pool_id);
mCreatureSearchMap.insert(p);
++count;
}
while (result->NextRow());
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Gameobjects
sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Pooling Data...");
{
uint32 oldMSTime = getMSTime();
// 1 2 3
QueryResult result = WorldDatabase.Query("SELECT guid, pool_entry, chance FROM pool_gameobject");
if (!result)
{
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty.");
}
//.........这里部分代码省略.........
开发者ID:3DViking,项目名称:MistCore,代码行数:101,代码来源:PoolMgr.cpp
示例7: LoadSkillExtraItemTable
// loads the extra item creation info from DB
void LoadSkillExtraItemTable()
{
uint32 oldMSTime = getMSTime();
SkillExtraItemStore.clear(); // need for reload
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT spellId, requiredSpecialization, additionalCreateChance, additionalMaxNum FROM skill_extra_item_template");
if (!result)
{
sLog->outErrorDb(">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty.");
sLog->outString();
return;
}
uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 spellId = fields[0].GetUInt32();
if (!sSpellMgr->GetSpellInfo(spellId))
{
sLog->outError("Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);
continue;
}
uint32 requiredSpecialization = fields[1].GetUInt32();
if (!sSpellMgr->GetSpellInfo(requiredSpecialization))
{
sLog->outError("Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization);
continue;
}
float additionalCreateChance = fields[2].GetFloat();
if (additionalCreateChance <= 0.0f)
{
sLog->outError("Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);
continue;
}
uint8 additionalMaxNum = fields[3].GetUInt8();
if (!additionalMaxNum)
{
sLog->outError("Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);
continue;
}
SkillExtraItemEntry& skillExtraItemEntry = SkillExtraItemStore[spellId];
skillExtraItemEntry.requiredSpecialization = requiredSpecialization;
skillExtraItemEntry.additionalCreateChance = additionalCreateChance;
skillExtraItemEntry.additionalMaxNum = additionalMaxNum;
++count;
}
while (result->NextRow());
sLog->outString(">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
开发者ID:SkyFireArchives,项目名称:SkyFireEMU_434,代码行数:65,代码来源:SkillExtraItems.cpp
示例8: getMSTime
// -------------------
void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
{
uint32 oldMSTime = getMSTime();
//Drop Existing EventSummon Map
m_CreatureEventAI_Summon_Map.clear();
// Gather additional data for EventAI
QueryResult result = WorldDatabase.Query("SELECT id, position_x, position_y, position_z, orientation, spawntimesecs FROM creature_ai_summons");
if (!result)
{
sLog->outString(">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty.");
sLog->outString();
return;
}
uint32 count = 0;
do
{
Field* fields = result->Fetch();
CreatureEventAI_Summon temp;
uint32 i = fields[0].GetUInt32();
temp.position_x = fields[1].GetFloat();
temp.position_y = fields[2].GetFloat();
temp.position_z = fields[3].GetFloat();
temp.orientation = fields[4].GetFloat();
temp.SpawnTimeSecs = fields[5].GetUInt32();
if (!Trinity::IsValidMapCoord(temp.position_x, temp.position_y, temp.position_z, temp.orientation))
{
sLog->outErrorDb("CreatureEventAI: Summon id %u have wrong coordinates (%f, %f, %f, %f), skipping.", i, temp.position_x, temp.position_y, temp.position_z, temp.orientation);
continue;
}
//Add to map
m_CreatureEventAI_Summon_Map[i] = temp;
++count;
}
while (result->NextRow());
sLog->outString(">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
开发者ID:MCInteger,项目名称:uwom-server,代码行数:48,代码来源:CreatureEventAIMgr.cpp
示例9: getMSTime
//.........这里部分代码省略.........
// 0 1 2 3 4 5 6
QueryResult result = WorldDatabase.Query("SELECT entry, title_A, title_H, item, sender, subject, text FROM achievement_reward");
if (!result)
{
sLog->outErrorDb(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
sLog->outString();
return;
}
uint32 count = 0;
do
{
Field *fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
const AchievementEntry* pAchievement = sAchievementStore.LookupEntry(entry);
if (!pAchievement)
{
sLog->outErrorDb("Table `achievement_reward` has wrong achievement (Entry: %u), ignore", entry);
continue;
}
AchievementReward reward;
reward.titleId[0] = fields[1].GetUInt32();
reward.titleId[1] = fields[2].GetUInt32();
reward.itemId = fields[3].GetUInt32();
reward.sender = fields[4].GetUInt32();
reward.subject = fields[5].GetString();
reward.text = fields[6].GetString();
// must be title or mail at least
if (!reward.titleId[0] && !reward.titleId[1] && !reward.sender)
{
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) not have title or item reward data, ignore.", entry);
continue;
}
if (pAchievement->requiredFaction == ACHIEVEMENT_FACTION_ANY && ((reward.titleId[0] == 0) != (reward.titleId[1] == 0)))
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) for only one team.", entry, reward.titleId[0], reward.titleId[1]);
if (reward.titleId[0])
{
CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[0]);
if (!titleEntry)
{
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`, set to 0", entry, reward.titleId[0]);
reward.titleId[0] = 0;
}
}
if (reward.titleId[1])
{
CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[1]);
if (!titleEntry)
{
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`, set to 0", entry, reward.titleId[1]);
reward.titleId[1] = 0;
}
}
//check mail data before item for report including wrong item case
if (reward.sender)
{
if (!sObjectMgr->GetCreatureTemplate(reward.sender))
{
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid creature entry %u as sender, mail reward skipped.", entry, reward.sender);
reward.sender = 0;
}
}
else
{
if (reward.itemId)
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has item reward, item will not be rewarded.", entry);
if (!reward.subject.empty())
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has mail subject.", entry);
if (!reward.text.empty())
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have sender data but has mail text.", entry);
}
if (reward.itemId)
{
if (!sObjectMgr->GetItemTemplate(reward.itemId))
{
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid item id %u, reward mail will not contain item.", entry, reward.itemId);
reward.itemId = 0;
}
}
m_achievementRewards[entry] = reward;
++count;
}
while (result->NextRow());
sLog->outString(">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
开发者ID:Facelive,项目名称:ArkCORE2,代码行数:101,代码来源:AchievementMgr.cpp
示例10: getMSTime
void GuildMgr::LoadGuilds()
{
// 1. Load all guilds
sLog->outString("Loading guilds definitions...");
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6
QueryResult result = CharacterDatabase.Query("SELECT g.guildid, g.name, g.leaderguid, g.EmblemStyle, g.EmblemColor, g.BorderStyle, g.BorderColor, "
// 7 8 9 10 11 12
"g.BackgroundColor, g.info, g.motd, g.createdate, g.BankMoney, COUNT(gbt.guildid) "
"FROM guild g LEFT JOIN guild_bank_tab gbt ON g.guildid = gbt.guildid GROUP BY g.guildid ORDER BY g.guildid ASC");
if (!result)
{
sLog->outString(">> Loaded 0 guild definitions. DB table `guild` is empty.");
sLog->outString();
return;
}
else
{
uint32 count = 0;
do
{
Field* fields = result->Fetch();
Guild* guild = new Guild();
if (!guild->LoadFromDB(fields))
{
delete guild;
continue;
}
QueryResult gNews = CharacterDatabase.PQuery("SELECT type, date, value1, value2, source_guid, flags FROM guild_news WHERE guildid = %u ORDER BY date DESC", guild->GetId());
if (gNews)
{
Field* fields = gNews->Fetch();
guild->LoadGuildNewsFromDB(fields);
}
AddGuild(guild);
++count;
}
while (result->NextRow());
sLog->outString(">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
}
// 2. Load all guild ranks
sLog->outString("Loading guild ranks...");
{
uint32 oldMSTime = getMSTime();
// Delete orphaned guild rank entries before loading the valid ones
CharacterDatabase.DirectExecute("DELETE gr FROM guild_rank gr LEFT JOIN guild g ON gr.guildId = g.guildId WHERE g.guildId IS NULL");
// 0 1 2 3 4
QueryResult result = CharacterDatabase.Query("SELECT guildid, rid, rname, rights, BankMoneyPerDay FROM guild_rank ORDER BY guildid ASC, rid ASC");
if (!result)
{
sLog->outString(">> Loaded 0 guild ranks. DB table `guild_rank` is empty.");
sLog->outString();
}
else
{
uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 guildId = fields[0].GetUInt32();
if (Guild* guild = GetGuildById(guildId))
guild->LoadRankFromDB(fields);
++count;
}
while (result->NextRow());
sLog->outString(">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
}
// 3. Load all guild members
sLog->outString("Loading guild members...");
{
uint32 oldMSTime = getMSTime();
// Delete orphaned guild member entries before loading the valid ones
CharacterDatabase.DirectExecute("DELETE gm FROM guild_member gm LEFT JOIN guild g ON gm.guildId = g.guildId WHERE g.guildId IS NULL");
// 0 1 2 3 4 5 6
QueryResult result = CharacterDatabase.Query("SELECT guildid, gm.guid, rank, pnote, offnote, BankResetTimeMoney, BankRemMoney, "
// 7 8 9 10 11 12
"BankResetTimeTab0, BankRemSlotsTab0, BankResetTimeTab1, BankRemSlotsTab1, BankResetTimeTab2, BankRemSlotsTab2, "
// 13 14 15 16 17 18
"BankResetTimeTab3, BankRemSlotsTab3, BankResetTimeTab4, BankRemSlotsTab4, BankResetTimeTab5, BankRemSlotsTab5, "
// 19 20 21 22 23 24
//.........这里部分代码省略.........
开发者ID:Anyriand,项目名称:ArkCORE,代码行数:101,代码来源:GuildMgr.cpp
示例11: getMSTime
void SmartWaypointMgr::LoadFromDB()
{
uint32 oldMSTime = getMSTime();
waypoint_map.clear();
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_LOAD_SMARTAI_WP);
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
{
sLog->outString(">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
sLog->outString();
return;
}
uint32 count = 0;
uint32 total = 0;
WPPath* path = NULL;
uint32 last_entry = 0;
uint32 last_id = 1;
do
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
uint32 id = fields[1].GetUInt32();
float x, y, z;
x = fields[2].GetFloat();
y = fields[3].GetFloat();
z = fields[4].GetFloat();
WayPoint* wp = new WayPoint(id, x, y, z);
if (last_entry != entry)
{
path = new WPPath;
last_id = 1;
}
if (last_id != id)
{
sLog->outErrorDb("SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);
}
last_id++;
(*path)[id] = wp;
if (last_entry != entry)
{
count++;
waypoint_map[entry] = path;
}
last_entry = entry;
total++;
}
while (result->NextRow());
sLog->outString(">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
开发者ID:55887MX,项目名称:CCORE,代码行数:59,代码来源:SmartScriptMgr.cpp
示例12: LoadSkillDiscoveryTable
//.........这里部分代码省略.........
{
sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty.");
return;
}
uint32 count = 0;
std::ostringstream ssNonDiscoverableEntries;
std::set<uint32> reportedReqSpells;
do
{
Field* fields = result->Fetch();
uint32 spellId = fields[0].GetUInt32();
int32 reqSkillOrSpell = fields[1].GetInt32();
uint32 reqSkillValue = fields[2].GetUInt16();
float chance = fields[3].GetFloat();
if (chance <= 0) // chance
{
ssNonDiscoverableEntries << "spellId = " << spellId << " reqSkillOrSpell = " << reqSkillOrSpell
<< " reqSkillValue = " << reqSkillValue << " chance = " << chance << "(chance problem)\n";
continue;
}
if (reqSkillOrSpell > 0) // spell case
{
uint32 absReqSkillOrSpell = uint32(reqSkillOrSpell);
SpellInfo const* reqSpellInfo = sSpellMgr->GetSpellInfo(absReqSkillOrSpell);
if (!reqSpellInfo)
{
if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end())
{
sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table", spellId, reqSkillOrSpell);
reportedReqSpells.insert(absReqSkillOrSpell);
}
continue;
}
// mechanic discovery
if (reqSpellInfo->Mechanic != MECHANIC_DISCOVERY &&
// explicit discovery ability
!reqSpellInfo->IsExplicitDiscovery())
{
if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end())
{
sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc"
" and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table",
absReqSkillOrSpell, spellId);
reportedReqSpells.insert(absReqSkillOrSpell);
}
continue;
}
SkillDiscoveryStore[reqSkillOrSpell].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance));
}
else if (reqSkillOrSpell == 0) // skill case
{
SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId);
if (bounds.first == bounds.second)
{
sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table", spellId);
continue;
}
for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
SkillDiscoveryStore[-int32(_spell_idx->second->skillId)].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance));
}
else
{
sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId);
continue;
}
++count;
}
while (result->NextRow());
if (!ssNonDiscoverableEntries.str().empty())
sLog->outError(LOG_FILTER_SQL, "Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str());
// report about empty data for explicit discovery spells
for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id)
{
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spell_id);
if (!spellEntry)
continue;
// skip not explicit discovery spells
if (!spellEntry->IsExplicitDiscovery())
continue;
if (SkillDiscoveryStore.find(int32(spell_id)) == SkillDiscoveryStore.end())
sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id);
}
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
开发者ID:Tithand,项目名称:TER-Server,代码行数:101,代码来源:SkillDiscovery.cpp
示例13: getMSTime
void MapManager::LoadTransports()
{
uint32 oldMSTime = getMSTime();
QueryResult result = WorldDatabase.Query("SELECT guid, entry, name, period, ScriptName FROM transports");
if (!result)
{
sLog->outString(">> Loaded 0 transports. DB table `transports` is empty!");
sLog->outString();
return;
}
uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 lowguid = fields[0].GetUInt32();
uint32 entry = fields[1].GetUInt32();
std::string name = fields[2].GetString();
uint32 period = fields[3].GetUInt32();
uint32 scriptId = sObjectMgr->GetScriptId(fields[4].GetCString());
const GameObjectTemplate* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
if (!goinfo)
{
sLog->outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template missing", entry, name.c_str());
continue;
}
if (goinfo->type != GAMEOBJECT_TYPE_MO_TRANSPORT)
{
sLog->outErrorDb("Transport ID:%u, Name: %s, will not be loaded, gameobject_template type wrong", entry, name.c_str());
continue;
}
// sLog->outString("Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name);
std::set<uint32> mapsUsed;
Transport* t = new Transport(period, scriptId);
if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed))
// skip transports with empty waypoints list
{
sLog->outErrorDb("Transport (path id %u) path size = 0. Transport ignored, check DBC files or transport GO data0 field.", goinfo->moTransport.taxiPathId);
delete t;
continue;
}
float x = t->m_WayPoints[0].x;
float y = t->m_WayPoints[0].y;
float z = t->m_WayPoints[0].z;
uint32 mapid = t->m_WayPoints[0].mapid;
float o = 1.0f;
// creates the Gameobject
if (!t->Create(lowguid, entry, mapid, x, y, z, o, 100, 0))
{
delete t;
continue;
}
m_Transports.insert(t);
for (std::set<uint32>::const_iterator i = mapsUsed.begin(); i != mapsUsed.end(); ++i)
m_TransportsByMap[*i].insert(t);
//If we someday decide to use the grid to track transports, here:
t->SetMap(sMapMgr->CreateBaseMap(mapid));
t->AddToWorld();
++count;
}
while (result->NextRow());
// check transport data DB integrity
result = WorldDatabase.Query("SELECT gameobject.guid, gameobject.id, transports.name FROM gameobject, transports WHERE gameobject.id = transports.entry");
if (result) // wrong data found
{
do
{
Field* fields = result->Fetch();
uint32 guid = fields[0].GetUInt32();
uint32 entry = fields[1].GetUInt32();
std::string name = fields[2].GetString();
sLog->outErrorDb("Transport %u '%s' have record (GUID: %u) in `gameobject`. Transports must not have any records in `gameobject` or its behavior will be unpredictable/bugged.", entry, name.c_str(), guid);
}
while (result->NextRow());
}
sLog->outString(">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
开发者ID:FirstCore,项目名称:PandaCore,代码行数:97,代码来源:Transport.cpp
示例14: getMSTime
void CreatureTextMgr::LoadCreatureTexts()
{
uint32 oldMSTime = getMSTime();
mTextMap.clear(); // for reload case
//all currently used temp texts are NOT reset
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, groupid, id, text, type, language, probability, emote, duration, sound, TextRange FROM creature_text");
if (!result)
{
sLog.outString(">> Loaded 0 ceature texts. DB table `creature_text` is empty.");
return;
}
uint32 textCount = 0;
do
{
Field* fields = result->Fetch();
CreatureTextEntry temp;
temp.entry = fields[0].GetUInt32();
temp.group = fields[1].GetUInt8();
temp.id = fields[2].GetUInt8();
temp.text = fields[3].GetString();
temp.type = ChatMsg(fields[4].GetUInt8());
temp.lang = Language(fields[5].GetUInt8());
temp.probability = fields[6].GetFloat();
temp.emote = Emote(fields[7].GetUInt32());
temp.duration = fields[8].GetUInt32();
temp.sound = fields[9].GetUInt32();
temp.TextRange = CreatureTextRange(fields[10].GetUInt8());
if (temp.sound)
{
if (!sSoundEntriesStore.LookupEntry(temp.sound))
{
sLog.outError("CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound);
temp.sound = 0;
}
}
if (!GetLanguageDescByID(temp.lang))
{
sLog.outError("CreatureTextMgr: Entry %u, Group %u in table `creature_text` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang));
temp.lang = LANG_UNIVERSAL;
}
if (temp.type >= MAX_CHAT_MSG_TYPE)
{
sLog.outError("CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type));
temp.type = CHAT_MSG_SAY;
}
if (temp.emote)
{
if (!sEmotesStore.LookupEntry(temp.emote))
{
sLog.outError("CreatureTextMgr: Entry %u, Group %u in table `creature_text` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote));
temp.emote = EMOTE_ONESHOT_NONE;
}
}
if (temp.TextRange > TEXT_RANGE_WORLD)
{
sLog.outError("CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has incorrect TextRange %u.", temp.entry, temp.group, temp.id, temp.TextRange);
temp.TextRange = TEXT_RANGE_NORMAL;
}
// add the text into our entry's group
mTextMap[temp.entry][temp.group].push_back(temp);
++textCount;
}
while (result->NextRow());
sLog.outString(">> Loaded %u creature texts for %lu creatures in %u ms", textCount, mTextMap.size(), GetMSTimeDiffToNow(oldMSTime));
}
开发者ID:Zaffy,项目名称:OregonCore,代码行数:80,代码来源:CreatureTextMgr.cpp
示例15: LoadDBCStores
//.........这里部分代码省略.........
{
// not spell path
if (spellPaths.find(dest_i->second.ID) == spellPaths.end())
{
ok = true;
break;
}
}
if (!ok)
continue;
}
// valid taxi network node
uint8 field = (uint8)((i - 1) / 32);
uint32 submask = 1<<((i-1)%32);
sTaxiNodesMask[field] |= submask;
if (node->MountCreatureID[0] && node->MountCreatureID[0] != 32981)
sHordeTaxiNodesMask[field] |= submask;
if (node->MountCreatureID[1] && node->MountCreatureID[1] != 32981)
sAllianceTaxiNodesMask[field] |= submask;
if (node->MountCreatureID[0] == 32981 || node->MountCreatureID[1] == 32981)
sDeathKnightTaxiNodesMask[field] |= submask;
// old continent node (+ nodes virtually at old continents, check explicitly to avoid loading map files for zone info)
if (node->map_id < 2 || i == 82 || i == 83 || i == 93 || i == 94)
sOldContinentsNodesMask[field] |= submask;
// fix DK node at Ebon Hold and Shadow Vault flight master
if (i == 315 || i == 333)
((TaxiNodesEntry*)node)->MountCreatureID[1] = 32981;
}
}
LoadDBC(availableDbcLocales, bad_dbc_files, sTeamContributionPointsStore, dbcPath, "TeamContributionPoints.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sTotemCategoryStore, dbcPath, "TotemCategory.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sTransportAnimationStore, dbcPath, "TransportAnimation.dbc");
for (uint32 i = 0; i < sTransportAnimationStore.GetNumRows(); ++i)
{
TransportAnimationEntry const* anim = sTransportAnimationStore.LookupEntry(i);
if (!anim)
continue;
sTransportMgr->AddPathNodeToTransport(anim->TransportEntry, anim->TimeSeg, anim);
}
LoadDBC(availableDbcLocales, bad_dbc_files, sTransportRotationStore, dbcPath, "TransportRotation.dbc");
for (uint32 i = 0; i < sTransportRotationStore.GetNumRows(); ++i)
{
TransportRotationEntry const* rot = sTranspor
|
请发表评论