Exemplo n.º 1
0
        protected void DropExperienceOrbs()
        {
            var exp   = (short)Math.Min(Experience, short.MaxValue);
            var level = Utilities.Misc.Experience.GetLevel(exp);

            if (level < 1)
            {
                return;
            }
            var expToDrop = (short)Math.Min(level * 7, 100);
            var orb       = new ExpOrbEntity(Server, Server.AllocateEntity(), expToDrop);

            orb.Position = Position;
            Server.AddEntity(orb);
        }
Exemplo n.º 2
0
        private void PickupExpOrb(ExpOrbEntity orb)
        {
            if (Server.GetEntityById(orb.EntityId) == null)
            {
                return;
            }

            Server.SendPacketToNearbyPlayers(orb.World, UniversalCoords.FromAbsWorld(orb.Position), new CollectItemPacket
            {
                EntityId = orb.EntityId,
                PlayerId = EntityId
            });

            Server.RemoveEntity(orb);

            AddExperience(orb.Experience);
        }
Exemplo n.º 3
0
        protected void DropExperienceOrbs()
        {
            short minExp = (MinExp < 0 ? (short)0 : MinExp);
            short maxExp = (MaxExp > short.MaxValue ? short.MaxValue : MaxExp);

            if (maxExp < 1 || maxExp < minExp)
            {
                return;
            }

            short exp = (short)(minExp + Server.Rand.Next(0, maxExp - minExp));

            if (exp < 1)
            {
                return;
            }

            var orb = new ExpOrbEntity(Server, Server.AllocateEntity(), exp);

            orb.Position = Position;
            Server.AddEntity(orb);
        }
Exemplo n.º 4
0
        private void PickupExpOrb(ExpOrbEntity orb)
        {
            if (Server.GetEntityById(orb.EntityId) == null)
                return;

            Server.SendPacketToNearbyPlayers(orb.World, UniversalCoords.FromAbsWorld(orb.Position), new CollectItemPacket
            {
                EntityId = orb.EntityId,
                PlayerId = EntityId
            });

            Server.RemoveEntity(orb);

            AddExperience(orb.Experience);
        }
Exemplo n.º 5
0
 protected void DropExperienceOrbs()
 {
     var exp = (short)Math.Min(Experience, short.MaxValue);
     var level = Utilities.Misc.Experience.GetLevel(exp);
     if (level < 1)
         return;
     var expToDrop = (short)Math.Min(level * 7, 100);
     var orb = new ExpOrbEntity(Server, Server.AllocateEntity(), expToDrop);
     orb.Position = Position;
     Server.AddEntity(orb);
 }
Exemplo n.º 6
0
Arquivo: Mob.cs Projeto: TheaP/c-raft
        protected void DropExperienceOrbs()
        {
            short minExp = (MinExp < 0 ? (short)0 : MinExp);
            short maxExp = (MaxExp > short.MaxValue ? short.MaxValue : MaxExp);

            if (maxExp < 1 || maxExp < minExp)
                return;

            short exp = (short)(minExp + Server.Rand.Next(0, maxExp - minExp));

            if (exp < 1)
                return;

            var orb = new ExpOrbEntity(Server, Server.AllocateEntity(), exp);
            orb.Position = Position;
            Server.AddEntity(orb);
        }