Initial Commit for client version change to 4.2.2 (14545)

- added known opcodes (handlers are commented till not updated)
- added bitstream support to bytebuffer
- updated realm auth for 14545
- updated world auth
- fixed char_enum,create,delete handlers
- added DB2 reader
- added opcode logging to debuglogmask (ignores loglevel)
- fixed compile in win64, others not yet tested
- using db2 values for item models at char_enum to prevent client crash

Lots of Thanks to All SingularityCore Members
This commit is contained in:
Rat
2011-11-20 18:28:18 +01:00
parent 10b89d976f
commit d1affc4340
43 changed files with 4130 additions and 3045 deletions
+118
View File
@@ -0,0 +1,118 @@
/*
* Copyright (C) 2011 TrintiyCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "DB2Stores.h"
#include "Logging/Log.h"
#include "SharedDefines.h"
#include "SpellMgr.h"
#include "DB2fmt.h"
#include <map>
DB2Storage <ItemEntry> sItemStore(Itemfmt);
DB2Storage <ItemSparseEntry> sItemSparseStore (ItemSparsefmt);
DB2Storage <ItemExtendedCostEntry> sItemExtendedCostStore(ItemExtendedCostEntryfmt);
typedef std::list<std::string> StoreProblemList1;
uint32 DB2FilesCount = 0;
static bool LoadDB2_assert_print(uint32 fsize,uint32 rsize, const std::string& filename)
{
sLog->outError("Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize);
// ASSERT must fail after function call
return false;
}
struct LocalDB2Data
{
LocalDB2Data(LocaleConstant loc) : defaultLocale(loc), availableDb2Locales(0xFFFFFFFF) {}
LocaleConstant defaultLocale;
// bitmasks for index of fullLocaleNameList
uint32 availableDb2Locales;
};
template<class T>
inline void LoadDB2(uint32& availableDb2Locales, StoreProblemList1& errlist, DB2Storage<T>& storage, const std::string& db2_path, const std::string& filename)
{
// compatibility format and C++ structure sizes
ASSERT(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDB2_assert_print(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename));
++DB2FilesCount;
std::string db2_filename = db2_path + filename;
if (storage.Load(db2_filename.c_str()))
{
}
else
{
// sort problematic db2 to (1) non compatible and (2) nonexistent
FILE * f = fopen(db2_filename.c_str(), "rb");
if (f)
{
char buf[100];
snprintf(buf, 100,"(exist, but have %d fields instead " SIZEFMTD ") Wrong client version DBC file?", storage.GetFieldCount(), strlen(storage.GetFormat()));
errlist.push_back(db2_filename + buf);
fclose(f);
}
else
errlist.push_back(db2_filename);
}
}
void LoadDB2Stores(const std::string& dataPath)
{
std::string db2Path = dataPath + "dbc/";
StoreProblemList1 bad_db2_files;
uint32 availableDb2Locales = 0xFFFFFFFF;
LoadDB2(availableDb2Locales, bad_db2_files, sItemStore, db2Path, "Item.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemSparseStore, db2Path, "Item-sparse.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemExtendedCostStore, db2Path, "ItemExtendedCost.db2");
// error checks
if (bad_db2_files.size() >= DB2FilesCount)
{
sLog->outError("\nIncorrect DataDir value in worldserver.conf or ALL required *.db2 files (%d) not found by path: %sdb2", DB2FilesCount, dataPath.c_str());
exit(1);
}
else if (!bad_db2_files.empty())
{
std::string str;
for (std::list<std::string>::iterator i = bad_db2_files.begin(); i != bad_db2_files.end(); ++i)
str += *i + "\n";
sLog->outError("\nSome required *.db2 files (%u from %d) not found or not compatible:\n%s", (uint32)bad_db2_files.size(), DB2FilesCount,str.c_str());
exit(1);
}
// Check loaded DB2 files proper version
if (!sItemStore.LookupEntry(72068) || // last item added in 4.2.2 (14545)
!sItemExtendedCostStore.LookupEntry(3652) ) // last item extended cost added in 4.2.2 (14545)
{
sLog->outString("");
sLog->outError("Please extract correct db2 files from client 4.2.2 14545.");
exit(1);
}
sLog->outString(">> Initialized %d DB2 data stores.", DB2FilesCount);
sLog->outString();
}
+33
View File
@@ -0,0 +1,33 @@
/*
* Copyright (C) 2011 TrintiyCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_DB2STORES_H
#define TRINITY_DB2STORES_H
#include "Common.h"
#include "DB2Store.h"
#include "DB2Structure.h"
#include <list>
extern DB2Storage <ItemEntry> sItemStore;
extern DB2Storage <ItemSparseEntry> sItemSparseStore;
extern DB2Storage <ItemExtendedCostEntry> sItemExtendedCostStore;
void LoadDB2Stores(const std::string& dataPath);
#endif
+135
View File
@@ -0,0 +1,135 @@
/*
* Copyright (C) 2011 TrintiyCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_DB2STRUCTURE_H
#define TRINITY_DB2STRUCTURE_H
#include "Common.h"
#include "DBCEnums.h"
#include "Define.h"
#include "Path.h"
#include "Util.h"
#include "Vehicle.h"
#include "SharedDefines.h"
#include <map>
#include <set>
#include <vector>
// Structures used to access raw DB2 data and required packing to portability
struct ItemEntry
{
uint32 ID; // 0
uint32 Class; // 1
uint32 SubClass; // 2
int32 Unk0; // 3
int32 Material; // 4
uint32 DisplayId; // 5
uint32 InventoryType; // 6
uint32 Sheath; // 7
};
struct ItemSparseEntry
{
uint32 ID; // 0
uint32 Quality; // 1
uint32 Flags; // 2
uint32 Flags2; // 3
uint32 BuyPrice; // 4
uint32 SellPrice; // 5
uint32 InventoryType; // 6
int32 AllowableClass; // 7
int32 AllowableRace; // 8
uint32 ItemLevel; // 9
int32 RequiredLevel; // 10
uint32 RequiredSkill; // 11
uint32 RequiredSkillRank; // 12
uint32 RequiredSpell; // 13
uint32 RequiredHonorRank; // 14
uint32 RequiredCityRank; // 15
uint32 RequiredReputationFaction; // 16
uint32 RequiredReputationRank; // 17
uint32 MaxCount; // 18
uint32 Stackable; // 19
uint32 ContainerSlots; // 20
int32 ItemStatType[MAX_ITEM_PROTO_STATS]; // 21 - 30
uint32 ItemStatValue[MAX_ITEM_PROTO_STATS]; // 31 - 40
int32 ItemStatUnk1[MAX_ITEM_PROTO_STATS]; // 41 - 50
int32 ItemStatUnk2[MAX_ITEM_PROTO_STATS]; // 51 - 60
uint32 ScalingStatDistribution; // 61
uint32 DamageType; // 62
uint32 Delay; // 63
float RangedModRange; // 64
int32 SpellId[MAX_ITEM_PROTO_SPELLS]; // 65 - 69
int32 SpellTrigger[MAX_ITEM_PROTO_SPELLS]; // 70 - 74
int32 SpellCharges[MAX_ITEM_PROTO_SPELLS]; // 75 - 79
int32 SpellCooldown[MAX_ITEM_PROTO_SPELLS]; // 80 - 84
int32 SpellCategory[MAX_ITEM_PROTO_SPELLS]; // 85 - 89
int32 SpellCategoryCooldown[MAX_ITEM_PROTO_SPELLS]; // 90 - 94
uint32 Bonding; // 95
DB2String Name; // 96
DB2String Name2; // 97
DB2String Name3; // 98
DB2String Name4; // 99
DB2String Description; // 100
uint32 PageText; // 101
uint32 LanguageID; // 102
uint32 PageMaterial; // 103
uint32 StartQuest; // 104
uint32 LockID; // 105
int32 Material; // 106
uint32 Sheath; // 107
uint32 RandomProperty; // 108
uint32 RandomSuffix; // 109
uint32 ItemSet; // 110
uint32 MaxDurability; // 111
uint32 Area; // 112
uint32 Map; // 113
uint32 BagFamily; // 114
uint32 TotemCategory; // 115
uint32 Color[MAX_ITEM_PROTO_SOCKETS]; // 116 - 118
uint32 Content[MAX_ITEM_PROTO_SOCKETS]; // 119 - 121
int32 SocketBonus; // 122
uint32 GemProperties; // 123
float ArmorDamageModifier; // 124
uint32 Duration; // 125
uint32 ItemLimitCategory; // 126
uint32 HolidayId; // 127
float StatScalingFactor; // 128
int32 Field130; // 129
int32 Field131; // 130
};
#define MAX_ITEM_EXT_COST_ITEMS 5
#define MAX_ITEM_EXT_COST_CURRENCIES 5
struct ItemExtendedCostEntry
{
uint32 ID; // 0 extended-cost entry id
//uint32 reqhonorpoints; // 1 required honor points
//uint32 reqarenapoints; // 2 required arena points
uint32 RequiredArenaSlot; // 3 arena slot restrictions (min slot value)
uint32 RequiredItem[MAX_ITEM_EXT_COST_ITEMS]; // 4-8 required item id
uint32 RequiredItemCount[MAX_ITEM_EXT_COST_ITEMS]; // 9-13 required count of 1st item
uint32 RequiredPersonalArenaRating; // 14 required personal arena rating
//uint32 ItemPurchaseGroup; // 15
uint32 RequiredCurrency[MAX_ITEM_EXT_COST_CURRENCIES];// 16-20 required curency id
uint32 RequiredCurrencyCount[MAX_ITEM_EXT_COST_CURRENCIES];// 21-25 required curency count
//uint32 Unknown[5]; // 26-30
};
#endif
+25
View File
@@ -0,0 +1,25 @@
/*
* Copyright (C) 2011 TrintiyCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_DB2SFRM_H
#define TRINITY_DB2SFRM_H
const char Itemfmt[]="niiiiiii";
const char ItemSparsefmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisssssiiiiiiiiiiiiiiiiiiiiiiifiiifii";
const char ItemExtendedCostEntryfmt[]="nxxiiiiiiiiiiiixiiiiiiiiiixxxxx";
#endif
+9
View File
@@ -439,4 +439,13 @@ enum VehicleSeatFlagsB
VEHICLE_SEAT_FLAG_B_VEHICLE_PLAYERFRAME_UI = 0x80000000, // Lua_UnitHasVehiclePlayerFrameUI - actually checked for flagsb &~ 0x80000000
};
// CreatureType.dbc
enum CurrencyTypes
{
CURRENCY_TYPE_CONQUEST_POINTS = 390,
CURRENCY_TYPE_HONOR_POINTS = 392,
CURRENCY_TYPE_JUSTICE_POINTS = 395,
CURRENCY_TYPE_VALOR_POINTS = 396
};
#endif
+8 -8
View File
@@ -107,11 +107,11 @@ DBCStorage <GtRegenMPPerSptEntry> sGtRegenMPPerSptStore(GtRegenMPPerSptf
DBCStorage <HolidaysEntry> sHolidaysStore(Holidaysfmt);
DBCStorage <ItemEntry> sItemStore(Itemfmt);
//DBCStorage <ItemEntry> sItemStore(Itemfmt);
DBCStorage <ItemBagFamilyEntry> sItemBagFamilyStore(ItemBagFamilyfmt);
//DBCStorage <ItemCondExtCostsEntry> sItemCondExtCostsStore(ItemCondExtCostsEntryfmt);
//DBCStorage <ItemDisplayInfoEntry> sItemDisplayInfoStore(ItemDisplayTemplateEntryfmt); -- not used currently
DBCStorage <ItemExtendedCostEntry> sItemExtendedCostStore(ItemExtendedCostEntryfmt);
//DBCStorage <ItemExtendedCostEntry> sItemExtendedCostStore(ItemExtendedCostEntryfmt);
DBCStorage <ItemLimitCategoryEntry> sItemLimitCategoryStore(ItemLimitCategoryEntryfmt);
DBCStorage <ItemRandomPropertiesEntry> sItemRandomPropertiesStore(ItemRandomPropertiesfmt);
DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore(ItemRandomSuffixfmt);
@@ -344,11 +344,11 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales, bad_dbc_files, sHolidaysStore, dbcPath, "Holidays.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sItemStore, dbcPath, "Item.dbc");
// LoadDBC(availableDbcLocales, bad_dbc_files, sItemStore, dbcPath, "Item.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sItemBagFamilyStore, dbcPath, "ItemBagFamily.dbc");
//LoadDBC(dbcCount, availableDbcLocales, bad_dbc_files, sItemDisplayInfoStore, dbcPath, "ItemDisplayInfo.dbc"); -- not used currently
//LoadDBC(dbcCount, availableDbcLocales, bad_dbc_files, sItemCondExtCostsStore, dbcPath, "ItemCondExtCosts.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sItemExtendedCostStore, dbcPath, "ItemExtendedCost.dbc");
// LoadDBC(availableDbcLocales, bad_dbc_files, sItemExtendedCostStore, dbcPath, "ItemExtendedCost.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sItemLimitCategoryStore, dbcPath, "ItemLimitCategory.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sItemRandomPropertiesStore, dbcPath, "ItemRandomProperties.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sItemRandomSuffixStore, dbcPath, "ItemRandomSuffix.dbc");
@@ -623,8 +623,8 @@ void LoadDBCStores(const std::string& dataPath)
if (!sAreaStore.LookupEntry(3617) || // last area (areaflag) added in 3.3.5a
!sCharTitlesStore.LookupEntry(177) || // last char title added in 3.3.5a
!sGemPropertiesStore.LookupEntry(1629) || // last added spell in 3.3.5a
!sItemStore.LookupEntry(56806) || // last gem property added in 3.3.5a
!sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a
//!sItemStore.LookupEntry(56806) || // last gem property added in 3.3.5a
//!sItemExtendedCostStore.LookupEntry(2997) || // last item extended cost added in 3.3.5a
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
!sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
{
@@ -632,7 +632,7 @@ void LoadDBCStores(const std::string& dataPath)
exit(1);
}
sLog->outString(">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
sLog->outString(">> Initialized %d DBC data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
@@ -866,7 +866,7 @@ uint32 const* GetTalentTabPages(uint8 cls)
DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore() { return &sSoundEntriesStore; }
DBCStorage <SpellRangeEntry> const* GetSpellRangeStore() { return &sSpellRangeStore; }
DBCStorage <FactionEntry> const* GetFactionStore() { return &sFactionStore; }
DBCStorage <ItemEntry> const* GetItemDisplayStore() { return &sItemStore; }
// DBCStorage <ItemEntry> const* GetItemDisplayStore() { return &sItemStore; }
DBCStorage <CreatureDisplayInfoEntry> const* GetCreatureDisplayStore() { return &sCreatureDisplayInfoStore; }
DBCStorage <EmotesEntry> const* GetEmotesStore() { return &sEmotesStore; }
DBCStorage <EmotesTextEntry> const* GetEmotesTextStore() { return &sEmotesTextStore; }
+3 -3
View File
@@ -109,10 +109,10 @@ extern DBCStorage <GtOCTRegenHPEntry> sGtOCTRegenHPStore;
extern DBCStorage <GtRegenHPPerSptEntry> sGtRegenHPPerSptStore;
extern DBCStorage <GtRegenMPPerSptEntry> sGtRegenMPPerSptStore;
extern DBCStorage <HolidaysEntry> sHolidaysStore;
extern DBCStorage <ItemEntry> sItemStore;
//extern DBCStorage <ItemEntry> sItemStore;
extern DBCStorage <ItemBagFamilyEntry> sItemBagFamilyStore;
//extern DBCStorage <ItemDisplayInfoEntry> sItemDisplayInfoStore; -- not used currently
extern DBCStorage <ItemExtendedCostEntry> sItemExtendedCostStore;
//extern DBCStorage <ItemExtendedCostEntry> sItemExtendedCostStore;
extern DBCStorage <ItemLimitCategoryEntry> sItemLimitCategoryStore;
extern DBCStorage <ItemRandomPropertiesEntry> sItemRandomPropertiesStore;
extern DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore;
@@ -176,7 +176,7 @@ void LoadDBCStores(const std::string& dataPath);
DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore();
DBCStorage <SpellRangeEntry> const* GetSpellRangeStore();
DBCStorage <FactionEntry> const* GetFactionStore();
DBCStorage <ItemEntry> const* GetItemDisplayStore();
// DBCStorage <ItemEntry> const* GetItemDisplayStore();
DBCStorage <CreatureDisplayInfoEntry> const* GetCreatureDisplayStore();
DBCStorage <EmotesEntry> const* GetEmotesStore();
DBCStorage <EmotesTextEntry> const* GetEmotesTextStore();
+15 -8
View File
@@ -783,10 +783,17 @@ struct CurrencyCategoryEntry
struct CurrencyTypesEntry
{
//uint32 ID; // 0 not used
uint32 ItemId; // 1 used as real index
//uint32 Category; // 2 may be category
uint32 BitIndex; // 3 bit index in PLAYER_FIELD_KNOWN_CURRENCIES (1 << (index-1))
uint32 ID; // 0 not used
//uint32 Category; // 1 may be category
//DBCString name; // 2
//DBCString iconName; // 3
//uint32 unk4; // 4 all 0
//uint32 unk5; // 5 archaeology-related (?)
//uint32 unk6; // 6 archaeology-related (?)
uint32 TotalCap; // 7
uint32 WeekCap; // 8
//int32 unk9; // 9
//DBCString description; // 10
};
struct DestructibleModelDataEntry
@@ -1060,7 +1067,7 @@ struct HolidaysEntry
//uint32 flags; // 54 m_flags (0 = Darkmoon Faire, Fishing Contest and Wotlk Launch, rest is 1)
};
struct ItemEntry
/*struct ItemEntry
{
uint32 ID; // 0
uint32 Class; // 1
@@ -1070,7 +1077,7 @@ struct ItemEntry
uint32 DisplayId; // 5
uint32 InventoryType; // 6
uint32 Sheath; // 7
};
};*/
struct ItemBagFamilyEntry
{
@@ -1105,7 +1112,7 @@ struct ItemDisplayInfoEntry
#define MAX_ITEM_EXTENDED_COST_REQUIREMENTS 5
struct ItemExtendedCostEntry
/*struct ItemExtendedCostEntry
{
uint32 ID; // 0 extended-cost entry id
uint32 reqhonorpoints; // 1 required honor points
@@ -1114,7 +1121,7 @@ struct ItemExtendedCostEntry
uint32 reqitem[MAX_ITEM_EXTENDED_COST_REQUIREMENTS]; // 4-8 required item id
uint32 reqitemcount[MAX_ITEM_EXTENDED_COST_REQUIREMENTS]; // 9-14 required count of 1st item
uint32 reqpersonalarenarating; // 15 required personal arena rating};
};
};*/
struct ItemLimitCategoryEntry
{
+1 -1
View File
@@ -42,7 +42,7 @@ const char CreatureDisplayInfofmt[]="nxxxfxxxxxxxxxxx";
const char CreatureFamilyfmt[]="nfifiiiiixssssssssssssssssxx";
const char CreatureSpellDatafmt[]="niiiixxxx";
const char CreatureTypefmt[]="nxxxxxxxxxxxxxxxxxx";
const char CurrencyTypesfmt[]="xnxi";
const char CurrencyTypesfmt[]="nxxxxxxiixx";//14545
const char DestructibleModelDatafmt[]="nxxixxxixxxixxxixxx";
const char DungeonEncounterfmt[]="niixissssssssssssssssxx";
const char DurabilityCostsfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiii";