Revert all TagMap changes and fix some exceptions

This commit is contained in:
DeKaN 2023-01-26 19:25:16 +04:00
parent d044a9c1fd
commit 9d046be1d1
No known key found for this signature in database
GPG Key ID: 8133F26EAA20C471
27 changed files with 44 additions and 45 deletions

View File

@ -42,8 +42,8 @@ namespace DiIiS_NA.Core.MPQ.FileFormats
};
public Header Header { get; private set; }
public int SNOParentAnimSet { get; private set; }
private TagMap TagMapAnimDefault;
private TagMap[] AnimSetTagMaps;
public TagMap TagMapAnimDefault { get; private set; }
public TagMap[] AnimSetTagMaps;
private Dictionary<int, AnimationSno> _animations;
@ -63,7 +63,7 @@ namespace DiIiS_NA.Core.MPQ.FileFormats
if (SNOParentAnimSet != -1)
{
var ani = (AnimSet)MPQStorage.Data.Assets[SNOGroup.AnimSet][SNOParentAnimSet].Data;
return defaultAnimations.Union(ani.Animations.Where(x => !defaultAnimations.ContainsKey(x.Key))).ToDictionary(x => x.Key, x => (AnimationSno)x.Value);
return defaultAnimations.Union(ani.Animations.Where(x => !defaultAnimations.ContainsKey(x.Key))).ToDictionary(x => x.Key, x => x.Value);
}
return defaultAnimations;
}

View File

@ -58,7 +58,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
Logger.Trace("Breaked barricade, id: {0}", SNO);
if (AnimationSet.Animations.ContainsKey(AnimationSetKeys.DeathDefault.ID))
if (AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.DeathDefault))
World.BroadcastIfRevealed(plr => new PlayAnimationMessage
{
ActorID = DynamicID(plr),
@ -69,7 +69,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
new PlayAnimationMessageSpec()
{
Duration = 10,
AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.DeathDefault.ID], //{DeathDefault = 10217}
AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.DeathDefault], //{DeathDefault = 10217}
PermutationIndex = 0,
AnimationTag = 0,
Speed = 1

View File

@ -57,7 +57,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
Logger.Trace("Breaked barricade, id: {0}", SNO);
if (this.AnimationSet.Animations.ContainsKey(AnimationSetKeys.DeathDefault.ID))
if (AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.DeathDefault))
World.BroadcastIfRevealed(plr => new PlayAnimationMessage
{
ActorID = DynamicID(plr),
@ -68,7 +68,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
new PlayAnimationMessageSpec()
{
Duration = 10,
AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.DeathDefault.ID],
AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.DeathDefault],
PermutationIndex = 0,
AnimationTag = 0,
Speed = 1

View File

@ -41,7 +41,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
{
bool Activated = false;
this.PlayAnimation(5, AnimationSet.Animations[AnimationSetKeys.Opening.ID]);
this.PlayAnimation(5, (AnimationSno)AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]);
Attributes[GameAttribute.Team_Override] = (Activated ? -1 : 2);
Attributes[GameAttribute.Untargetable] = !Activated;
Attributes[GameAttribute.NPC_Is_Operatable] = Activated;
@ -81,7 +81,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
}
else
{
this.PlayAnimation(5, AnimationSet.Animations[AnimationSetKeys.Opening.ID]);
this.PlayAnimation(5, (AnimationSno)AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]);
}
return true;
}

View File

@ -106,7 +106,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
(source as Player).AddAchievementCounter(74987243307171, 1);
}
if (this.AnimationSet.Animations.ContainsKey(AnimationSetKeys.DeathDefault.ID))
if (AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.DeathDefault))
World.BroadcastIfRevealed(plr => new PlayAnimationMessage
{
ActorID = DynamicID(plr),
@ -117,7 +117,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
new PlayAnimationMessageSpec()
{
Duration = 10,
AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.DeathDefault.ID],
AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.DeathDefault],
PermutationIndex = 0,
AnimationTag = 0,
Speed = 1

View File

@ -98,7 +98,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
new PlayAnimationMessageSpec()
{
Duration = 500,
AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID],
AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening],
PermutationIndex = 0,
AnimationTag = 0,
Speed = 1

View File

@ -159,7 +159,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
new PlayAnimationMessageSpec()
{
Duration = 50,
AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID],
AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening],
PermutationIndex = 0,
AnimationTag = 0,
Speed = 1

View File

@ -37,7 +37,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
if (!base.Reveal(player))
return false;
var animation = Attributes[GameAttribute.Untargetable] ? AnimationSet.Animations[AnimationSetKeys.Open.ID] : AnimationSet.Animations[AnimationSetKeys.IdleDefault.ID];
var animationTag = Attributes[GameAttribute.Untargetable] ? AnimationSetKeys.Open : AnimationSetKeys.IdleDefault;
var animation = (AnimationSno)AnimationSet.TagMapAnimDefault[animationTag];
PlayAnimation(5, animation);
SetIdleAnimation(animation);

View File

@ -66,7 +66,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
new PlayAnimationMessageSpec()
{
Duration = duration,
AnimationSNO = (int)(ActorData.TagMap.ContainsKey(ActorKeys.DeathAnimationTag) ? AnimationSet.Animations[ActorData.TagMap[ActorKeys.DeathAnimationTag]] : AnimationSet.Animations[AnimationSetKeys.DeathDefault.ID]) ,
AnimationSNO = ActorData.TagMap.ContainsKey(ActorKeys.DeathAnimationTag) ? AnimationSet.TagMapAnimDefault[ActorData.TagMap[ActorKeys.DeathAnimationTag]].Int : AnimationSet.TagMapAnimDefault[AnimationSetKeys.DeathDefault],
PermutationIndex = 0,
AnimationTag = 0,
Speed = 1

View File

@ -61,7 +61,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
new PlayAnimationMessageSpec()
{
Duration = 50,
AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID],
AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening],
PermutationIndex = 0,
AnimationTag = 0,
Speed = 1

View File

@ -71,7 +71,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.ScriptObjects
new PlayAnimationMessageSpec()
{
Duration = 600,
AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID],
AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening],
PermutationIndex = 0,
AnimationTag = 0,
Speed = 1

View File

@ -81,7 +81,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.ScriptObjects
new PlayAnimationMessageSpec()
{
Duration = idDuration,
AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID],
AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening],
PermutationIndex = 0,
AnimationTag = 0,
Speed = 1

View File

@ -84,7 +84,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.ScriptObjects
new PlayAnimationMessageSpec()
{
Duration = 50,
AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID],
AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening],
PermutationIndex = 0,
AnimationTag = 0,
Speed = 1

View File

@ -72,7 +72,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.ScriptObjects
new PlayAnimationMessageSpec()
{
Duration = 1000,
AnimationSNO = (int)AnimationSet.Animations[AnimationSetKeys.Opening.ID],
AnimationSNO = AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening],
PermutationIndex = 0,
AnimationTag = 0,
Speed = 1

View File

@ -28,8 +28,8 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations
if (Attributes[GameAttribute.Disabled]) return;
PlayAnimation(5, AnimationSet.Animations[AnimationSetKeys.Opening.ID]);
SetIdleAnimation(AnimationSet.Animations[AnimationSetKeys.Opening.ID]);
PlayAnimation(5, (AnimationSno)AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]);
SetIdleAnimation((AnimationSno)AnimationSetKeys.Open.ID);
Attributes[GameAttribute.Gizmo_Has_Been_Operated] = true;
Attributes.BroadcastChangedIfRevealed();

View File

@ -1539,7 +1539,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
//{[1013103213, {[Actor] [Type: Gizmo] SNOId:78439 GlobalId: 1013103213 Position: x:119.54008 y:140.65799 z:-4.535186 Name: Test_CainIntro_greybox_bridge_trOut_TempWorking}]}
//Обрушиваем мостик //EffectGroup "CainIntro_shake", 81546
var bridge = encWorld.GetActorBySNO(ActorSno._test_cainintro_greybox_bridge_trout_tempworking);
bridge.PlayAnimation(5, bridge.AnimationSet.Animations[AnimationSetKeys.DeathDefault.ID]);
bridge.PlayAnimation(5, (AnimationSno)bridge.AnimationSet.TagMapAnimDefault[AnimationSetKeys.DeathDefault]);
//}
foreach (var skeleton in Skeletons)
{

View File

@ -939,7 +939,7 @@ namespace DiIiS_NA.GameServer.GSSystem.GameSystem
{
while (MonsterCount < AdditionalTargetCounter + 20)
{
Core.Types.Math.Vector3D SSV = Scenes[RandomHelper.Next(0, Scenes.Count - 1)].Position;
Core.Types.Math.Vector3D SSV = Scenes[RandomHelper.Next(0, Scenes.Count)].Position;
Core.Types.Math.Vector3D SP = null;
while (true)
{

View File

@ -569,9 +569,9 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
monster.EnterWorld(position);
if (monster.AnimationSet != null)
{
var animationTag = new[] { AnimationSetKeys.Spawn.ID, AnimationSetKeys.Spawn2.ID }.FirstOrDefault(x => monster.AnimationSet.Animations.ContainsKey(x));
var animationTag = new[] { AnimationSetKeys.Spawn, AnimationSetKeys.Spawn2 }.FirstOrDefault(x => monster.AnimationSet.TagMapAnimDefault.ContainsKey(x));
if (animationTag > 0)
if (animationTag != null)
{
monster.World.BroadcastIfRevealed(plr => new PlayAnimationMessage
{
@ -583,7 +583,7 @@ namespace DiIiS_NA.GameServer.GSSystem.MapSystem
new PlayAnimationMessageSpec()
{
Duration = 150,
AnimationSNO = (int)monster.AnimationSet.Animations[animationTag],
AnimationSNO = monster.AnimationSet.TagMapAnimDefault[animationTag],
PermutationIndex = 0,
Speed = 1
}

View File

@ -530,8 +530,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
var HubWorld = player.InGameClient.Game.GetWorld(WorldSno.x1_tristram_adventure_mode_hub);
var NStone = HubWorld.GetActorBySNO(ActorSno._x1_openworld_lootrunobelisk_b);
bool Activated = true;
NStone.SetIdleAnimation(NStone.AnimationSet.Animations[AnimationSetKeys.IdleDefault.ID]);
NStone.PlayActionAnimation(NStone.AnimationSet.Animations[AnimationSetKeys.Closing.ID]);
NStone.SetIdleAnimation((AnimationSno)NStone.AnimationSet.TagMapAnimDefault[AnimationSetKeys.IdleDefault]);
NStone.PlayActionAnimation((AnimationSno)NStone.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Closing]);
NStone.Attributes[GameAttribute.Team_Override] = (Activated ? -1 : 2);
NStone.Attributes[GameAttribute.Untargetable] = !Activated;
NStone.Attributes[GameAttribute.NPC_Is_Operatable] = Activated;

View File

@ -1715,7 +1715,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
#region Активация
NStone = World.GetActorBySNO(ActorSno._x1_openworld_lootrunobelisk_b);
NStone.PlayAnimation(5, NStone.AnimationSet.Animations[AnimationSetKeys.Opening.ID]);
NStone.PlayAnimation(5, (AnimationSno)NStone.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]);
NStone.Attributes[GameAttribute.Team_Override] = (Activated ? -1 : 2);
NStone.Attributes[GameAttribute.Untargetable] = !Activated;
NStone.Attributes[GameAttribute.NPC_Is_Operatable] = Activated;
@ -1852,7 +1852,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem
actor.Destroy();
#region Активация
NStone = World.GetActorBySNO(ActorSno._x1_openworld_lootrunobelisk_b);
NStone.PlayAnimation(5, NStone.AnimationSet.Animations[AnimationSetKeys.Opening.ID]);
NStone.PlayAnimation(5, (AnimationSno)NStone.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]);
NStone.Attributes[GameAttribute.Team_Override] = (Activated ? -1 : 2);
NStone.Attributes[GameAttribute.Untargetable] = !Activated;
NStone.Attributes[GameAttribute.NPC_Is_Operatable] = Activated;

View File

@ -119,7 +119,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
if (payload.Target == User && payload is DeathPayload)
{
if (User.GetActorsInRange(80f).Count > 100) return;
User.PlayAnimation(11, User.AnimationSet.Animations[AnimationSetKeys.Explode.ID]);
User.PlayAnimation(11, (AnimationSno)User.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Explode]);
for (int i = 0; i < 3; i++)
{
var monster = ActorFactory.Create(User.World, (User as Monster).SNOSummons[0], new TagMap());
@ -170,7 +170,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations
SuicideTimer = null;
var dmgTargets = GetEnemiesInRadius(User.Position, 6f);
WeaponDamage(dmgTargets, 5.0f, DamageType.Physical);
User.PlayAnimation(11, User.AnimationSet.Animations[AnimationSetKeys.Attack.ID]);
User.PlayAnimation(11, (AnimationSno)User.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Attack]);
WeaponDamage(User, 1000.0f, DamageType.Physical);
//(User as Living).Kill();
//foreach (var anim in Target.AnimationSet.TagMapAnimDefault)

View File

@ -1176,7 +1176,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
private AnimationSno FindBestDeathAnimationSNO()
{
if (Context != null)
if (Context == null)
return AnimationSno._NONE;
// check if power has special death animation, and roll chance to use it
@ -1211,8 +1211,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
private AnimationSno GetSNOFromTag(TagKeyInt tag)
{
if (Target.AnimationSet != null && Target.AnimationSet.Animations.ContainsKey(tag.ID))
return (AnimationSno)Target.AnimationSet.Animations[tag.ID];
if (Target.AnimationSet != null && Target.AnimationSet.TagMapAnimDefault.ContainsKey(tag))
return (AnimationSno)Target.AnimationSet.TagMapAnimDefault[tag];
else
return AnimationSno._NONE;
}

View File

@ -821,9 +821,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads
if (Target.World.BuffManager.GetFirstBuff<KnockbackBuff>(Target) == null &&
Target.AnimationSet != null)
{
if (Target.AnimationSet.Animations.ContainsKey(AnimationSetKeys.GetHit.ID) && FastRandom.Instance.Next(100) < 33)
if (Target.AnimationSet.TagMapAnimDefault.ContainsKey(AnimationSetKeys.GetHit) && FastRandom.Instance.Next(100) < 33)
{
var hitAni = Target.AnimationSet.Animations[AnimationSetKeys.GetHit.ID];
var hitAni = (AnimationSno)Target.AnimationSet.TagMapAnimDefault[AnimationSetKeys.GetHit];
if (hitAni != AnimationSno._NONE)
{
// HACK: hardcoded animation speed/ticks, need to base those off hit recovery speed

View File

@ -1220,8 +1220,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
ListenProximity(ActorSno._woodfencee_fields_trout, new Advance()); //if going through graveyard
var Gate = world.GetActorBySNO(ActorSno._cemetary_gate_trout_wilderness_no_lock);
Gate.Field2 = 16;
var animation = Gate.AnimationSet.Animations[AnimationSetKeys.Opening.ID];
Gate.PlayAnimation(5, animation);
Gate.PlayAnimation(5, (AnimationSno)Gate.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]);
world.BroadcastIfRevealed(plr => new MessageSystem.Message.Definitions.ACD.ACDCollFlagsMessage
{
ActorID = Gate.DynamicID(plr),
@ -1896,8 +1895,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem
var world = Game.GetWorld(WorldSno.trout_townattack_chapelcellar_a);
foreach (var Table in world.GetActorsBySNO(ActorSno._trout_townattack_cellar_altar)) {
Table.SetUsable(false);
var animation = Table.AnimationSet.Animations[AnimationSetKeys.Open.ID];
Table.SetIdleAnimation(animation);
Table.SetIdleAnimation((AnimationSno)Table.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Open]);
}
foreach (var Maghda in world.GetActorsBySNO(ActorSno._maghda_a_tempprojection)) Maghda.Destroy();
});

View File

@ -172,7 +172,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents.Implementations
var AllTablets = DrownedTempleWorld.GetActorsBySNO(ActorSno._a1dun_caves_nephalem_altar_tablet_a);
foreach (var Tablet in AllTablets)
{
Tablet.PlayAnimation(5, Tablet.AnimationSet.Animations[AnimationSetKeys.Opening.ID]);
Tablet.PlayAnimation(5, (AnimationSno)Tablet.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening]);
DrownedTempleWorld.BroadcastIfRevealed(plr => new SetIdleAnimationMessage
{
ActorID = Tablet.DynamicID(plr),

View File

@ -65,7 +65,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents.Implementations
StartConversation(world, 17923);
SkeletonKing_Bridge.PlayAnimation(5, SkeletonKing_Bridge.AnimationSet.Animations[AnimationSetKeys.Opening.ID], 1f);
SkeletonKing_Bridge.PlayAnimation(5, (AnimationSno)SkeletonKing_Bridge.AnimationSet.TagMapAnimDefault[AnimationSetKeys.Opening], 1f);
world.BroadcastIfRevealed(plr => new SetIdleAnimationMessage
{

View File

@ -126,7 +126,7 @@ namespace DiIiS_NA
using var proc = Process.GetCurrentProcess();
var cpuTime = proc.TotalProcessorTime;
var text =
$"{name} | {PlayerManager.OnlinePlayers.Count()} onlines in {PlayerManager.OnlinePlayers.Count(s => s.InGameClient.Player.World != null)} worlds | Memory: {totalMemory:0.000} GB | CPU Time: {cpuTime.ToSmallText()} | Uptime: {uptime}";
$"{name} | {PlayerManager.OnlinePlayers.Count()} onlines in {PlayerManager.OnlinePlayers.Count(s => s.InGameClient?.Player?.World != null)} worlds | Memory: {totalMemory:0.000} GB | CPU Time: {cpuTime.ToSmallText()} | Uptime: {uptime}";
try
{
Console.Title = text;