Пример #1
0
        public static Obj_AI_Base GetMobs(float spellRange, MobTypes mobTypes = MobTypes.All, int minMobCount = 1)
        {
            List <Obj_AI_Base> mobs = MinionManager.GetMinions(spellRange + 200, MinionTypes.All, MinionTeam.Neutral, MinionOrderTypes.MaxHealth);

            if (mobs == null)
            {
                return(null);
            }

            if (mobTypes == MobTypes.BigBoys)
            {
                Obj_AI_Base oMob = (from fMobs in mobs
                                    from fBigBoys in
                                    new[]
                {
                    "SRU_Blue", "SRU_Gromp", "SRU_Murkwolf", "SRU_Razorbeak", "SRU_Red",
                    "SRU_Krug", "SRU_Dragon", "SRU_Baron", "Sru_Crab"
                }
                                    where fBigBoys == fMobs.SkinName
                                    select fMobs).FirstOrDefault();

                if (oMob != null)
                {
                    if (oMob.IsValidTarget(spellRange))
                    {
                        return(oMob);
                    }
                }
            }
            else if (mobs.Count >= minMobCount)
            {
                return(mobs[0]);
            }
            return(null);
        }
Пример #2
0
        public void ParseMobTypes(
            AsyncRPGDataContext db_context,
            string mob_types_file_path)
        {
            // Clear out any existing room templates
            db_context.ExecuteCommand("DELETE FROM mob_types");

            // Read in the given JSON file and save it into the mob types table
            string         jsonString     = "";
            MobTypeDataSet jsonMobTypeSet = null;

            using (StreamReader streamReader = new StreamReader(mob_types_file_path))
            {
                jsonString = streamReader.ReadToEnd();

                if (jsonString.Length == 0)
                {
                    throw new Exception("MobTypeParser: Mob type file empty: " + mob_types_file_path);
                }
            }

            jsonMobTypeSet = JsonMapper.ToObject <MobTypeDataSet>(jsonString);

            {
                Dictionary <string, MobTypeData> validMobTypes = new Dictionary <string, MobTypeData>();

                foreach (MobTypeData jsonMobType in jsonMobTypeSet.mob_types_set)
                {
                    if (ValidateMobType(jsonMobType, validMobTypes))
                    {
                        string mobTypeJsonString = JsonMapper.ToJson(jsonMobType);

                        MobTypes dbMobType = new MobTypes
                        {
                            MobTypeData = mobTypeJsonString
                        };

                        db_context.MobTypes.InsertOnSubmit(dbMobType);
                        db_context.SubmitChanges();

                        _logger.LogInfo("MobTypeParser: Added MobType:");
                        _logger.LogInfo(jsonMobType.mob_type_name);

                        validMobTypes.Add(jsonMobType.mob_type_name, jsonMobType);
                    }
                    else
                    {
                        throw new Exception("MobTypeParser: Problem(s) validating mob type: " + jsonMobType.mob_type_name);
                    }
                }
            }
        }
Пример #3
0
    public int GetMaxMobs(MobTypes mob)
    {
        switch (mob)
        {
        case MobTypes.Protester:
            return(_maxProtesters);

        case MobTypes.Globflob:
            return(_maxGlobflobs);
        }

        return(0);
    }
Пример #4
0
    public int GetCurrentMobs(MobTypes mob)
    {
        switch (mob)
        {
        case MobTypes.Protester:
            return(_currentProtesters);

        case MobTypes.Globflob:
            return(_currentGlobflobs);
        }

        return(0);
    }
Пример #5
0
    public void DecreaseCurrentMobsBy(MobTypes mob, int amount)
    {
        switch (mob)
        {
        case MobTypes.Protester:
            _currentProtesters -= amount;
            break;

        case MobTypes.Globflob:
            _currentGlobflobs -= amount;
            break;
        }
    }
Пример #6
0
            public static Vector2 Minions(Spell spell, MobTypes mobTypes = MobTypes.All, int minMobCount = 1)
            {
                var rangedMinionsE = LeagueSharp.Common.MinionManager.GetMinions(
                    ObjectManager.Player.ServerPosition,
                    Spells.E.Range);

                var minionsE = Spells.E.GetCircularFarmLocation(rangedMinionsE, spell.Range);

                if (minionsE.MinionsHit < minMobCount || !spell.IsInRange(minionsE.Position))
                {
                    return(new Vector2());
                }

                return(minionsE.Position);
            }
Пример #7
0
            public static Vector2 GetCircularFarmLocation(Spell spell, MobTypes mobTypes = MobTypes.All,
                                                          int minMobCount = 1)
            {
                var cVector        = new Vector2();
                var rangedMinionsE = LeagueSharp.Common.MinionManager.GetMinions(ObjectManager.Player.ServerPosition,
                                                                                 spell.Range, LeagueSharp.Common.MinionTypes.All);

                var minionsE = spell.GetCircularFarmLocation(rangedMinionsE, spell.Range);

                if (minionsE.MinionsHit > minMobCount && spell.IsInRange(minionsE.Position))
                {
                    cVector = minionsE.Position;
                }

                return(cVector);
            }
Пример #8
0
        public MobType(MobTypes db_mob_type)
        {
            m_mob_type_id = db_mob_type.MobTypeID;

            try
            {
                string jsonString = db_mob_type.MobTypeData;

                if (jsonString.Length == 0)
                {
                    throw new ArgumentException();
                }

                m_mob_type_data = JsonMapper.ToObject <MobTypeData>(jsonString);
            }
            catch (System.Exception)
            {
                m_mob_type_data = null;
            }
        }
Пример #9
0
            public static Vector2 Minions(Spell spell, MobTypes mobTypes = MobTypes.All, int minMobCount = 1)
            {
                var rangedMinionsE = LeagueSharp.Common.MinionManager.GetMinions(
                    ObjectManager.Player.ServerPosition,
                    Spells.E.Range);

                var minionsE = Spells.E.GetCircularFarmLocation(rangedMinionsE, spell.Range);
                if (minionsE.MinionsHit < minMobCount || !spell.IsInRange(minionsE.Position))
                {
                    return new Vector2();
                }

                return minionsE.Position;
            }
Пример #10
0
            public static Obj_AI_Base GetMobs(float spellRange, MobTypes mobTypes = MobTypes.All, int minMobCount = 1)
            {
                var mobs = LeagueSharp.Common.MinionManager.GetMinions(spellRange + 200,
                    LeagueSharp.Common.MinionTypes.All, MinionTeam.Neutral, MinionOrderTypes.MaxHealth);

                if (mobs == null) return null;

                if (mobTypes == MobTypes.BigBoys)
                {
                    var oMob = (from fMobs in mobs
                        from fBigBoys in
                            new[]
                            {
                                "SRU_Blue", "SRU_Gromp", "SRU_Murkwolf", "SRU_Razorbeak", "SRU_Red",
                                "SRU_Krug", "SRU_Dragon", "SRU_Baron", "Sru_Crab"
                            }
                        where fBigBoys == fMobs.BaseSkinName
                        select fMobs).FirstOrDefault();

                    if (oMob != null)
                    {
                        if (oMob.LSIsValidTarget(spellRange))
                        {
                            return oMob;
                        }
                    }
                }
                else if (mobs.Count >= minMobCount)
                {
                    return mobs[0];
                }

                return null;
            }
Пример #11
0
            public static Vector2 GetCircularFarmLocation(Spell spell, MobTypes mobTypes = MobTypes.All,
                int minMobCount = 1)
            {
                var cVector = new Vector2();
                var rangedMinionsE = LeagueSharp.Common.MinionManager.GetMinions(ObjectManager.Player.ServerPosition,
                    spell.Range);

                var minionsE = spell.GetCircularFarmLocation(rangedMinionsE, spell.Range);
                if (minionsE.MinionsHit > minMobCount && spell.IsInRange(minionsE.Position))
                {
                    cVector = minionsE.Position;
                }

                return cVector;
            }
Пример #12
0
    // SPAWNING
    public Mob Spawn(MobTypes mobType)
    {
        Mob newMob = Instantiate(_mobs[mobType]);

        return(newMob);
    }