/// <summary> /// Grid start callback. /// </summary> /// <param name="grid">Ignite instance.</param> internal void OnStart(Ignite grid) { ResourceProcessor.Inject(_target, grid); if (_startEvt) _target.OnLifecycleEvent(LifecycleEventType.AfterNodeStart); }
/// <summary> /// Default ctor for marshalling. /// </summary> /// <param name="reader"></param> public ComputeJobHolder(IPortableReader reader) { var reader0 = (PortableReaderImpl) reader.RawReader(); _ignite = reader0.Marshaller.Ignite; _job = PortableUtils.ReadPortableOrSerializable<IComputeJob>(reader0); }
/// <summary> /// Default ctor for marshalling. /// </summary> /// <param name="reader"></param> public ComputeJobHolder(BinaryReader reader) { Debug.Assert(reader != null); _ignite = reader.Marshaller.Ignite; _job = reader.ReadObject<IComputeJob>(); }
/// <summary> /// Constructor. /// </summary> /// <param name="grid">Grid.</param> /// <param name="job">Job.</param> public ComputeJobHolder(Ignite grid, IComputeJob job) { Debug.Assert(grid != null); Debug.Assert(job != null); _ignite = grid; _job = job; }
/// <summary> /// Default ctor for marshalling. /// </summary> /// <param name="reader"></param> public ComputeJobHolder(IBinaryReader reader) { Debug.Assert(reader != null); var reader0 = (BinaryReader) reader.GetRawReader(); _ignite = reader0.Marshaller.Ignite; _job = reader0.ReadObject<IComputeJob>(); }
/// <summary> /// Creates an instance of this class from a stream. /// </summary> /// <param name="memPtr">Memory pointer.</param> /// <param name="grid">Grid</param> /// <returns>Deserialized instance of <see cref="RemoteListenEventFilter"/></returns> public static RemoteListenEventFilter CreateInstance(long memPtr, Ignite grid) { Debug.Assert(grid != null); using (var stream = IgniteManager.Memory.Get(memPtr).Stream()) { var marsh = grid.Marshaller; var reader = marsh.StartUnmarshal(stream); var pred = reader.ReadObject<PortableOrSerializableObjectHolder>().Item; var func = DelegateTypeDescriptor.GetEventFilter(pred.GetType()); return new RemoteListenEventFilter(grid, (id, evt) => func(pred, id, evt)); } }
public CacheEntryProcessorResultHolder Process(object key, object value, bool exists, Ignite grid) { ResourceProcessor.Inject(_proc, grid); var entry = _entryCtor(key, value, exists); try { return new CacheEntryProcessorResultHolder(entry, _processFunc(entry, _arg), null); } catch (TargetInvocationException ex) { return new CacheEntryProcessorResultHolder(null, null, ex.InnerException); } catch (Exception ex) { return new CacheEntryProcessorResultHolder(null, null, ex); } }
/// <summary> /// Create job instance. /// </summary> /// <param name="grid">Grid.</param> /// <param name="stream">Stream.</param> /// <returns></returns> internal static ComputeJobHolder CreateJob(Ignite grid, IBinaryStream stream) { try { return grid.Marshaller.StartUnmarshal(stream).ReadObject<ComputeJobHolder>(); } catch (Exception e) { throw new IgniteException("Failed to deserialize the job [errType=" + e.GetType().Name + ", errMsg=" + e.Message + ']'); } }
/// <summary> /// Gets the field ids. /// </summary> private static int[] GetFieldIds(BinaryObjectHeader hdr, BinaryObjectSchema schema, Ignite ignite) { return(schema.Get(hdr.SchemaId) ?? GetFieldIds(hdr, ignite)); }
public override void Execute() { // KillSteal if (Settings.KsE && E.IsReady()) { var enemy = EntityManager.Heroes.Enemies.FirstOrDefault(e => e.IsValidTarget(E.Range) && e.TotalShieldHealth() < Damages.EDamage(e) && !e.HasBuffOfType(BuffType.SpellImmunity) && !e.HasBuffOfType(BuffType.SpellShield)); if (enemy != null) { E.Cast(enemy); Debug.WriteChat("Casting E in KS on {0}, Enemy HP: {1}", "" + enemy.ChampionName, "" + enemy.Health); return; } } if (Settings.KsR && R.IsReady()) { var enemy = EntityManager.Heroes.Enemies.FirstOrDefault( e => e.IsValidTarget(R.Range) && e.TotalShieldHealth() < Damages.RDamage(e) && !e.HasBuffOfType(BuffType.SpellImmunity) && !e.HasBuffOfType(BuffType.SpellShield)); if (enemy != null) { R.Cast(); Debug.WriteChat("Casting R in KS on {0}, Enemy HP: {1}", "" + enemy.ChampionName, "" + enemy.Health); return; } } if (Settings.KsIgnite && HasIgnite && Ignite.IsReady()) { var enemy = EntityManager.Heroes.Enemies.FirstOrDefault( e => e.IsValidTarget(Ignite.Range) && e.TotalShieldHealth() < Damages.IgniteDmg(e)); if (enemy != null) { Ignite.Cast(enemy); Debug.WriteChat("Casting Ignite in KS on {0}, Enemy HP: {1}", "" + enemy.ChampionName, "" + enemy.Health); return; } } // Automatic ult usage if (Settings.AutoR && R.IsReady() && !Player.Instance.IsRecalling()) { var ultableEnemies = EntityManager.Heroes.Enemies.Count(e => e.IsValidTarget(R.Range)); if (ultableEnemies >= Settings.AutoRMinEnemies && Player.Instance.HealthPercent >= Settings.AutoRMinHP) { Debug.WriteChat("AutoCasting R, Enemies in range: {0}", "" + "" + ultableEnemies); R.Cast(); return; } } // Potion manager if (Settings.Potion && !Player.Instance.IsInShopRange() && !Player.Instance.IsRecalling() && Player.Instance.HealthPercent <= Settings.potionMinHP && !(Player.Instance.HasBuff("RegenerationPotion") || Player.Instance.HasBuff("ItemCrystalFlaskJungle") || Player.Instance.HasBuff("ItemMiniRegenPotion") || Player.Instance.HasBuff("ItemCrystalFlask") || Player.Instance.HasBuff("ItemDarkCrystalFlask"))) { if (Item.HasItem(HealthPotion.Id) && Item.CanUseItem(HealthPotion.Id)) { Debug.WriteChat("Using HealthPotion because below {0}% HP - have {1}% HP", String.Format("{0}", Settings.potionMinHP), String.Format("{0:##.##}", Player.Instance.HealthPercent)); HealthPotion.Cast(); return; } if (Item.HasItem(HuntersPotion.Id) && Item.CanUseItem(HuntersPotion.Id)) { Debug.WriteChat("Using HuntersPotion because below {0}% HP - have {1}% HP", String.Format("{0}", Settings.potionMinHP), String.Format("{0:##.##}", Player.Instance.HealthPercent)); HuntersPotion.Cast(); return; } if (Item.HasItem(TotalBiscuit.Id) && Item.CanUseItem(TotalBiscuit.Id)) { Debug.WriteChat("Using TotalBiscuitOfRejuvenation because below {0}% HP - have {1}% HP", String.Format("{0}", Settings.potionMinHP), String.Format("{0:##.##}", Player.Instance.HealthPercent)); TotalBiscuit.Cast(); return; } if (Item.HasItem(RefillablePotion.Id) && Item.CanUseItem(RefillablePotion.Id)) { Debug.WriteChat("Using RefillablePotion because below {0}% HP - have {1}% HP", String.Format("{0}", Settings.potionMinHP), String.Format("{0:##.##}", Player.Instance.HealthPercent)); RefillablePotion.Cast(); return; } if (Item.HasItem(CorruptingPotion.Id) && Item.CanUseItem(CorruptingPotion.Id)) { Debug.WriteChat("Using CorruptingPotion because below {0}% HP - have {1}% HP", String.Format("{0}", Settings.potionMinHP), String.Format("{0:##.##}", Player.Instance.HealthPercent)); CorruptingPotion.Cast(); return; } } if (Player.Instance.ManaPercent <= Settings.potionMinMP && !(Player.Instance.HasBuff("RegenerationPotion") || Player.Instance.HasBuff("ItemMiniRegenPotion") || Player.Instance.HasBuff("ItemCrystalFlask") || Player.Instance.HasBuff("ItemDarkCrystalFlask"))) { if (Item.HasItem(CorruptingPotion.Id) && Item.CanUseItem(CorruptingPotion.Id)) { Debug.WriteChat("Using HealthPotion because below {0}% MP - have {1}% MP", String.Format("{0}", Settings.potionMinMP), String.Format("{0:##.##}", Player.Instance.ManaPercent)); CorruptingPotion.Cast(); return; } if (Item.HasItem(HuntersPotion.Id) && Item.CanUseItem(HuntersPotion.Id)) { Debug.WriteChat("Using HuntersPotion because below {0}% MP - have {1}% MP", String.Format("{0}", Settings.potionMinMP), String.Format("{0:##.##}", Player.Instance.ManaPercent)); HuntersPotion.Cast(); return; } } }
/// <summary> /// Invokes a store operation. /// </summary> /// <param name="stream">Input stream.</param> /// <param name="grid">Grid.</param> /// <returns>Invocation result.</returns> /// <exception cref="IgniteException">Invalid operation type: + opType</exception> public int Invoke(IBinaryStream stream, Ignite grid) { IBinaryReader reader = grid.Marshaller.StartUnmarshal(stream, _convertBinary ? BinaryMode.Deserialize : BinaryMode.ForceBinary); IBinaryRawReader rawReader = reader.GetRawReader(); int opType = rawReader.ReadByte(); // Setup cache session for this invocation. long sesId = rawReader.ReadLong(); CacheStoreSession ses = grid.HandleRegistry.Get <CacheStoreSession>(sesId, true); // Session cache name may change in cross-cache transaction. // Single session is used for all stores in cross-cache transactions. ses.CacheName = rawReader.ReadString(); _sesProxy.SetSession(ses); try { // Perform operation. switch (opType) { case OpLoadCache: { var args = rawReader.ReadArray <object>(); stream.Seek(0, SeekOrigin.Begin); int cnt = 0; stream.WriteInt(cnt); // Reserve space for count. var writer = grid.Marshaller.StartMarshal(stream); _store.LoadCache((k, v) => { lock (writer) // User-defined store can be multithreaded. { writer.WithDetach(w => { w.WriteObject(k); w.WriteObject(v); }); cnt++; } }, args); stream.WriteInt(0, cnt); grid.Marshaller.FinishMarshal(writer); break; } case OpLoad: { var val = _store.Load(rawReader.ReadObject <TK>()); stream.Seek(0, SeekOrigin.Begin); var writer = grid.Marshaller.StartMarshal(stream); writer.WriteObject(val); grid.Marshaller.FinishMarshal(writer); break; } case OpLoadAll: { // We can't do both read and write lazily because stream is reused. // Read keys non-lazily, write result lazily. var keys = ReadAllKeys(rawReader); var result = _store.LoadAll(keys); stream.Seek(0, SeekOrigin.Begin); int cnt = 0; stream.WriteInt(cnt); // Reserve space for count. var writer = grid.Marshaller.StartMarshal(stream); foreach (var entry in result) { var entry0 = entry; // Copy modified closure. writer.WithDetach(w => { w.WriteObject(entry0.Key); w.WriteObject(entry0.Value); }); cnt++; } stream.WriteInt(0, cnt); grid.Marshaller.FinishMarshal(writer); break; } case OpPut: _store.Write(rawReader.ReadObject <TK>(), rawReader.ReadObject <TV>()); break; case OpPutAll: _store.WriteAll(ReadPairs(rawReader)); break; case OpRmv: _store.Delete(rawReader.ReadObject <TK>()); break; case OpRmvAll: _store.DeleteAll(ReadKeys(rawReader)); break; case OpSesEnd: { var commit = rawReader.ReadBoolean(); var last = rawReader.ReadBoolean(); if (last) { grid.HandleRegistry.Release(sesId); } _store.SessionEnd(commit); break; } default: throw new IgniteException("Invalid operation type: " + opType); } return(0); } finally { _sesProxy.ClearSession(); } }
/// <summary> /// Cleanups this instance. /// </summary> public void Cleanup() { _ignite = null; _handleRegistry.Close(); }
/// <summary> /// Creates local holder instance. /// </summary> /// <param name="grid">Ignite instance.</param> /// <param name="listener">Filter.</param> /// <returns> /// New instance of <see cref="MessageListenerHolder" /> /// </returns> public static MessageListenerHolder CreateLocal <T>(Ignite grid, IMessageListener <T> listener) { Debug.Assert(listener != null); return(new MessageListenerHolder(grid, listener, (id, msg) => listener.Invoke(id, (T)msg))); }
/// <summary> /// Starts Ignite with given configuration. /// </summary> /// <returns>Started Ignite.</returns> public unsafe static IIgnite Start(IgniteConfiguration cfg) { IgniteArgumentCheck.NotNull(cfg, "cfg"); // Copy configuration to avoid changes to user-provided instance. IgniteConfigurationEx cfgEx = cfg as IgniteConfigurationEx; cfg = cfgEx == null ? new IgniteConfiguration(cfg) : new IgniteConfigurationEx(cfgEx); // Set default Spring config if needed. if (cfg.SpringConfigUrl == null) cfg.SpringConfigUrl = DefaultCfg; lock (SyncRoot) { // 1. Check GC settings. CheckServerGc(cfg); // 2. Create context. IgniteUtils.LoadDlls(cfg.JvmDllPath); var cbs = new UnmanagedCallbacks(); void* ctx = IgniteManager.GetContext(cfg, cbs); sbyte* cfgPath0 = IgniteUtils.StringToUtf8Unmanaged(cfg.SpringConfigUrl ?? DefaultCfg); string gridName = cfgEx != null ? cfgEx.GridName : null; sbyte* gridName0 = IgniteUtils.StringToUtf8Unmanaged(gridName); // 3. Create startup object which will guide us through the rest of the process. _startup = new Startup(cfg) { Context = ctx }; IUnmanagedTarget interopProc = null; try { // 4. Initiate Ignite start. interopProc = UU.IgnitionStart(cbs.Context, cfg.SpringConfigUrl ?? DefaultCfg, cfgEx != null ? cfgEx.GridName : null, ClientMode); // 5. At this point start routine is finished. We expect STARTUP object to have all necessary data. Ignite node = new Ignite(cfg, _startup.Name, interopProc, _startup.Marshaller, _startup.LifecycleBeans, cbs); // 6. On-start callback (notify lifecycle components). node.OnStart(); Nodes[new NodeKey(_startup.Name)] = node; return node; } catch (Exception) { // 1. Perform keys cleanup. string name = _startup.Name; if (name != null) { NodeKey key = new NodeKey(name); if (Nodes.ContainsKey(key)) Nodes.Remove(key); } // 2. Stop Ignite node if it was started. if (interopProc != null) UU.IgnitionStop(interopProc.Context, gridName, true); // 3. Throw error further (use startup error if exists because it is more precise). if (_startup.Error != null) throw _startup.Error; throw; } finally { _startup = null; Marshal.FreeHGlobal((IntPtr)cfgPath0); if ((IntPtr)gridName0 != IntPtr.Zero) Marshal.FreeHGlobal((IntPtr)gridName0); if (interopProc != null) UU.ProcessorReleaseStart(interopProc); } } }
private static void Orbwalk() { if (MainMenu["Orbwalk"]["R"].GetValue <MenuBool>().Value&& R.IsReady() && GetRTarget.Count > 0) { var hero = (from enemy in GetRTarget let nearEnemy = GameObjects.EnemyHeroes.Where(i => i.Distance(enemy) < RWidth && CanCastR(i)).ToList() where (nearEnemy.Count > 1 && enemy.Health <= GetRDmg(enemy)) || nearEnemy.Any( i => i.HealthPercent < MainMenu["Orbwalk"]["RHpU"].GetValue <MenuSlider>().Value) || nearEnemy.Count >= MainMenu["Orbwalk"]["RCountA"].GetValue <MenuSlider>().Value orderby nearEnemy.Count descending select enemy).ToList(); if (hero.Count > 0) { var target = !MainMenu["Orbwalk"]["RDelay"].GetValue <MenuBool>().Value ? hero.FirstOrDefault() : hero.FirstOrDefault(CanCastDelayR); if (target != null && R.CastOnUnit(target)) { return; } } } if (MainMenu["Orbwalk"]["EGap"].GetValue <MenuBool>().Value&& E.IsReady()) { var target = Q.GetTarget() ?? Q2.GetTarget(); if (target != null) { var nearObj = GetNearObj(target, true) ?? GetNearObj(target); if (nearObj != null && (!UnderTower(PosAfterE(nearObj)) || MainMenu["Orbwalk"]["ETower"].GetValue <MenuBool>().Value) && (target.Compare(nearObj) ? (target.Distance(PosAfterE(target)) < target.GetRealAutoAttackRange() || (HaveQ3 && target.HasBuffOfType(BuffType.SpellShield))) : Player.Distance(target) > MainMenu["Orbwalk"]["ERange"].GetValue <MenuSlider>().Value) && E.CastOnUnit(nearObj)) { return; } } } if (Q.IsReady()) { if (Player.IsDashing()) { var target = GetQCirTarget; if (target != null && CastQCir(target)) { return; } if (!HaveQ3 && MainMenu["Orbwalk"]["EGap"].GetValue <MenuBool>().Value && MainMenu["Orbwalk"]["EStackQ"].GetValue <MenuBool>().Value&& Q.GetTarget(70) == null) { var obj = GetQCirObj.MinOrDefault(i => i.Distance(Player)); if (obj != null && CastQCir(obj)) { return; } } } else { if (!HaveQ3) { var target = Q.GetTarget(30); if (target != null && Common.Cast(Q, target, true) == CastStates.SuccessfullyCasted) { return; } } else if (CastQ3()) { return; } } } var itemTarget = Q.GetTarget() ?? Q2.GetTarget(); UseItem(itemTarget); if (itemTarget == null) { return; } if (Ignite.IsReady() && itemTarget.HealthPercent < 30 && Player.Distance(itemTarget) <= 600) { Player.Spellbook.CastSpell(Ignite, itemTarget); } }
private static void Combo() { var target = GetTarget; if (target != null) { Swap(target); var useR = MainMenu["Combo"]["R"].GetValue <MenuKeyBind>().Active; var targetR = MainMenu["Combo"]["RCast" + target.ChampionName]; var stateR = RState; var canCast = !useR || !targetR || (stateR == 0 && target.DistanceToPlayer() > MainMenu["Combo"]["RStopRange"]) || stateR == -1; if (stateR == 0 && useR && targetR && R.IsInRange(target) && CanR && R.CastOnUnit(target)) { return; } if (MainMenu["Combo"]["Ignite"] && Ignite.IsReady() && (HaveR(target) || target.HealthPercent < 25) && target.DistanceToPlayer() < IgniteRange) { Player.Spellbook.CastSpell(Ignite, target); } var norW = MainMenu["Combo"]["WNormal"]; var advW = MainMenu["Combo"]["WAdv"].GetValue <MenuList>().Index; if ((norW || advW > 0) && WState == 0) { var slot = CanW(target); if (slot != SpellSlot.Unknown) { if (advW > 0 && rShadow.IsValid() && useR && targetR && HaveR(target) && !IsKillByMark(target)) { CastW(target, slot, true); return; } if (norW) { if (stateR < 1 && canCast) { CastW(target, slot); } if (rShadow.IsValid() && useR && targetR && !HaveR(target)) { CastW(target, slot); } } } else if (Variables.TickCount - lastW > 500 && target.Health + target.PhysicalShield <= Player.GetAutoAttackDamage(target) && !E.IsInRange(target) && !IsKillByMark(target) && target.DistanceToPlayer() < W.Range + target.GetRealAutoAttackRange() - 100 && W.Cast( target.ServerPosition.Extend(Player.ServerPosition, -target.GetRealAutoAttackRange()))) { lastW = Variables.TickCount; return; } } if (canCast || rShadow.IsValid()) { CastE(); CastQ(target); } } if (MainMenu["Combo"]["Item"]) { UseItem(target); } }
public CacheEntryProcessorResultHolder Process(object key, object value, bool exists, Ignite grid) { ResourceProcessor.Inject(_proc, grid); var entry = _entryCtor(key, value, exists); try { return(new CacheEntryProcessorResultHolder(entry, _processFunc(entry, _arg), null)); } catch (TargetInvocationException ex) { return(new CacheEntryProcessorResultHolder(null, null, ex.InnerException)); } catch (Exception ex) { return(new CacheEntryProcessorResultHolder(null, null, ex)); } }
// W > Q > E > R public static void Execute() { var target = TargetSelector.GetTarget(SpellsManager.Q.Range, DamageType.Magical); if ((target == null) || target.IsInvulnerable) { return; } var Poisoned = EntityManager.Heroes.Enemies.Find(e => e.IsValidTarget(SpellsManager.E.Range) && e.HasBuffOfType(BuffType.Poison)); //var Poisoned = EntityManager.Heroes.Enemies.Where(e => e.IsValidTarget(SpellsManager.E.Range)).OrderBy(e => e.HasBuffOfType(BuffType.Poison)).ThenBy(e => target).FirstOrDefault; if (SpellsManager.R.IsReady() && ComboMenu["R"].Cast <CheckBox>().CurrentValue&& ComboMenu[target.ChampionName].Cast <CheckBox>().CurrentValue&& !target.IsDead && !ComboMenu["ROnly"].Cast <CheckBox>().CurrentValue&& target.IsValidTarget(SpellsManager.R.Range)) { if (HumanizerMenu["Humanize"].Cast <CheckBox>().CurrentValue) { Core.DelayAction(() => SpellsManager.R.Cast(target.Position), HumanizerMenu["HumanizeR"].Cast <Slider>().CurrentValue); } else { SpellsManager.R.Cast(target.Position); } } if (SpellsManager.R.IsReady() && ComboMenu["R"].Cast <CheckBox>().CurrentValue&& ComboMenu["ROnly"].Cast <CheckBox>().CurrentValue&& target.IsFacing(myhero) && ComboMenu[target.ChampionName].Cast <CheckBox>().CurrentValue&& !target.IsDead && target.IsValidTarget(SpellsManager.R.Range)) { if (HumanizerMenu["Humanize"].Cast <CheckBox>().CurrentValue) { Core.DelayAction(() => SpellsManager.R.Cast(target.Position), HumanizerMenu["HumanizeR"].Cast <Slider>().CurrentValue); } else { SpellsManager.R.Cast(target.Position); } } if (ComboMenu["W"].Cast <CheckBox>().CurrentValue&& SpellsManager.W.IsReady() && target.IsValidTarget(SpellsManager.W.Range)) { var prediction = SpellsManager.W.GetPrediction(target); if (HumanizerMenu["Humanize"].Cast <CheckBox>().CurrentValue) { Core.DelayAction(() => SpellsManager.W.Cast(prediction.CastPosition), HumanizerMenu["HumanizeW"].Cast <Slider>().CurrentValue); } else { SpellsManager.W.Cast(prediction.CastPosition); } } if (ComboMenu["Q"].Cast <CheckBox>().CurrentValue&& SpellsManager.Q.IsReady() && target.IsValidTarget(SpellsManager.Q.Range + 100)) { var prediction = SpellsManager.Q.GetPrediction(target); if (HumanizerMenu["Humanize"].Cast <CheckBox>().CurrentValue) { Core.DelayAction(() => SpellsManager.Q.Cast(SpellsManager.Q.GetPrediction(target).CastPosition), HumanizerMenu["HumanizeQ"].Cast <Slider>().CurrentValue); } else { SpellsManager.Q.Cast(SpellsManager.Q.GetPrediction(target).CastPosition); } } if (SpellsManager.E.IsReady() && ComboMenu["E"].Cast <CheckBox>().CurrentValue&& Poisoned.IsValidTarget(SpellsManager.E.Range) && ComboMenu["EOnly"].Cast <CheckBox>().CurrentValue&& (SpellsManager.Q.IsOnCooldown || !target.IsInRange(myhero, SpellsManager.Q.Range))) { if (HumanizerMenu["Humanize"].Cast <CheckBox>().CurrentValue) { Core.DelayAction(() => SpellsManager.E.Cast(Poisoned), HumanizerMenu["HumanizeE"].Cast <Slider>().CurrentValue); } else { SpellsManager.E.Cast(Poisoned); } } else if (SpellsManager.E.IsReady() && ComboMenu["E"].Cast <CheckBox>().CurrentValue&& target.IsValidTarget(SpellsManager.E.Range) && (SpellsManager.Q.IsOnCooldown || !target.IsInRange(myhero, SpellsManager.Q.Range))) { if (HumanizerMenu["Humanize"].Cast <CheckBox>().CurrentValue) { Core.DelayAction(() => SpellsManager.E.Cast(target), HumanizerMenu["HumanizeE"].Cast <Slider>().CurrentValue); } else { SpellsManager.E.Cast(target); } } var Summ = TargetSelector.GetTarget(Ignite.Range, DamageType.Mixed); if ((Summ == null) || Summ.IsInvulnerable) { return; } //Ignite if (ComboMenu["Ignite"].Cast <CheckBox>().CurrentValue) { if (Player.Instance.CountEnemyChampionsInRange(600) >= 1 && Ignite.IsReady() && Ignite.IsLearned && Summ.IsValidTarget(Ignite.Range)) { if (target.Health > target.GetRealDamage()) { Ignite.Cast(Summ); } } } }
public static void Execute() { var rtarget = TargetSelector.GetTarget(SpellsManager.R.Range, DamageType.Magical); var target = TargetSelector.GetTarget(SpellsManager.Q.Range, DamageType.Magical); if ((target == null) || target.IsInvulnerable) { return; } if (ComboMenu["R"].Cast <CheckBox>().CurrentValue&& rtarget.IsValidTarget(ComboMenu["RRangeSlider"].Cast <Slider>().CurrentValue) && SpellsManager.R.IsReady() && target.HealthPercent < ComboMenu["RHpSlider"].Cast <Slider>().CurrentValue) { var prediction = SpellsManager.R.GetPrediction(rtarget); if (ComboMenu["RPrediction"].Cast <ComboBox>().CurrentValue == 1) { if (ComboMenu["RSlider"].Cast <Slider>().CurrentValue == 1) { SpellsManager.R.Cast(prediction.CastPosition); } else if (rtarget.CountEnemyChampionsInRange(400) == ComboMenu["RSlider"].Cast <Slider>().CurrentValue - 1) { SpellsManager.R.Cast(prediction.CastPosition); } } if (ComboMenu["RPrediction"].Cast <ComboBox>().CurrentValue == 0) { if (ComboMenu["RSlider"].Cast <Slider>().CurrentValue == 1) { SpellsManager.R.Cast(target.Position); } else if (rtarget.CountEnemyChampionsInRange(400) == ComboMenu["RSlider"].Cast <Slider>().CurrentValue - 1) { SpellsManager.R.Cast(target.Position); } } } if (ComboMenu["Q"].Cast <CheckBox>().CurrentValue&& target.IsValidTarget(SpellsManager.Q.Range) && SpellsManager.Q.IsReady()) { var prediction = SpellsManager.Q.GetPrediction(target); SpellsManager.Q.Cast(prediction.CastPosition); } if (ComboMenu["E"].Cast <CheckBox>().CurrentValue&& target.IsValidTarget(SpellsManager.E.Range) && SpellsManager.E.IsReady()) { var prediction = SpellsManager.E.GetPrediction(target); SpellsManager.E.Cast(prediction.CastPosition); } if (ComboMenu["W"].Cast <CheckBox>().CurrentValue&& target.IsValidTarget(SpellsManager.W.Range - 200) && SpellsManager.W.IsReady()) { var pred = SpellsManager.W.GetPrediction(target); Vector3 wheretocast; var wheretocastt = myhero.Position.Extend(pred.CastPosition, 140).To3DWorld(); wheretocast = myhero.Position.Extend(pred.CastPosition, 140).To3DWorld(); SpellsManager.W.CastStartToEnd(wheretocastt, pred.CastPosition); } var Summ = TargetSelector.GetTarget(Ignite.Range, DamageType.Mixed); if ((Summ == null) || Summ.IsInvulnerable) { return; } //Ignite if (ComboMenu["Ignite"].Cast <CheckBox>().CurrentValue) { if (Player.Instance.CountEnemyChampionsInRange(600) >= 1 && Ignite.IsReady() && Ignite.IsLearned && Summ.IsValidTarget(Ignite.Range) && target.HealthPercent <= ComboMenu["IgniteHealth"].Cast <Slider>().CurrentValue) { if (target.Health > target.GetRealDamage()) { Ignite.Cast(Summ); } } } }
private static void Combo() { var target = myTarget.IsValidTarget() ? myTarget : TargetSelector.GetTarget(800f, TargetSelector.DamageType.Physical); if (target != null && target.IsValidTarget(800f)) { if (MenuInit.ComboDot && IgniteSlot != SpellSlot.Unknown && Ignite.IsReady() && target.IsValidTarget(Ignite.Range) && (target.Health < DamageCalculate.GetComboDamage(target) || target.Health < DamageCalculate.GetIgniteDmage(target)) && Ignite.Cast(target, true) == Spell.CastStates.SuccessfullyCasted) { return; } if (MenuInit.ComboYoumuu && Items.HasItem(3142) && Items.CanUseItem(3142) && target.IsValidTarget(580) && Items.UseItem(3142)) { return; } if (MenuInit.ComboR && R.IsReady() && !isRActive && target.Health <= DamageCalculate.GetComboDamage(target) && target.IsValidTarget(600f) && Riven.R1Logic(target)) { return; } if (MenuInit.ComboR2 != 3 && R.IsReady() && isRActive && Riven.R2Logic(target)) { return; } if (MenuInit.ComboQGap && Q.IsReady() && Utils.TickCount - lastQTime > 3600 && !Me.IsDashing() && target.IsValidTarget(480) && target.DistanceToPlayer() > Orbwalking.GetRealAutoAttackRange(Me)) { var pred = Prediction.GetPrediction(target, Q.Delay); if (pred.UnitPosition != Vector3.Zero && (pred.UnitPosition.DistanceToPlayer() < target.DistanceToPlayer() || pred.UnitPosition.Distance(target.Position) <= target.DistanceToPlayer()) && Riven.CastQ(target)) { return; } } if (MenuInit.ComboEGap && E.IsReady() && target.IsValidTarget(600) && target.DistanceToPlayer() > Orbwalking.GetRealAutoAttackRange(Me) + 50) { E.Cast(target.Position, true); } if (MenuInit.ComboWLogic && W.IsReady() && target.IsValidTarget(W.Range)) { if (!Q.IsReady() && qStack == 0 && W.Cast(true)) { return; } if (!target.IsFacing(Me) && W.Cast(true)) { return; } if (Q.IsReady() && qStack > 0 && W.Cast(true)) { return; } if (Me.HasBuff("RivenFeint")) { W.Cast(true); } } } }
private static void ShyBurst(AIHeroClient target) { if (MenuInit.BurstDot && IgniteSlot != SpellSlot.Unknown && Ignite.IsReady() && Ignite.Cast(target, true) == Spell.CastStates.SuccessfullyCasted) { return; } if (target.IsValidTarget(W.Range) && W.Cast(true)) { return; } if (target.IsValidTarget(E.Range + Me.AttackRange + Me.BoundingRadius)) { if (E.IsReady() && R.IsReady() && W.IsReady() && !isRActive) { E.Cast(target.Position, true); LeagueSharp.Common.Utility.DelayAction.Add(10 + Game.Ping, () => R.Cast(true)); LeagueSharp.Common.Utility.DelayAction.Add(60 + Game.Ping, () => W.Cast(true)); return; } if (E.IsReady() && R.IsReady() && !isRActive) { E.Cast(target.Position, true); LeagueSharp.Common.Utility.DelayAction.Add(10 + Game.Ping, () => R.Cast(true)); } } //else if (target.IsValidTarget(E.Range + Q.Range + Me.AttackRange + Me.BoundingRadius - 100)) //{ // if (E.IsReady() && R.IsReady() && W.IsReady() && Q.IsReady() && !isRActive) // { // E.Cast(target.Position, true); // LeagueSharp.Common.Utility.DelayAction.Add(10 + Game.Ping, () => R.Cast(true)); // LeagueSharp.Common.Utility.DelayAction.Add(60 + Game.Ping, () => Q.Cast(target.Position, true)); // LeagueSharp.Common.Utility.DelayAction.Add(65 + Game.Ping, () => W.Cast(true)); // return; // } // if (E.IsReady() && R.IsReady() && Q.IsReady() && !isRActive) // { // E.Cast(target.Position, true); // LeagueSharp.Common.Utility.DelayAction.Add(10 + Game.Ping, () => R.Cast(true)); // LeagueSharp.Common.Utility.DelayAction.Add(60 + Game.Ping, () => Q.Cast(target.Position, true)); // } //} else if (MenuInit.BurstFlash && FlashSlot != SpellSlot.Unknown && Flash.IsReady()) { if (target.IsValidTarget(E.Range + Me.AttackRange + Me.BoundingRadius + Flash.Range)) { if (E.IsReady() && R.IsReady() && W.IsReady() && !isRActive) { E.Cast(target.Position, true); LeagueSharp.Common.Utility.DelayAction.Add(10 + Game.Ping, () => R.Cast(true)); LeagueSharp.Common.Utility.DelayAction.Add(60 + Game.Ping, () => W.Cast(true)); LeagueSharp.Common.Utility.DelayAction.Add(61 + Game.Ping, () => Flash.Cast(target.Position, true)); return; } if (E.IsReady() && R.IsReady() && !isRActive) { E.Cast(target.Position, true); LeagueSharp.Common.Utility.DelayAction.Add(10 + Game.Ping, () => R.Cast(true)); LeagueSharp.Common.Utility.DelayAction.Add(60 + Game.Ping, () => Flash.Cast(target.Position, true)); } } //else if (target.IsValidTarget(E.Range + Me.AttackRange + Me.BoundingRadius + Flash.Range + Q.Range - 50)) //{ // if (E.IsReady() && R.IsReady() && W.IsReady() && Q.IsReady() && !isRActive) // { // E.Cast(target.Position, true); // LeagueSharp.Common.Utility.DelayAction.Add(10 + Game.Ping, () => R.Cast(true)); // LeagueSharp.Common.Utility.DelayAction.Add(60 + Game.Ping, () => Q.Cast(target.Position, true)); // LeagueSharp.Common.Utility.DelayAction.Add(80 + Game.Ping, () => W.Cast(true)); // LeagueSharp.Common.Utility.DelayAction.Add(81 + Game.Ping, () => Flash.Cast(target.Position, true)); // return; // } // if (E.IsReady() && R.IsReady() && Q.IsReady() && !isRActive) // { // E.Cast(target.Position, true); // LeagueSharp.Common.Utility.DelayAction.Add(10 + Game.Ping, () => R.Cast(true)); // LeagueSharp.Common.Utility.DelayAction.Add(60 + Game.Ping, () => Q.Cast(target.Position, true)); // LeagueSharp.Common.Utility.DelayAction.Add(80 + Game.Ping, () => Flash.Cast(target.Position, true)); // } //} } }
private static void ComboEvent() { try { var target = TargetSelector.GetTarget(800f); if (target != null && target.IsValidTarget(800f)) { if (ComboMenu["FlowersFiora.ComboMenu.Item"].Enabled) { if ((target.Health * 1.12 >= target.MaxHealth ? target.MaxHealth : target.Health * 1.12) < MyExtraManager.GetComboDamage(target) && target.DistanceToPlayer() > 400) { ItemsUse(true, false, false); } if (target.IsValidTarget(400) && (!target.IsValidAutoRange() || !Orbwalker.CanAttack())) { ItemsUse(false, true, false); } } if (ComboMenu["FlowersFiora.ComboMenu.Ignite"].Enabled && IgniteSlot != SpellSlot.Unknown && Ignite.Ready) { if (target.Health < MyExtraManager.GetComboDamage(target) * 0.6 || target.Health < Me.GetIgniteDamage(target)) { Ignite.CastOnUnit(target); } } if (ComboMenu["FlowersFiora.ComboMenu.Force"].Enabled && target.IsValidTarget(500)) { ForcusAttack(target); } if (ComboMenu["FlowersFiora.ComboMenu.Q"].Enabled && Q.Ready && target.IsValidTarget(Q.Range)) { CastQ(target); } if (ComboMenu["FlowersFiora.ComboMenu.R"].As <MenuKeyBind>().Enabled&& R.Ready) { if (ComboMenu["FlowersFiora.ComboMenu.RSolo"].Enabled && ComboMenu["FlowersFiora.ComboMenu.RTargetFor" + target.ChampionName].Enabled && target.IsValidTarget(R.Range)) { if (Me.CountAllyHeroesInRange(1000) < 2 && Me.CountEnemyHeroesInRange(1000) <= 2) { if (target.Health < MyExtraManager.GetComboDamage(target) - Me.GetAutoAttackDamage(target)) { if (!target.IsUnKillable() && target.Health > Me.GetAutoAttackDamage(target) * 3) { R.CastOnUnit(target); } } } } if (ComboMenu["FlowersFiora.ComboMenu.RTeam"].Enabled) { if (Me.CountEnemyHeroesInRange(1000) > 2 && Me.CountAllyHeroesInRange(1000) > 1) { foreach ( var x in GameObjects.EnemyHeroes.Where( x => x.IsValidTarget(R.Range) && x.Health <= MyExtraManager.GetComboDamage(target) + Me.GetAutoAttackDamage(x) * 3)) { if (!x.IsUnKillable() && x.IsValidTarget(R.Range)) { R.CastOnUnit(x); } } } } } } } catch (Exception ex) { Console.WriteLine("Error in MyEventManager.ComboEvent." + ex); } }
internal static void Init() { var target = TargetSelector.GetSelectedTarget() ?? TargetSelector.GetTarget(1200f, TargetSelector.DamageType.Physical); if (target == null) { return; } if (target.DistanceToPlayer() > R.Range) { return; } if (Menu.Item("ComboIgnite", true).GetValue <bool>() && Ignite != SpellSlot.Unknown && Ignite.IsReady() && target.IsValidTarget(600f) && (target.Health <= Me.GetSummonerSpellDamage(target, Damage.SummonerSpell.Ignite) || target.HealthPercent <= 25)) { Me.Spellbook.CastSpell(Ignite, target); } if (Menu.Item("ComboItems", true).GetValue <bool>()) { SpellManager.UseItems(target, true); } if (Menu.Item("ComboR", true).GetValue <KeyBind>().Active&& R.IsReady()) { var KnockedUpEnemies = HeroManager.Enemies.Where(x => x.IsValidTarget(R.Range)) .Where(x => x.HasBuffOfType(BuffType.Knockup) || x.HasBuffOfType(BuffType.Knockback)) .Where(CanCastDelayR); if (KnockedUpEnemies.Count() >= Menu.Item("ComboRCount", true).GetValue <Slider>().Value) { R.Cast(); } foreach (var rTarget in HeroManager.Enemies.Where(x => x.IsValidTarget(R.Range)) .Where(x => x.HasBuffOfType(BuffType.Knockup) || x.HasBuffOfType(BuffType.Knockback)) .Where(CanCastDelayR)) { if (Menu.Item("R" + rTarget.ChampionName.ToLower(), true).GetValue <bool>() && rTarget.HealthPercent <= Menu.Item("ComboRHp", true).GetValue <Slider>().Value) { R.Cast(); } if (Menu.Item("ComboRAlly", true).GetValue <bool>() && HeroManager.Allies.Any(x => !x.IsDead && !x.IsZombie && x.Distance(rTarget) <= 600) && rTarget.Health >= Menu.Item("ComboRHp", true).GetValue <Slider>().Value) { R.Cast(); } } } if (Menu.Item("ComboE", true).GetValue <bool>() && E.IsReady()) { var dmg = (float)(SpellManager.GetQDmg(target) * 2 + SpellManager.GetEDmg(target)) + Me.GetAutoAttackDamage(target) * 2 + (R.IsReady() ? R.GetDamage(target) : (float)SpellManager.GetQDmg(target)); if (target.DistanceToPlayer() >= Orbwalking.GetRealAutoAttackRange(Me) + 65 && dmg >= target.Health && SpellManager.CanCastE(target) && (Menu.Item("ComboETurret", true).GetValue <bool>() || !UnderTower(PosAfterE(target)))) { E.CastOnUnit(target, true); } } if (Menu.Item("ComboEGapcloser", true).GetValue <bool>() && E.IsReady() && target.DistanceToPlayer() >= Menu.Item("ComboEGap", true).GetValue <Slider>().Value) { if (Menu.Item("ComboEMode", true).GetValue <StringList>().SelectedIndex == 0) { SpellManager.EGapTarget(target, Menu.Item("ComboETurret", true).GetValue <bool>(), Menu.Item("ComboEGap", true).GetValue <Slider>().Value, false); } else { SpellManager.EGapMouse(target, Menu.Item("ComboETurret", true).GetValue <bool>(), Menu.Item("ComboEGap", true).GetValue <Slider>().Value, false); } } if (Menu.Item("ComboQ", true).GetValue <bool>() && Me.Spellbook.GetSpell(SpellSlot.Q).IsReady() && !IsDashing) { if (SpellManager.HaveQ3) { if (target.IsValidTarget(Q3.Range)) { SpellManager.CastQ3(); } } else { if (target.IsValidTarget(Q.Range)) { Q.Cast(target, true); } } } if (Me.IsDashing() && Menu.Item("ComboEQFlash", true).GetValue <KeyBind>().Active&& Flash != SpellSlot.Unknown && Flash.IsReady() && SpellManager.HaveQ3 && Q3.IsReady() && R.IsReady()) { if (Menu.Item("ComboEQFlashSolo", true).GetValue <bool>() && !HeroManager.Enemies.Any(x => x.IsValidTarget(1200) && x.NetworkId != target.NetworkId) && !HeroManager.Allies.Any(x => x.IsValidTarget(1200, false) && x.NetworkId != Me.NetworkId)) { if (target.Health + target.HPRegenRate * 2 < SpellManager.GetQDmg(target) + (SpellManager.CanCastE(target) ? SpellManager.GetEDmg(target) : 0) + Me.GetAutoAttackDamage(target) * 2 + R.GetDamage(target) && !HeroManager.Enemies.Any(x => x.IsValidTarget(1200) && x.NetworkId != target.NetworkId) && !HeroManager.Allies.Any(x => x.IsValidTarget(1200, false) && x.NetworkId != Me.NetworkId)) { var bestPos = FlashPoints().FirstOrDefault(x => target.Distance(x) <= 220); if (bestPos.IsValid() && bestPos.CountEnemiesInRange(220) > 0 && Q3.Cast(bestPos, true)) { Utility.DelayAction.Add(10 + (Game.Ping / 2 - 5), () => Me.Spellbook.CastSpell(Flash, bestPos)); } } } if (Menu.Item("ComboEQFlashTeam", true).GetValue <bool>() && HeroManager.Enemies.Count(x => x.IsValidTarget(1200)) >= Menu.Item("ComboEQFlashTeamCount", true).GetValue <Slider>().Value&& HeroManager.Allies.Count(x => x.IsValidTarget(1200, false) && x.NetworkId != Me.NetworkId) >= Menu.Item("ComboEQFlashTeamAlly", true).GetValue <Slider>().Value) { var bestPos = FlashPoints() .Where( x => HeroManager.Enemies.Count(a => a.IsValidTarget(600f, true, x)) >= Menu.Item("ComboEQFlashTeamCount", true).GetValue <Slider>().Value) .OrderByDescending(x => HeroManager.Enemies.Count(i => i.Distance(x) <= 220)) .FirstOrDefault(); if (bestPos.IsValid() && bestPos.CountEnemiesInRange(220) >= Menu.Item("ComboEQFlashTeamCount", true).GetValue <Slider>().Value&& Q3.Cast(bestPos, true)) { Utility.DelayAction.Add(10 + (Game.Ping / 2 - 5), () => Me.Spellbook.CastSpell(Flash, bestPos)); } } } if (IsDashing) { if (Menu.Item("ComboEQ", true).GetValue <bool>() && Q.IsReady() && !SpellManager.HaveQ3 && target.Distance(lastEPos) <= 220) { Q.Cast(Me.Position, true); } if (Menu.Item("ComboEQ3", true).GetValue <bool>() && Q3.IsReady() && SpellManager.HaveQ3 && target.Distance(lastEPos) <= 220) { Q3.Cast(Me.Position, true); } if (Menu.Item("ComboQStack", true).GetValue <StringList>().SelectedIndex != 3 && Q.IsReady() && !SpellManager.HaveQ3) { switch (Menu.Item("ComboQStack", true).GetValue <StringList>().SelectedIndex) { case 0: if (MinionManager.GetMinions(lastEPos, 220, MinionTypes.All, MinionTeam.NotAlly).Count > 0 || HeroManager.Enemies.Count(x => x.IsValidTarget(220, true, lastEPos)) > 0) { Q.Cast(Me.Position, true); } break; case 1: if (HeroManager.Enemies.Count(x => x.IsValidTarget(220, true, lastEPos)) > 0) { Q.Cast(Me.Position, true); } break; case 2: if (MinionManager.GetMinions(lastEPos, 220, MinionTypes.All, MinionTeam.NotAlly).Count > 0) { Q.Cast(Me.Position, true); } break; } } } }
public void SetUp() { TestUtils.KillProcesses(); var cfg = new IgniteConfiguration { BinaryConfiguration = new BinaryConfiguration { TypeConfigurations = new List<BinaryTypeConfiguration> { new BinaryTypeConfiguration(typeof (Empty)), new BinaryTypeConfiguration(typeof (Primitives)), new BinaryTypeConfiguration(typeof (PrimitiveArrays)), new BinaryTypeConfiguration(typeof (StringDateGuidEnum)), new BinaryTypeConfiguration(typeof (WithRaw)), new BinaryTypeConfiguration(typeof (MetaOverwrite)), new BinaryTypeConfiguration(typeof (NestedOuter)), new BinaryTypeConfiguration(typeof (NestedInner)), new BinaryTypeConfiguration(typeof (MigrationOuter)), new BinaryTypeConfiguration(typeof (MigrationInner)), new BinaryTypeConfiguration(typeof (InversionOuter)), new BinaryTypeConfiguration(typeof (InversionInner)), new BinaryTypeConfiguration(typeof (CompositeOuter)), new BinaryTypeConfiguration(typeof (CompositeInner)), new BinaryTypeConfiguration(typeof (CompositeArray)), new BinaryTypeConfiguration(typeof (CompositeContainer)), new BinaryTypeConfiguration(typeof (ToBinary)), new BinaryTypeConfiguration(typeof (Remove)), new BinaryTypeConfiguration(typeof (RemoveInner)), new BinaryTypeConfiguration(typeof (BuilderInBuilderOuter)), new BinaryTypeConfiguration(typeof (BuilderInBuilderInner)), new BinaryTypeConfiguration(typeof (BuilderCollection)), new BinaryTypeConfiguration(typeof (BuilderCollectionItem)), new BinaryTypeConfiguration(typeof (DecimalHolder)), new BinaryTypeConfiguration(TypeEmpty) }, DefaultIdMapper = new IdMapper() }, JvmClasspath = TestUtils.CreateTestClasspath(), JvmOptions = new List<string> { "-ea", "-Xcheck:jni", "-Xms4g", "-Xmx4g", "-DIGNITE_QUIET=false", "-Xnoagent", "-Djava.compiler=NONE", "-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005", "-XX:+HeapDumpOnOutOfMemoryError" }, SpringConfigUrl = "config\\binary.xml" }; _grid = (Ignite) Ignition.Start(cfg); _marsh = _grid.Marshaller; }
/// <summary> /// Inject resources to the given object. /// </summary> /// <param name="target">Target.</param> /// <param name="ignite">Grid.</param> public void InjectIgnite(object target, Ignite ignite) { Inject0(target, ignite, _igniteInjectors); }
public virtual void TearDown() { if (_grid != null) Ignition.Stop(_grid.Name, true); _grid = null; }
/// <summary> /// Inject resources to the given target. /// </summary> /// <param name="target">Target object.</param> /// <param name="grid">Grid.</param> public static void Inject(object target, Ignite grid) { Inject(target, grid.Proxy); }
/// <summary> /// Initializes this instance with a grid. /// </summary> /// <param name="grid">Grid.</param> public void Init(Ignite grid) { ResourceProcessor.Inject(_store, grid); }
public static void Routine() { var targetR = TargetSelector.GetTarget(R1.Range, TargetSelector.DamageType.Magical); var target = TargetSelector.GetTarget(Q1.Range, TargetSelector.DamageType.Magical); if (target == null || !target.IsValid || targetR == null || !targetR.IsValid) { return; } Ignite = player.GetSpellSlot("summonerdot"); //[R] Aoe Cast byte hitcount; hitcount = (byte)Config.Item("advanced.R.aoe.count").GetValue <Slider>().Value; if (Config.Item("advanced.R.aoe").GetValue <bool>() && R1.IsReady() && !E1.IsReady() && target.IsValidTarget(E1.Range + E1.Width)) { R1.CastIfWillHit(target, hitcount); } #region -- Variables/Floats etc. float qdmg = Q1.GetDamage(target); float edmg = E1.GetDamage(target); float rdmg = R1.GetDamage(target); float aa = (float)Player.GetAutoAttackDamage(target); var insideE = Lux_E != null && target.Distance(Lux_E.Position) <= E1.Width; var thp = target.Health; var AArange = Orbwalking.GetRealAutoAttackRange(player); var debuff = target.HasBuff("luxilluminatingfraulein"); if (debuff) { rdmg += PassiveDMG(target); } if (debuff) { aa += PassiveDMG(target); } if (insideE) { rdmg += edmg; } var rooted = target.HasBuff("LuxLightBindingMis"); #endregion if (insideE && thp < edmg && target.IsValidTarget(R1.Range)) { return; } if (rooted && insideE && rdmg + edmg > thp && target.IsValidTarget(R1.Range)) { SpellCastR(targetR); } #region -- Q spellcast var prediction = Q1.GetPrediction(target, true); var collision = Q1.GetCollision(Player.Position.To2D(), new List <Vector2> { prediction.UnitPosition.To2D() }); if (Config.Item("combo.Q").GetValue <bool>() && Environment.TickCount - E1.LastCastAttemptT > 400 && Environment.TickCount - R1.LastCastAttemptT > 800 && prediction.Hitchance >= PredQ("prediction.Q")) { if (collision.Count == 2) { if (collision[0].IsChampion() || collision[1].IsChampion()) { Q1.Cast(prediction.CastPosition); } } else if (collision.Count == 1 && collision[0].IsChampion()) { Q1.Cast(prediction.CastPosition); } else if (collision.Count <= 1) { Q1.Cast(prediction.CastPosition); } #endregion -- Q spellcast end if (rooted && thp < aa && target.IsValidTarget(AArange)) { return; } if (Config.Item("combo.E").GetValue <bool>() && Environment.TickCount - Q1.LastCastAttemptT > 875 && Environment.TickCount - R1.LastCastAttemptT > 800) { SpellCast(target, E1.Range, E1, false, 1, true, PredE("prediction.E")); } if (IgniteKillCheck() < thp && target.HasBuff("summonerdot")) { return; } if (Config.Item("combo.R").GetValue <bool>() && R1.IsReady()) { SpellCastR(targetR); } if (!target.IsValidTarget(600)) { return; } var ignitemenu = Config.Item("autospells.ignite").GetValue <bool>(); if (thp > IgniteDamage(target) && thp < IgniteDamage(target) + edmg + aa && rooted && E1.IsReady() && target.IsValidTarget(600) && Ignite.IsReady() && ignitemenu) { player.Spellbook.CastSpell(Ignite, target); Printchat("Ignite casted"); } if (thp < IgniteDamage(target) + rdmg + aa && rooted && Ignite.IsReady() && R1.IsReady() && ignitemenu) { player.Spellbook.CastSpell(Ignite, target); Printchat("Ignite casted"); } if (thp < IgniteDamage(target) + rdmg + aa && Ignite.IsReady() && R1.IsReady() && ignitemenu) { player.Spellbook.CastSpell(Ignite, target); Printchat("Ignite casted"); } if (thp < IgniteDamage(target) && target.IsValidTarget(600) && AllyCheck(target, 600) < 1 && Ignite.IsReady() && ignitemenu) { player.Spellbook.CastSpell(Ignite, target); Printchat("Ignite casted"); } } }
private static void ComboEvent() { try { if (isCastingUlt) { return; } var target = TargetSelector.GetTarget(E.Range + 300f); if (target != null && target.IsValidTarget(E.Range + 300f)) { if (ComboMenu["FlowersKatarina.ComboMenu.Ignite"].GetValue <MenuBool>().Enabled&& IgniteSlot != SpellSlot.Unknown && Ignite.IsReady() && target.IsValidTarget(600) && (target.Health < MyExtraManager.GetComboDamage(target) && target.IsValidTarget(400) || target.Health < Me.GetIgniteDamage(target))) { Ignite.Cast(target); } //Item Hextech_Gunblade Bilgewater_Cutlass if (ComboMenu["FlowersKatarina.ComboMenu.W"].GetValue <MenuBool>().Enabled&& ComboMenu["FlowersKatarina.ComboMenu.WSmart"].GetValue <MenuBool>().Enabled&& W.IsReady() && target.IsValidTarget(W.Range)) { W.Cast(); } switch (ComboMenu["FlowersKatarina.ComboMenu.Mode"].GetValue <MenuList>().Index) { case 0: MyExtraManager.QEWLogic(target, ComboMenu["FlowersKatarina.ComboMenu.Q"].GetValue <MenuBool>().Enabled, ComboMenu["FlowersKatarina.ComboMenu.W"].GetValue <MenuBool>().Enabled, ComboMenu["FlowersKatarina.ComboMenu.E"].GetValue <MenuBool>().Enabled); break; case 1: MyExtraManager.EQWLogic(target, ComboMenu["FlowersKatarina.ComboMenu.Q"].GetValue <MenuBool>().Enabled, ComboMenu["FlowersKatarina.ComboMenu.W"].GetValue <MenuBool>().Enabled, ComboMenu["FlowersKatarina.ComboMenu.E"].GetValue <MenuBool>().Enabled); break; } if (ComboMenu["FlowersKatarina.ComboMenu.R"].GetValue <MenuBool>().Enabled&& R.IsReady() && Me.CountEnemyHeroesInRange(R.Range) > 0 && !Q.IsReady() && !W.IsReady() && !E.IsReady()) { if (ComboMenu["FlowersKatarina.ComboMenu.RAlways"].GetValue <MenuBool>().Enabled) { Orbwalker.AttackState = false; Orbwalker.MovementState = false; R.Cast(); } if (ComboMenu["FlowersKatarina.ComboMenu.RKillAble"].GetValue <MenuBool>().Enabled&& (target.Health <= MyExtraManager.GetComboDamage(target) || target.Health <= R.GetDamage(target) * 0.8) && target.Health > Q.GetDamage(target) + MyExtraManager.GetKataPassiveDamage(target) * 2) { Orbwalker.AttackState = false; Orbwalker.MovementState = false; R.Cast(); } if (ComboMenu["FlowersKatarina.ComboMenu.RCountHit"].GetValue <MenuSliderButton>().Enabled&& Me.CountEnemyHeroesInRange(R.Range) >= ComboMenu["FlowersKatarina.ComboMenu.RCountHit"].GetValue <MenuSliderButton>().Value) { Orbwalker.AttackState = false; Orbwalker.MovementState = false; R.Cast(); } } } } catch (Exception ex) { Console.WriteLine("Error in MyEventManager.ComboEvent." + ex); } }
/** <inheritDoc /> */ public void Inject(Ignite grid) { ResourceProcessor.Inject(_action, grid); }
/// <summary> /// Reads the schema according to this header data. /// </summary> /// <param name="stream">The stream.</param> /// <param name="position">The position.</param> /// <param name="hdr">The header.</param> /// <param name="schema">The schema.</param> /// <param name="ignite">The ignite.</param> /// <returns> /// Schema. /// </returns> public static BinaryObjectSchemaField[] ReadSchema(IBinaryStream stream, int position, BinaryObjectHeader hdr, BinaryObjectSchema schema, Ignite ignite) { Debug.Assert(stream != null); Debug.Assert(schema != null); return(ReadSchema(stream, position, hdr, () => GetFieldIds(hdr, schema, ignite))); }
/// <summary> /// Initializes a new instance of the <see cref="RemoteListenEventFilter"/> class. /// </summary> /// <param name="ignite">The grid.</param> /// <param name="filter">The filter.</param> public RemoteListenEventFilter(Ignite ignite, Func<Guid, IEvent, bool> filter) { _ignite = ignite; _filter = filter; }
/// <summary> /// Inject resources to the given object. /// </summary> /// <param name="target">Target.</param> /// <param name="ignite">Grid.</param> public void InjectIgnite(object target, Ignite ignite) { InjectIgnite(target, ignite.Proxy); }
public void SetUp() { TestUtils.KillProcesses(); var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration()) { BinaryConfiguration = new BinaryConfiguration { TypeConfigurations = new List<BinaryTypeConfiguration> { new BinaryTypeConfiguration(typeof (Empty)), new BinaryTypeConfiguration(typeof (Primitives)), new BinaryTypeConfiguration(typeof (PrimitiveArrays)), new BinaryTypeConfiguration(typeof (StringDateGuidEnum)), new BinaryTypeConfiguration(typeof (WithRaw)), new BinaryTypeConfiguration(typeof (MetaOverwrite)), new BinaryTypeConfiguration(typeof (NestedOuter)), new BinaryTypeConfiguration(typeof (NestedInner)), new BinaryTypeConfiguration(typeof (MigrationOuter)), new BinaryTypeConfiguration(typeof (MigrationInner)), new BinaryTypeConfiguration(typeof (InversionOuter)), new BinaryTypeConfiguration(typeof (InversionInner)), new BinaryTypeConfiguration(typeof (CompositeOuter)), new BinaryTypeConfiguration(typeof (CompositeInner)), new BinaryTypeConfiguration(typeof (CompositeArray)), new BinaryTypeConfiguration(typeof (CompositeContainer)), new BinaryTypeConfiguration(typeof (ToBinary)), new BinaryTypeConfiguration(typeof (Remove)), new BinaryTypeConfiguration(typeof (RemoveInner)), new BinaryTypeConfiguration(typeof (BuilderInBuilderOuter)), new BinaryTypeConfiguration(typeof (BuilderInBuilderInner)), new BinaryTypeConfiguration(typeof (BuilderCollection)), new BinaryTypeConfiguration(typeof (BuilderCollectionItem)), new BinaryTypeConfiguration(typeof (DecimalHolder)), new BinaryTypeConfiguration(TypeEmpty), new BinaryTypeConfiguration(typeof(TestEnumRegistered)), new BinaryTypeConfiguration(typeof(NameMapperTestType)) }, DefaultIdMapper = new IdMapper(), DefaultNameMapper = new NameMapper(), CompactFooter = GetCompactFooter() } }; _grid = (Ignite) Ignition.Start(cfg); _marsh = _grid.Marshaller; }
/// <summary> /// Constructor. /// </summary> /// <param name="grid">Grid.</param> /// <param name="job">Job.</param> public ComputeJobHolder(Ignite grid, IComputeJob job) { _ignite = grid; _job = job; }
/// <summary> /// Invokes a store operation. /// </summary> /// <param name="input">Input stream.</param> /// <param name="cb">Callback.</param> /// <param name="grid">Grid.</param> /// <returns>Invocation result.</returns> /// <exception cref="IgniteException">Invalid operation type: + opType</exception> public int Invoke(IBinaryStream input, IUnmanagedTarget cb, Ignite grid) { IBinaryReader reader = grid.Marshaller.StartUnmarshal(input, _convertBinary ? BinaryMode.Deserialize : BinaryMode.ForceBinary); IBinaryRawReader rawReader = reader.GetRawReader(); int opType = rawReader.ReadByte(); // Setup cache sessoin for this invocation. long sesId = rawReader.ReadLong(); CacheStoreSession ses = grid.HandleRegistry.Get<CacheStoreSession>(sesId, true); ses.CacheName = rawReader.ReadString(); _sesProxy.SetSession(ses); try { // Perform operation. switch (opType) { case OpLoadCache: _store.LoadCache((k, v) => WriteObjects(cb, grid, k, v), rawReader.ReadArray<object>()); break; case OpLoad: object val = _store.Load(rawReader.ReadObject<object>()); if (val != null) WriteObjects(cb, grid, val); break; case OpLoadAll: var keys = rawReader.ReadCollection(); var result = _store.LoadAll(keys); foreach (DictionaryEntry entry in result) WriteObjects(cb, grid, entry.Key, entry.Value); break; case OpPut: _store.Write(rawReader.ReadObject<object>(), rawReader.ReadObject<object>()); break; case OpPutAll: _store.WriteAll(rawReader.ReadDictionary()); break; case OpRmv: _store.Delete(rawReader.ReadObject<object>()); break; case OpRmvAll: _store.DeleteAll(rawReader.ReadCollection()); break; case OpSesEnd: grid.HandleRegistry.Release(sesId); _store.SessionEnd(rawReader.ReadBoolean()); break; default: throw new IgniteException("Invalid operation type: " + opType); } return 0; } finally { _sesProxy.ClearSession(); } }
public static bool CastIgnite(Obj_AI_Hero target) { return(Ignite.IsReady() && target.IsValidTarget(600) && target.Health + 5 < Player.GetSummonerSpellDamage(target, Damage.SummonerSpell.Ignite) && Player.Spellbook.CastSpell(Ignite, target)); }
/** <inheritDoc /> */ public void Inject(Ignite grid) { ResourceProcessor.Inject(_clo, grid); }
/// <summary> /// Creates an instance of this class from a stream. /// </summary> /// <param name="memPtr">Memory pointer.</param> /// <param name="grid">Grid.</param> /// <returns>Deserialized instance of <see cref="CacheEntryFilterHolder"/></returns> public static CacheEntryFilterHolder CreateInstance(long memPtr, Ignite grid) { using (var stream = IgniteManager.Memory.Get(memPtr).GetStream()) { Debug.Assert(grid != null); var marsh = grid.Marshaller; return marsh.Unmarshal<CacheEntryFilterHolder>(stream); } }
public void SetUp() { TestUtils.KillProcesses(); var cfg = new IgniteConfiguration { BinaryConfiguration = new BinaryConfiguration { TypeConfigurations = new List<BinaryTypeConfiguration> { new BinaryTypeConfiguration(typeof (Empty)), new BinaryTypeConfiguration(typeof (Primitives)), new BinaryTypeConfiguration(typeof (PrimitiveArrays)), new BinaryTypeConfiguration(typeof (StringDateGuidEnum)), new BinaryTypeConfiguration(typeof (WithRaw)), new BinaryTypeConfiguration(typeof (MetaOverwrite)), new BinaryTypeConfiguration(typeof (NestedOuter)), new BinaryTypeConfiguration(typeof (NestedInner)), new BinaryTypeConfiguration(typeof (MigrationOuter)), new BinaryTypeConfiguration(typeof (MigrationInner)), new BinaryTypeConfiguration(typeof (InversionOuter)), new BinaryTypeConfiguration(typeof (InversionInner)), new BinaryTypeConfiguration(typeof (CompositeOuter)), new BinaryTypeConfiguration(typeof (CompositeInner)), new BinaryTypeConfiguration(typeof (CompositeArray)), new BinaryTypeConfiguration(typeof (CompositeContainer)), new BinaryTypeConfiguration(typeof (ToBinary)), new BinaryTypeConfiguration(typeof (Remove)), new BinaryTypeConfiguration(typeof (RemoveInner)), new BinaryTypeConfiguration(typeof (BuilderInBuilderOuter)), new BinaryTypeConfiguration(typeof (BuilderInBuilderInner)), new BinaryTypeConfiguration(typeof (BuilderCollection)), new BinaryTypeConfiguration(typeof (BuilderCollectionItem)), new BinaryTypeConfiguration(typeof (DecimalHolder)), new BinaryTypeConfiguration(TypeEmpty), new BinaryTypeConfiguration(typeof(TestEnumRegistered)) }, DefaultIdMapper = new IdMapper(), CompactFooter = GetCompactFooter() }, JvmClasspath = TestUtils.CreateTestClasspath(), JvmOptions = TestUtils.TestJavaOptions(), DiscoverySpi = new TcpDiscoverySpi { IpFinder = new TcpDiscoveryStaticIpFinder { Endpoints = new[] { "127.0.0.1:47500", "127.0.0.1:47501" } } } }; _grid = (Ignite) Ignition.Start(cfg); _marsh = _grid.Marshaller; }
public static bool CastIgnite(AIHeroClient target) { return(Ignite.IsReady() && target.LSIsValidTarget(600) && target.Health + 5 < myHero.GetSummonerSpellDamage(target, DamageLibrary.SummonerSpells.Ignite) && myHero.Spellbook.CastSpell(Ignite, target)); }
/** <inheritDoc /> */ public void Inject(Ignite grid) { _ignite = grid; ResourceProcessor.Inject(_filter, grid); }
/// <summary> /// Initializes this instance with a grid. /// </summary> /// <param name="grid">Grid.</param> public void Init(Ignite grid) { _store.Init(grid); }
/// <summary> /// Invokes a store operation. /// </summary> /// <param name="stream">Input stream.</param> /// <param name="grid">Grid.</param> /// <returns>Invocation result.</returns> /// <exception cref="IgniteException">Invalid operation type: + opType</exception> public long Invoke(PlatformMemoryStream stream, Ignite grid) { return(_store.Invoke(stream, grid)); }
private static void Orbwalk() { if (RState == 1 && rShadow.IsValid() && Player.HealthPercent < MainMenu["Orbwalk"]["RSwapIfHpU"] && Common.CountEnemy(Q.Range) > Common.CountEnemy(W.Range, rShadow.ServerPosition) && R.Cast()) { return; } var target = GetTarget; if (target != null) { if (MainMenu["Orbwalk"]["WSwapGap"].GetValue <MenuList>().Index > 0 && WState == 1 && wShadow.IsValid() && Player.Distance(target) > wShadow.Distance(target) && !E.IsInRange(target) && !DeadByRMark(target)) { if (MainMenu["Orbwalk"]["WSwapGap"].GetValue <MenuList>().Index == 1) { var calcCombo = GetComboDmg( target, Q.IsReady(), wShadow.Distance(target) < Q.Range || (rShadow.IsValid() && rShadow.Distance(target) < Q.Range), E.IsReady(), MainMenu["Orbwalk"]["R"] && MainMenu["Orbwalk"]["RCast" + target.ChampionName] && RState == 0); if (((target.Health < calcCombo[0] && (Player.Mana >= calcCombo[1] || Player.Mana * OverkillValue >= calcCombo[1])) || (MainMenu["Orbwalk"]["R"] && MainMenu["Orbwalk"]["RCast" + target.ChampionName] && RState == 0 && !R.IsInRange(target) && wShadow.Distance(target) < R.Range)) && W.Cast()) { return; } } else if (!Q.IsReady() && W.Cast()) { return; } } if (MainMenu["Orbwalk"]["RSwapGap"].GetValue <MenuList>().Index > 0 && RState == 1 && rShadow.IsValid() && Player.Distance(target) > rShadow.Distance(target) && !E.IsInRange(target) && !DeadByRMark(target)) { if (MainMenu["Orbwalk"]["RSwapGap"].GetValue <MenuList>().Index == 1) { var calcCombo = GetComboDmg( target, Q.IsReady(), rShadow.Distance(target) < Q.Range || (wShadow.IsValid() && wShadow.Distance(target) < Q.Range), E.IsReady(), false); if (((target.Health < calcCombo[0] && (Player.Mana >= calcCombo[1] || Player.Mana * OverkillValue >= calcCombo[1])) || (MainMenu["Orbwalk"]["WAdv"].GetValue <MenuList>().Index > 0 && WState == 0 && !W.IsInRange(target) && rShadow.Distance(target) < W.Range + E.Range && ((Q.IsReady() && Player.Mana >= Q.Instance.ManaCost + W.Instance.ManaCost) || (E.IsReady() && Player.Mana >= E.Instance.ManaCost + W.Instance.ManaCost)))) && R.Cast()) { return; } } else if (!Q.IsReady() && R.Cast()) { return; } } if (RState == 1 && rShadow.IsValid() && MainMenu["Orbwalk"]["RSwapIfKill"] && DeadByRMark(target) && Common.CountEnemy(Q.Range) > Common.CountEnemy(W.Range, rShadow.ServerPosition) && R.Cast()) { return; } if (RState == 0 && MainMenu["Orbwalk"]["R"] && MainMenu["Orbwalk"]["RCast" + target.ChampionName] && R.IsInRange(target) && R.CastOnUnit(target)) { return; } if (Player.IsVisible) { if (Ignite.IsReady() && ((HaveRMark(target) && rShadow.IsValid()) || target.HealthPercent < 30) && Player.Distance(target) <= 600 && Player.Spellbook.CastSpell(Ignite, target)) { return; } if ((Q.IsReady() && Player.Mana >= Q.Instance.ManaCost + W.Instance.ManaCost) || (E.IsReady() && Player.Mana >= E.Instance.ManaCost + W.Instance.ManaCost && Player.Distance(target) < W.Range + E.Range)) { if (MainMenu["Orbwalk"]["WNormal"]) { if (RState < 1 && (!MainMenu["Orbwalk"]["R"] || !MainMenu["Orbwalk"]["RCast" + target.ChampionName] || RState == -1)) { CastW(target); } if (RState > 0 && MainMenu["Orbwalk"]["R"] && MainMenu["Orbwalk"]["RCast" + target.ChampionName] && !HaveRMark(target) && rShadow.IsValid()) { CastW(target); } } if (MainMenu["Orbwalk"]["WAdv"].GetValue <MenuList>().Index > 0 && RState > 0 && MainMenu["Orbwalk"]["R"] && MainMenu["Orbwalk"]["RCast" + target.ChampionName] && HaveRMark(target) && rShadow.IsValid()) { CastW(target, true); } } CastQ(target, true); CastE(); } } UseItem(target); }
/// <summary> /// Writes objects to the marshaller. /// </summary> /// <param name="cb">Optional callback.</param> /// <param name="grid">Grid.</param> /// <param name="objects">Objects.</param> private static void WriteObjects(IUnmanagedTarget cb, Ignite grid, params object[] objects) { using (var stream = IgniteManager.Memory.Allocate().GetStream()) { BinaryWriter writer = grid.Marshaller.StartMarshal(stream); try { foreach (var obj in objects) { var obj0 = obj; writer.WithDetach(w => w.WriteObject(obj0)); } } finally { grid.Marshaller.FinishMarshal(writer); } if (cb != null) { stream.SynchronizeOutput(); UnmanagedUtils.CacheStoreCallbackInvoke(cb, stream.MemoryPointer); } } }
public static float GetComboDamage(Obj_AI_Hero unit, int maxStacks) { var d = 2 * Player.GetAutoAttackDamage(unit); if (ItemManager.RavenousHydra.IsValidAndReady() || ItemManager.TitanicHydra.IsValidAndReady()) { d += Player.GetItemDamage(unit, Damage.DamageItems.Hydra); } if (ItemManager.Tiamat.IsValidAndReady()) { d += Player.GetItemDamage(unit, Damage.DamageItems.Tiamat); } if (ItemManager.Botrk.IsValidAndReady()) { d += Player.GetItemDamage(unit, Damage.DamageItems.Botrk); } if (ItemManager.Cutlass.IsValidAndReady()) { d += Player.GetItemDamage(unit, Damage.DamageItems.Bilgewater); } if (ItemManager.Youmuus.IsValidAndReady()) { d += Player.GetAutoAttackDamage(unit, true) * 2; } if (Ignite != null && Ignite.IsReady()) { d += Player.GetSummonerSpellDamage(unit, Damage.SummonerSpell.Ignite); } if (Q.IsReady()) { d += Player.GetSpellDamage(unit, SpellSlot.Q); } if (E.IsReady()) { d += 2 * Player.GetAutoAttackDamage(unit); } if (maxStacks == 0) { if (R.IsReady()) { d += unit.GetPassiveDamage(4); } else { d += unit.GetPassiveDamage(); } } else { d += unit.GetPassiveDamage(maxStacks); } return((float)d); }
/// <summary> /// Initializes a new instance of the <see cref="RemoteListenEventFilter"/> class. /// </summary> /// <param name="ignite">The grid.</param> /// <param name="filter">The filter.</param> public RemoteListenEventFilter(Ignite ignite, Func <IEvent, bool> filter) { _ignite = ignite; _filter = filter; }
/** <inheritdoc /> */ public void Inject(Ignite grid) { throw new NotSupportedException("Should not be called."); }
public void SetUp() { TestUtils.KillProcesses(); var cfg = new IgniteConfiguration { BinaryConfiguration = new BinaryConfiguration { TypeConfigurations = new List<BinaryTypeConfiguration> { new BinaryTypeConfiguration(typeof (Empty)), new BinaryTypeConfiguration(typeof (Primitives)), new BinaryTypeConfiguration(typeof (PrimitiveArrays)), new BinaryTypeConfiguration(typeof (StringDateGuidEnum)), new BinaryTypeConfiguration(typeof (WithRaw)), new BinaryTypeConfiguration(typeof (MetaOverwrite)), new BinaryTypeConfiguration(typeof (NestedOuter)), new BinaryTypeConfiguration(typeof (NestedInner)), new BinaryTypeConfiguration(typeof (MigrationOuter)), new BinaryTypeConfiguration(typeof (MigrationInner)), new BinaryTypeConfiguration(typeof (InversionOuter)), new BinaryTypeConfiguration(typeof (InversionInner)), new BinaryTypeConfiguration(typeof (CompositeOuter)), new BinaryTypeConfiguration(typeof (CompositeInner)), new BinaryTypeConfiguration(typeof (CompositeArray)), new BinaryTypeConfiguration(typeof (CompositeContainer)), new BinaryTypeConfiguration(typeof (ToBinary)), new BinaryTypeConfiguration(typeof (Remove)), new BinaryTypeConfiguration(typeof (RemoveInner)), new BinaryTypeConfiguration(typeof (BuilderInBuilderOuter)), new BinaryTypeConfiguration(typeof (BuilderInBuilderInner)), new BinaryTypeConfiguration(typeof (BuilderCollection)), new BinaryTypeConfiguration(typeof (BuilderCollectionItem)), new BinaryTypeConfiguration(typeof (DecimalHolder)), new BinaryTypeConfiguration(TypeEmpty), new BinaryTypeConfiguration(typeof(TestEnumRegistered)) }, DefaultIdMapper = new IdMapper() }, JvmClasspath = TestUtils.CreateTestClasspath(), JvmOptions = TestUtils.TestJavaOptions(), SpringConfigUrl = "config\\binary.xml" }; _grid = (Ignite) Ignition.Start(cfg); _marsh = _grid.Marshaller; }
/// <summary> /// Invokes a store operation. /// </summary> /// <param name="stream">Input stream.</param> /// <param name="grid">Grid.</param> /// <returns>Invocation result.</returns> /// <exception cref="IgniteException">Invalid operation type: + opType</exception> public int Invoke(IBinaryStream stream, Ignite grid) { IBinaryReader reader = grid.Marshaller.StartUnmarshal(stream, _convertBinary ? BinaryMode.Deserialize : BinaryMode.ForceBinary); IBinaryRawReader rawReader = reader.GetRawReader(); int opType = rawReader.ReadByte(); // Setup cache session for this invocation. long sesId = rawReader.ReadLong(); CacheStoreSession ses = grid.HandleRegistry.Get<CacheStoreSession>(sesId, true); ses.CacheName = rawReader.ReadString(); _sesProxy.SetSession(ses); try { // Perform operation. switch (opType) { case OpLoadCache: { var args = rawReader.ReadArray<object>(); stream.Seek(0, SeekOrigin.Begin); int cnt = 0; stream.WriteInt(cnt); // Reserve space for count. var writer = grid.Marshaller.StartMarshal(stream); _store.LoadCache((k, v) => { lock (writer) // User-defined store can be multithreaded. { writer.WithDetach(w => { w.WriteObject(k); w.WriteObject(v); }); cnt++; } }, args); stream.WriteInt(0, cnt); grid.Marshaller.FinishMarshal(writer); break; } case OpLoad: { var val = _store.Load(rawReader.ReadObject<object>()); stream.Seek(0, SeekOrigin.Begin); var writer = grid.Marshaller.StartMarshal(stream); writer.WriteObject(val); grid.Marshaller.FinishMarshal(writer); break; } case OpLoadAll: { var keys = rawReader.ReadCollection(); var result = _store.LoadAll(keys); stream.Seek(0, SeekOrigin.Begin); stream.WriteInt(result.Count); var writer = grid.Marshaller.StartMarshal(stream); foreach (DictionaryEntry entry in result) { var entry0 = entry; // Copy modified closure. writer.WithDetach(w => { w.WriteObject(entry0.Key); w.WriteObject(entry0.Value); }); } grid.Marshaller.FinishMarshal(writer); break; } case OpPut: _store.Write(rawReader.ReadObject<object>(), rawReader.ReadObject<object>()); break; case OpPutAll: var size = rawReader.ReadInt(); var dict = new Hashtable(size); for (int i = 0; i < size; i++) dict[rawReader.ReadObject<object>()] = rawReader.ReadObject<object>(); _store.WriteAll(dict); break; case OpRmv: _store.Delete(rawReader.ReadObject<object>()); break; case OpRmvAll: _store.DeleteAll(rawReader.ReadCollection()); break; case OpSesEnd: grid.HandleRegistry.Release(sesId); _store.SessionEnd(rawReader.ReadBoolean()); break; default: throw new IgniteException("Invalid operation type: " + opType); } return 0; } finally { _sesProxy.ClearSession(); } }