private bool TotemSelect(int indexTotem, TotemId spellId) { string sLua; _totemBar[indexTotem] = spellId; // Shaman.Dlog("Totem Bar: called with #{0} to '{1}'", indexTotem, sSpell); if (!SpellManager.HasSpell("Call of the Elements")) { return(false); } if (spellId == 0) { Shaman.Dlog("Totem Bar: removing slot #{0}", indexTotem); sLua = String.Format("SetMultiCastSpell({0})", 132 + indexTotem); Shaman.RunLUA(sLua); return(true); } if (!HasTotemSpell(spellId)) { Shaman.Dlog("Totem Bar: cannot set slot #{0} to unknown spell id '{1}'", indexTotem, spellId); return(false); } sLua = String.Format("SetMultiCastSpell({0}, {1})", 132 + indexTotem, (int)spellId); Shaman.RunLUA(sLua); return(true); }
private bool TotemCast(TotemId idTotem) { int indexTotem = _dictTotemSlot[idTotem]; bool setTotem = Shaman.Safe_CastSpell(null, (int)idTotem, Shaman.SpellRange.NoCheck, Shaman.SpellWait.NoWait); return(setTotem); }
private static bool TotemExist(TotemId totemId) { int indexTotem = _dictTotemSlot[totemId]; try { return(_totem[indexTotem] != null && totemId == (TotemId)_totem[indexTotem].CreatedBySpellId); } catch (System.Reflection.TargetInvocationException) { _totem[indexTotem] = null; } catch (Styx.InvalidObjectPointerException) { _totem[indexTotem] = null; } catch (System.InvalidOperationException) { _totem[indexTotem] = null; } return(false); }
/// <summary> /// SetTotemsAsNeeded() - manages casting totems as called for by environment and /// user configuration values. This code uses: /// http://www.yawb.info/2009/08/25/learning-about-totems-tips-to-aid-your-growing-shamanism/ /// as a guideline for totem usage while leveling. /// </summary> private bool SetTotemsAsNeeded() { bool castTotem = false; try { if (!_me.Fleeing && (Shaman.cfg.FarmingLowLevel || _me.IsMoving)) { return(false); } // limit how frequently we check totems. needs to be often, // .. but not each loop. // .. if (_TotemCheckTimer.ElapsedMilliseconds < 1500) { // if this isn't first time here since reset, then wait for 2 seconds if (!_me.Fleeing && _TotemCheckTimer.ElapsedMilliseconds > 0 && TotemsWereSet()) { return(false); } // otherwise, only 0 if first check after last .Reset // .. so continue processing } if (TotemsWereSet() && _ptTotems.Distance(_me.Location) > Shaman.cfg.DistanceForTotemRecall) { Shaman.Dlog("Recalling Totems that were set {0:F1} yds away at point {1}", _ptTotems.Distance(_me.Location), _ptTotems.ToString()); RecallTotemsForMana(); } _TotemCheckTimer.Reset(); _TotemCheckTimer.Start(); //----- // if you make it past the following gate, only limited tests are needed for each totem //----- if (IsPVP() || Shaman.IsRAF()) { ; } else if (Shaman.IsFightStressful() || !Shaman.cfg.PVE_SaveForStress_TotemsSelected) { ; } else { Shaman.Dlog("not setting totems until a stressful situation"); return(false); } // check which totems exist bool bAnyTotemsUp = TotemExist(TOTEM_EARTH) || TotemExist(TOTEM_FIRE) || TotemExist(TOTEM_WATER) || TotemExist(TOTEM_AIR); Shaman.Dlog("SetTotemsAsNeeded: earth: " + BoolToYN(TotemExist(TOTEM_EARTH)) + " fire: " + BoolToYN(TotemExist(TOTEM_FIRE)) + " water: " + BoolToYN(TotemExist(TOTEM_WATER)) + " air: " + BoolToYN(TotemExist(TOTEM_AIR))); _WereTotemsSet = bAnyTotemsUp; // _WereTotemsSet || removed because only matters if they exist // Quick scan for mobs that cast fear (only in RAF) ////////////////////////////////////////////////////////////////////// Shaman.foundMobsThatFear = _me.Fleeing; if (Shaman.foundMobsThatFear) { Shaman.Slog("Tremor Totem: detected fear mob"); } // Totem Bar Set // -- add handling for changing totem bar setup temporarily if needed for tremor totem ////////////////////////////////////////////////////////////////////// const string totemBar = "Call of the Elements"; if (!bAnyTotemsUp && SpellManager.HasSpell(totemBar)) { TotemId saveEarthTotemSetup = TotemId.TREMOR_TOTEM; // if mobs that fear are found and tremor not in bar setup already, add temporarily just for cast if (Shaman.foundMobsThatFear && _totemBar[TOTEM_EARTH] != TotemId.TREMOR_TOTEM) { saveEarthTotemSetup = _totemBar[TOTEM_EARTH]; TotemSelect(TOTEM_EARTH, TotemId.TREMOR_TOTEM); } if (Shaman.Safe_CastSpell(totemBar, Shaman.SpellRange.NoCheck, Shaman.SpellWait.Complete)) { castTotem = true; _WereTotemsSet = true; _ptTotems = _me.Location; if (IsRAF()) { Dlog("SetTotemsAsNeeded: set totems at <{0}> {1:F1} yds from Leader", _ptTotems.ToString(), GroupTank.Distance); } else { Dlog("SetTotemsAsNeeded: set totems at <{0}>", _ptTotems.ToString()); } } // if we changed the earth totem on bar, restore back to configured value if (saveEarthTotemSetup != TotemId.TREMOR_TOTEM) { TotemSelect(TOTEM_EARTH, saveEarthTotemSetup); } } else { // Earth Totems First ////////////////////////////////////////////////////////////////////// if (foundMobsThatFear && HasTotemSpell(TotemId.TREMOR_TOTEM) && TotemId.TREMOR_TOTEM != (TotemId)_totem[TOTEM_EARTH].CreatedBySpellId) { castTotem = castTotem || TotemCast(TotemId.TREMOR_TOTEM); } else if (0 != _totemBar[TOTEM_EARTH]) { if (!TotemExist(TOTEM_EARTH) && HasTotemSpell(_totemBar[TOTEM_EARTH])) { castTotem = castTotem || TotemCast(_totemBar[TOTEM_EARTH]); } if (!TotemExist(TOTEM_EARTH) && Shaman.typeShaman == Shaman.ShamanType.Enhance && HasTotemSpell(TotemId.STRENGTH_OF_EARTH_TOTEM)) { castTotem = castTotem || TotemCast(TotemId.STRENGTH_OF_EARTH_TOTEM); } if (!TotemExist(TOTEM_EARTH) && Shaman.typeShaman != Shaman.ShamanType.Enhance && HasTotemSpell(TotemId.STONESKIN_TOTEM)) { castTotem = castTotem || TotemCast(TotemId.STONESKIN_TOTEM); } } // Fire Totems ////////////////////////////////////////////////////////////////////// if (_countMeleeEnemy >= 3 && !IsHealerOnly()) { if (!_me.GotTarget || !IsImmunneToFire(_me.CurrentTarget)) { if (!TotemExist(TOTEM_FIRE) || (!TotemExist(TotemId.MAGMA_TOTEM) && !TotemExist(TotemId.FIRE_ELEMENTAL_TOTEM))) { if (HasTotemSpell(TotemId.MAGMA_TOTEM)) { castTotem = castTotem || TotemCast(TotemId.MAGMA_TOTEM); } else if (_countMeleeEnemy >= 4 && HasTotemSpell(TotemId.FLAMETONGUE_TOTEM) && !TotemExist(TotemId.FLAMETONGUE_TOTEM)) { Dlog("SetTotemsAsNeeded: 4 or more mobs and Magma not trained, using Flametongue to allow Fire Nova"); castTotem = castTotem || TotemCast(TotemId.FLAMETONGUE_TOTEM); } } } } if (0 != _totemBar[TOTEM_FIRE] && !TotemExist(TOTEM_FIRE)) { if (!TotemExist(TOTEM_FIRE) && HasTotemSpell(_totemBar[TOTEM_FIRE])) { castTotem = castTotem || TotemCast(_totemBar[TOTEM_FIRE]); } if (!TotemExist(TOTEM_FIRE) && Shaman.typeShaman != Shaman.ShamanType.Resto && HasTotemSpell(TotemId.SEARING_TOTEM)) { castTotem = castTotem || TotemCast(TotemId.SEARING_TOTEM); } if (!TotemExist(TOTEM_FIRE) && HasTotemSpell(TotemId.FLAMETONGUE_TOTEM)) { castTotem = castTotem || TotemCast(TotemId.FLAMETONGUE_TOTEM); } } // Water Totems ////////////////////////////////////////////////////////////////////// if (0 != _totemBar[TOTEM_WATER]) { if (!TotemExist(TOTEM_WATER) && HasTotemSpell(_totemBar[TOTEM_WATER])) { castTotem = castTotem || TotemCast(_totemBar[TOTEM_WATER]); } if (!TotemExist(TOTEM_WATER) && HasTotemSpell(TotemId.MANA_SPRING_TOTEM)) { castTotem = castTotem || TotemCast(TotemId.MANA_SPRING_TOTEM); } } // Air Totems ////////////////////////////////////////////////////////////////////// if (0 != _totemBar[TOTEM_AIR]) { if (!TotemExist(TOTEM_AIR) && HasTotemSpell(_totemBar[TOTEM_WATER])) { castTotem = castTotem || TotemCast(_totemBar[TOTEM_AIR]); } if (!TotemExist(TOTEM_AIR) && Shaman.typeShaman == Shaman.ShamanType.Resto && HasTotemSpell(TotemId.GROUNDING_TOTEM)) { castTotem = castTotem || TotemCast(TotemId.GROUNDING_TOTEM); } if (!TotemExist(TOTEM_AIR) && Shaman.typeShaman == Shaman.ShamanType.Enhance && HasTotemSpell(TotemId.WINDFURY_TOTEM)) { castTotem = castTotem || TotemCast(TotemId.WINDFURY_TOTEM); } if (!TotemExist(TOTEM_AIR) && Shaman.typeShaman == Shaman.ShamanType.Elemental && HasTotemSpell(TotemId.WRATH_OF_AIR_TOTEM)) { castTotem = castTotem || TotemCast(TotemId.WRATH_OF_AIR_TOTEM); } } _WereTotemsSet = _WereTotemsSet || TotemExist(TOTEM_EARTH) || TotemExist(TOTEM_FIRE) || TotemExist(TOTEM_WATER) || TotemExist(TOTEM_AIR); if (!bAnyTotemsUp && _WereTotemsSet) { _ptTotems = _me.Location; } } } catch (ThreadAbortException) { throw; } catch (Exception e) { Log(Color.Red, "An Exception occured. Check debug log for details."); Logging.WriteDebug("HB EXCEPTION in SetTotemsAsNeeded()"); Logging.WriteException(e); } // would like to remove this code, but seeing duplicate totem sets if (castTotem) { ObjectManager.Update(); TotemManagerUpdate(); } return(castTotem); }
public bool HasTotemSpell(TotemId t) { return(SpellManager.HasSpell((int)t)); }
private bool TotemSelect(int indexTotem, TotemId spellId) { string sLua; _totemBar[indexTotem] = spellId; // Shaman.Dlog("Totem Bar: called with #{0} to '{1}'", indexTotem, sSpell); if (!SpellManager.HasSpell("Call of the Elements")) return false; if (spellId == 0) { Shaman.Dlog("Totem Bar: removing slot #{0}", indexTotem); sLua = String.Format("SetMultiCastSpell({0})", 132 + indexTotem); Shaman.RunLUA(sLua); return true; } if (!HasTotemSpell(spellId)) { Shaman.Dlog("Totem Bar: cannot set slot #{0} to unknown spell id '{1}'", indexTotem, spellId); return false; } sLua = String.Format("SetMultiCastSpell({0}, {1})", 132 + indexTotem, (int) spellId); Shaman.RunLUA(sLua); return true; }
private bool TotemCast(TotemId idTotem) { int indexTotem = _dictTotemSlot[idTotem]; bool setTotem = Shaman.Safe_CastSpell(null, (int)idTotem, Shaman.SpellRange.NoCheck, Shaman.SpellWait.NoWait ); return setTotem; }
public bool HasTotemSpell(TotemId t) { return SpellManager.HasSpell((int) t); }
private static bool TotemExist(TotemId totemId) { int indexTotem = _dictTotemSlot[totemId]; try { return _totem[indexTotem] != null && totemId == (TotemId)_totem[indexTotem].CreatedBySpellId; } catch (System.Reflection.TargetInvocationException) { _totem[indexTotem] = null; } catch (Styx.InvalidObjectPointerException) { _totem[indexTotem] = null; } catch (System.InvalidOperationException) { _totem[indexTotem] = null; } return false; }