예제 #1
0
        public static void HandleMove(MapleClient c, PacketReader pr)
        {
            int         objectId = pr.ReadInt();
            MapleSummon summon   = c.Account.Character.Map.GetSummon(objectId);

            if (summon != null && summon.Owner.Id == c.Account.Character.Id && summon.MovementType != SummonMovementType.Stationary)
            {
                pr.Skip(4);
                Point startPosition = pr.ReadPoint();
                pr.Skip(4);
                List <MapleMovementFragment> movements = ParseMovement.Parse(pr);
                if (movements != null && movements.Count > 0)
                {
                    c.Account.Character.Map.BroadcastPacket(summon.MovePacket(startPosition, movements), c.Account.Character);
                    for (int i = movements.Count - 1; i >= 0; i--)
                    {
                        if (movements[i] is AbsoluteLifeMovement)
                        {
                            summon.Position = movements[i].Position;
                            break;
                        }
                    }
                }
            }
        }
        public static void Handle(MapleClient c, PacketReader pr)
        {
            pr.Skip(1); //dont know, == 1 in spawn map and becomes 3 after changing map
            pr.Skip(4); //CRC ?
            int tickCount = pr.ReadInt();

            pr.Skip(1);
            pr.Skip(4); //new v137
            Point originalPosition = pr.ReadPoint();

            pr.Skip(4); //wobble?

            List <MapleMovementFragment> movementList = ParseMovement.Parse(pr);

            updatePosition(movementList, c.Account.Character, 0);
            MapleMap Map = c.Account.Character.Map;

            if (movementList != null && pr.Available > 10 && Map.CharacterCount > 1)
            {
                PacketWriter packet = CharacterMovePacket(c.Account.Character.Id, movementList, originalPosition);
                Map.BroadcastPacket(packet, c.Account.Character);
            }
        }
예제 #3
0
        public static void Handle(MapleClient c, PacketReader pr)
        {
            if (c.Account.Character.Map != null)
            {
                int          objectId = pr.ReadInt();
                MapleMonster Mob      = c.Account.Character.Map.GetMob(objectId);
                if (Mob == null)
                {
                    return;
                }
                lock (Mob.MobLock)
                {
                    if (!Mob.Alive)
                    {
                        return;
                    }
                    if (Mob.GetController() != c.Account.Character)
                    {
                        c.SendPacket(MapleMonster.RemoveMobControl(objectId));
                        return;
                    }
                    pr.Skip(1);
                    short moveID     = pr.ReadShort();
                    bool  useSkill   = pr.ReadBool();
                    byte  skill      = pr.ReadByte();
                    int   unk        = pr.ReadInt();
                    Point startPos   = Mob.Position;
                    int   skillid    = 0;
                    int   skilllevel = 0;
                    if (useSkill)
                    {
                        if (Mob.WzInfo.Skills.Count > 0)
                        {
                            if (skill >= 0 && skill < Mob.WzInfo.Skills.Count)
                            {
                                MobSkill mobSkill = Mob.WzInfo.Skills[skill];
                                if ((DateTime.UtcNow - Mob.SkillTimes[mobSkill]).TotalMilliseconds > mobSkill.interval)// && mobSkill.summonOnce
                                {
                                    Mob.SkillTimes[mobSkill] = DateTime.UtcNow;
                                    if (mobSkill.hp <= Mob.HpPercent)
                                    {
                                        //supposed to apply efffect here :/
                                        //todo $$
                                        //mobSkill.applyEffect(chr, monster, true);
                                        skillid    = mobSkill.Skill;
                                        skilllevel = mobSkill.Level;
                                    }
                                }
                            }
                            else
                            {
                                return;//hacking?
                            }
                        }
                    }
                    List <int>   unkList  = new List <int>();
                    List <short> unkList2 = new List <short>();
                    byte         count    = pr.ReadByte();
                    for (int i = 0; i < count; i++)
                    {
                        unkList.Add(pr.ReadInt());
                    }
                    count = pr.ReadByte();
                    for (int i = 0; i < count; i++)
                    {
                        unkList.Add(pr.ReadShort());
                    }

                    pr.Skip(30);
                    List <MapleMovementFragment> Res = ParseMovement.Parse(pr);
                    if (Res != null && Res.Count > 0)
                    {
                        updatePosition(Res, Mob, -1);
                        if (Mob.Alive)
                        {
                            MoveResponse(c, objectId, moveID, Mob.ControllerHasAggro, (short)Mob.WzInfo.MP, 0, 0);
                            MoveMob(c, objectId, useSkill, skill, unk, startPos, Res, unkList, unkList2);
                        }
                    }
                    else
                    {
                        ServerConsole.Warning("Monster Res == null or empty!");
                    }
                }
            }
        }