public static UOCharacter BandHealRess(string target) { Game.PrintMessage("BandHealRess - Ghosts: " + GhostCount()); if (Healing.CleanBandage.Exist) { TargetInfo tInfo = Targeting.GetTarget(target); if (tInfo.Success) { if (tInfo.Character.Distance <= 1) { tInfo.Character.Print(Game.Val_GreenBlue, "[Ressuji..]"); CastResultInfo info = Magery.Current.CastSpell(StandardSpell.GreaterHeal, tInfo.Character, true, false); if (info.NotInSpellBook) { info = Magery.Current.CastSpell(StandardSpell.Heal, tInfo.Character, false, false); } Game.Wait(250); Healing.CleanBandage.Use(); UO.WaitTargetObject(tInfo); LastCharacter = tInfo.Character; if (tInfo.Character.Distance <= 1) { World.Player.PrintMessage("[Ress done " + Healing.CleanBandage.Amount + "..]"); } Game.Wait(50); if (tInfo.Character.RequestStatus(125) && tInfo.Character.Hits > 0) { tInfo.Character.Print(Game.Val_GreenBlue, "[Ress OK " + tInfo.Character.Hits + "hp]"); } } else { tInfo.Character.Print(Game.Val_LightPurple, "[Daleko " + tInfo.Character.Distance + "...]"); } } else { World.Player.PrintMessage("[Zadny duch..]", MessageType.Warning); } } else { World.Player.PrintMessage("[Nemas bandage..]", MessageType.Error); } return(LastCharacter); }
//--------------------------------------------------------------------------------------------- //TODO public CastResultInfo CastNecroSpell(NecromancySpell spell, string target) { Journal.Clear(); CastResultInfo info = new CastResultInfo(); info.Usage = CastUsage.Scrool; if (EnsureNecroScroll(spell)) { World.Player.PrintMessage(spell + "" /*+ " [" + World.Player.FindType(SpellScrool[spell]).Amount + "ks]"*/);//spis regy Game.RunScriptCheck(5000); TargetInfo tInfo = Targeting.GetTarget(target); if (tInfo.Success) { UOItem scroll = World.Player.FindType(SpellScrool[spell]); scroll.Use(); if (tInfo.Object.Exist) { UO.WaitTargetObject(tInfo); } else { UO.WaitTargetTile(tInfo.StaticTarget.X, tInfo.StaticTarget.Y, tInfo.StaticTarget.Z, tInfo.StaticTarget.Graphic); } if (Journal.WaitForText(true, 150, "You can't see the target", "Target is not in line of sight")) { if (Journal.Contains(true, "You can't see the target")) { info.CantSee = true; Game.PrintMessage("Cant SEE: " + tInfo.StaticTarget.Serial + " / " + tInfo.Object.Exist + " / " + tInfo.Character.Name); } else if (Journal.Contains(true, "Target is not in line of sight")) { info.NoInLineOfSight = true; tInfo.Object.PrintMessage("[Not in sight]", Game.Val_LightPurple); } } } } return(info); }
public UOCharacter IVMAutoB(int maxdistance, int hits) { UOCharacter result = null; List <CharHealPriority> chhpList = GetCharHealPriorityList(maxdistance, false, Game.MergeLists <UOCharacter>(Game.CurrentGame.Alies, Game.CurrentGame.HealAlies)); var sortedList = chhpList.Where(c => !skip.Contains(c.Char.Serial)).ToList(); if (sortedList.Count == 0) { skip.Clear(); sortedList = chhpList; } if (sortedList.Count > 0) { foreach (CharHealPriority c in sortedList) { UOCharacter ch = result = c.Char; //if (ch.Serial != World.Player.Serial) // LastCharacter = ch; if (String.IsNullOrEmpty(ch.Name)) { ch.Click(); Game.Wait(150); } CastResultInfo info = new CastResultInfo(); string spellShortCut = ""; double dhits = (double)hits; double dmg = ch.MaxHits - ch.Hits; double dmgRel = dmg / dhits; double mHitsRel = (double)ch.MaxHits / dhits; double dmgHitsRel = mHitsRel - dmgRel; UOItem scrools = World.Player.Backpack.AllItems.FindType(Magery.SpellScrool[StandardSpell.GreaterHeal]); if (dmgRel > 0.75 && dmgHitsRel <= 2.25 && scrools.Exist) { spellShortCut = "IVM"; info = Bishop.CastBishopGreaterHeal(true, ch.Serial, true); if (info.Spell == StandardSpell.Heal) { spellShortCut = "IM"; } } else if (dmg > 30) { spellShortCut = "IVM"; info = Magery.Current.CastSpell(StandardSpell.GreaterHeal, ch, true, false, true); } else { spellShortCut = "IM"; info = Magery.Current.CastSpell(StandardSpell.Heal, ch, true, false, true); } if (info.NoInLineOfSight) { skip.Add(ch.Serial); } else { ushort color = CalStatusMessage.Val_InfoColor; if (info.Usage == CastUsage.Scrool) { color = Game.Val_Green; } ch.PrintMessage("[" + spellShortCut + "...]", Game.GetAlieColorByHits(ch.Serial)); bool reset = sortedList.Count == 1; if (!reset) { int skipCount = 0; foreach (CharHealPriority chp in sortedList) { if (skip.Contains(chp.Char.Serial)) { skipCount++; } } reset = skipCount == sortedList.Count; } if (reset) { skip = new List <Serial>(); } } break; } } else { Game.PrintMessage("IVMA: " + Game.MergeLists <UOCharacter>(Game.CurrentGame.Alies, Game.CurrentGame.HealAlies).Count + " OK"); } return(result); }
public UOCharacter IVMAuto(int maxdistance, bool useInMani, StandardSpell secondarySpell, bool useScroolByHits, StandardSpell primarySpell) { UOCharacter result = null; List <CharHealPriority> chhpList = GetCharHealPriorityList(maxdistance, false, Game.MergeLists <UOCharacter>(Game.CurrentGame.Alies, Game.CurrentGame.HealAlies)); var sortedList = chhpList.Where(c => !skip.Contains(c.Char.Serial)).ToList(); if (sortedList.Count == 0) { skip.Clear(); sortedList = chhpList; } if (sortedList.Count > 0) { bool useScrool = false; foreach (CharHealPriority c in sortedList) { UOCharacter ch = result = c.Char; //if (ch.Serial != World.Player.Serial) // LastCharacter = ch; if (String.IsNullOrEmpty(ch.Name)) { ch.Click(); Game.Wait(150); } CastResultInfo info = new CastResultInfo(); string spellShortCut = ""; if (ch.MaxHits - ch.Hits <= 25 && useInMani) { spellShortCut = "IM"; info = Magery.Current.CastSpell(StandardSpell.Heal, ch, true, false, true); } else { if (useScroolByHits && (c.DamagePerc >= 35 || c.Char.MaxHits <= 90 && c.Damage >= 30 || ch.Serial == World.Player.Serial)) { useScrool = true; } //TODO predelat info = Magery.Current.CastSpell(primarySpell, ch, useScrool, false, true, true); if (!info.Success) { if (secondarySpell == StandardSpell.Heal) { spellShortCut = "IM"; info = Magery.Current.CastSpell(StandardSpell.Heal, ch, useScrool, false, true, false); } else if (secondarySpell == StandardSpell.GreaterHeal) { spellShortCut = "IVM"; info = Magery.Current.CastSpell(StandardSpell.GreaterHeal, ch, false, false, true, false); } } else { spellShortCut = primarySpell == StandardSpell.GreaterHeal ? "IVM" : "IM"; } } if (info.NoInLineOfSight) { skip.Add(ch.Serial); } else { ushort color = CalStatusMessage.Val_InfoColor; if (info.Usage == CastUsage.Scrool) { color = 0x0048; } ch.PrintMessage("[" + spellShortCut + "...]" + (useScrool ? " (S)" : ""), Game.GetAlieColorByHits(ch.Serial)); bool reset = sortedList.Count == 1; if (!reset) { int skipCount = 0; foreach (CharHealPriority chp in sortedList) { if (skip.Contains(chp.Char.Serial)) { skipCount++; } } reset = skipCount == sortedList.Count; } if (reset) { skip = new List <Serial>(); } } break; } } else { Game.PrintMessage("IVMA: " + Game.MergeLists <UOCharacter>(Game.CurrentGame.Alies, Game.CurrentGame.HealAlies).Count + " OK"); } return(result); }
//--------------------------------------------------------------------------------------------- /// <summary> /// Obecne kouzleni hlava + svitky, svitky omezena podpora na to co je SpellScrool, co chybi napsat dodela. Nefunguje na nekro kouzla. Pokud je kouzlo vypsano nad hlavou zelene = SVITEK /// </summary> /// <param name="spell">Kouzlo</param> /// <param name="target">Cil = pokud Serial.Invalid resp. null tak vyhodi tercik</param> /// <param name="useScrool">Pouzij svitek, pokud je, jinak hlava</param> /// <param name="useSwitchHeadScrool">Stridej svitek a hlavu, tj. uchovava si ke kazdemu kouzlo co bylo kouzleno naposled</param> /// <param name="silence">Nevypise nad hlavu jmeno kouzla + lvl, pouziva se v kodu kde chcete si vypadt neco extra</param> /// <param name="forceScrool">Vynutit svite, pokud neni svitek tak nekouzli a v CastResiltInfu vrat FALSe</param> /// <returns></returns> public CastResultInfo CastSpell(StandardSpell spell, Serial target, bool useScrool, bool useSwitchHeadScrool, bool silence, bool forceScrool) { Game.CheckStopBanding(); Targeting.ResetTarget(); Journal.Clear(); CastResultInfo info = new CastResultInfo(); info.Usage = useScrool ? CastUsage.Scrool : CastUsage.Head; if (htSwitch == null) { htSwitch = new Hashtable(); } int circle = GetSpellCircle(spell); UOCharacter ch = new UOCharacter(target); if (ch.Exist && String.IsNullOrEmpty(ch.Name)) { ch.Click(); Game.Wait(50, true); } if (spell == StandardSpell.SummonCreature && !String.IsNullOrEmpty(this.selectedSummon)) { Game.RunScript(5000); this.CastSummonCreature(this.selectedSummon, target); } else { if (htSwitch[spell] == null) { htSwitch[spell] = info.Usage; } else if (useSwitchHeadScrool && !forceScrool) { CastUsage currentUsage = (CastUsage)htSwitch[spell]; if (currentUsage == CastUsage.Head) { info.Usage = CastUsage.Scrool; } else { info.Usage = CastUsage.Head; } } bool waitForScrool = false; if (info.Usage == CastUsage.Scrool && lastScrool.HasValue) { double currentTimeout = GetScroolTimeout(); double currentTime = (DateTime.Now - lastScrool.Value).TotalSeconds; if (currentTime < currentTimeout) { waitForScrool = true; if (!forceScrool) { info.Usage = CastUsage.Head; } Game.PrintMessage(String.Format("Scroll za! {0:N1}s", currentTimeout - currentTime)); } } //TODO zjistit Flag na jsem parnutej if (info.Usage == CastUsage.Scrool && !waitForScrool) { if (SpellScrool.ContainsKey(spell) && World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Exist) { if (!target.IsValid || !new UOObject(target).Exist) { Magery.TrySetCastingSpell(new CastSpellInfo(spell, true, silence)); World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Use(); if (!Journal.WaitForText(true, 250, "You can't reach that", "You can't cast", "You can't read that")) { lastScrool = DateTime.Now.AddMilliseconds(-250); info.Usage = CastUsage.Scrool; info.Success = true; } else if (!forceScrool) { info.Usage = CastUsage.Head; } } else { Magery.TrySetCastingSpell(new CastSpellInfo(spell, true, silence)); UO.WaitTargetObject(target); World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Use(); if (!Journal.WaitForText(true, 250, "You can't reach that", "You can't cast", "You can't read that")) { lastScrool = DateTime.Now.AddMilliseconds(-250); info.Usage = CastUsage.Scrool; info.Success = true; } else if (!forceScrool) { info.Usage = CastUsage.Head; } } } else if (!forceScrool) { info.Usage = CastUsage.Head; } } ushort color = CalStatusMessage.Val_InfoColor; //if (info.Usage == CastUsage.Scrool) //{ // color = Game.Val_Green; // if (!silence) // World.Player.PrintMessage(spell + " [" + World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Amount + "ks]", color); //} htSwitch[spell] = info.Usage; if (info.Usage == CastUsage.Head) { //Game.RunScript(Magery.GetCircleRunscriptTime(Magery.GetSpellCircle(spell))); if (!target.IsValid || !new UOObject(target).Exist || new UOObject(target).Distance > 30) { Magery.TrySetCastingSpell(new CastSpellInfo(spell, false, silence)); UO.Cast(spell); } else { Magery.TrySetCastingSpell(new CastSpellInfo(spell, false, silence)); UO.Cast(spell, target); if (Journal.WaitForText(true, 150, "You can't see the target", "Target is not in line of sight")) { if (Journal.Contains(true, "You can't see the target")) { info.CantSee = true; Game.PrintMessage("Cant SEE: " + target + " / " + new UOCharacter(target).Exist + " / " + new UOCharacter(target).Name); info.Success = CastSpell(spell, Serial.Invalid, useScrool, useSwitchHeadScrool, silence, forceScrool).Success; } else if (Journal.Contains(true, "Target is not in line of sight")) { info.NoInLineOfSight = true; new UOObject(target).PrintMessage("[Not in sight]", Game.Val_LightPurple); } } else { if (ch.Exist && !silence && (spell == StandardSpell.Harm || spell == StandardSpell.FlameStrike || spell == StandardSpell.MagicArrow || spell == StandardSpell.Lightning || spell == StandardSpell.Clumsy || spell == StandardSpell.Curse || spell == StandardSpell.EnergyBolt || spell == StandardSpell.Feeblemind || spell == StandardSpell.MindBlast || spell == StandardSpell.Paralyze) ) { if (target != World.Player.Serial) { new UOObject(target).PrintMessage(String.Format("[{0}/{1}]", ch.Hits, ch.MaxHits), ch.Notoriety == Notoriety.Murderer || ch.Notoriety == Notoriety.Enemy ? Game.GetEnemyColorByHits(target) : Game.GetAlieColorByHits(target)); } } } } if (Journal.WaitForText(true, 100, "The spell is not in your spellbook")) { info.Success = false; info.NotInSpellBook = true; Targeting.ResetTarget(); } else if (!info.CantReach) { info.Success = true; } } else { Game.PrintMessage(spell + ": " + World.Player.Backpack.AllItems.FindType(SpellScrool[spell]).Amount + ""); } } return(info); }