All pastes #494525 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-05-18 09:12 UTC
rendered paste body
Index: src/game/BattleGroundMgr.cpp
===================================================================
--- src/game/BattleGroundMgr.cpp	(revision 3653)
+++ src/game/BattleGroundMgr.cpp	(working copy)
@@ -279,7 +279,7 @@
     HStartLoc[3] = 2.27452f;    // todo: find correct coords
 
     sLog.outDetail("Creating battleground %s, %u-%u", bl->name, bl->minlvl, bl->maxlvl);
-    CreateBattleGround(bg_ID, bl->maxplayersperteam, bl->minlvl, bl->maxlvl, bl->name, bl->mapid1, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]);
+    CreateBattleGround(bg_ID, bl->maxplayersperteam, bl->minlvl, bl->maxlvl, bl->name[sWorld.GetDBClang()], bl->mapid1, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]);
 
     // Create BG, WSG
     bg_ID = 2;
@@ -295,7 +295,7 @@
     HStartLoc[3] = 3.141593f;
 
     sLog.outDetail("Creating battleground %s, %u-%u", bl->name, bl->minlvl, bl->maxlvl);
-    CreateBattleGround(bg_ID, bl->maxplayersperteam, bl->minlvl, bl->maxlvl, bl->name, bl->mapid1, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]);
+    CreateBattleGround(bg_ID, bl->maxplayersperteam, bl->minlvl, bl->maxlvl, bl->name[sWorld.GetDBClang()], bl->mapid1, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]);
 
     // Create BG, AB
     bg_ID = 3;
@@ -311,7 +311,7 @@
     HStartLoc[3] = 0.263892f;   // todo: find correct coords
 
     sLog.outDetail("Creating battleground %s, %u-%u", bl->name, bl->minlvl, bl->maxlvl);
-    CreateBattleGround(bg_ID, bl->maxplayersperteam, bl->minlvl, bl->maxlvl, bl->name, bl->mapid1, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]);
+    CreateBattleGround(bg_ID, bl->maxplayersperteam, bl->minlvl, bl->maxlvl, bl->name[sWorld.GetDBClang()], bl->mapid1, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]);
 
     // Create BG, EotS
     bg_ID = 7;
@@ -327,7 +327,7 @@
     HStartLoc[3] = 0.263892f;   // todo: find coords
 
     sLog.outDetail("Creating battleground %s, %u-%u", bl->name, bl->minlvl, bl->maxlvl);
-    CreateBattleGround(bg_ID, bl->maxplayersperteam, bl->minlvl, bl->maxlvl, bl->name, bl->mapid1, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]);
+    CreateBattleGround(bg_ID, bl->maxplayersperteam, bl->minlvl, bl->maxlvl, bl->name[sWorld.GetDBClang()], bl->mapid1, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]);
 
     sLog.outDetail("Created initial battlegrounds.");
 }
Index: src/game/Level2.cpp
===================================================================
--- src/game/Level2.cpp	(revision 3653)
+++ src/game/Level2.cpp	(working copy)
@@ -1118,7 +1118,7 @@
         {
             FactionEntry const *factionEntry = sFactionStore.LookupEntry(itr->ID);
             if (factionEntry)
-                FactionName = factionEntry->name;
+                FactionName = factionEntry->name[sWorld.GetDBClang()];
             else
                 FactionName = "#Not found#";
             ReputationRank Rank = target->GetReputationRank(factionEntry);
Index: src/game/Level3.cpp
===================================================================
--- src/game/Level3.cpp	(revision 3653)
+++ src/game/Level3.cpp	(working copy)
@@ -1659,7 +1659,7 @@
         ItemSetEntry const *set = sItemSetStore.LookupEntry(id);
         if(set)
         {
-            std::string name = set->name;
+            std::string name = set->name[sWorld.GetDBClang()];
 
             // converting name to lower case
             std::transform( name.begin(), name.end(), name.begin(), ::tolower );
@@ -1670,7 +1670,7 @@
             if (name.find(namepart) != std::string::npos)
             {
                 // send item set in "id - name" format
-                PSendSysMessage("%d - %s",id,set->name);
+                PSendSysMessage("%d - %s",id,set->name[sWorld.GetDBClang()]);
                 counter++;
             }
         }
@@ -1695,7 +1695,7 @@
         if(skillInfo)
         {
             // name - is first name field from dbc (English localized)
-            std::string name = skillInfo->name[0];
+            std::string name = skillInfo->name[sWorld.GetDBClang()];
 
             // converting SkillName to lower case
             std::transform( name.begin(), name.end(), name.begin(), ::tolower );
@@ -1706,7 +1706,7 @@
             {
                 uint16 skill = m_session->GetPlayer()->GetPureSkillValue(id);
                 // send skill in "id - name" format
-                PSendSysMessage("%d - %s%s",id,skillInfo->name[0],(skill == 0 ? "" : " [known]"));
+                PSendSysMessage("%d - %s%s",id,skillInfo->name[sWorld.GetDBClang()],(skill == 0 ? "" : " [known]"));
 
                 counter++;
             }
@@ -1731,7 +1731,7 @@
         if(spellInfo)
         {
             // name - is first name field from dbc (English localized)
-            std::string name = spellInfo->SpellName[0];
+            std::string name = spellInfo->SpellName[sWorld.GetDBClang()];
 
             // converting SpellName to lower case
             std::transform( name.begin(), name.end(), name.begin(), ::tolower );
@@ -1741,7 +1741,7 @@
 
             if (name.find(namepart) != std::string::npos)
             {
-                std::string rank = spellInfo->Rank[0];
+                std::string rank = spellInfo->Rank[sWorld.GetDBClang()];
 
                 bool known = m_session->GetPlayer()->HasSpell(id);
 
@@ -1749,13 +1749,13 @@
                 if (!rank.empty())
                 {
                     // send spell in "id - name - rank" format
-                    PSendSysMessage("%d - %s - %s%s",id,spellInfo->SpellName[0],rank.c_str(),(known ? " [known]" : ""));
+                    PSendSysMessage("%d - %s - %s%s",id,spellInfo->SpellName[sWorld.GetDBClang()],rank.c_str(),(known ? " [known]" : ""));
                     counter++;
                 }
                 else
                 {
                     // send spell in "id - name" format
-                    PSendSysMessage("%d - %s%s",id,spellInfo->SpellName[0],(known ? " [known]" : ""));
+                    PSendSysMessage("%d - %s%s",id,spellInfo->SpellName[sWorld.GetDBClang()],(known ? " [known]" : ""));
                     counter++;
                 }
             }
Index: src/game/World.h
===================================================================
--- src/game/World.h	(revision 3653)
+++ src/game/World.h	(working copy)
@@ -184,6 +184,8 @@
         /// Get the current Message of the Day
         const char* GetMotd() const { return m_motd.c_str(); }
 
+        uint32 GetDBClang() const { return m_langid; }
+        void SetDBClang(uint32 lang) { m_langid = lang; }
         /// Get the path where data (dbc, maps) are stored on disk
         std::string GetDataPath() const { return m_dataPath; }
 
@@ -266,6 +268,7 @@
         multimap<uint64, ScriptAction> scriptSchedule;
 
         float rate_values[MAX_RATES];
+        uint32 m_langid;
         uint32 m_configs[CONFIG_VALUE_COUNT];
         uint32 m_playerLimit;
         bool m_allowMovement;
Index: src/shared/Database/DBCfmt.cpp
===================================================================
--- src/shared/Database/DBCfmt.cpp	(revision 3653)
+++ src/shared/Database/DBCfmt.cpp	(working copy)
@@ -18,19 +18,19 @@
 
 const char AreaTableEntryfmt[]="iiinixxxxxixxxxxxxxxixxxxxx";
 const char BankBagSlotPricesEntryfmt[]="ni";
-const char BattlemasterListEntryfmt[]="niixxxxxxiiiixxsxxxxxxxx";
-const char ChatChannelsEntryfmt[]="iixsxxxxxxxxsxxxxxxxx";  // data not sorted (more compact store)
-const char ChrClassesEntryfmt[]="nxxixsxxxxxxxxxxxx";
-const char ChrRacesEntryfmt[]="nxixiixxixxxxisxxxxxxxxxxxx";
-const char CreatureFamilyfmt[]="nxxxxxiisxxxxxxxxx";
+const char BattlemasterListEntryfmt[]="niixxxxxxiiiixxssssssssx";
+const char ChatChannelsEntryfmt[]="iixssssssssxssssssssx";  // data not sorted (more compact store)
+const char ChrClassesEntryfmt[]="nxxixssssssssxxxxx";
+const char ChrRacesEntryfmt[]="nxixiixxixxxxissssssssxxxxx";
+const char CreatureFamilyfmt[]="nxxxxxiissssssssxx";
 const char EmoteEntryfmt[]="nxixxxxxxxxxxxxxxxx";
-const char FactionEntryfmt[]="niiiiixxxxiiiixxxxisxxxxxxxxxxxxxxxxx";
+const char FactionEntryfmt[]="niiiiixxxxiiiixxxxissssssssxxxxxxxxxx";
 const char FactionTemplateEntryfmt[]="nixiiiiixxiiii";
 const char GemPropertiesEntryfmt[]="nixxi";
 const char ItemDisplayTemplateEntryfmt[]="nxxxxxxxxxxixxxxxxxxxxx";
 const char ItemExtendedCostEntryfmt[]="niiiiixxiiixx";
 const char ItemRandomPropertiesfmt[]="nxiiixxxxxxxxxxx";
-const char ItemSetEntryfmt[]="dsxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii";
+const char ItemSetEntryfmt[]="dssssssssxxxxxxxxxxxxxxxxxxiiiiiiiiiiiiiiiiii";
 const char LockEntryfmt[]="nxxxxxxxxixxxxxxxiixxxxxxxxxxxxxx";
 const char MapEntryfmt[]="nsixxxxxxxxxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
 const char SkillLinefmt[]="nixssssssssxssssssssxi";
@@ -38,15 +38,15 @@
 const char SpellCastTimefmt[]="nixx";
 const char SpellDurationfmt[]="niii";
 const char SpellEntryfmt[]="niixiiiiiiixixiiixixxiiiiiiiiiiiiiiiiiiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffiiixxxiiiiiiiiiiiiiiifffiiiiiiiiiiiifffixiiissssssssissssssssixxxxxxxxxxxxxxxxxxiiiiiiixixxfffxxxiii";
-const char SpellFocusObjectfmt[]="nsxxxxxxxx";
-const char SpellItemEnchantmentfmt[]="niiiiiixxxiiisxxxxxxxxiiii";
+const char SpellFocusObjectfmt[]="nssssssssx";
+const char SpellItemEnchantmentfmt[]="niiiiiixxxiiissssssssxiiii";
 const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";
 const char SpellRadiusfmt[]="nfxf";
 const char SpellRangefmt[]="nffxxxxxxxxxxxxxxxxxxx";
 const char StableSlotPricesfmt[] = "ni";
 const char TalentEntryfmt[]="niiiiiiiixxxxixxixxxx";
 const char TalentTabEntryfmt[]="nxxxxxxxxxxxixx";
-const char TaxiNodesEntryfmt[]="nifffsxxxxxxxxii";
+const char TaxiNodesEntryfmt[]="nifffssssssssxii";
 const char TaxiPathEntryfmt[]="niii";
 const char TaxiPathNodeEntryfmt[]="diiifffii";
 const char WorldSafeLocsEntryfmt[]="nifffxxxxxxxxx";
Index: src/shared/Database/DBCStores.cpp
===================================================================
--- src/shared/Database/DBCStores.cpp	(revision 3653)
+++ src/shared/Database/DBCStores.cpp	(working copy)
@@ -21,6 +21,7 @@
 #include "Policies/SingletonImp.h"
 #include "Log.h"
 #include "ProgressBar.h"
+#include "../../game/World.h"
 
 #include "DBCfmt.cpp"
 
@@ -282,6 +283,17 @@
         exit(1);
     }
 
+    ChrRacesEntry const* race = sChrRacesStore.LookupEntry(1);
+    for (int i = 0; i < 8; i++)
+    {
+        if ( strlen(race->name[i]) > 0)
+        {
+            sWorld.SetDBClang(i);
+            sLog.outString("Detected DBC Locale: %d", i);
+            break;
+        }
+    }
+
     sLog.outString( "" );
     sLog.outString( ">> Loaded %d data stores", DBCFilesCount );
     sLog.outString( "" );
@@ -346,7 +358,7 @@
     CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(petfamily);
     if(!pet_family)
         return NULL;
-    return pet_family->Name?pet_family->Name:NULL;
+    return pet_family->Name[sWorld.GetDBClang()]?pet_family->Name[sWorld.GetDBClang()]:NULL;
 }
 
 bool IsPassiveSpell(uint32 spellId)
@@ -645,14 +657,14 @@
         {
             if((ch->flags & 4) == 4)                          // global channel without zone name in pattern
             {
-                if(strcmp(name,ch->pattern)==0)
+                if(strcmp(name,ch->pattern[sWorld.GetDBClang()])==0)
                     return ch;
             }
             else
             {
                 // compare pattern (something - %s)
                 char zone_name_buf[50];
-                if(sscanf(name,ch->pattern,zone_name_buf)>0)
+                if(sscanf(name,ch->pattern[sWorld.GetDBClang()],zone_name_buf)>0)
                     return ch;
             }
         }
Index: src/shared/Database/DBCStructure.h
===================================================================
--- src/shared/Database/DBCStructure.h	(revision 3653)
+++ src/shared/Database/DBCStructure.h	(working copy)
@@ -58,22 +58,22 @@
     uint32      minlvl;
     uint32      maxlvl;
     uint32      maxplayersperteam;
-    char*       name;
+    char*       name[8];
 };
 
 struct ChatChannelsEntry
 {
     uint32      ChannelID;
     uint32      flags;
-    char*       pattern;
-    char*       name;
+    char*       pattern[8];
+    char*       name[8];
 };
 
 struct ChrClassesEntry
 {
     uint32      ClassID;
     uint32      powerType;
-    char*       name;
+    char*       name[8];
 };
 
 struct ChrRacesEntry
@@ -85,7 +85,7 @@
     uint32      TeamID;                                     // 7-Alliance 1-Horde
     //uint32      startingTaxiMask;                         // removed in 2.0.1
     uint32      startmovie;
-    char*       name;
+    char*       name[8];
 };
 
 struct CreatureFamilyEntry
@@ -93,7 +93,7 @@
     uint32    ID;
     uint32    tamable;                                      //if this = 270 then "is tamable Creature" (or 0 is non-tamable)
     uint32    petFoodMask;
-    char*     Name;
+    char*     Name[8];
 };
 
 struct EmotesTextEntry
@@ -109,7 +109,7 @@
     uint32      BaseRepMask[4];                             // Base reputation masks (see enum Races)
     int32       BaseRepValue[4];                            // Base reputation values
     uint32      team;
-    char*       name;
+    char*       name[8];
 };
 
 enum FactionMasks
@@ -194,7 +194,7 @@
 
 struct ItemSetEntry
 {
-    char*     name;
+    char*     name[8];
     uint32    spells[8];
     uint32    items_to_triggerspell[8];
     uint32    required_skill_id;
@@ -347,7 +347,7 @@
 struct SpellFocusObjectEntry
 {
     uint32    ID;
-    char*     Name;
+    char*     Name[8];
 };
 
 // stored in SQL table
@@ -443,7 +443,7 @@
     float     x;
     float     y;
     float     z;
-    char*     name;
+    char*     name[8];
     uint32    horde_mount_type;
     uint32    alliance_mount_type;
 };