Core/DataStores: Updated db2 structures to 8.2.5

Port From (https://github.com/TrinityCore/TrinityCore/commit/3ac790287aba5f7d7c3bccf79e608de9119e461a)
This commit is contained in:
hondacrx
2019-10-29 13:09:23 -04:00
parent c6e53b2ba7
commit e95115dc94
54 changed files with 4589 additions and 349 deletions
+32 -53
View File
@@ -166,7 +166,6 @@ namespace Game.Entities
stmt.AddValue(++index, (uint)m_itemData.Durability);
stmt.AddValue(++index, (uint)m_itemData.CreatePlayedTime);
stmt.AddValue(++index, m_text);
stmt.AddValue(++index, GetModifier(ItemModifier.UpgradeId));
stmt.AddValue(++index, GetModifier(ItemModifier.BattlePetSpeciesId));
stmt.AddValue(++index, GetModifier(ItemModifier.BattlePetBreedData));
stmt.AddValue(++index, GetModifier(ItemModifier.BattlePetLevel));
@@ -303,7 +302,7 @@ namespace Game.Entities
ItemModifier[] modifiersTable =
{
ItemModifier.ScalingStatDistributionFixedLevel,
ItemModifier.TimewalkerLevel,
ItemModifier.ArtifactKnowledgeLevel
};
@@ -315,7 +314,7 @@ namespace Game.Entities
{
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_ITEM_INSTANCE_MODIFIERS);
stmt.AddValue(0, GetGUID().GetCounter());
stmt.AddValue(1, GetModifier(ItemModifier.ScalingStatDistributionFixedLevel));
stmt.AddValue(1, GetModifier(ItemModifier.TimewalkerLevel));
stmt.AddValue(2, GetModifier(ItemModifier.ArtifactKnowledgeLevel));
trans.Append(stmt);
}
@@ -438,30 +437,14 @@ namespace Game.Entities
SetCreatePlayedTime(fields.Read<uint>(11));
SetText(fields.Read<string>(12));
uint upgradeId = fields.Read<uint>(13);
ItemUpgradeRecord rulesetUpgrade = CliDB.ItemUpgradeStorage.LookupByKey(Global.DB2Mgr.GetRulesetItemUpgrade(entry));
ItemUpgradeRecord upgrade = CliDB.ItemUpgradeStorage.LookupByKey(upgradeId);
if (rulesetUpgrade == null || upgrade == null || rulesetUpgrade.ItemUpgradePathID != upgrade.ItemUpgradePathID)
{
upgradeId = 0;
need_save = true;
}
SetModifier(ItemModifier.BattlePetSpeciesId, fields.Read<uint>(13));
SetModifier(ItemModifier.BattlePetBreedData, fields.Read<uint>(14));
SetModifier(ItemModifier.BattlePetLevel, fields.Read<ushort>(14));
SetModifier(ItemModifier.BattlePetDisplayId, fields.Read<uint>(16));
if (rulesetUpgrade != null && upgradeId == 0)
{
upgradeId = rulesetUpgrade.Id;
need_save = true;
}
SetContext(fields.Read<byte>(17));
SetModifier(ItemModifier.UpgradeId, upgradeId);
SetModifier(ItemModifier.BattlePetSpeciesId, fields.Read<uint>(14));
SetModifier(ItemModifier.BattlePetBreedData, fields.Read<uint>(15));
SetModifier(ItemModifier.BattlePetLevel, fields.Read<ushort>(16));
SetModifier(ItemModifier.BattlePetDisplayId, fields.Read<uint>(17));
SetContext(fields.Read<byte>(18));
var bonusListString = new StringArray(fields.Read<string>(19), ' ');
var bonusListString = new StringArray(fields.Read<string>(18), ' ');
List<uint> bonusListIDs = new List<uint>();
for (var i = 0; i < bonusListString.Length; ++i)
{
@@ -470,25 +453,25 @@ namespace Game.Entities
}
SetBonuses(bonusListIDs);
SetModifier(ItemModifier.TransmogAppearanceAllSpecs, fields.Read<uint>(20));
SetModifier(ItemModifier.TransmogAppearanceSpec1, fields.Read<uint>(21));
SetModifier(ItemModifier.TransmogAppearanceSpec2, fields.Read<uint>(22));
SetModifier(ItemModifier.TransmogAppearanceSpec3, fields.Read<uint>(23));
SetModifier(ItemModifier.TransmogAppearanceSpec4, fields.Read<uint>(24));
SetModifier(ItemModifier.TransmogAppearanceAllSpecs, fields.Read<uint>(19));
SetModifier(ItemModifier.TransmogAppearanceSpec1, fields.Read<uint>(20));
SetModifier(ItemModifier.TransmogAppearanceSpec2, fields.Read<uint>(21));
SetModifier(ItemModifier.TransmogAppearanceSpec3, fields.Read<uint>(22));
SetModifier(ItemModifier.TransmogAppearanceSpec4, fields.Read<uint>(23));
SetModifier(ItemModifier.EnchantIllusionAllSpecs, fields.Read<uint>(25));
SetModifier(ItemModifier.EnchantIllusionSpec1, fields.Read<uint>(26));
SetModifier(ItemModifier.EnchantIllusionSpec2, fields.Read<uint>(27));
SetModifier(ItemModifier.EnchantIllusionSpec3, fields.Read<uint>(28));
SetModifier(ItemModifier.EnchantIllusionSpec4, fields.Read<uint>(29));
SetModifier(ItemModifier.EnchantIllusionAllSpecs, fields.Read<uint>(24));
SetModifier(ItemModifier.EnchantIllusionSpec1, fields.Read<uint>(25));
SetModifier(ItemModifier.EnchantIllusionSpec2, fields.Read<uint>(26));
SetModifier(ItemModifier.EnchantIllusionSpec3, fields.Read<uint>(27));
SetModifier(ItemModifier.EnchantIllusionSpec4, fields.Read<uint>(28));
int gemFields = 4;
ItemDynamicFieldGems[] gemData = new ItemDynamicFieldGems[ItemConst.MaxGemSockets];
for (int i = 0; i < ItemConst.MaxGemSockets; ++i)
{
gemData[i] = new ItemDynamicFieldGems();
gemData[i].ItemId = fields.Read<uint>(30 + i * gemFields);
var gemBonusListIDs = new StringArray(fields.Read<string>(31 + i * gemFields), ' ');
gemData[i].ItemId = fields.Read<uint>(29 + i * gemFields);
var gemBonusListIDs = new StringArray(fields.Read<string>(30 + i * gemFields), ' ');
if (!gemBonusListIDs.IsEmpty())
{
uint b = 0;
@@ -499,13 +482,13 @@ namespace Game.Entities
}
}
gemData[i].Context = fields.Read<byte>(32 + i * gemFields);
gemData[i].Context = fields.Read<byte>(31 + i * gemFields);
if (gemData[i].ItemId != 0)
SetGem((ushort)i, gemData[i], fields.Read<uint>(33 + i * gemFields));
SetGem((ushort)i, gemData[i], fields.Read<uint>(32 + i * gemFields));
}
SetModifier(ItemModifier.ScalingStatDistributionFixedLevel, fields.Read<uint>(42));
SetModifier(ItemModifier.ArtifactKnowledgeLevel, fields.Read<uint>(43));
SetModifier(ItemModifier.TimewalkerLevel, fields.Read<uint>(41));
SetModifier(ItemModifier.ArtifactKnowledgeLevel, fields.Read<uint>(42));
// Enchants must be loaded after all other bonus/scaling data
var enchantmentTokens = new StringArray(fields.Read<string>(8), ' ');
@@ -536,7 +519,6 @@ namespace Game.Entities
stmt.AddValue(index++, (uint)m_itemData.Expiration);
stmt.AddValue(index++, (uint)m_itemData.DynamicFlags);
stmt.AddValue(index++, (uint)m_itemData.Durability);
stmt.AddValue(index++, GetModifier(ItemModifier.UpgradeId));
stmt.AddValue(index++, guid);
DB.Characters.Execute(stmt);
}
@@ -1104,7 +1086,8 @@ namespace Game.Entities
public bool IsLimitedToAnotherMapOrZone(uint cur_mapId, uint cur_zoneId)
{
ItemTemplate proto = GetTemplate();
return proto != null && ((proto.GetMap() != 0 && proto.GetMap() != cur_mapId) || (proto.GetArea() != 0 && proto.GetArea() != cur_zoneId));
return proto != null && ((proto.GetMap() != 0 && proto.GetMap() != cur_mapId) ||
((proto.GetArea(0) != 0 && proto.GetArea(0) != cur_zoneId) && (proto.GetArea(1) != 0 && proto.GetArea(1) != cur_zoneId)));
}
public void SendUpdateSockets()
@@ -1892,12 +1875,11 @@ namespace Game.Entities
uint minItemLevelCutoff = owner.m_unitData.MinItemLevelCutoff;
uint maxItemLevel = GetTemplate().GetFlags3().HasAnyFlag(ItemFlags3.IgnoreItemLevelCapInPvp) ? 0u : owner.m_unitData.MaxItemLevel;
bool pvpBonus = owner.IsUsingPvpItemLevels();
return GetItemLevel(GetTemplate(), _bonusData, owner.GetLevel(), GetModifier(ItemModifier.ScalingStatDistributionFixedLevel), GetModifier(ItemModifier.UpgradeId),
return GetItemLevel(GetTemplate(), _bonusData, owner.GetLevel(), GetModifier(ItemModifier.TimewalkerLevel),
minItemLevel, minItemLevelCutoff, maxItemLevel, pvpBonus);
}
public static uint GetItemLevel(ItemTemplate itemTemplate, BonusData bonusData, uint level, uint fixedLevel, uint upgradeId,
uint minItemLevel, uint minItemLevelCutoff, uint maxItemLevel, bool pvpBonus)
public static uint GetItemLevel(ItemTemplate itemTemplate, BonusData bonusData, uint level, uint fixedLevel, uint minItemLevel, uint minItemLevelCutoff, uint maxItemLevel, bool pvpBonus)
{
if (itemTemplate == null)
return 1;
@@ -1927,9 +1909,6 @@ namespace Game.Entities
itemLevel += bonusData.GemItemLevelBonus[i];
uint itemLevelBeforeUpgrades = itemLevel;
ItemUpgradeRecord upgrade = CliDB.ItemUpgradeStorage.LookupByKey(upgradeId);
if (upgrade != null)
itemLevel += upgrade.ItemLevelIncrement;
if (pvpBonus)
itemLevel += Global.DB2Mgr.GetPvpItemLevelBonus(itemTemplate.GetId());
@@ -1974,7 +1953,7 @@ namespace Game.Entities
if (itemTemplate.GetFlags().HasAnyFlag(ItemFlags.Conjured | ItemFlags.NoDisenchant) || itemTemplate.GetBonding() == ItemBondingType.Quest)
return null;
if (itemTemplate.GetArea() != 0 || itemTemplate.GetMap() != 0 || itemTemplate.GetMaxStackSize() > 1)
if (itemTemplate.GetArea(0) != 0 || itemTemplate.GetArea(1) != 0 || itemTemplate.GetMap() != 0 || itemTemplate.GetMaxStackSize() > 1)
return null;
if (GetSellPrice(itemTemplate, quality, itemLevel) == 0 && !Global.DB2Mgr.HasItemCurrencyCost(itemTemplate.GetId()))
@@ -2380,7 +2359,7 @@ namespace Game.Entities
public void SetFixedLevel(uint level)
{
if (!_bonusData.HasFixedLevel || GetModifier(ItemModifier.ScalingStatDistributionFixedLevel) != 0)
if (!_bonusData.HasFixedLevel || GetModifier(ItemModifier.TimewalkerLevel) != 0)
return;
ScalingStatDistributionRecord ssd = CliDB.ScalingStatDistributionStorage.LookupByKey(_bonusData.ScalingStatDistribution);
@@ -2393,7 +2372,7 @@ namespace Game.Entities
if ((contentTuning.Flags.HasAnyFlag(2) || contentTuning.MinLevel != 0 || contentTuning.MaxLevel != 0) && !contentTuning.Flags.HasAnyFlag(4))
level = (uint)Math.Min(Math.Max(level, contentTuning.MinLevel), contentTuning.MaxLevel);
SetModifier(ItemModifier.ScalingStatDistributionFixedLevel, level);
SetModifier(ItemModifier.TimewalkerLevel, level);
}
}
@@ -2402,7 +2381,7 @@ namespace Game.Entities
if (_bonusData.RequiredLevelOverride != 0)
return _bonusData.RequiredLevelOverride;
else if (_bonusData.HasFixedLevel)
return (int)GetModifier(ItemModifier.ScalingStatDistributionFixedLevel);
return (int)GetModifier(ItemModifier.TimewalkerLevel);
else
return _bonusData.RequiredLevel;
}
+5 -5
View File
@@ -30,9 +30,9 @@ namespace Game.Entities
BasicData = item;
ExtendedData = sparse;
Specializations[0] = new BitArray((int)Class.Max * PlayerConst.MaxSpecializations);
Specializations[1] = new BitArray((int)Class.Max * PlayerConst.MaxSpecializations);
Specializations[2] = new BitArray((int)Class.Max * PlayerConst.MaxSpecializations);
Specializations[0] = new BitSet((int)Class.Max * PlayerConst.MaxSpecializations);
Specializations[1] = new BitSet((int)Class.Max * PlayerConst.MaxSpecializations);
Specializations[2] = new BitSet((int)Class.Max * PlayerConst.MaxSpecializations);
}
public string GetName(LocaleConstant locale = SharedConst.DefaultLocale)
@@ -296,7 +296,7 @@ namespace Game.Entities
public uint GetStartQuest() { return ExtendedData.StartQuestID; }
public uint GetLockID() { return ExtendedData.LockID; }
public uint GetItemSet() { return ExtendedData.ItemSet; }
public uint GetArea() { return ExtendedData.ZoneBound; }
public uint GetArea(int index) { return ExtendedData.ZoneBound[index]; }
public uint GetMap() { return ExtendedData.InstanceBound; }
public BagFamilyMask GetBagFamily() { return (BagFamilyMask)ExtendedData.BagFamily; }
public uint GetTotemCategory() { return ExtendedData.TotemCategoryID; }
@@ -344,7 +344,7 @@ namespace Game.Entities
public ItemFlagsCustom FlagsCu;
public float SpellPPMRate;
public uint RandomBonusListTemplateId;
public BitArray[] Specializations = new BitArray[3];
public BitSet[] Specializations = new BitSet[3];
public uint ItemSpecClassMask;
protected ItemRecord BasicData;
@@ -2326,9 +2326,9 @@ namespace Game.Entities
}
if (fieldVisibilityFlags.HasFlag(UpdateFieldFlag.PartyMember))
{
data.WriteBit(HasQuestSession);
data.WriteBit((bool)HasQuestSession);
}
data.WriteBit(HasLevelLink);
data.WriteBit((bool)HasLevelLink);
data.FlushBits();
}
public override void WriteUpdate(WorldPacket data, UpdateFieldFlag fieldVisibilityFlags, Player owner, Player receiver)
+13 -16
View File
@@ -92,9 +92,9 @@ namespace Game.Entities
if (item.GetTemplate().GetArtifactID() != 0 && artifactDataPair != null)
item.LoadArtifactData(this, artifactDataPair.Item1, artifactDataPair.Item2, artifactDataPair.Item3, artifactDataPair.Item4);
ulong counter = result.Read<ulong>(44);
ulong counter = result.Read<ulong>(43);
ObjectGuid bagGuid = counter != 0 ? ObjectGuid.Create(HighGuid.Item, counter) : ObjectGuid.Empty;
byte slot = result.Read<byte>(45);
byte slot = result.Read<byte>(44);
GetSession().GetCollectionMgr().CheckHeirloomUpgrades(item);
GetSession().GetCollectionMgr().AddItemAppearance(item);
@@ -1100,18 +1100,17 @@ namespace Game.Entities
do
{
// SELECT itemId, itemEntry, slot, creatorGuid, randomBonusListId, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs FROM character_void_storage WHERE playerGuid = ?
// SELECT itemId, itemEntry, slot, creatorGuid, randomBonusListId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs FROM character_void_storage WHERE playerGuid = ?
ulong itemId = result.Read<ulong>(0);
uint itemEntry = result.Read<uint>(1);
byte slot = result.Read<byte>(2);
ObjectGuid creatorGuid = result.Read<ulong>(3) != 0 ? ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(3)) : ObjectGuid.Empty;
uint randomBonusListId = result.Read<uint>(4);
uint upgradeId = result.Read<uint>(5);
uint fixedScalingLevel = result.Read<uint>(6);
uint artifactKnowledgeLevel = result.Read<uint>(7);
byte context = result.Read<byte>(8);
uint fixedScalingLevel = result.Read<uint>(5);
uint artifactKnowledgeLevel = result.Read<uint>(6);
byte context = result.Read<byte>(7);
List<uint> bonusListIDs = new List<uint>();
var bonusListIdTokens = new StringArray(result.Read<string>(9), ' ');
var bonusListIdTokens = new StringArray(result.Read<string>(8), ' ');
for (var i = 0; i < bonusListIdTokens.Length; ++i)
{
if (uint.TryParse(bonusListIdTokens[i], out uint id))
@@ -1136,10 +1135,9 @@ namespace Game.Entities
continue;
}
_voidStorageItems[slot] = new VoidStorageItem(itemId, itemEntry, creatorGuid, randomBonusListId, upgradeId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs);
_voidStorageItems[slot] = new VoidStorageItem(itemId, itemEntry, creatorGuid, randomBonusListId, fixedScalingLevel, artifactKnowledgeLevel, context, bonusListIDs);
BonusData bonus = new BonusData(new ItemInstance(_voidStorageItems[slot]));
GetSession().GetCollectionMgr().AddItemAppearance(itemEntry, bonus.AppearanceModID);
}
while (result.NextRow());
@@ -1230,7 +1228,7 @@ namespace Game.Entities
}
Item item = Bag.NewItemOrBag(proto);
ObjectGuid ownerGuid = result.Read<ulong>(44) != 0 ? ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(44)) : ObjectGuid.Empty;
ObjectGuid ownerGuid = result.Read<ulong>(43) != 0 ? ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(43)) : ObjectGuid.Empty;
if (!item.LoadFromDB(itemGuid, ownerGuid, result.GetFields(), itemEntry))
{
Log.outError(LogFilter.Player, "Player:_LoadMailedItems - Item in mail ({0}) doesn't exist !!!! - item guid: {1}, deleted from mail", mail.messageID, itemGuid);
@@ -2249,15 +2247,14 @@ namespace Game.Entities
stmt.AddValue(3, i);
stmt.AddValue(4, _voidStorageItems[i].CreatorGuid.GetCounter());
stmt.AddValue(5, (byte)_voidStorageItems[i].RandomBonusListId);
stmt.AddValue(6, _voidStorageItems[i].ItemUpgradeId);
stmt.AddValue(7, _voidStorageItems[i].FixedScalingLevel);
stmt.AddValue(8, _voidStorageItems[i].ArtifactKnowledgeLevel);
stmt.AddValue(9, _voidStorageItems[i].Context);
stmt.AddValue(6, _voidStorageItems[i].FixedScalingLevel);
stmt.AddValue(7, _voidStorageItems[i].ArtifactKnowledgeLevel);
stmt.AddValue(8, _voidStorageItems[i].Context);
StringBuilder bonusListIDs = new StringBuilder();
foreach (uint bonusListID in _voidStorageItems[i].BonusListIDs)
bonusListIDs.AppendFormat("{0} ", bonusListID);
stmt.AddValue(10, bonusListIDs.ToString());
stmt.AddValue(9, bonusListIDs.ToString());
}
trans.Append(stmt);
+5 -7
View File
@@ -446,13 +446,12 @@ namespace Game.Entities
public class VoidStorageItem
{
public VoidStorageItem(ulong id, uint entry, ObjectGuid creator, uint randomBonusListId, uint upgradeId, uint fixedScalingLevel, uint artifactKnowledgeLevel, byte context, List<uint> bonuses)
public VoidStorageItem(ulong id, uint entry, ObjectGuid creator, uint randomBonusListId, uint fixedScalingLevel, uint artifactKnowledgeLevel, byte context, List<uint> bonuses)
{
ItemId = id;
ItemEntry = entry;
CreatorGuid = creator;
RandomBonusListId = randomBonusListId;
ItemUpgradeId = upgradeId;
FixedScalingLevel = fixedScalingLevel;
ArtifactKnowledgeLevel = artifactKnowledgeLevel;
Context = context;
@@ -465,7 +464,6 @@ namespace Game.Entities
public uint ItemEntry;
public ObjectGuid CreatorGuid;
public uint RandomBonusListId;
public uint ItemUpgradeId;
public uint FixedScalingLevel;
public uint ArtifactKnowledgeLevel;
public byte Context;
@@ -545,14 +543,14 @@ namespace Game.Entities
{
public CUFProfile()
{
BoolOptions = new BitArray((int)CUFBoolOptions.BoolOptionsCount);
BoolOptions = new BitSet((int)CUFBoolOptions.BoolOptionsCount);
}
public CUFProfile(string name, ushort frameHeight, ushort frameWidth, byte sortBy, byte healthText, uint boolOptions,
byte topPoint, byte bottomPoint, byte leftPoint, ushort topOffset, ushort bottomOffset, ushort leftOffset)
{
ProfileName = name;
BoolOptions = new BitArray(new int[] { (int)boolOptions });
BoolOptions = new BitSet(new uint[] { boolOptions });
FrameHeight = frameHeight;
FrameWidth = frameWidth;
@@ -576,7 +574,7 @@ namespace Game.Entities
}
public ulong GetUlongOptionValue()
{
int[] array = new int[1];
uint[] array = new uint[1];
BoolOptions.CopyTo(array, 0);
return (ulong)array[0];
}
@@ -597,7 +595,7 @@ namespace Game.Entities
public ushort BottomOffset;
public ushort LeftOffset;
public BitArray BoolOptions;
public BitSet BoolOptions;
// More fields can be added to BoolOptions without changing DB schema (up to 32, currently 27)
}
@@ -1275,10 +1275,6 @@ namespace Game.Entities
item.AddItemFlag(ItemFieldFlags.NewItem);
uint upgradeID = Global.DB2Mgr.GetRulesetItemUpgrade(itemId);
if (upgradeID != 0)
item.SetModifier(ItemModifier.UpgradeId, upgradeID);
item.SetContext(context);
item.SetBonuses(bonusListIDs);
+2 -2
View File
@@ -695,9 +695,9 @@ namespace Game.Entities
// If map is dungeon find linked graveyard
if (GetMap().IsDungeon())
{
WorldSafeLocsRecord entry = Global.ObjectMgr.GetClosestGraveYard(this, GetTeam(), this);
WorldSafeLocsEntry entry = Global.ObjectMgr.GetClosestGraveYard(this, GetTeam(), this);
if (entry != null)
m_bgData.joinPos = new WorldLocation(entry.MapID, entry.Loc.X, entry.Loc.Y, entry.Loc.Z, 0.0f);
m_bgData.joinPos = entry.Loc;
else
Log.outError(LogFilter.Player, "SetBattlegroundEntryPoint: Dungeon map {0} has no linked graveyard, setting home location as entry point.", GetMapId());
}
+3 -3
View File
@@ -4666,7 +4666,7 @@ namespace Game.Entities
SpawnCorpseBones();
}
WorldSafeLocsRecord ClosestGrave = null;
WorldSafeLocsEntry ClosestGrave = null;
// Special handle for Battlegroundmaps
Battleground bg = GetBattleground();
@@ -4688,11 +4688,11 @@ namespace Game.Entities
// and don't show spirit healer location
if (ClosestGrave != null)
{
TeleportTo(ClosestGrave.MapID, ClosestGrave.Loc.X, ClosestGrave.Loc.Y, ClosestGrave.Loc.Z, (ClosestGrave.Facing * MathFunctions.PI) / 180);
TeleportTo(ClosestGrave.Loc);
if (IsDead()) // not send if alive, because it used in TeleportTo()
{
DeathReleaseLoc packet = new DeathReleaseLoc();
packet.MapID = (int)ClosestGrave.MapID;
packet.MapID = (int)ClosestGrave.Loc.GetMapId();
packet.Loc = ClosestGrave.Loc;
SendPacket(packet);
}