Beispiel #1
0
        public override void PostUpdate(DateTime tick, List <SubPacket> packets = null)
        {
            if (updateFlags != ActorUpdateFlags.None)
            {
                packets = packets ?? new List <SubPacket>();

                if ((updateFlags & ActorUpdateFlags.Appearance) != 0)
                {
                    packets.Add(new SetActorAppearancePacket(modelId, appearanceIds).BuildPacket(actorId));
                }

                if ((updateFlags & ActorUpdateFlags.State) != 0)
                {
                    packets.Add(SetActorStatePacket.BuildPacket(actorId, currentMainState, 0x0));
                    packets.Add(CommandResultX00Packet.BuildPacket(actorId, 0x72000062, 0));
                    packets.Add(CommandResultX01Packet.BuildPacket(actorId, 0x7C000062, 21001, new CommandResult(actorId, 0, 1)));

                    updateFlags &= ~ActorUpdateFlags.State;
                    //DoBattleAction(21001, 0x7C000062, new BattleAction(this.actorId, 0, 1, 0, 0, 1)); //Attack Mode
                }

                if ((updateFlags & ActorUpdateFlags.SubState) != 0)
                {
                    packets.Add(SetActorSubStatePacket.BuildPacket(actorId, currentSubState));
                    packets.Add(CommandResultX00Packet.BuildPacket(actorId, 0x72000062, 0));
                    packets.Add(CommandResultX01Packet.BuildPacket(actorId, 0x7C000062, 21001, new CommandResult(actorId, 0, 1)));

                    updateFlags &= ~ActorUpdateFlags.SubState;
                    //DoBattleAction(21001, 0x7C000062, new BattleAction(this.actorId, 0, 1, 0, 0, 1)); //Attack Mode
                }

                if ((updateFlags & ActorUpdateFlags.Status) != 0)
                {
                    List <SubPacket> statusPackets = statusEffects.GetStatusPackets();
                    packets.AddRange(statusPackets);
                    statusPackets.Clear();
                    updateFlags &= ~ActorUpdateFlags.Status;
                }

                if ((updateFlags & ActorUpdateFlags.StatusTime) != 0)
                {
                    packets.AddRange(statusEffects.GetStatusTimerPackets());
                    statusEffects.ResetPropPacketUtil();
                    updateFlags &= ~ActorUpdateFlags.StatusTime;
                }

                if ((updateFlags & ActorUpdateFlags.HpTpMp) != 0)
                {
                    var propPacketUtil = new ActorPropertyPacketUtil("charaWork/stateAtQuicklyForAll", this);
                    propPacketUtil.AddProperty("charaWork.parameterSave.hp[0]");
                    propPacketUtil.AddProperty("charaWork.parameterSave.hpMax[0]");
                    propPacketUtil.AddProperty("charaWork.parameterSave.mp");
                    propPacketUtil.AddProperty("charaWork.parameterSave.mpMax");
                    propPacketUtil.AddProperty("charaWork.parameterTemp.tp");
                    packets.AddRange(propPacketUtil.Done());
                }

                base.PostUpdate(tick, packets);
            }
        }
Beispiel #2
0
        public void DoBattleAction(ushort commandId, uint animationId, CommandResult[] actions)
        {
            int currentIndex = 0;

            //AoE abilities only ever hit 16 people, so we probably won't need this loop anymore
            //Apparently aoe are limited to 8?
            while (true)
            {
                if (actions.Length - currentIndex >= 10)
                {
                    zone.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex));
                }
                else if (actions.Length - currentIndex > 1)
                {
                    zone.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex));
                }
                else if (actions.Length - currentIndex == 1)
                {
                    zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, actions[currentIndex]));
                    currentIndex++;
                }
                else
                {
                    break;
                }

                //I think aoe effects play on all hit enemies. Firaga does at least
                //animationId = 0; //If more than one packet is sent out, only send the animation once to avoid double playing.
            }
        }
Beispiel #3
0
        public void DoBattleAction(ushort commandId, uint animationId, List <CommandResult> actions)
        {
            int currentIndex = 0;

            while (true)
            {
                if (actions.Count - currentIndex >= 10)
                {
                    zone.BroadcastPacketAroundActor(this, CommandResultX18Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex));
                }
                else if (actions.Count - currentIndex > 1)
                {
                    zone.BroadcastPacketAroundActor(this, CommandResultX10Packet.BuildPacket(actorId, animationId, commandId, actions, ref currentIndex));
                }
                else if (actions.Count - currentIndex == 1)
                {
                    zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, actions[currentIndex]));
                    currentIndex++;
                }
                else
                {
                    break;
                }

                //Sending multiple packets at once causes some issues. Setting any combination of these to zero changes what breaks
                //animationId = 0; //If more than one packet is sent out, only send the animation once to avoid double playing.
                //commandId = 0;
                //sourceActorId = 0;
            }
        }
Beispiel #4
0
 public override void OnInterrupt()
 {
     // todo: send paralyzed/sleep message etc.
     if (errorResult != null)
     {
         owner.zone.BroadcastPacketAroundActor(owner, CommandResultX01Packet.BuildPacket(errorResult.targetId, errorResult.animation, 0x765D, errorResult));
         errorResult = null;
     }
 }
Beispiel #5
0
 public void DoBattleAction(ushort commandId, uint animationId, CommandResult action)
 {
     zone.BroadcastPacketAroundActor(this, CommandResultX01Packet.BuildPacket(actorId, animationId, commandId, action));
 }