Add WorldEffectID to Gameobject
This commit is contained in:
@@ -252,6 +252,7 @@ namespace Game.DataStorage
|
||||
VehicleStorage = DB6Reader.Read<VehicleRecord>("Vehicle.db2", DB6Metas.VehicleMeta, HotfixStatements.SEL_VEHICLE);
|
||||
VehicleSeatStorage = DB6Reader.Read<VehicleSeatRecord>("VehicleSeat.db2", DB6Metas.VehicleSeatMeta, HotfixStatements.SEL_VEHICLE_SEAT);
|
||||
WMOAreaTableStorage = DB6Reader.Read<WMOAreaTableRecord>("WMOAreaTable.db2", DB6Metas.WMOAreaTableMeta, HotfixStatements.SEL_WMO_AREA_TABLE, HotfixStatements.SEL_WMO_AREA_TABLE_LOCALE);
|
||||
WorldEffectStorage = DB6Reader.Read<WorldEffectRecord>("WorldEffect.db2", DB6Metas.WorldEffectMeta, HotfixStatements.SEL_WORLD_EFFECT);
|
||||
WorldMapAreaStorage = DB6Reader.Read<WorldMapAreaRecord>("WorldMapArea.db2", DB6Metas.WorldMapAreaMeta, HotfixStatements.SEL_WORLD_MAP_AREA);
|
||||
WorldMapOverlayStorage = DB6Reader.Read<WorldMapOverlayRecord>("WorldMapOverlay.db2", DB6Metas.WorldMapOverlayMeta, HotfixStatements.SEL_WORLD_MAP_OVERLAY);
|
||||
WorldMapTransformsStorage = DB6Reader.Read<WorldMapTransformsRecord>("WorldMapTransforms.db2", DB6Metas.WorldMapTransformsMeta, HotfixStatements.SEL_WORLD_MAP_TRANSFORMS);
|
||||
@@ -577,6 +578,7 @@ namespace Game.DataStorage
|
||||
public static DB6Storage<VehicleRecord> VehicleStorage;
|
||||
public static DB6Storage<VehicleSeatRecord> VehicleSeatStorage;
|
||||
public static DB6Storage<WMOAreaTableRecord> WMOAreaTableStorage;
|
||||
public static DB6Storage<WorldEffectRecord> WorldEffectStorage;
|
||||
public static DB6Storage<WorldMapAreaRecord> WorldMapAreaStorage;
|
||||
public static DB6Storage<WorldMapOverlayRecord> WorldMapOverlayStorage;
|
||||
public static DB6Storage<WorldMapTransformsRecord> WorldMapTransformsStorage;
|
||||
|
||||
@@ -39,6 +39,17 @@ namespace Game.DataStorage
|
||||
public uint UWZoneMusic;
|
||||
}
|
||||
|
||||
public sealed class WorldEffectRecord
|
||||
{
|
||||
public uint ID;
|
||||
public uint TargetAsset;
|
||||
public ushort CombatConditionID;
|
||||
public byte TargetType;
|
||||
public byte WhenToDisplay;
|
||||
public uint QuestFeedbackEffectID;
|
||||
public uint PlayerConditionID;
|
||||
}
|
||||
|
||||
public sealed class WorldMapAreaRecord
|
||||
{
|
||||
public string AreaName;
|
||||
|
||||
@@ -228,6 +228,12 @@ namespace Game.Entities
|
||||
{
|
||||
SetUInt32Value(GameObjectFields.Faction, m_goTemplateAddon.faction);
|
||||
SetUInt32Value(GameObjectFields.Flags, m_goTemplateAddon.flags);
|
||||
|
||||
if (m_goTemplateAddon.WorldEffectID)
|
||||
{
|
||||
m_updateFlag |= UpdateFlag.Gameobject;
|
||||
SetWorldEffectID(m_goTemplateAddon.WorldEffectID);
|
||||
}
|
||||
}
|
||||
|
||||
SetEntry(goinfo.entry);
|
||||
@@ -318,6 +324,12 @@ namespace Game.Entities
|
||||
m_invisibility.AddValue(gameObjectAddon.invisibilityType, gameObjectAddon.invisibilityValue);
|
||||
}
|
||||
|
||||
if (gameObjectAddon != null && gameObjectAddon.WorldEffectID)
|
||||
{
|
||||
m_updateFlag |= UpdateFlag.Gameobject;
|
||||
SetWorldEffectID(gameObjectAddon.WorldEffectID);
|
||||
}
|
||||
|
||||
LastUsedScriptID = GetGoInfo().ScriptId;
|
||||
AIM_Initialize();
|
||||
|
||||
@@ -2498,6 +2510,9 @@ namespace Game.Entities
|
||||
|
||||
public override ushort GetAIAnimKitId() { return _animKitId; }
|
||||
|
||||
public uint GetWorldEffectID() { return _worldEffectID; }
|
||||
public void SetWorldEffectID(uint worldEffectID) { _worldEffectID = worldEffectID; }
|
||||
|
||||
public GameObjectTemplate GetGoInfo() { return m_goInfo; }
|
||||
public GameObjectTemplateAddon GetTemplateAddon() { return m_goTemplateAddon; }
|
||||
GameObjectData GetGoData() { return m_goData; }
|
||||
@@ -2663,6 +2678,7 @@ namespace Game.Entities
|
||||
|
||||
GameObjectAI m_AI;
|
||||
ushort _animKitId;
|
||||
uint _worldEffectID;
|
||||
|
||||
GameObjectState m_prevGoState; // What state to set whenever resetting
|
||||
|
||||
|
||||
@@ -1030,6 +1030,7 @@ namespace Game.Entities
|
||||
public uint flags;
|
||||
public uint mingold;
|
||||
public uint maxgold;
|
||||
public uint WorldEffectID;
|
||||
}
|
||||
|
||||
public class GameObjectLocale
|
||||
@@ -1044,6 +1045,7 @@ namespace Game.Entities
|
||||
public Quaternion ParentRotation;
|
||||
public InvisibilityType invisibilityType;
|
||||
public uint invisibilityValue;
|
||||
public uint WorldEffectID;
|
||||
}
|
||||
|
||||
public class GameObjectData
|
||||
|
||||
@@ -325,7 +325,7 @@ namespace Game.Entities
|
||||
bool AnimKitCreate = flags.HasAnyFlag(UpdateFlag.AnimKits);
|
||||
bool Rotation = flags.HasAnyFlag(UpdateFlag.Rotation);
|
||||
bool HasAreaTrigger = flags.HasAnyFlag(UpdateFlag.Areatrigger);
|
||||
bool HasGameObject = false;
|
||||
bool HasGameObject = flags.HasAnyFlag(UpdateFlag.Gameobject);
|
||||
bool ThisIsYou = flags.HasAnyFlag(UpdateFlag.Self);
|
||||
bool SmoothPhasing = false;
|
||||
bool SceneObjCreate = false;
|
||||
@@ -653,14 +653,20 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
//if (HasGameObject)
|
||||
//{
|
||||
// *data << uint32(WorldEffectID);
|
||||
if (HasGameObject)
|
||||
{
|
||||
bool bit8 = false;
|
||||
uint Int1 = 0;
|
||||
|
||||
// data.WriteBit(bit8);
|
||||
// if (bit8)
|
||||
// *data << uint32(Int1);
|
||||
//}
|
||||
GameObject gameObject = ToGameObject();
|
||||
|
||||
data.WriteUInt32(gameObject.GetWorldEffectID());
|
||||
|
||||
data.WriteBit(bit8);
|
||||
data.FlushBits();
|
||||
if (bit8)
|
||||
data.WriteUInt32(Int1);
|
||||
}
|
||||
|
||||
//if (SmoothPhasing)
|
||||
//{
|
||||
|
||||
@@ -3803,8 +3803,8 @@ namespace Game
|
||||
{
|
||||
uint oldMSTime = Time.GetMSTime();
|
||||
|
||||
// 0 1 2 3 4
|
||||
SQLResult result = DB.World.Query("SELECT entry, faction, flags, mingold, maxgold FROM gameobject_template_addon");
|
||||
// 0 1 2 3 4 5
|
||||
SQLResult result = DB.World.Query("SELECT entry, faction, flags, mingold, maxgold, WorldEffectID FROM gameobject_template_addon");
|
||||
|
||||
if (result.IsEmpty())
|
||||
{
|
||||
@@ -3820,7 +3820,7 @@ namespace Game
|
||||
GameObjectTemplate got = Global.ObjectMgr.GetGameObjectTemplate(entry);
|
||||
if (got == null)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "GameObject template (Entry: {0}) does not exist but has a record in `gameobject_template_addon`", entry);
|
||||
Log.outError(LogFilter.Sql, $"GameObject template (Entry: {entry}) does not exist but has a record in `gameobject_template_addon`");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3829,10 +3829,11 @@ namespace Game
|
||||
gameObjectAddon.flags = result.Read<uint>(2);
|
||||
gameObjectAddon.mingold = result.Read<uint>(3);
|
||||
gameObjectAddon.maxgold = result.Read<uint>(4);
|
||||
gameObjectAddon.WorldEffectID = result.Read<uint>(5);
|
||||
|
||||
// checks
|
||||
if (gameObjectAddon.faction != 0 && !CliDB.FactionTemplateStorage.ContainsKey(gameObjectAddon.faction))
|
||||
Log.outError(LogFilter.Sql, "GameObject (Entry: {0}) has invalid faction ({1}) defined in `gameobject_template_addon`.", entry, gameObjectAddon.faction);
|
||||
Log.outError(LogFilter.Sql, $"GameObject (Entry: {entry}) has invalid faction ({gameObjectAddon.faction}) defined in `gameobject_template_addon`.");
|
||||
|
||||
if (gameObjectAddon.maxgold > 0)
|
||||
{
|
||||
@@ -3842,13 +3843,18 @@ namespace Game
|
||||
case GameObjectTypes.FishingHole:
|
||||
break;
|
||||
default:
|
||||
Log.outError(LogFilter.Sql, "GameObject (Entry {0} GoType: {1}) cannot be looted but has maxgold set in `gameobject_template_addon`.", entry, got.type);
|
||||
Log.outError(LogFilter.Sql, $"GameObject (Entry {entry} GoType: {got.type}) cannot be looted but has maxgold set in `gameobject_template_addon`.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_gameObjectTemplateAddonStore[entry] = gameObjectAddon;
|
||||
if (gameObjectAddon.WorldEffectID != 0 && !CliDB.WorldEffectStorage.ContainsKey(gameObjectAddon.WorldEffectID))
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"GameObject (Entry: {entry}) has invalid WorldEffectID ({gameObjectAddon.WorldEffectID}) defined in `gameobject_template_addon`, set to 0.");
|
||||
gameObjectAddon.WorldEffectID = 0;
|
||||
}
|
||||
|
||||
_gameObjectTemplateAddonStore[entry] = gameObjectAddon;
|
||||
++count;
|
||||
}
|
||||
while (result.NextRow());
|
||||
@@ -4062,8 +4068,8 @@ namespace Game
|
||||
|
||||
_gameObjectAddonStorage.Clear();
|
||||
|
||||
// 0 1 2 3 4 5 6
|
||||
SQLResult result = DB.World.Query("SELECT guid, parent_rotation0, parent_rotation1, parent_rotation2, parent_rotation3, invisibilityType, invisibilityValue FROM gameobject_addon");
|
||||
// 0 1 2 3 4 5 6 7
|
||||
SQLResult result = DB.World.Query("SELECT guid, parent_rotation0, parent_rotation1, parent_rotation2, parent_rotation3, invisibilityType, invisibilityValue, WorldEffectID FROM gameobject_addon");
|
||||
|
||||
if (result.IsEmpty())
|
||||
{
|
||||
@@ -4079,7 +4085,7 @@ namespace Game
|
||||
GameObjectData goData = GetGOData(guid);
|
||||
if (goData == null)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "GameObject (GUID: {0}) does not exist but has a record in `gameobject_addon`", guid);
|
||||
Log.outError(LogFilter.Sql, $"GameObject (GUID: {guid}) does not exist but has a record in `gameobject_addon`");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -4087,32 +4093,39 @@ namespace Game
|
||||
gameObjectAddon.ParentRotation = new Quaternion(result.Read<float>(1), result.Read<float>(2), result.Read<float>(3), result.Read<float>(4));
|
||||
gameObjectAddon.invisibilityType = (InvisibilityType)result.Read<byte>(5);
|
||||
gameObjectAddon.invisibilityValue = result.Read<uint>(6);
|
||||
gameObjectAddon.WorldEffectID = result.Read<uint>(7);
|
||||
|
||||
if (gameObjectAddon.invisibilityType >= InvisibilityType.Max)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "GameObject (GUID: {0}) has invalid InvisibilityType in `gameobject_addon`, disabled invisibility", guid);
|
||||
Log.outError(LogFilter.Sql, $"GameObject (GUID: {guid}) has invalid InvisibilityType in `gameobject_addon`, disabled invisibility");
|
||||
gameObjectAddon.invisibilityType = InvisibilityType.General;
|
||||
gameObjectAddon.invisibilityValue = 0;
|
||||
}
|
||||
|
||||
if (gameObjectAddon.invisibilityType != 0 && gameObjectAddon.invisibilityValue == 0)
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "GameObject (GUID: {0}) has InvisibilityType set but has no InvisibilityValue in `gameobject_addon`, set to 1", guid);
|
||||
Log.outError(LogFilter.Sql, $"GameObject (GUID: {guid}) has InvisibilityType set but has no InvisibilityValue in `gameobject_addon`, set to 1");
|
||||
gameObjectAddon.invisibilityValue = 1;
|
||||
}
|
||||
|
||||
if (!gameObjectAddon.ParentRotation.isUnit())
|
||||
{
|
||||
Log.outError(LogFilter.Sql, "GameObject (GUID: {0}) has invalid parent rotation in `gameobject_addon`, set to default", guid);
|
||||
Log.outError(LogFilter.Sql, $"GameObject (GUID: {guid}) has invalid parent rotation in `gameobject_addon`, set to default");
|
||||
gameObjectAddon.ParentRotation = Quaternion.WAxis;
|
||||
}
|
||||
|
||||
if (gameObjectAddon.WorldEffectID != 0 && !CliDB.WorldEffectStorage.ContainsKey(gameObjectAddon.WorldEffectID))
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"GameObject (GUID: {guid}) has invalid WorldEffectID ({gameObjectAddon.WorldEffectID}) in `gameobject_addon`, set to 0.");
|
||||
gameObjectAddon.WorldEffectID = 0;
|
||||
}
|
||||
|
||||
_gameObjectAddonStorage[guid] = gameObjectAddon;
|
||||
++count;
|
||||
}
|
||||
while (result.NextRow());
|
||||
|
||||
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} gameobject addons in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
|
||||
Log.outInfo(LogFilter.ServerLoading, $"Loaded {count} gameobject addons in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
|
||||
}
|
||||
public void LoadGameObjectQuestItems()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user