Core/Datastore: updated db2 field names and types to reflect client magic names

*fixed string length for sending names in item_sparse length
This commit is contained in:
Ovahlord
2020-02-23 02:20:38 +01:00
parent 2c6beb7f99
commit 73ce49cb78
9 changed files with 102 additions and 44 deletions

View File

@@ -0,0 +1,58 @@
ALTER TABLE `item_sparse`
CHANGE `Unk1` `PriceRandomValue` FLOAT DEFAULT 0 NOT NULL,
CHANGE `Unk2` `PriceVariance` FLOAT DEFAULT 0 NOT NULL,
CHANGE `Name` `Display` TEXT CHARSET utf8 COLLATE utf8_general_ci NULL,
CHANGE `Name2` `Display1` TEXT CHARSET utf8 COLLATE utf8_general_ci NULL,
CHANGE `Name3` `Display2` TEXT CHARSET utf8 COLLATE utf8_general_ci NULL,
CHANGE `Name4` `Display3` TEXT CHARSET utf8 COLLATE utf8_general_ci NULL,
CHANGE `Sheath` `SheatheType` INT(10) UNSIGNED DEFAULT 0 NOT NULL,
CHANGE `Area` `AreaID` INT(10) UNSIGNED DEFAULT 0 NOT NULL,
CHANGE `Map` `MapID` INT(10) UNSIGNED DEFAULT 0 NOT NULL;
ALTER TABLE `item`
CHANGE `Class` `ClassID` INT(10) UNSIGNED DEFAULT 0 NOT NULL,
CHANGE `SubClass` `SubclassID` INT(10) UNSIGNED DEFAULT 0 NOT NULL,
CHANGE `SoundOverrideSubclass` `SoundOverrideSubclassID` INT(11) DEFAULT 0 NOT NULL,
CHANGE `Sheath` `SheatheType` INT(10) UNSIGNED DEFAULT 0 NOT NULL;
ALTER TABLE `item_sparse_locale`
CHANGE `Name_lang` `Display_lang` TEXT CHARSET utf8 COLLATE utf8_general_ci NULL,
CHANGE `Name2_lang` `Display1_lang` TEXT CHARSET utf8 COLLATE utf8_general_ci NULL,
CHANGE `Name3_lang` `Display2_lang` TEXT CHARSET utf8 COLLATE utf8_general_ci NULL,
CHANGE `Name4_lang` `Display3_lang` TEXT CHARSET utf8 COLLATE utf8_general_ci NULL;
ALTER TABLE `item_currency_cost`
CHANGE `ItemId` `ItemID` INT(10) UNSIGNED DEFAULT 0 NOT NULL;
ALTER TABLE `item_sparse`
CHANGE `RequiredSpell` `RequiredSpell` INT(11) DEFAULT 0 NOT NULL,
CHANGE `MaxCount` `MaxCount` INT(11) DEFAULT 0 NOT NULL,
CHANGE `Stackable` `Stackable` INT(11) DEFAULT 0 NOT NULL,
CHANGE `ItemStatSocketCostMultiplier1` `ItemStatSocketCostMultiplier1` INT(11) DEFAULT 0 NOT NULL,
CHANGE `ItemStatSocketCostMultiplier2` `ItemStatSocketCostMultiplier2` INT(11) DEFAULT 0 NOT NULL,
CHANGE `ItemStatSocketCostMultiplier3` `ItemStatSocketCostMultiplier3` INT(11) DEFAULT 0 NOT NULL,
CHANGE `ItemStatSocketCostMultiplier4` `ItemStatSocketCostMultiplier4` INT(11) DEFAULT 0 NOT NULL,
CHANGE `ItemStatSocketCostMultiplier5` `ItemStatSocketCostMultiplier5` INT(11) DEFAULT 0 NOT NULL,
CHANGE `ItemStatSocketCostMultiplier6` `ItemStatSocketCostMultiplier6` INT(11) DEFAULT 0 NOT NULL,
CHANGE `ItemStatSocketCostMultiplier7` `ItemStatSocketCostMultiplier7` INT(11) DEFAULT 0 NOT NULL,
CHANGE `ItemStatSocketCostMultiplier8` `ItemStatSocketCostMultiplier8` INT(11) DEFAULT 0 NOT NULL,
CHANGE `ItemStatSocketCostMultiplier9` `ItemStatSocketCostMultiplier9` INT(11) DEFAULT 0 NOT NULL,
CHANGE `ItemStatSocketCostMultiplier10` `ItemStatSocketCostMultiplier10` INT(11) DEFAULT 0 NOT NULL,
CHANGE `ScalingStatDistribution` `ScalingStatDistribution` INT(11) DEFAULT 0 NOT NULL,
CHANGE `DamageType` `DamageType` INT(11) DEFAULT 0 NOT NULL,
CHANGE `Bonding` `Bonding` INT(11) DEFAULT 0 NOT NULL,
CHANGE `LanguageID` `LanguageID` INT(11) DEFAULT 0 NOT NULL,
CHANGE `PageMaterial` `PageMaterial` INT(11) DEFAULT 0 NOT NULL,
CHANGE `StartQuest` `StartQuest` INT(11) DEFAULT 0 NOT NULL,
CHANGE `SheatheType` `SheatheType` INT(11) DEFAULT 0 NOT NULL,
CHANGE `RandomProperty` `RandomProperty` INT(11) DEFAULT 0 NOT NULL,
CHANGE `MapID` `MapID` INT(11) DEFAULT 0 NOT NULL,
CHANGE `BagFamily` `BagFamily` INT(11) DEFAULT 0 NOT NULL,
CHANGE `TotemCategory` `TotemCategory` INT(11) DEFAULT 0 NOT NULL,
CHANGE `SocketColor1` `SocketColor1` INT(11) DEFAULT 0 NOT NULL,
CHANGE `SocketColor2` `SocketColor2` INT(11) DEFAULT 0 NOT NULL,
CHANGE `SocketColor3` `SocketColor3` INT(11) DEFAULT 0 NOT NULL,
CHANGE `GemProperties` `GemProperties` INT(11) DEFAULT 0 NOT NULL,
CHANGE `Duration` `Duration` INT(11) DEFAULT 0 NOT NULL,
CHANGE `ItemLimitCategory` `ItemLimitCategory` INT(11) DEFAULT 0 NOT NULL,
CHANGE `HolidayID` `HolidayID` INT(11) DEFAULT 0 NOT NULL;

View File

@@ -31,11 +31,11 @@ void HotfixDatabaseConnection::DoPrepareStatements()
m_stmts.resize(MAX_HOTFIXDATABASE_STATEMENTS);
// KeyChain.db2
PrepareStatement(HOTFIX_SEL_KEY_CHAIN, "SELECT Id, Key1, Key2, Key3, Key4, Key5, Key6, Key7, Key8, Key9, Key10, Key11, Key12, Key13, Key14, Key15, Key16, "
PrepareStatement(HOTFIX_SEL_KEY_CHAIN, "SELECT ID, Key1, Key2, Key3, Key4, Key5, Key6, Key7, Key8, Key9, Key10, Key11, Key12, Key13, Key14, Key15, Key16, "
"Key17, Key18, Key19, Key20, Key21, Key22, Key23, Key24, Key25, Key26, Key27, Key28, Key29, Key30, Key31, Key32 FROM key_chain ORDER BY ID DESC", CONNECTION_SYNCH);
// Item.db2
PrepareStatement(HOTFIX_SEL_ITEM, "SELECT ID, Class, SubClass, SoundOverrideSubclass, Material, DisplayInfoID, InventoryType, Sheath FROM item ORDER BY ID DESC", CONNECTION_SYNCH);
PrepareStatement(HOTFIX_SEL_ITEM, "SELECT ID, ClassID, SubclassID, SoundOverrideSubclassID, Material, DisplayInfoID, InventoryType, SheatheType FROM item ORDER BY ID DESC", CONNECTION_SYNCH);
// ItemCurrencyCost.db2
PrepareStatement(HOTFIX_SEL_ITEM_CURRENCY_COST, "SELECT ID, ItemID FROM item_currency_cost ORDER BY ItemID DESC", CONNECTION_SYNCH);
@@ -50,7 +50,7 @@ void HotfixDatabaseConnection::DoPrepareStatements()
"RequiredFactionId, RequiredFactionStanding, RequirementFlags, RequiredAchievement FROM item_extended_cost ORDER BY ID DESC", CONNECTION_SYNCH);
// Item-sparse.db2
PrepareStatement(HOTFIX_SEL_ITEM_SPARSE, "SELECT ID, Quality, Flags1, Flags2, Unk1, Unk2, BuyCount, BuyPrice, SellPrice, InventoryType, "
PrepareStatement(HOTFIX_SEL_ITEM_SPARSE, "SELECT ID, Quality, Flags1, Flags2, PriceRandomValue, PriceVariance, BuyCount, BuyPrice, SellPrice, InventoryType, "
"AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, RequiredSpell, RequiredHonorRank, "
"RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, MaxCount, Stackable, ContainerSlots, "
"ItemStatType1, ItemStatType2, ItemStatType3, ItemStatType4, ItemStatType5, "
@@ -68,10 +68,10 @@ void HotfixDatabaseConnection::DoPrepareStatements()
"SpellCooldown1, SpellCooldown2, SpellCooldown3, SpellCooldown4, SpellCooldown5, "
"SpellCategory1, SpellCategory2, SpellCategory3, SpellCategory4, SpellCategory5, "
"SpellCategoryCooldown1, SpellCategoryCooldown2, SpellCategoryCooldown3, SpellCategoryCooldown4, SpellCategoryCooldown5, "
"Bonding, Name, Name2, Name3, Name4, Description, PageText, LanguageID, PageMaterial, StartQuest, LockID, Material, Sheath, RandomProperty, RandomSuffix, ItemSet, "
"Area, Map, BagFamily, TotemCategory, SocketColor1, SocketColor2, SocketColor3, Content1, Content2, Content3, SocketBonus, GemProperties, ArmorDamageModifier, "
"Bonding, Display, Display1, Display2, Display3, Description, PageText, LanguageID, PageMaterial, StartQuest, LockID, Material, SheatheType, RandomProperty, RandomSuffix, ItemSet, "
"AreaID, MapID, BagFamily, TotemCategory, SocketColor1, SocketColor2, SocketColor3, Content1, Content2, Content3, SocketBonus, GemProperties, ArmorDamageModifier, "
"Duration, ItemLimitCategory, HolidayID, StatScalingFactor, CurrencySubstitutionID, CurrencySubstitutionCount FROM item_sparse ORDER BY ID DESC", CONNECTION_SYNCH);
PREPARE_LOCALE_STMT(HOTFIX_SEL_ITEM_SPARSE, "SELECT ID, Name_lang, Name2_lang, Name3_lang, Name4_lang, Description_lang FROM item_sparse_locale WHERE locale = ?", CONNECTION_SYNCH);
PREPARE_LOCALE_STMT(HOTFIX_SEL_ITEM_SPARSE, "SELECT ID, Display_lang, Display1_lang, Display2_lang, Display3_lang, Description_lang FROM item_sparse_locale WHERE locale = ?", CONNECTION_SYNCH);
}
HotfixDatabaseConnection::HotfixDatabaseConnection(MySQLConnectionInfo& connInfo) : MySQLConnection(connInfo)

View File

@@ -50,8 +50,8 @@ struct ItemSparseEntry
uint32 Quality; // 1
uint32 Flags; // 2
uint32 Flags2; // 3
float Unk1; // 4
float Unk2; // 5
float PriceRandomValue; // 4
float PriceVariance; // 5
uint32 BuyCount; // 6
uint32 BuyPrice; // 7
uint32 SellPrice; // 8
@@ -59,23 +59,23 @@ struct ItemSparseEntry
int32 AllowableClass; // 10
int32 AllowableRace; // 11
uint32 ItemLevel; // 12
int32 RequiredLevel; // 13
uint32 RequiredLevel; // 13
uint32 RequiredSkill; // 14
uint32 RequiredSkillRank; // 15
uint32 RequiredSpell; // 16
int32 RequiredSpell; // 16
uint32 RequiredHonorRank; // 17
uint32 RequiredCityRank; // 18
uint32 RequiredReputationFaction; // 19
uint32 RequiredReputationRank; // 20
uint32 MaxCount; // 21
uint32 Stackable; // 22
int32 MaxCount; // 21
int32 Stackable; // 22
uint32 ContainerSlots; // 23
int32 ItemStatType[MAX_ITEM_PROTO_STATS]; // 24 - 33
int32 ItemStatValue[MAX_ITEM_PROTO_STATS]; // 34 - 43
int32 ItemStatAllocation[MAX_ITEM_PROTO_STATS]; // 44 - 53
float ItemStatSocketCostMultiplier[MAX_ITEM_PROTO_STATS]; // 54 - 63
uint32 ScalingStatDistribution; // 64
uint32 DamageType; // 65
int32 ItemStatSocketCostMultiplier[MAX_ITEM_PROTO_STATS]; // 54 - 63
int32 ScalingStatDistribution; // 64
int32 DamageType; // 65
uint32 Delay; // 66
float RangedModRange; // 67
int32 SpellID[MAX_ITEM_PROTO_SPELLS]; // 68 - 72
@@ -84,34 +84,34 @@ struct ItemSparseEntry
int32 SpellCooldown[MAX_ITEM_PROTO_SPELLS]; // 83 - 87
int32 SpellCategory[MAX_ITEM_PROTO_SPELLS]; // 88 - 92
int32 SpellCategoryCooldown[MAX_ITEM_PROTO_SPELLS]; // 93 - 94
uint32 Bonding; // 95
LocalizedString* Name; // 96
LocalizedString* Name2; // 97
LocalizedString* Name3; // 98
LocalizedString* Name4; // 99
int32 Bonding; // 95
LocalizedString* Display; // 96
LocalizedString* Display1; // 97
LocalizedString* Display2; // 98
LocalizedString* Display3; // 99
LocalizedString* Description; // 100
uint32 PageText; // 101
uint32 LanguageID; // 102
uint32 PageMaterial; // 103
uint32 StartQuest; // 104
int32 LanguageID; // 102
int32 PageMaterial; // 103
int32 StartQuest; // 104
uint32 LockID; // 105
int32 Material; // 106
uint32 Sheath; // 107
uint32 RandomProperty; // 108
int32 SheatheType; // 107
int32 RandomProperty; // 108
uint32 RandomSuffix; // 109
uint32 ItemSet; // 110
uint32 Area; // 112
uint32 Map; // 113
uint32 BagFamily; // 114
uint32 TotemCategory; // 115
uint32 SocketColor[MAX_ITEM_PROTO_SOCKETS]; // 116 - 118
uint32 AreaID; // 112
int32 MapID; // 113
int32 BagFamily; // 114
int32 TotemCategory; // 115
int32 SocketColor[MAX_ITEM_PROTO_SOCKETS]; // 116 - 118
uint32 Content[MAX_ITEM_PROTO_SOCKETS]; // 119 - 121
int32 SocketBonus; // 122
uint32 GemProperties; // 123
int32 GemProperties; // 123
float ArmorDamageModifier; // 124
uint32 Duration; // 125
int32 Duration; // 125
uint32 ItemLimitCategory; // 126
uint32 HolidayID; // 127
int32 HolidayID; // 127
float StatScalingFactor; // 128
int32 CurrencySubstitutionID; // 129
int32 CurrencySubstitutionCount; // 130

View File

@@ -20,7 +20,7 @@
char const Itemfmt[]="niiiiiii";
char const ItemCurrencyCostfmt[]="in";
char const ItemSparsefmt[]="niiiffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffffffiiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisssssiiiiiiiiiiiiiiiiiiiiiifiiifii";
char const ItemSparsefmt[]="niiiffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisssssiiiiiiiiiiiiiiiiiiiiiifiiifii";
char const ItemExtendedCostEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiiii";
char const KeyChainfmt[]="nbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";

View File

@@ -1360,7 +1360,7 @@ uint32 Item::GetSellPrice(ItemTemplate const* proto, bool& normalSellPrice)
}
normalSellPrice = false;
return uint32(qualityFactor * proto->GetUnk1() * proto->GetUnk2() * typeFactor * baseFactor);
return uint32(qualityFactor * proto->GetPriceRandomValue() * proto->GetPriceVariance() * typeFactor * baseFactor);
}
}

View File

@@ -22,15 +22,15 @@
char const* ItemTemplate::GetName(LocaleConstant locale) const
{
if (!strlen(ExtendedData->Name->Str[locale]))
if (!strlen(ExtendedData->Display->Str[locale]))
return GetDefaultLocaleName();
return ExtendedData->Name->Str[locale];
return ExtendedData->Display->Str[locale];
}
char const* ItemTemplate::GetDefaultLocaleName() const
{
return ExtendedData->Name->Str[sWorld->GetDefaultDbcLocale()];
return ExtendedData->Display->Str[sWorld->GetDefaultDbcLocale()];
}
bool ItemTemplate::CanChangeEquipStateInCombat() const

View File

@@ -636,8 +636,8 @@ struct ItemTemplate
uint32 GetQuality() const { return ExtendedData->Quality; }
uint32 GetFlags() const { return ExtendedData->Flags; }
uint32 GetFlags2() const { return ExtendedData->Flags2; }
float GetUnk1() const { return ExtendedData->Unk1; }
float GetUnk2() const { return ExtendedData->Unk2; }
float GetPriceRandomValue() const { return ExtendedData->PriceRandomValue; }
float GetPriceVariance() const { return ExtendedData->PriceVariance; }
uint32 GetBuyCount() const { return std::max(ExtendedData->BuyCount, 1u); }
uint32 GetBuyPrice() const { return ExtendedData->BuyPrice; }
uint32 GetSellPrice() const { return ExtendedData->SellPrice; }
@@ -668,8 +668,8 @@ struct ItemTemplate
uint32 GetRandomProperty() const { return ExtendedData->RandomProperty; }
uint32 GetRandomSuffix() const { return ExtendedData->RandomSuffix; }
uint32 GetItemSet() const { return ExtendedData->ItemSet; }
uint32 GetArea() const { return ExtendedData->Area; }
uint32 GetMap() const { return ExtendedData->Map; }
uint32 GetArea() const { return ExtendedData->AreaID; }
uint32 GetMap() const { return ExtendedData->MapID; }
uint32 GetBagFamily() const { return ExtendedData->BagFamily; }
SocketColor GetSocketColor(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_SOCKETS); return SocketColor(ExtendedData->SocketColor[index]); }
uint32 GetSocketBonus() const { return ExtendedData->SocketBonus; }

View File

@@ -1231,7 +1231,7 @@ public:
auto itr = std::find_if(sItemSparseStore.begin(), sItemSparseStore.end(), [&itemName](ItemSparseEntry const* sparse)
{
for (uint32 i = 0; i < MAX_LOCALES; ++i)
if (itemName == sparse->Name->Str[i])
if (itemName == sparse->Display->Str[i])
return true;
return false;
});

View File

@@ -98,7 +98,7 @@ public:
char const* str = locStr->Str[locale];
std::size_t len = strlen(str);
buffer << uint16(len ? len + 1 : 0);
buffer << uint16(len ? len : 0);
if (len)
{
buffer.append(str, len);