public void SetDefault()
 {
     Unknown = 0;
     Foothold = 0;
     PixelsPerSecond = new Pos(0, 0);
     Offset = new Pos(0, 0);
 }
 public MovableLife(short FH, Pos Position, byte pStance)
 {
     Stance = pStance;
     Position = new Pos(Position);
     Foothold = FH;
     Wobble = new Pos(0, 0);
 }
 public MovableLife()
 {
     Stance = 0;
     Foothold = 0;
     Position = new Pos();
     Wobble = new Pos(0, 0);
 }
 public AbstractLifeMovement(int pType, Pos pPos, int pDuration, int pNewState)
     : base()
 {
     this.Type = pType;
     this.Position = pPos;
     this.Duration = pDuration;
     this.NewState = pNewState;
 }
Example #5
0
 internal Mob(int id, int mapid, int mobid, Pos position, short foothold, MobControlStatus controlStatus)
     : base(foothold, position, 2)
 {
     Damages = new Dictionary<int, ulong>();
     OriginalFoothold = foothold;
     MobID = mobid;
     MapID = mapid;
     SpawnID = id;
     ControlStatus = controlStatus;
     DoesRespawn = true;
     OriginalPosition = position;
     Position = position;
     DeadsInFiveMinutes = 0;
     Init();
 }
Example #6
0
        public Drop(int mapid, Equip item, Pos position, int owner, bool playerdrop = false, int dropperid = 0)
        {
            QuestID = 0;
            Owner = owner;
            MapID = mapid;
            ItemData = item;
            PlayerID = 0;
            PlayerDrop = playerdrop;
            Type = (byte)DropType.Normal;
            Tradable = true;
            Position = position;
            Mesos = 0;
            Droptime = DateTime.Now;
            DropperID = dropperid;

            Master.Instance.DataProvider.Maps[MapID].AddDrop(this);
        }
        public void ChangeMap(int pMapId, Portal pTo)
        {
            Map Map = ChannelMaps[MapId];
            Map NewMap = ChannelMaps[pMapId];

            Map.RemovePlayer(this);
            PortalCount++;
            MapId = pMapId;

            MapPosition = pTo.ID;

            Position = new Pos(pTo.X, (short)(pTo.Y - 40));
            Stance = 0;
            Foothold = 0;

            Client.SendPacket(MapPacket.EnterField(this));

            NewMap.AddPlayer(this);
        }
        public void ChangeMap(int pMapId)
        {
            Map Map = ChannelMaps[MapId];
            Map NewMap = ChannelMaps[pMapId];

            Map.RemovePlayer(this);
            PortalCount++;
            MapId = pMapId;

            Portal Portal;
            Random Random = new Random();
            Portal = NewMap.SpawnPoints[Random.Next(0, NewMap.SpawnPoints.Count)];
            MapPosition = Portal.ID;
            Position = new Pos(Portal.X, (short)(Portal.Y - 40));
            Stance = 0;
            Foothold = 0;

            Client.SendPacket(MapPacket.EnterField(this));

            NewMap.AddPlayer(this);
        }
Example #9
0
        public int spawnMobNoRespawn(int mobid, Pos position, short foothold, Mob owner, byte summonEffect)
        {
            int id = ObjectIDs.NextValue();
            Mob mob = new Mob(id, ID, mobid, position, foothold, MobControlStatus.ControlNormal);
            mob.DoesRespawn = false;
            _Mobs.Add(mob);
            if (summonEffect != 0)
            {
                mob.Owner = owner;
                if (owner != null)
                {
                    mob.DoesRespawn = false; // Is mob of owner
                    owner.SpawnedMobs.Add(id, mob);
                }
            }
            //MobPacket.SendMobSpawn(null, mob, summonEffect, owner, (owner == null), false);

            UpdateMobControl(mob, true, null);
            return id;
        }
Example #10
0
        public static Packet PlayerMove(int pCharacterId, Packet pPacket, Pos pStartPos)
        {
            Packet p = new Packet();

            p.WriteShort((short)SendOpcodes.Player_Movement);
            p.WriteInt(pCharacterId);
            p.WriteInt(0);
            p.WritePosition(pStartPos);
            p.WriteHexString("25 FD D0 77");
            p.WriteByte(1);

            return p;
        }
 public static bool CheckSpeed(Pos PixelsPerSecond, float pAllowedSpeed)
 {
     float speedMod = Math.Abs(PixelsPerSecond.X) / 125f;
     return speedMod < pAllowedSpeed + 0.1f;
 }
Example #12
0
        public void CheckDead(Pos killPos = null)
        {
            //    if (HP == 0 && !IsDead)
            //    {
            //        IsDead = true;
            //        if (killPos != null) mPosition = killPos;
            //        setControl(null, false, null);
            //        MobPacket.SendMobDeath(this, 1);
            //        Character maxDmgChar = null;
            //        ulong maxDmgAmount = 0;
            //        MobData md = DataProvider.Mobs[MobID];
            //        DeadsInFiveMinutes++;

            //        foreach (KeyValuePair<int, ulong> dmg in Damages)
            //        {
            //            if (maxDmgAmount < dmg.Value && Server.CharacterList.ContainsKey(dmg.Key))
            //            {
            //                Character chr = Server.CharacterList[dmg.Key];
            //                if (chr.mMap == MapID)
            //                {
            //                    maxDmgAmount = dmg.Value;
            //                    maxDmgChar = chr;
            //                }
            //            }
            //        }
            //        if (maxDmgChar != null)
            //        {
            //            maxDmgChar.AddEXP((uint)EXP);
            //        }

            //        DropPacket.HandleDrops(maxDmgChar, MapID, Constants.getDropName(MobID, true), SpawnID, mPosition, false, false, false);

            //        foreach (int mobid in md.Revive)
            //        {
            //            DataProvider.Maps[MapID].spawnMobNoRespawn(mobid, mPosition, mFoothold);
            //        }

            //        Damages.Clear();

            //        if (DoesRespawn)
            //        {
            //            mPosition = OriginalPosition;
            //            mFoothold = OriginalFoothold;
            //            int derp = (int)(((((SpawnData == null ? 10 : SpawnData.RespawnTime + 1) / DataProvider.Maps[MapID].MobRate)) * DeadsInFiveMinutes) * 5);
            //            TimeSpan respawn = new TimeSpan(0, 0, derp);

            //            RunTimedFunction.AddTimedFunction(delegate
            //            {
            //                InitAndSpawn();
            //            }, respawn, new TimeSpan(), BetterTimerTypes.MobRespawn, MapID, SpawnID);
            //        }
            //        else
            //        {
            //            Clearup();
            //            DataProvider.Maps[MapID].RemoveMob(this);
            //        }
            //    }
        }
Example #13
0
 public Pos(Pos basePos)
 {
     X = basePos.X;
     Y = basePos.Y;
 }
Example #14
0
 public void DoDrop(Pos Origin)
 {
     Time = (int)DateTime.Now.Ticks;
     if (QuestID == 0)
     {
         if (!Tradable)
         {
             //DropPacket.ShowDrop(null, this, (byte)DropPacket.DropTypes.DisappearDuringDrop, false, Origin);
         }
         else
         {
             //DropPacket.ShowDrop(null, this, (byte)DropPacket.DropTypes.DropAnimation, true, Origin);
         }
     }
     else
     {
         Character chr = Master.Instance.DataProvider.Maps[MapID].GetPlayer(PlayerID);
         if (chr != null)
         {
             //DropPacket.ShowDrop(chr, this, (byte)DropPacket.DropTypes.DropAnimation, true, Origin);
         }
     }
 }
Example #15
0
        public int spawnMobNoRespawn(int mobid, Pos position, short foothold)
        {
            int id = ObjectIDs.NextValue();
            Mob mob = new Mob(id, ID, mobid, position, foothold, MobControlStatus.ControlNormal);
            mob.DoesRespawn = false;
            _Mobs.Add(mob);
            //MobPacket.SendMobSpawn(null, mob, 0, null, true, false);

            UpdateMobControl(mob, true, null);
            return id;
        }
Example #16
0
        public Pos FindFloor(Pos mainPos)
        {
            short x = mainPos.X;
            short y = (short)(mainPos.Y - 100);
            short maxy = mainPos.Y;

            bool firstCheck = true;

            for (int i = 0; i < Footholds.Count; i++)
            {
                Foothold fh = Footholds[i];
                if ((x > fh.X1 && x <= fh.X2) || (x > fh.X2 && x <= fh.X1))
                {
                    short cmax = (short)((float)(fh.Y1 - fh.Y2) / (fh.X1 - fh.X2) * (x - fh.X1) + fh.Y1);
                    if ((cmax <= maxy || (maxy == mainPos.Y && firstCheck)) && cmax >= y)
                    {
                        maxy = cmax;
                        firstCheck = false;
                    }
                }
            }
            return new Pos(x, maxy);
        }
 public void SetPixelsPerSecond(Pos pPos)
 {
     this.PixelsPerSecond = pPos;
 }
 public void SetOffset(Pos pWobble)
 {
     this.Offset = pWobble;
 }
 public AbsoluteLifeMovement(int pType, Pos pPos, int pDuration, int pNewState)
     : base(pType, pPos, pDuration, pNewState)
 {
 }