Esempio n. 1
0
		protected override void dispose( bool disposeManagedResources )
		{
			if ( !IsDisposed )
			{
				if ( disposeManagedResources )
				{
					if ( this.mMovable != null )
					{
						if ( !this.mMovable.IsDisposed )
						{
							this.mMovable.Dispose();
						}

						this.mMovable = null;
					}

					if ( this.mRend != null )
					{
						this.mRend = null;
					}

					if ( this.mLocalNode != null )
					{
						this.mTerrain.RootSceneNode.RemoveAndDestroyChild( this.mLocalNode.Name );
						this.mLocalNode = null;
					}

					for ( int i = 0; i < this.mChildren.Length; i++ )
					{
						if ( this.mChildren[ i ] != null )
						{
							this.mChildren[ i ].Dispose();
						}
					}

					DestroyCpuVertexData();
					DestroyGpuVertexData();
					DestroyGpuIndexData();

					if ( this.mLodLevels != null )
					{
						this.mLodLevels.Clear();
						this.mLodLevels = null;
					}

					this.mVertexDataRecord = null;
				}
			}

			base.dispose( disposeManagedResources );
		}
Esempio n. 2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="parent"></param>
 public Movable(TerrainQuadTreeNode parent, Rend renderable)
 {
     mParent = parent;
     mRend = renderable;
 }
Esempio n. 3
0
		public TerrainQuadTreeNode( Terrain terrain, TerrainQuadTreeNode parent, ushort xOff, ushort yOff, ushort size,
		                            ushort lod, ushort depth, ushort quadrant )
			: base()
		{
			this.mTerrain = terrain;
			this.mParent = parent;
			this.mOffsetX = xOff;
			this.mOffsetY = yOff;
			this.mBoundaryX = (ushort)( xOff + size );
			this.mBoundaryY = (ushort)( yOff + size );
			this.mSize = size;
			this.mBaseLod = lod;
			this.mDepth = depth;
			this.mQuadrant = quadrant;
			this.mBoundingRadius = 0;
			this.mCurrentLod = -1;
			this.mMaterialLodIndex = 0;
			this.mLodTransition = 0;
			this.mChildWithMaxHeightDelta = null;
			this.mSelfOrChildRendered = false;
			this.mNodeWithVertexData = null;
			this.mAABB = new AxisAlignedBox();
			if ( this.mTerrain.MaxBatchSize < size )
			{
				var childSize = (ushort)( ( ( size - 1 )*0.5f ) + 1 );
				var childOff = (ushort)( childSize - 1 );
				var childLod = (ushort)( lod - 1 ); // LOD levels decrease down the tree (higher detail)
				var childDepth = (ushort)( depth + 1 );
				// create children
				this.mChildren[ 0 ] = new TerrainQuadTreeNode( this.mTerrain, this, xOff, yOff, childSize, childLod, childDepth, 0 );
				this.mChildren[ 1 ] = new TerrainQuadTreeNode( this.mTerrain, this, (ushort)( xOff + childOff ), yOff, childSize,
				                                               childLod,
				                                               childDepth, 1 );
				this.mChildren[ 2 ] = new TerrainQuadTreeNode( this.mTerrain, this, xOff, (ushort)( yOff + childOff ), childSize,
				                                               childLod,
				                                               childDepth, 2 );
				this.mChildren[ 3 ] = new TerrainQuadTreeNode( this.mTerrain, this, (ushort)( xOff + childOff ),
				                                               (ushort)( yOff + childOff ),
				                                               childSize, childLod, childDepth, 3 );

				var ll = new LodLevel();
				// non-leaf nodes always render with minBatchSize vertices
				ll.BatchSize = this.mTerrain.MinBatchSize;
				ll.MaxHeightDelta = 0;
				ll.CalcMaxHeightDelta = 0;
				this.mLodLevels.Add( ll );
			}
			else
			{
				//no children
				Array.Clear( this.mChildren, 0, this.mChildren.Length );
				// this is a leaf node and may have internal LODs of its own
				var ownLod = this.mTerrain.NumLodLevelsPerLeaf;

				Debug.Assert( lod == ( ownLod - 1 ), "The lod passed in should reflect the number of lods in a leaf" );
				// leaf nodes always have a base LOD of 0, because they're always handling
				// the highest level of detail
				this.mBaseLod = 0;
				var sz = this.mTerrain.MaxBatchSize;

				while ( ownLod-- != 0 )
				{
					var ll = new LodLevel();
					ll.BatchSize = sz;
					ll.MaxHeightDelta = 0;
					ll.CalcMaxHeightDelta = 0;
					this.mLodLevels.Add( ll );
					if ( ownLod != 0 )
					{
						sz = (ushort)( ( ( sz - 1 )*0.5 ) + 1 );
					}
				}
				Debug.Assert( sz == this.mTerrain.MinBatchSize );
			}

			// local centre calculation
			// because of pow2 +1 there is always a middle point
			var midoffset = (ushort)( ( size - 1 )/2 );
			var midpointX = (ushort)( this.mOffsetX + midoffset );
			var midpointY = (ushort)( this.mOffsetY + midoffset );

			//derive the local centry, but give it a height if 0
			//TODO: - what if we actually centred this at the terrain height at this point?
			//would this be better?
			this.mTerrain.GetPoint( midpointX, midpointY, 0, ref this.mLocalCentre );
			this.mMovable = new Movable( this );
			this.mRend = new Rend( this );
		}
Esempio n. 4
0
        protected override void AddToMenu()
        {
            var comboMenu = Menu.AddSubMenu(new Menu(Global.Lang.Get("G_Combo"), Menu.Name + ".combo"));

            ManaManager.AddToMenu(comboMenu, "combo-q", ManaCheckType.Minimum, ManaValueType.Percent, "Q");
            HitchanceManager.AddToMenu(
                comboMenu.AddSubMenu(new Menu(Global.Lang.Get("F_MH"), comboMenu.Name + ".hitchance")), "combo",
                new Dictionary <string, int> {
                { "Q", 2 }
            });
            comboMenu.AddItem(new MenuItem(comboMenu.Name + ".q", Global.Lang.Get("G_UseQ")).SetValue(true));
            comboMenu.AddItem(new MenuItem(comboMenu.Name + ".e", Global.Lang.Get("G_UseE")).SetValue(true));
            comboMenu.AddItem(
                new MenuItem(comboMenu.Name + ".e-min", "E " + Global.Lang.Get("G_Min")).SetValue(new Slider(10, 1, 20)));

            var harassMenu = Menu.AddSubMenu(new Menu(Global.Lang.Get("G_Harass"), Menu.Name + ".harass"));

            HitchanceManager.AddToMenu(
                harassMenu.AddSubMenu(new Menu(Global.Lang.Get("F_MH"), harassMenu.Name + ".hitchance")), "harass",
                new Dictionary <string, int> {
                { "Q", 2 }
            });
            ManaManager.AddToMenu(harassMenu, "harass-q", ManaCheckType.Minimum, ManaValueType.Percent, "Q");
            harassMenu.AddItem(new MenuItem(harassMenu.Name + ".q", Global.Lang.Get("G_UseQ")).SetValue(true));
            ManaManager.AddToMenu(comboMenu, "harass-e", ManaCheckType.Minimum, ManaValueType.Percent, "E");
            harassMenu.AddItem(new MenuItem(harassMenu.Name + ".e", Global.Lang.Get("G_UseE")).SetValue(true));
            harassMenu.AddItem(
                new MenuItem(harassMenu.Name + ".e-min", "E " + Global.Lang.Get("G_Min")).SetValue(new Slider(5, 1, 15)));

            var laneclearMenu = Menu.AddSubMenu(new Menu(Global.Lang.Get("G_LaneClear"), Menu.Name + ".lane-clear"));

            ManaManager.AddToMenu(laneclearMenu, "lane-clear", ManaCheckType.Minimum, ManaValueType.Percent);
            laneclearMenu.AddItem(new MenuItem(laneclearMenu.Name + ".q", Global.Lang.Get("G_UseQ")).SetValue(true));
            laneclearMenu.AddItem(
                new MenuItem(laneclearMenu.Name + ".q-min-1", "Q " + Global.Lang.Get("G_Min") + " <= 4").SetValue(
                    new Slider(2, 1, 5)));
            laneclearMenu.AddItem(
                new MenuItem(laneclearMenu.Name + ".q-min-2", "Q " + Global.Lang.Get("G_Min") + " <= 7").SetValue(
                    new Slider(3, 1, 5)));
            laneclearMenu.AddItem(
                new MenuItem(laneclearMenu.Name + ".q-min-3", "Q " + Global.Lang.Get("G_Min") + " >= 10").SetValue(
                    new Slider(5, 1, 5)));
            laneclearMenu.AddItem(new MenuItem(laneclearMenu.Name + ".e", Global.Lang.Get("G_UseE")).SetValue(false));
            laneclearMenu.AddItem(
                new MenuItem(laneclearMenu.Name + ".e-min", "E " + Global.Lang.Get("G_Min")).SetValue(
                    new Slider(2, 1, 5)));
            laneclearMenu.AddItem(
                new MenuItem(laneclearMenu.Name + ".e-jungle", "E " + Global.Lang.Get("G_Jungle")).SetValue(true));

            var lasthitMenu = Menu.AddSubMenu(new Menu(Global.Lang.Get("G_LastHit"), Menu.Name + ".lasthit"));

            ManaManager.AddToMenu(lasthitMenu, "lasthit", ManaCheckType.Minimum, ManaValueType.Percent);
            lasthitMenu.AddItem(
                new MenuItem(lasthitMenu.Name + ".e-big", "E " + Global.Lang.Get("G_Big")).SetValue(true));
            lasthitMenu.AddItem(
                new MenuItem(lasthitMenu.Name + ".e-unkillable", "E " + Global.Lang.Get("G_Unkillable")).SetValue(true));
            lasthitMenu.AddItem(
                new MenuItem(lasthitMenu.Name + ".e-turret", "E " + Global.Lang.Get("G_Turret")).SetValue(true));

            var killstealMenu = Menu.AddSubMenu(new Menu(Global.Lang.Get("G_Killsteal"), Menu.Name + ".killsteal"));

            killstealMenu.AddItem(new MenuItem(killstealMenu.Name + ".e", Global.Lang.Get("G_UseE")).SetValue(true));

            var fleeMenu = Menu.AddSubMenu(new Menu(Global.Lang.Get("G_Flee"), Menu.Name + ".flee"));

            fleeMenu.AddItem(new MenuItem(fleeMenu.Name + ".aa", Global.Lang.Get("G_UseAutoAttacks")).SetValue(true));

            var ultimateMenu = Menu.AddSubMenu(new Menu(Global.Lang.Get("F_Ultimate"), Menu.Name + ".ultimate"));

            var blitzMenu = ultimateMenu.AddSubMenu(new Menu("Blitzcrank", ultimateMenu.Name + ".blitzcrank"));

            HeroListManager.AddToMenu(
                blitzMenu.AddSubMenu(new Menu(Global.Lang.Get("G_Blacklist"), blitzMenu.Name + ".blacklist")),
                "blitzcrank", false, false, true, false);

            blitzMenu.AddItem(new MenuItem(blitzMenu.Name + ".r", Global.Lang.Get("G_UseR")).SetValue(true));

            var tahmMenu = ultimateMenu.AddSubMenu(new Menu("Tahm Kench", ultimateMenu.Name + ".tahm-kench"));

            HeroListManager.AddToMenu(
                tahmMenu.AddSubMenu(new Menu(Global.Lang.Get("G_Blacklist"), tahmMenu.Name + ".blacklist")),
                "tahm-kench", false, false, true, false);

            tahmMenu.AddItem(new MenuItem(tahmMenu.Name + ".r", Global.Lang.Get("G_UseR")).SetValue(true));

            ultimateMenu.AddItem(new MenuItem(ultimateMenu.Name + ".save", Global.Lang.Get("G_Save")).SetValue(true));

            var miscMenu = Menu.AddSubMenu(new Menu(Global.Lang.Get("G_Miscellaneous"), Menu.Name + ".miscellaneous"));

            ManaManager.AddToMenu(miscMenu, "misc", ManaCheckType.Minimum, ManaValueType.Percent);
            miscMenu.AddItem(
                new MenuItem(miscMenu.Name + ".e-reset", Global.Lang.Get("Kalista_EHarassReset")).SetValue(true));
            miscMenu.AddItem(
                new MenuItem(miscMenu.Name + ".w-baron", Global.Lang.Get("Kalista_WBaron")).SetValue(
                    new KeyBind('J', KeyBindType.Press)));
            miscMenu.AddItem(
                new MenuItem(miscMenu.Name + ".w-dragon", Global.Lang.Get("Kalista_WDragon")).SetValue(
                    new KeyBind('K', KeyBindType.Press)));

            IndicatorManager.AddToMenu(DrawingManager.GetMenu(), true);
            IndicatorManager.Add(Q);
            IndicatorManager.Add(W);
            IndicatorManager.Add("E", Rend.GetDamage);
            IndicatorManager.Finale();

            TargetSelector.OverwriteWeightFunction("low-health", hero => hero.Health - Rend.GetDamage(hero));
            TargetSelector.AddWeightedItem(
                new WeightedItem(
                    "w-stack", "W " + Global.Lang.Get("G_Stack"), 10, false,
                    hero => hero.HasBuff("kalistacoopstrikemarkally") ? 10 : 0));
        }
Esempio n. 5
0
        protected override void LaneClear()
        {
            if (!ManaManager.Check("lane-clear"))
            {
                return;
            }

            var useQ = Menu.Item(Menu.Name + ".lane-clear.q").GetValue <bool>() && Q.IsReady();
            var useE = Menu.Item(Menu.Name + ".lane-clear.e").GetValue <bool>() && E.IsReady();

            if (!useQ && !useE)
            {
                return;
            }

            var minQ1   = Menu.Item(Menu.Name + ".lane-clear.q-min-1").GetValue <Slider>().Value;
            var minQ2   = Menu.Item(Menu.Name + ".lane-clear.q-min-2").GetValue <Slider>().Value;
            var minQ3   = Menu.Item(Menu.Name + ".lane-clear.q-min-3").GetValue <Slider>().Value;
            var minE    = Menu.Item(Menu.Name + ".lane-clear.e-min").GetValue <Slider>().Value;
            var minQ    = 0;
            var minions = MinionManager.GetMinions(
                Q.Range, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.MaxHealth);

            if (minions.Count == 0)
            {
                return;
            }
            if (minions.Count >= 10)
            {
                minQ = minQ3;
            }
            else if (minions.Count <= 7)
            {
                minQ = minQ2;
            }
            else if (minions.Count <= 4)
            {
                minQ = minQ1;
            }
            if (useQ && minions.Count >= minQ && !Player.IsWindingUp && !Player.IsDashing())
            {
                foreach (var minion in minions.Where(x => x.Health <= Q.GetDamage(x)))
                {
                    var killcount = 0;

                    foreach (var colminion in
                             QGetCollisions(Player, Player.ServerPosition.Extend(minion.ServerPosition, Q.Range)))
                    {
                        if (colminion.Health <= Q.GetDamage(colminion))
                        {
                            killcount++;
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (killcount >= minQ)
                    {
                        Q.Cast(minion.ServerPosition);
                        break;
                    }
                }
            }
            if (useE)
            {
                var killable = minions.Where(m => E.IsInRange(m) && Rend.IsKillable(m, false)).ToList();
                if (killable.Count >= minE ||
                    (killable.Count >= 1 && Menu.Item(Menu.Name + ".lane-clear.e-jungle").GetValue <bool>() &&
                     killable.Any(m => m.Team == GameObjectTeam.Neutral)))
                {
                    E.Cast();
                }
            }
        }
Esempio n. 6
0
        protected override void Combo()
        {
            var useQ = Menu.Item(Menu.Name + ".combo.q").GetValue <bool>() && Q.IsReady() && ManaManager.Check("combo-q");
            var useE = Menu.Item(Menu.Name + ".combo.e").GetValue <bool>() && E.IsReady();

            if (useQ)
            {
                Casting.SkillShot(Q, Q.GetHitChance("combo"));
            }

            if (useE)
            {
                var target = TargetSelector.GetTarget(E);
                if (target != null && Rend.HasBuff(target))
                {
                    if (target.Distance(Player) > Orbwalking.GetRealAutoAttackRange(target))
                    {
                        var minion =
                            GameObjects.EnemyMinions.FirstOrDefault(
                                m => m.IsValidTarget(Orbwalking.GetRealAutoAttackRange(m)) && Rend.IsKillable(m, true));
                        if (minion != null)
                        {
                            E.Cast();
                        }
                    }
                    else if (E.IsInRange(target))
                    {
                        if (Rend.IsKillable(target, false))
                        {
                            E.Cast();
                        }
                        else
                        {
                            var buff = Rend.GetBuff(target);
                            if (buff != null &&
                                buff.Count >= Menu.Item(Menu.Name + ".combo.e-min").GetValue <Slider>().Value)
                            {
                                if (target.Distance(Player) > E.Range * 0.8 || buff.EndTime - Game.Time < 0.3)
                                {
                                    E.Cast();
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 7
0
        private void OnCorePreUpdate(EventArgs args)
        {
            try
            {
                if (Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Combo &&
                    Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Flee)
                {
                    var eBig    = Menu.Item(Menu.Name + ".lasthit.e-big").GetValue <bool>();
                    var eTurret = Menu.Item(Menu.Name + ".lasthit.e-turret").GetValue <bool>();
                    var eReset  = Menu.Item(Menu.Name + ".miscellaneous.e-reset").GetValue <bool>();

                    IEnumerable <Obj_AI_Minion> minions = new HashSet <Obj_AI_Minion>();
                    if (eBig || eTurret || eReset)
                    {
                        minions =
                            GameObjects.EnemyMinions.Where(e => e.IsValidTarget(E.Range) && Rend.IsKillable(e, true));
                    }

                    if (E.IsReady())
                    {
                        if (eBig)
                        {
                            var creeps =
                                GameObjects.Jungle.Where(e => e.IsValidTarget(E.Range) && Rend.IsKillable(e, false))
                                .Concat(minions)
                                .ToList();
                            if (
                                creeps.Any(
                                    m =>
                                    (m.CharData.BaseSkinName.Contains("MinionSiege") ||
                                     m.CharData.BaseSkinName.Contains("Super") ||
                                     m.CharData.BaseSkinName.StartsWith("SRU_Dragon") ||
                                     m.CharData.BaseSkinName.StartsWith("SRU_Baron"))))
                            {
                                E.Cast();
                                return;
                            }
                        }

                        if (eTurret && ManaManager.Check("lasthit"))
                        {
                            var minion =
                                minions.FirstOrDefault(
                                    m => Utils.UnderAllyTurret(m.Position) && Rend.IsKillable(m, false));
                            if (minion != null)
                            {
                                E.Cast();
                                return;
                            }
                        }
                    }

                    if (eReset && E.IsReady() && ManaManager.Check("misc") &&
                        GameObjects.EnemyHeroes.Any(e => Rend.HasBuff(e) && e.IsValidTarget(E.Range)))
                    {
                        if (minions.Any())
                        {
                            E.Cast();
                            return;
                        }
                    }
                }
                if (Menu.Item(Menu.Name + ".ultimate.save").GetValue <bool>() && SoulBound.Unit != null && R.IsReady() &&
                    !SoulBound.Unit.InFountain())
                {
                    SoulBound.Clean();
                    var enemies = SoulBound.Unit.CountEnemiesInRange(500);
                    if ((SoulBound.Unit.HealthPercent <= 10 && SoulBound.Unit.CountEnemiesInRange(500) > 0) ||
                        (SoulBound.Unit.HealthPercent <= 5 && SoulBound.TotalDamage > SoulBound.Unit.Health &&
                         enemies == 0) ||
                        (SoulBound.Unit.HealthPercent <= 50 && SoulBound.TotalDamage > SoulBound.Unit.Health &&
                         enemies > 0))
                    {
                        R.Cast();
                    }
                }
                if (Menu.Item(Menu.Name + ".miscellaneous.w-baron").GetValue <KeyBind>().Active&& W.IsReady() &&
                    Player.Distance(SummonersRift.River.Baron) <= W.Range)
                {
                    W.Cast(SummonersRift.River.Baron);
                }
                if (Menu.Item(Menu.Name + ".miscellaneous.w-dragon").GetValue <KeyBind>().Active&& W.IsReady() &&
                    Player.Distance(SummonersRift.River.Dragon) <= W.Range)
                {
                    W.Cast(SummonersRift.River.Dragon);
                }

                if (SoulBound.Unit == null)
                {
                    SoulBound.Unit =
                        GameObjects.AllyHeroes.FirstOrDefault(
                            a =>
                            a.Buffs.Any(
                                b =>
                                b.Caster.IsMe &&
                                b.Name.Equals("kalistacoopstrikeally", StringComparison.OrdinalIgnoreCase)));
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
Esempio n. 8
0
 public void ApplyChanges(Rend entity)
 {
     _repositoryRend.ApplyChanges(entity);
 }