Core/Commands: Add support for ip2nation database lookups when using .pinfo command.

This will (when a full database exists) allow for seeing (approximately) which country a player might be from when doing .pinfo <player>
Note: External data required for this patch to work correctly can be found at http://www.ip2nation.com/ip2nation/Download

Signed-off-by: click <[email protected]>
This commit is contained in:
Spp
2012-03-23 05:35:32 +01:00
committed by click
parent 479c0976ab
commit 0fe4580fe0
4 changed files with 58 additions and 0 deletions
+20
View File
@@ -1625,6 +1625,9 @@ void World::SetInitialWorldSettings()
sLog->outString("Loading Autobroadcasts...");
LoadAutobroadcasts();
sLog->outString("Loading Ip2nation...");
LoadIp2nation();
///- Load and initialize scripts
sObjectMgr->LoadQuestStartScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
sObjectMgr->LoadQuestEndScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
@@ -1881,6 +1884,23 @@ void World::LoadAutobroadcasts()
sLog->outString();
}
void World::LoadIp2nation()
{
uint32 oldMSTime = getMSTime();
QueryResult result = WorldDatabase.Query("SELECT count(c.code) FROM ip2nationCountries c, ip2nation i WHERE c.code = i.country");
uint32 count = 0;
if (result)
{
Field* fields = result->Fetch();
count = fields[0].GetUInt32();
}
sLog->outString(">> Loaded %u ip2nation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
/// Update the World !
void World::Update(uint32 diff)
{
+2
View File
@@ -740,6 +740,8 @@ class World
void LoadAutobroadcasts();
void LoadIp2nation();
void UpdateAreaDependentAuras();
void ProcessStartEvent();