Ejemplo n.º 1
0
        public MobGroup(MonsterGenerator.RoomType roomType, int id, int minLevel, int maxLevel, int minWorld, int maxWorld, int frequency, MonsterGenerator.RegionSize minRegionSize, MonsterGenerator.RegionSize maxRegionSize)
        {
            this.roomType = roomType;

            this.id            = id;
            this.minLevel      = minLevel;
            this.maxLevel      = maxLevel;
            this.minWorld      = minWorld;
            this.maxWorld      = maxWorld;
            this.frequency     = frequency;
            this.minRegionSize = minRegionSize;
            this.maxRegionSize = maxRegionSize;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Zpracuje prikaz z konzole
        /// </summary>
        /// <param name="msg"></param>
        public void AdminCommand(string msg)
        {
            if (msg.ToLower().StartsWith("help"))
            {
                BroadcastMessage("group [group-ID]   - spawne grupu mobu z SpawnData.xml (automaticky zvoli groupy z kategorie main_room)");
                //BroadcastMessage("spawn [type] [group-ID]   - spawne grupu mobu z SpawnData.xml (za type se pise \"main\" \"side\" \"bonus\" \"boss\" \"end\" \"start\" a to da kategorii ze ktery se groupa bere)");
            }

            if (msg.ToLower().StartsWith("heal"))
            {
                CurrentPlayer.HealMe();
            }

            if (msg.ToLower().StartsWith("reuse"))
            {
                foreach (Skill sk in CurrentPlayer.Skills.Skills)
                {
                    if (sk is ActiveSkill)
                    {
                        ((ActiveSkill)sk).reuse = 0.5f;
                    }
                }
            }

            if (msg.ToLower().StartsWith("speed "))
            {
                string[] args = msg.Split(' ');
                int      val  = -1;

                try
                {
                    val = Int32.Parse(args[1]);
                }
                catch (Exception)
                {
                    BroadcastMessage("spatne parametry - zadejte cislo");
                    return;
                }

                CurrentPlayer.SetMoveSpeed(val);
            }

            if (msg.ToLower().StartsWith("maxhp "))
            {
                string[] args = msg.Split(' ');
                int      val  = -1;

                try
                {
                    val = Int32.Parse(args[1]);
                }
                catch (Exception)
                {
                    BroadcastMessage("spatne parametry - zadejte cislo");
                    return;
                }

                CurrentPlayer.UpdateMaxHp(val);
                CurrentPlayer.HealMe();
            }

            if (msg.ToLower().Equals("invis"))
            {
                CurrentPlayer.UpdateMaxHp(99999);
                CurrentPlayer.HealMe();
            }

            if (msg.ToLower().StartsWith("spawn "))
            {
                MonsterTemplateTable.Instance.Load();

                string[] args = msg.Split(' ');
                string   type = null;
                int      team = 0;

                try
                {
                    type = args[1];
                }
                catch (Exception)
                {
                    BroadcastMessage("spatne parametry - treba zadat jmeno monstera, ve jmenu nesmi byt mezera");
                    return;
                }

                try
                {
                    team = Int32.Parse(args[2]);
                }
                catch (Exception)
                {
                }

                Tile t = WorldHolder.instance.activeMap.GetTileFromWorldPosition(CurrentPlayer.GetData().GetBody().transform.position);

                if (t == null)
                {
                    return;
                }

                Monster m = GameSystem.Instance.SpawnMonster(type, Utils.GenerateRandomPositionAround(CurrentPlayer.GetData().GetBody().transform.position, 7, 4), false, 1, team);
                WorldHolder.instance.activeMap.RegisterMonsterToMap(m);
            }

            // spawn GROUP_ID || spawn TYPE GROUP_ID
            if (msg.ToLower().StartsWith("spawngroup ") || msg.ToLower().StartsWith("group "))
            {
                MonsterGenerator.Instance.LoadXmlFile();

                string[] args = msg.ToLower().Split(' ');
                int      id;
                string   type;

                try
                {
                    id   = Int32.Parse(args[1]);
                    type = "main";
                }
                catch (Exception)
                {
                    type = args[1];
                    id   = Int32.Parse(args[2]);
                }


                MonsterGenerator.RoomType currentRoomType = MonsterGenerator.RoomType.MAIN_ROOM;

                switch (type)
                {
                case "main":
                    currentRoomType = MonsterGenerator.RoomType.MAIN_ROOM;
                    break;

                case "side":
                    currentRoomType = MonsterGenerator.RoomType.SIDE_ROOM;
                    break;

                case "bonus":
                    currentRoomType = MonsterGenerator.RoomType.BONUS_ROOM;
                    break;

                case "boss":
                    currentRoomType = MonsterGenerator.RoomType.BOSS_ROOM;
                    break;

                case "end":
                    currentRoomType = MonsterGenerator.RoomType.END_ROOM;
                    break;

                case "start":
                    currentRoomType = MonsterGenerator.RoomType.START_ROOM;
                    break;

                case "extra":
                    currentRoomType = MonsterGenerator.RoomType.EXTRA_ROOM;
                    break;
                }

                Tile t = WorldHolder.instance.activeMap.GetTileFromWorldPosition(CurrentPlayer.GetData().GetBody().transform.position);

                if (t == null)
                {
                    return;
                }

                MapRoom room = t.region.GetParentOrSelf().GetMapRoom();

                room.Unexclude();

                MonsterGenerator.Instance.GenerateGenericEnemyGroup(room, WorldHolder.instance.activeMap.levelData, currentRoomType, 2, t.region.GetParentOrSelf(), id);

                room.Unexclude();
                BroadcastMessage("Spawned group ID " + id + " (roomtype " + currentRoomType + ")");
            }
        }