Esempio n. 1
0
        private void BuildRoom()
        {
            switch (RoomType)
            {
            case RoomType.Entry:
                break;

            case RoomType.Outry:
                break;

            case RoomType.Casual:
                //Permet de récupérer les classes filles de MobEntity
                IEnumerable <Type> ChildClasses = Assembly.GetAssembly(typeof(MobEntity)).GetTypes().Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(MobEntity)));
                object[]           paramArray   = new object[] { Game, SpriteBatch, Player };
                Random             r            = new Random();

                int mobCount = r.Next(2, 5);
                for (int i = 0; i < mobCount; i++)
                {
                    Mobs.Add((MobEntity)Activator.CreateInstance(ChildClasses.ElementAt(r.Next(0, ChildClasses.Count())), args: paramArray));
                }
                foreach (Entity ett in Mobs)
                {
                    ett.Position = new Vector2(r.Next(-tileWidth * 10 * 16, tileWidth * 10 * 16), r.Next(-tileWidth * 10 * 16, tileWidth * 10 * 16));
                }
                break;

            default:
                break;
            }
        }
Esempio n. 2
0
 public void WyrmPortal()
 {
     for (int i = 0; i < 7; i++)
     {
         Mobs.Add(new DragonPortal {
             Portal = this
         });
     }
     for (int i = 0; i < 3; i++)
     {
         Mobs.Add(new ShadowWyrmPortal {
             Portal = this
         });
     }
     for (int i = 0; i < 3; i++)
     {
         Mobs.Add(new AncientWyrm {
             Portal = this
         });
     }
     for (int i = 0; i < 2; i++)
     {
         Mobs.Add(new HarrowerTentaclesPortal {
             Portal = this
         });
     }
 }
Esempio n. 3
0
 public void AddMob(MobState mob)
 {
     Mobs.Add(mob);
     if (IdsUsed.Contains(mob.Id))
     {
         throw new OpenDiablo2Exception("Tried to insert an existing mob id!");
     }
     IdsUsed.Add(mob.Id);
 }
Esempio n. 4
0
        private void AddMob(byte[] rawdata)
        {
            var data = Functions.GetData(rawdata);
            Mob m    = Mob.MobClient((MobClass)data[0], new Vector2((float)data[2], (float)data[3]));

            m.Netid  = (int)data[1];
            m.Target = m.Position;
            Mobs.Add(m);
        }
Esempio n. 5
0
        public int spawnMob(int spawnid, Life life)
        {
            int id  = _objectIDs.NextValue();
            Mob mob = new Mob(id, ID, life.ID, new Pos(life.X, life.Y), (short)life.Foothold, MobControlStatus.ControlNormal);

            mob.SetSpawnData(life);
            Mobs.Add(mob);
            MobPacket.SendMobSpawn(null, mob, 0, null, true, false);
            UpdateMobControl(mob, true, null);
            return(id);
        }
Esempio n. 6
0
 public void AddCharacter(Character character)
 {
     if (character is PlayerCharacter)
     {
         Players.Add(character as PlayerCharacter);
     }
     else if (character is NonPlayerCharacter)
     {
         Mobs.Add(character as NonPlayerCharacter);
     }
 }
Esempio n. 7
0
        private Task LoadMobs()
        {
            return(Task.Factory.StartNew(() =>
            {
                var mobs = MobInfo.Table.Rows.Cast <DataRow>()
                           .Where(x => Convert.ToInt32(x["IsNPC"]) == 0 &&
                                  Convert.ToInt32(x["Type"]) != 6 &&
                                  Convert.ToInt32(x["Type"]) != 12 &&
                                  Convert.ToInt32(x["Type"]) != 13);


                foreach (var row in mobs)
                {
                    var mob = new Mob();
                    mob.MobLevel = Convert.ToByte(row["Level"]);
                    mob.InxName = row["InxName"].ToString();
                    mob.DropGroups = new BindingList <MobDropGroupEntry>();
                    mob.MinLevel = 1;
                    mob.MaxLevel = 150;

                    var dropRow = ItemDropTable.DataSet.Tables[0].Rows.Cast <DataRow>().FirstOrDefault(x => x["MobId"].ToString() == mob.InxName);

                    if (dropRow != null)
                    {
                        mob.MinLevel = Convert.ToInt32(dropRow["MinLevel"]);
                        mob.MaxLevel = Convert.ToInt32(dropRow["MaxLevel"]);
                        mob.MinCen = Convert.ToInt32(dropRow["MinCen"]);
                        mob.MaxCen = Convert.ToInt32(dropRow["MaxCen"]);
                        mob.CenRate = Convert.ToDecimal(dropRow["CenRate"]) / 10000;

                        for (int i = 1; i < 46; i++)
                        {
                            var grp = dropRow["DrItem" + i].ToString();
                            var grpRate = Convert.ToDecimal(dropRow["DrItem" + i + "R"]) / 10000;
                            var UpGradeMin = Convert.ToInt32(dropRow[$"UpGradeMin{i:D2}"]);
                            var UpGradeMax = Convert.ToInt32(dropRow[$"UpGradeMax{i:D2}"]);

                            if (grp != "-")
                            {
                                var group = Groups.FirstOrDefault(x => x.Index == grp);

                                if (group != null)
                                {
                                    mob.DropGroups.Add(new MobDropGroupEntry(group, grpRate, UpGradeMin, UpGradeMax));
                                }
                            }
                        }
                    }

                    Mobs.Add(mob);
                }
            }));
        }
Esempio n. 8
0
        private static void ReadMobs()
        {
            int Count = Reader.ReadInt32();

            for (int i = 0; i < Count; i++)
            {
                MobData data = new MobData();
                data.ID              = Reader.ReadInt32();
                data.Level           = Reader.ReadByte();
                data.Boss            = Reader.ReadBoolean();
                data.Undead          = Reader.ReadBoolean();
                data.BodyAttack      = Reader.ReadBoolean();
                data.SummonType      = Reader.ReadByte();
                data.EXP             = Reader.ReadInt32();
                data.MaxHP           = Reader.ReadInt32();
                data.MaxMP           = Reader.ReadInt32();
                data.HPRecoverAmount = Reader.ReadInt32();
                data.MPRecoverAmount = Reader.ReadInt32();
                data.Speed           = Reader.ReadInt16();

                byte summons = Reader.ReadByte();
                data.Revive = new List <int>();
                for (byte j = 0; j < summons; j++)
                {
                    data.Revive.Add(Reader.ReadInt32());
                }

                byte skills = Reader.ReadByte();
                data.Skills = new List <MobSkillData>();
                for (byte j = 0; j < skills; j++)
                {
                    MobSkillData msd = new MobSkillData();
                    msd.SkillID     = (byte)Reader.ReadInt16();
                    msd.Level       = Reader.ReadByte();
                    msd.EffectAfter = Reader.ReadInt16();
                    data.Skills.Add(msd);
                }

                byte attacks = Reader.ReadByte();
                data.Attacks = new Dictionary <byte, MobAttackData>();
                for (byte j = 0; j < attacks; j++)
                {
                    MobAttackData mad = new MobAttackData();
                    mad.ID         = j;            //Reader.ReadByte();
                    mad.MPConsume  = (short)Reader.ReadUInt16();
                    mad.MPBurn     = (short)Reader.ReadUInt16();
                    mad.SkillID    = (short)Reader.ReadUInt16();
                    mad.SkillLevel = Reader.ReadByte();
                    data.Attacks.Add(mad.ID, mad);
                }
                Mobs.Add(data.ID, data);
            }
        }
Esempio n. 9
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, false);

            Mobs.Add(mob);

            MobPacket.SendMobSpawn(null, mob, 0, null, true, false);
            UpdateMobControl(mob, true, null);

            return(id);
        }
Esempio n. 10
0
 public void MinotaurPortal()
 {
     for (int i = 0; i < 12; i++)
     {
         Mobs.Add(new MinotaurWarriorPortal {
             Portal = this
         });
     }
     for (int i = 0; i < 2; i++)
     {
         Mobs.Add(new HarrowerTentaclesPortal {
             Portal = this
         });
     }
 }
Esempio n. 11
0
        public int spawnMob(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, summonEffect != 0 && owner != null);

            Mobs.Add(mob);
            if (summonEffect != 0)
            {
                mob.Owner = owner;
                if (owner != null)
                {
                    owner.SpawnedMobs.Add(id, mob);
                }
            }
            MobPacket.SendMobSpawn(null, mob, summonEffect, owner, (owner == null), false);

            UpdateMobControl(mob, true, null);
            return(id);
        }
Esempio n. 12
0
 protected MonsterHouseBaseStep(MonsterHouseBaseStep <T> other) : this()
 {
     for (int ii = 0; ii < other.Items.Count; ii++)
     {
         Items.Add(new MapItem(other.Items.GetSpawn(ii)), other.Items.GetSpawnRate(ii));
     }
     for (int ii = 0; ii < other.ItemThemes.Count; ii++)
     {
         ItemThemes.Add(other.ItemThemes.GetSpawn(ii).Copy(), other.ItemThemes.GetSpawnRate(ii));
     }
     for (int ii = 0; ii < other.Mobs.Count; ii++)
     {
         Mobs.Add(other.Mobs.GetSpawn(ii).Copy(), other.Mobs.GetSpawnRate(ii));
     }
     for (int ii = 0; ii < other.MobThemes.Count; ii++)
     {
         MobThemes.Add(other.MobThemes.GetSpawn(ii).Copy(), other.MobThemes.GetSpawnRate(ii));
     }
 }
Esempio n. 13
0
 public void DemonPortal()
 {
     for (int i = 0; i < 3; i++)
     {
         Mobs.Add(new AbysmalHorrorPortal {
             Portal = this
         });
     }
     for (int i = 0; i < 6; i++)
     {
         Mobs.Add(new DevourerPortal {
             Portal = this
         });
     }
     for (int i = 0; i < 2; i++)
     {
         Mobs.Add(new HarrowerTentaclesPortal {
             Portal = this
         });
     }
 }
Esempio n. 14
0
 public void UndeadPortal()
 {
     for (int i = 0; i < 10; i++)
     {
         Mobs.Add(new DreamWraithPortal {
             Portal = this
         });
     }
     for (int i = 0; i < 10; i++)
     {
         Mobs.Add(new UndeadWarDogPortal {
             Portal = this
         });
     }
     for (int i = 0; i < 2; i++)
     {
         Mobs.Add(new HarrowerTentaclesPortal {
             Portal = this
         });
     }
 }
Esempio n. 15
0
 public void BeetlePortal()
 {
     for (int i = 0; i < 6; i++)
     {
         Mobs.Add(new RockBeetlePortal {
             Portal = this
         });
     }
     for (int i = 0; i < 11; i++)
     {
         Mobs.Add(new DoomBeetlePortal {
             Portal = this
         });
     }
     for (int i = 0; i < 2; i++)
     {
         Mobs.Add(new HarrowerTentaclesPortal {
             Portal = this
         });
     }
 }
Esempio n. 16
0
 public void LummoxPortal()
 {
     for (int i = 0; i < 10; i++)
     {
         Mobs.Add(new LummoxWarriorPortal {
             Portal = this
         });
     }
     for (int i = 0; i < 10; i++)
     {
         Mobs.Add(new LummoxMagePortal {
             Portal = this
         });
     }
     for (int i = 0; i < 2; i++)
     {
         Mobs.Add(new HarrowerTentaclesPortal {
             Portal = this
         });
     }
 }
Esempio n. 17
0
    private void RollM()//дописать!
    {
        for (int i = 0; i < RoomSize; i++)
        {
            int      randmob = Random.Range(0, 2);
            Monsters mon;
            switch (randmob)
            {
            case 0:
                mon = Creator.CreateSkeleton();
                break;

            case 1:
                mon = Creator.CreateSpider();
                break;

            default:
                mon = Creator.CreateSkeleton();
                break;
            }
            Mobs.Add(mon);
            HeroesAndMobs.Add(mon);
        }
    }
Esempio n. 18
0
 public void AddMob(Mob mob)
 {
     Mobs.Add(mob);
     // a mob just arrived...
 }