Core/DataStores: Fixed db2 structures after 7.3.5

This commit is contained in:
hondacrx
2018-03-13 15:43:03 -04:00
parent 2199e07955
commit 0ab3b8e8cd
97 changed files with 3139 additions and 1707 deletions
+8 -8
View File
@@ -37,12 +37,12 @@ namespace Game.Garrisons
foreach (GameObjectsRecord gameObject in CliDB.GameObjectsStorage.Values)
{
if (gameObject.Type == GameObjectTypes.GarrisonPlot)
if (gameObject.TypeID == GameObjectTypes.GarrisonPlot)
{
if (!_garrisonPlots.ContainsKey(gameObject.MapID))
_garrisonPlots[gameObject.MapID] = new Dictionary<uint, GameObjectsRecord>();
if (!_garrisonPlots.ContainsKey(gameObject.OwnerID))
_garrisonPlots[gameObject.OwnerID] = new Dictionary<uint, GameObjectsRecord>();
_garrisonPlots[gameObject.MapID][(uint)gameObject.Data[0]] = gameObject;
_garrisonPlots[gameObject.OwnerID][(uint)gameObject.PropValue[0]] = gameObject;
}
}
@@ -53,7 +53,7 @@ namespace Game.Garrisons
_garrisonBuildingPlotInstances[MathFunctions.MakePair64(buildingPlotInst.GarrBuildingID, buildingPlotInst.GarrSiteLevelPlotInstID)] = buildingPlotInst.Id;
foreach (GarrBuildingRecord building in CliDB.GarrBuildingStorage.Values)
_garrisonBuildingsByType.Add(building.Type, building.Id);
_garrisonBuildingsByType.Add(building.BuildingType, building.Id);
for (var i = 0; i < 2; ++i)
_garrisonFollowerAbilities[i] = new Dictionary<uint, GarrAbilities>();
@@ -63,7 +63,7 @@ namespace Game.Garrisons
GarrAbilityRecord ability = CliDB.GarrAbilityStorage.LookupByKey(followerAbility.GarrAbilityID);
if (ability != null)
{
if (ability.FollowerTypeID != (uint)GarrisonFollowerType.Garrison)
if (ability.GarrFollowerTypeID != (uint)GarrisonFollowerType.Garrison)
continue;
if (!ability.Flags.HasAnyFlag(GarrisonAbilityFlags.CannotRoll) && ability.Flags.HasAnyFlag(GarrisonAbilityFlags.Trait))
@@ -92,7 +92,7 @@ namespace Game.Garrisons
public GarrSiteLevelRecord GetGarrSiteLevelEntry(uint garrSiteId, uint level)
{
foreach (GarrSiteLevelRecord siteLevel in CliDB.GarrSiteLevelStorage.Values)
if (siteLevel.SiteID == garrSiteId && siteLevel.Level == level)
if (siteLevel.GarrSiteID == garrSiteId && siteLevel.GarrLevel == level)
return siteLevel;
return null;
@@ -136,7 +136,7 @@ namespace Game.Garrisons
if (!list.Empty())
{
foreach (uint buildingId in list)
if (CliDB.GarrBuildingStorage.LookupByKey(buildingId).Level == currentLevel - 1)
if (CliDB.GarrBuildingStorage.LookupByKey(buildingId).UpgradeLevel == currentLevel - 1)
return buildingId;
}
+18 -18
View File
@@ -245,7 +245,7 @@ namespace Game.Garrisons
GarrisonDeleteResult garrisonDelete = new GarrisonDeleteResult();
garrisonDelete.Result = GarrisonError.Success;
garrisonDelete.GarrSiteID = _siteLevel.SiteID;
garrisonDelete.GarrSiteID = _siteLevel.GarrSiteID;
_owner.SendPacket(garrisonDelete);
}
@@ -267,7 +267,7 @@ namespace Game.Garrisons
Plot plotInfo = _plots[garrPlotInstanceId];
plotInfo.PacketInfo.GarrPlotInstanceID = garrPlotInstanceId;
plotInfo.PacketInfo.PlotPos.Relocate(gameObject.Position.X, gameObject.Position.Y, gameObject.Position.Z, 2 * (float)Math.Acos(gameObject.RotationW));
plotInfo.PacketInfo.PlotPos.Relocate(gameObject.Pos.X, gameObject.Pos.Y, gameObject.Pos.Z, 2 * (float)Math.Acos(gameObject.Rot[3]));
plotInfo.PacketInfo.PlotType = plot.PlotType;
plotInfo.EmptyGameObjectId = gameObject.Id;
plotInfo.GarrSiteLevelPlotInstId = plots[i].Id;
@@ -366,7 +366,7 @@ namespace Game.Garrisons
if (plot.BuildingInfo.PacketInfo.HasValue)
{
oldBuildingId = plot.BuildingInfo.PacketInfo.Value.GarrBuildingID;
if (CliDB.GarrBuildingStorage.LookupByKey(oldBuildingId).Type != building.Type)
if (CliDB.GarrBuildingStorage.LookupByKey(oldBuildingId).BuildingType != building.BuildingType)
plot.ClearBuildingInfo(_owner);
}
@@ -378,8 +378,8 @@ namespace Game.Garrisons
map.AddToMap(go);
}
_owner.ModifyCurrency((CurrencyTypes)building.CostCurrencyID, -building.CostCurrencyAmount, false, true);
_owner.ModifyMoney(-building.CostMoney * MoneyConstants.Gold, false);
_owner.ModifyCurrency((CurrencyTypes)building.CurrencyTypeID, -building.CurrencyQty, false, true);
_owner.ModifyMoney(-building.GoldCost * MoneyConstants.Gold, false);
if (oldBuildingId != 0)
{
@@ -418,13 +418,13 @@ namespace Game.Garrisons
GarrBuildingRecord constructing = CliDB.GarrBuildingStorage.LookupByKey(buildingRemoved.GarrBuildingID);
// Refund construction/upgrade cost
_owner.ModifyCurrency((CurrencyTypes)constructing.CostCurrencyID, constructing.CostCurrencyAmount, false, true);
_owner.ModifyMoney(constructing.CostMoney * MoneyConstants.Gold, false);
_owner.ModifyCurrency((CurrencyTypes)constructing.CurrencyTypeID, constructing.CurrencyQty, false, true);
_owner.ModifyMoney(constructing.GoldCost * MoneyConstants.Gold, false);
if (constructing.Level > 1)
if (constructing.UpgradeLevel > 1)
{
// Restore previous level building
uint restored = Global.GarrisonMgr.GetPreviousLevelBuilding(constructing.Type, constructing.Level);
uint restored = Global.GarrisonMgr.GetPreviousLevelBuilding(constructing.BuildingType, constructing.UpgradeLevel);
Contract.Assert(restored != 0);
GarrisonPlaceBuildingResult placeBuildingResult = new GarrisonPlaceBuildingResult();
@@ -493,7 +493,7 @@ namespace Game.Garrisons
follower.PacketInfo.DbID = dbId;
follower.PacketInfo.GarrFollowerID = garrFollowerId;
follower.PacketInfo.Quality = followerEntry.Quality; // TODO: handle magic upgrades
follower.PacketInfo.FollowerLevel = followerEntry.Level;
follower.PacketInfo.FollowerLevel = followerEntry.FollowerLevel;
follower.PacketInfo.ItemLevelWeapon = followerEntry.ItemLevelWeapon;
follower.PacketInfo.ItemLevelArmor = followerEntry.ItemLevelArmor;
follower.PacketInfo.Xp = 0;
@@ -521,7 +521,7 @@ namespace Game.Garrisons
GarrisonInfo garrison = new GarrisonInfo();
garrison.GarrTypeID = GarrisonType.Garrison;
garrison.GarrSiteID = _siteLevel.SiteID;
garrison.GarrSiteID = _siteLevel.GarrSiteID;
garrison.GarrSiteLevelID = _siteLevel.Id;
garrison.NumFollowerActivationsRemaining = _followerActivationsRemainingToday;
foreach (var plot in _plots.Values)
@@ -602,7 +602,7 @@ namespace Game.Garrisons
return GarrisonError.InvalidPlotBuilding;
// Cannot place buldings of higher level than garrison level
if (building.Level > _siteLevel.Level)
if (building.UpgradeLevel > _siteLevel.MaxBuildingLevel)
return GarrisonError.InvalidBuildingId;
if (building.Flags.HasAnyFlag(GarrisonBuildingFlags.NeedsPlan))
@@ -620,16 +620,16 @@ namespace Game.Garrisons
if (p.Value.BuildingInfo.PacketInfo.HasValue)
{
existingBuilding = CliDB.GarrBuildingStorage.LookupByKey(p.Value.BuildingInfo.PacketInfo.Value.GarrBuildingID);
if (existingBuilding.Type == building.Type)
if (p.Key != garrPlotInstanceId || existingBuilding.Level + 1 != building.Level) // check if its an upgrade in same plot
if (existingBuilding.BuildingType == building.BuildingType)
if (p.Key != garrPlotInstanceId || existingBuilding.UpgradeLevel + 1 != building.UpgradeLevel) // check if its an upgrade in same plot
return GarrisonError.BuildingExists;
}
}
if (!_owner.HasCurrency(building.CostCurrencyID, (uint)building.CostCurrencyAmount))
if (!_owner.HasCurrency(building.CurrencyTypeID, (uint)building.CurrencyQty))
return GarrisonError.NotEnoughCurrency;
if (!_owner.HasEnoughMoney(building.CostMoney * MoneyConstants.Gold))
if (!_owner.HasEnoughMoney(building.GoldCost * MoneyConstants.Gold))
return GarrisonError.NotEnoughGold;
// New building cannot replace another building currently under construction
@@ -673,7 +673,7 @@ namespace Game.Garrisons
if (PacketInfo.HasValue)
{
GarrBuildingRecord building = CliDB.GarrBuildingStorage.LookupByKey(PacketInfo.Value.GarrBuildingID);
if (PacketInfo.Value.TimeBuilt + building.BuildDuration <= Time.UnixTime)
if (PacketInfo.Value.TimeBuilt + building.BuildSeconds <= Time.UnixTime)
return true;
}
@@ -696,7 +696,7 @@ namespace Game.Garrisons
GarrPlotRecord plot = CliDB.GarrPlotStorage.LookupByKey(plotInstance.GarrPlotID);
GarrBuildingRecord building = CliDB.GarrBuildingStorage.LookupByKey(BuildingInfo.PacketInfo.Value.GarrBuildingID);
entry = faction == GarrisonFactionIndex.Horde ? plot.HordeConstructionGameObjectID : plot.AllianceConstructionGameObjectID;
entry = faction == GarrisonFactionIndex.Horde ? plot.HordeConstructObjID : plot.AllianceConstructObjID;
if (BuildingInfo.PacketInfo.Value.Active || entry == 0)
entry = faction == GarrisonFactionIndex.Horde ? building.HordeGameObjectID : building.AllianceGameObjectID;
}