mirror of
				https://bitbucket.org/Ioncannon/project-meteor-server.git
				synced 2025-05-20 08:26:59 -04:00 
			
		
		
		
	effect timers now display (<3 ion)
- added source/target to effects - todo: send battle packet crap
This commit is contained in:
		| @@ -912,7 +912,7 @@ namespace FFXIVClassic_Map_Server | |||||||
|                                 effect.SetExtra(extra); |                                 effect.SetExtra(extra); | ||||||
|  |  | ||||||
|                                 // dont wanna send ton of messages on login (i assume retail doesnt) |                                 // dont wanna send ton of messages on login (i assume retail doesnt) | ||||||
|                                 player.statusEffects.AddStatusEffect(effect, true); |                                 player.statusEffects.AddStatusEffect(effect, null, true); | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|   | |||||||
| @@ -128,6 +128,18 @@ namespace FFXIVClassic_Map_Server.Actors | |||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         public List<SubPacket> GetActorStatusPackets() | ||||||
|  |         { | ||||||
|  |             var propPacketUtil = new ActorPropertyPacketUtil("charaWork/status", this); | ||||||
|  |             var i = 0; | ||||||
|  |             foreach (var effect in statusEffects.GetStatusEffects()) | ||||||
|  |             { | ||||||
|  |                 propPacketUtil.AddProperty($"charaWork.statusShownTime[{i}]"); | ||||||
|  |                 i++; | ||||||
|  |             } | ||||||
|  |             return propPacketUtil.Done(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         public void PlayAnimation(uint animId, bool onlySelf = false) |         public void PlayAnimation(uint animId, bool onlySelf = false) | ||||||
|         {             |         {             | ||||||
|             if (onlySelf) |             if (onlySelf) | ||||||
|   | |||||||
| @@ -353,6 +353,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|         // todo: probably use get;set; |         // todo: probably use get;set; | ||||||
|  |  | ||||||
|         private Character owner; |         private Character owner; | ||||||
|  |         private Character source; | ||||||
|         private StatusEffectId id; |         private StatusEffectId id; | ||||||
|         private string name;        // name of this effect |         private string name;        // name of this effect | ||||||
|         private DateTime startTime; // when was this effect added |         private DateTime startTime; // when was this effect added | ||||||
| @@ -364,6 +365,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|         private UInt64 extra;       // optional value |         private UInt64 extra;       // optional value | ||||||
|         private StatusEffectFlags flags;         // death/erase/dispel etc |         private StatusEffectFlags flags;         // death/erase/dispel etc | ||||||
|         private StatusEffectOverwrite overwrite; // how to handle adding an effect with same id (see StatusEfectOverwrite) |         private StatusEffectOverwrite overwrite; // how to handle adding an effect with same id (see StatusEfectOverwrite) | ||||||
|  |         private bool silent = false;             // do i send a message on losing effect  | ||||||
|  |  | ||||||
|         public StatusEffect(Character owner, uint id, UInt64 magnitude, uint tickMs, uint durationMs, byte tier = 0) |         public StatusEffect(Character owner, uint id, UInt64 magnitude, uint tickMs, uint durationMs, byte tier = 0) | ||||||
|         { |         { | ||||||
| @@ -436,6 +438,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|             return owner; |             return owner; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         public Character GetSource() | ||||||
|  |         { | ||||||
|  |             return source; | ||||||
|  |         } | ||||||
|  |  | ||||||
|         public uint GetStatusEffectId() |         public uint GetStatusEffectId() | ||||||
|         { |         { | ||||||
|             return (uint)id; |             return (uint)id; | ||||||
| @@ -491,6 +498,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|             return (byte)overwrite; |             return (byte)overwrite; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         public bool GetSilent() | ||||||
|  |         { | ||||||
|  |             return silent; | ||||||
|  |         } | ||||||
|  |  | ||||||
|         public void SetStartTime(DateTime time) |         public void SetStartTime(DateTime time) | ||||||
|         { |         { | ||||||
|             this.startTime = time; |             this.startTime = time; | ||||||
| @@ -502,6 +514,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|             this.owner = owner; |             this.owner = owner; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         public void SetSource(Character source) | ||||||
|  |         { | ||||||
|  |             this.source = source; | ||||||
|  |         } | ||||||
|  |  | ||||||
|         public void SetName(string name) |         public void SetName(string name) | ||||||
|         { |         { | ||||||
|             this.name = name; |             this.name = name; | ||||||
| @@ -541,5 +558,10 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|         { |         { | ||||||
|             this.overwrite = (StatusEffectOverwrite)overwrite; |             this.overwrite = (StatusEffectOverwrite)overwrite; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         public void SetSilent(bool silent) | ||||||
|  |         { | ||||||
|  |             this.silent = silent; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ using System.Collections.Generic; | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using System.Text; | using System.Text; | ||||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||||
|  | using FFXIVClassic.Common; | ||||||
| using FFXIVClassic_Map_Server.Actors; | using FFXIVClassic_Map_Server.Actors; | ||||||
| using FFXIVClassic_Map_Server.lua; | using FFXIVClassic_Map_Server.lua; | ||||||
| using FFXIVClassic_Map_Server.actors.area; | using FFXIVClassic_Map_Server.actors.area; | ||||||
| @@ -43,7 +44,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|  |  | ||||||
|             if (sendUpdate) |             if (sendUpdate) | ||||||
|             { |             { | ||||||
|  |                 owner.zone.BroadcastPacketsAroundActor(owner, owner.GetActorStatusPackets()); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             sendUpdate = false; |             sendUpdate = false; | ||||||
| @@ -51,10 +52,10 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|  |  | ||||||
|         public bool AddStatusEffect(uint id, UInt64 magnitude, double tickMs, double durationMs, byte tier = 0) |         public bool AddStatusEffect(uint id, UInt64 magnitude, double tickMs, double durationMs, byte tier = 0) | ||||||
|         { |         { | ||||||
|             return AddStatusEffect(new StatusEffect(this.owner, id, magnitude, (uint)(tickMs * 1000), (uint)(durationMs * 1000), tier)); |             return AddStatusEffect(new StatusEffect(this.owner, id, magnitude, (uint)(tickMs * 1000), (uint)(durationMs * 1000), tier), owner); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public bool AddStatusEffect(StatusEffect newEffect, bool silent = false) |         public bool AddStatusEffect(StatusEffect newEffect, Character source, bool silent = false) | ||||||
|         { |         { | ||||||
|             // todo: check flags/overwritable and add effect to list |             // todo: check flags/overwritable and add effect to list | ||||||
|             var effect = GetStatusEffectById(newEffect.GetStatusEffectId()); |             var effect = GetStatusEffectById(newEffect.GetStatusEffectId()); | ||||||
| @@ -69,24 +70,31 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|  |  | ||||||
|             if (canOverwrite || effect == null) |             if (canOverwrite || effect == null) | ||||||
|             { |             { | ||||||
|                 if (!silent || (effect?.GetFlags() & (uint)StatusEffectFlags.Silent) == 0) |                 // send packet to client with effect added message | ||||||
|  |                 if (!silent || !effect.GetSilent() || (effect.GetFlags() & (uint)StatusEffectFlags.Silent) == 0) | ||||||
|                 { |                 { | ||||||
|                     // todo: send packet to client with effect added message |                     // todo: send packet to client with effect added message | ||||||
|  |                     //foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50)) | ||||||
|  |                     //    player.QueuePacket(packets.send.actor.battle.BattleActionX01Packet.BuildPacket(player.actorId, effect.GetSource().actorId, owner.actorId, 0, effect.GetStatusEffectId(), 0, effect.GetStatusId(), 0, 0)); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|  |                 // wont send a message about losing effect here | ||||||
|                 if (canOverwrite) |                 if (canOverwrite) | ||||||
|                     effects.Remove(newEffect.GetStatusEffectId()); |                     effects.Remove(newEffect.GetStatusEffectId()); | ||||||
|  |  | ||||||
|  |                 if (effects.Count < MAX_EFFECTS) | ||||||
|  |                 { | ||||||
|                     effects.Add(newEffect.GetStatusEffectId(), newEffect); |                     effects.Add(newEffect.GetStatusEffectId(), newEffect); | ||||||
|  |                     newEffect.SetSilent(silent); | ||||||
|                     // todo: this is retarded.. |                     // todo: this is retarded.. | ||||||
|                     { |                     { | ||||||
|                         var index = Array.IndexOf(effects.Values.ToArray(), newEffect); |                         var index = Array.IndexOf(effects.Values.ToArray(), newEffect); | ||||||
|                         owner.charaWork.status[index] = newEffect.GetStatusId(); |                         owner.charaWork.status[index] = newEffect.GetStatusId(); | ||||||
|                     owner.charaWork.statusShownTime[index] = (uint)(DateTime.Now.AddMilliseconds(newEffect.GetDurationMs()) - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds; |                         owner.charaWork.statusShownTime[index] = Utils.UnixTimeStampUTC() + (newEffect.GetDurationMs() / 1000); | ||||||
|                         this.owner.zone.BroadcastPacketAroundActor(this.owner, SetActorStatusPacket.BuildPacket(this.owner.actorId, (ushort)index, (ushort)newEffect.GetStatusId())); |                         this.owner.zone.BroadcastPacketAroundActor(this.owner, SetActorStatusPacket.BuildPacket(this.owner.actorId, (ushort)index, (ushort)newEffect.GetStatusId())); | ||||||
|                     } |                     } | ||||||
|                     sendUpdate = true; |                     sendUpdate = true; | ||||||
|  |                 } | ||||||
|                 return true; |                 return true; | ||||||
|             } |             } | ||||||
|             return false; |             return false; | ||||||
| @@ -97,9 +105,11 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|             if (effects.ContainsKey(effect.GetStatusEffectId())) |             if (effects.ContainsKey(effect.GetStatusEffectId())) | ||||||
|             { |             { | ||||||
|                 // send packet to client with effect remove message |                 // send packet to client with effect remove message | ||||||
|                 if (!silent || (effect.GetFlags() & (uint)StatusEffectFlags.Silent) == 0) |                 if (!silent || !effect.GetSilent() || (effect.GetFlags() & (uint)StatusEffectFlags.Silent) == 0) | ||||||
|                 { |                 { | ||||||
|                     // todo: send packet to client with effect removed message |                     // todo: send packet to client with effect removed message | ||||||
|  |                     //foreach (var player in owner.zone.GetActorsAroundActor<Player>(owner, 50)) | ||||||
|  |                     //    player.QueuePacket(packets.send.actor.battle.BattleActionX01Packet.BuildPacket(player.actorId, effect.GetSource().actorId, owner.actorId, 0, effect.GetStatusEffectId(), 0, effect.GetStatusId(), 0, 0)); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 // todo: this is retarded.. |                 // todo: this is retarded.. | ||||||
| @@ -109,7 +119,7 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|                     owner.charaWork.statusShownTime[index] = uint.MaxValue; |                     owner.charaWork.statusShownTime[index] = uint.MaxValue; | ||||||
|                     this.owner.zone.BroadcastPacketAroundActor(this.owner, SetActorStatusPacket.BuildPacket(owner.actorId, (ushort)index, (ushort)0)); |                     this.owner.zone.BroadcastPacketAroundActor(this.owner, SetActorStatusPacket.BuildPacket(owner.actorId, (ushort)index, (ushort)0)); | ||||||
|                 } |                 } | ||||||
|                 // function onLose(actor, effect |                 // function onLose(actor, effect) | ||||||
|                 LuaEngine.CallLuaStatusEffectFunction(this.owner, effect, "onLose", this.owner, effect); |                 LuaEngine.CallLuaStatusEffectFunction(this.owner, effect, "onLose", this.owner, effect); | ||||||
|                 effects.Remove(effect.GetStatusEffectId()); |                 effects.Remove(effect.GetStatusEffectId()); | ||||||
|                 sendUpdate = true; |                 sendUpdate = true; | ||||||
| @@ -132,8 +142,8 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai | |||||||
|         { |         { | ||||||
|             var newEffect = new StatusEffect(this.owner, effect); |             var newEffect = new StatusEffect(this.owner, effect); | ||||||
|             newEffect.SetOwner(this.owner); |             newEffect.SetOwner(this.owner); | ||||||
|  |             // todo: should source be copied too? | ||||||
|             return AddStatusEffect(newEffect) ? newEffect : null; |             return AddStatusEffect(newEffect, effect.GetSource()) ? newEffect : null; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public bool RemoveStatusEffectsByFlags(uint flags, bool silent = false) |         public bool RemoveStatusEffectsByFlags(uint flags, bool silent = false) | ||||||
|   | |||||||
| @@ -93,7 +93,20 @@ namespace FFXIVClassic_Map_Server.actors.chara.ai.controllers | |||||||
|  |  | ||||||
|         private void DoRoamTick(DateTime tick) |         private void DoRoamTick(DateTime tick) | ||||||
|         { |         { | ||||||
|  |             var battleNpc = owner as BattleNpc; | ||||||
|              |              | ||||||
|  |             if (battleNpc != null) | ||||||
|  |             { | ||||||
|  |                 if (battleNpc.hateContainer.GetHateList().Count > 0) | ||||||
|  |                 { | ||||||
|  |                     Engage(battleNpc.hateContainer.GetMostHatedTarget()); | ||||||
|  |                     return; | ||||||
|  |                 } | ||||||
|  |                 else if (battleNpc.currentLockedTarget != 0) | ||||||
|  |                 { | ||||||
|  |                      | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         private void DoCombatTick(DateTime tick) |         private void DoCombatTick(DateTime tick) | ||||||
|   | |||||||
| @@ -17,11 +17,11 @@ namespace FFXIVClassic_Map_Server.Actors | |||||||
|     [Flags] |     [Flags] | ||||||
|     enum AggroType |     enum AggroType | ||||||
|     { |     { | ||||||
|         None, |         None = 0x00, | ||||||
|         Sight, |         Sight = 0x01, | ||||||
|         Scent, |         Scent = 0x02, | ||||||
|         LowHp, |         LowHp = 0x04, | ||||||
|         IgnoreLevelDifference |         IgnoreLevelDifference = 0x08 | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     class BattleNpc : Npc |     class BattleNpc : Npc | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user