public static void WrongKlic() { List <UOCharacter> npcs = World.Characters.Where(i => i.Distance < 25 && i.Notoriety == Notoriety.Innocent && i.Serial != World.Player.Serial).OrderBy(i => (uint)i.Serial).ToList(); List <UOCharacter> npcsNext = npcs.Where(i => (uint)i.Serial > lastWrongSerial).ToList(); UOCharacter ch = new UOCharacter(Serial.Invalid); if (npcsNext.Count > 0) { ch = npcsNext[0]; } else if (npcs.Count > 0) { ch = npcs[0]; } if (ch.Serial.IsValidCust() && ch.Exist) { Journal.Clear(); if (String.IsNullOrEmpty(ch.Name)) { ch.Click(); Game.Wait(150); } if (!String.IsNullOrEmpty(ch.Name)) { UO.Say(ch.Name + " klic "); Game.Wait(250); if (ch.Exist) { if (Journal.Contains(true, "modry")) { ch.PrintMessage("[Modry..]", Game.Val_Blue); } else if (Journal.Contains(true, "cerveny")) { ch.PrintMessage("[Cerveny..]", Game.Val_Red); } else if (Journal.Contains(true, "zeleny")) { ch.PrintMessage("[Zleny..]", Game.Val_Green); } else if (Journal.Contains(true, "zluty")) { ch.PrintMessage("[Zluty..]", Game.Val_LightYellow); } else { ch.PrintMessage("[Zadny..]", Game.Val_LightPurple); } } } lastWrongSerial = ch.Serial; } }
public void MobGo() { Serial mob = Aliases.GetObject("SelectedMob"); UOCharacter ch = new UOCharacter(mob); string name = null; if (ch.Renamable && mob.IsValid && ch.Exist && ch.Distance < 15 && !String.IsNullOrEmpty(ch.Name)) { ch.PrintMessage("[go...]"); name = ch.Name; List <MobKillInfo> mobQueue = this.MobQueue; foreach (MobKillInfo k in mobQueue) { if (k.Mob.Serial == ch.Serial) { k.CommandCount = 0; k.Enemy = new UOCharacter(Serial.Invalid); } } } string command = "all go"; if (!String.IsNullOrEmpty(name)) { command = name + " go"; } UO.Say(Game.Val_GreenBlue, command); }
public void MobGo() { Serial mob = Aliases.GetObject("SelectedMob"); UOCharacter ch = new UOCharacter(mob); string name = null; TargetInfo t = Targeting.GetTarget(""); if (ch.Renamable && mob.IsValid && ch.Exist && ch.Distance < 18 && !String.IsNullOrEmpty(ch.Name)) { ch.PrintMessage("[go...]"); name = ch.Name; List <MobKillInfo> mobQueue = this.MobQueue; foreach (MobKillInfo k in mobQueue) { if (k.Mob.Serial == ch.Serial) { k.CommandCount = 0; k.Enemy = new UOCharacter(Serial.Invalid); } } } string command = "all go"; if (!String.IsNullOrEmpty(name)) { command = name + " go"; } if (t != null && t.Success) { UO.WaitTargetTile(t.StaticTarget.X, t.StaticTarget.Y, t.StaticTarget.Z, t.StaticTarget.Graphic); if (t.Character != null && t.Character.Exist && Game.IsMob(t.Character.Serial)) { Aliases.SetObject("SelectedMob", t.Character.Serial); } UO.Say(Game.Val_GreenBlue, command); } }
//--------------------------------------------------------------------------------------------- public static HealInfo BandSafe(Serial serial, bool isAutoHeal) { HealInfo hInfo = new HealInfo(); hInfo.HasBandages = Healing.CleanBandage.Exist; if (hInfo.HasBandages) { if (isAutoHeal && Game.CheckRunning()) { return(hInfo); } UOCharacter ch = new UOCharacter(serial); ch.PrintHitsMessage("[Banding...]"); int ohits = new UOCharacter(serial).Hits; Game.RunScriptCheck(250); Journal.Clear(); Targeting.ResetTarget(); Healing.CleanBandage.Use(); UO.WaitTargetObject(serial); DateTime start = DateTime.Now; //Vylecil jsi otravu! hInfo.Used = Journal.WaitForText(true, 3500, "You must be able to reach the target", "Chces vytvorit mumii?", "You put the bloody bandagess in your pack.", "You apply the bandages, but they barely help.", "Your target is already fully healed", "Vylecil jsi otravu!"); int time = Convert.ToInt32((DateTime.Now - start).TotalMilliseconds); int wait = 2550 - time; if (Journal.Contains(true, "Nemuzes pouzit bandy na summona!")) { hInfo.TryHealSummon = true; } if (Journal.Contains(true, "You must be able to reach the target")) { hInfo.CantReach = true; } if (Journal.Contains(true, "Chces vytvorit mumii?") || Journal.Contains(true, "Your target is already fully healed")) { hInfo.FullHealed = true; } if (Journal.Contains(true, "Vylecil jsi otravu!")) { hInfo.CuredPoison = true; } hInfo.Success = Journal.Contains(true, "You put the bloody bandagess in your pack"); hInfo.Failed = Journal.Contains(true, "You apply the bandages, but they barely help"); if (hInfo.CuredPoison) { wait = 250; } wait += 1; if (wait > 0) { Game.Wait(wait); } if (hInfo.CantReach) { ch.PrintMessage("[Can't reach Band]" + (serial == World.Player.Serial ? " Self" : ""), Game.Val_LightGreen); } int hits = new UOCharacter(serial).Hits; int incr = hits - ohits; if (hInfo.Success && incr > 0) { hInfo.Gain = incr; } } return(hInfo); }
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); }
public CallbackResult HitsChanged(byte[] data, CallbackResult prevResult) { UOCharacter character = new UOCharacter(ByteConverter.BigEndian.ToUInt32(data, 1)); decimal maxHits = (ushort)character.MaxHits; ushort hits = ByteConverter.BigEndian.ToUInt16(data, 7); if (character.Hits != hits) { ushort color = 0x059; string name = ""; decimal perc = 0; bool print = false; bool onlyDamage = false; short dmg = (short)(hits - character.Hits); bool alie = false; decimal percHit = (decimal)((decimal)hits / (decimal)character.MaxHits) * 100m;// / (decimal)character.MaxHits) * 100.0m) - 100; decimal damagePerc = ((decimal)(Math.Abs(dmg)) / (decimal)character.MaxHits) * 100.0m; if (maxHits > 0) { perc = ((hits / maxHits) * 100.0m); if (character.Serial == World.Player.Serial) { if (Math.Abs(character.Hits - hits) < 3) { print = false; } else { name = hits + ""; print = true; } } else if (Game.MergeLists <UOCharacter>(Game.CurrentGame.Alies, Game.CurrentGame.HealAlies).Where(item => item.Serial == character.Serial).Count() > 0) { alie = print = true; } else if (character.Renamable)//Summoni { print = true; color = 0x0159; print = onlyDamage = true; } else if (character.Notoriety == Notoriety.Murderer || character.Notoriety == Notoriety.Enemy) { name = character.Name; color = 0x0021; print = onlyDamage = true; } else if (character.Notoriety == Notoriety.Guild) { name = character.Name; color = 0x003F; print = onlyDamage = true; } else if (character.Notoriety == Notoriety.Criminal || character.Notoriety == Notoriety.Unknown || character.Notoriety == Notoriety.Neutral) { name = character.Name; color = 0x03B7; print = onlyDamage = true; } } if (print) { if (alie) { if (CalebConfig.FriendHitsMessageType != MessagePrintType.None) { if (dmg < 0) { color = 0x002a; } else { color = 0x003F; } if (Math.Abs(dmg) != 1) { if (CalebConfig.FriendHitsMessageType == MessagePrintType.Default) { character.PrintMessage((dmg < 0 ? "" : "+") + (dmg), color); } else { Game.PrintMessage(character.Name + ": " + (dmg < 0 ? "" : "+") + (dmg), color); } } } } else { if (onlyDamage) { if (dmg < 0 && CalebConfig.EnemyHitsMessageType != MessagePrintType.None) { if (CalebConfig.EnemyHitsMessageType == MessagePrintType.Default) { character.PrintMessage("" + (dmg), color); } else { Game.PrintMessage(character.Name + ": " + (dmg), color); } } } else//toto je hrac?? { if (CalebConfig.PlayerHitsMessageType != MessagePrintType.None) { string sufix = ""; if (dmg < 0 && (damagePerc > 30 || percHit <= 50)) { sufix = " Critical!"; color = 0x0149; } if (CalebConfig.PlayerHitsMessageType == MessagePrintType.Default) { character.PrintMessage(name + " [" + (dmg < 0 ? "" : "+") + dmg + "]" + sufix, color); } else { Game.PrintMessage("Player: " + name + " [" + (dmg < 0 ? "" : "+") + dmg + "]" + sufix, color); } } if (dmg < 0) { this.OnDamage(character); } } } } } return(0); }
public void MobKill(int resetTimer) { ResetTimerDefault = resetTimer; Game.CurrentGame.CurrentPlayer.EnsureWarMode(); List <MobKillInfo> mobQueue = this.MobQueue; MobKillInfo current = null; MobKillInfo last = null; int startIndex = 0; for (int i = 0; i < mobQueue.Count; i++) { MobKillInfo k = mobQueue[i]; if (lastMob.IsValid && lastMob == k.Mob.Serial) { //Game.PrintMessage("startIndex " + startIndex + " / " + Game.RenameSufix(k.Mob.Name), Game.Val_GreenBlue); if (i < mobQueue.Count - 1) { startIndex = i + 1; lastMob = Serial.Invalid; } else { last = k;//new MobKillInfo(new UOCharacter(lastMob), resetTimer); } } if (k.CommandCount == 0 && k.Mob.Serial != k.GetEnemyOrDefault().Serial) { //Game.PrintMessage("New FOUND " + k.Mob.Name + " / " + i, Game.Val_GreenBlue); current = mobQueue[i]; break; } } if (current == null) { for (int i = startIndex; i < mobQueue.Count; i++) { MobKillInfo k = mobQueue[i]; if (k.NeedCommand()) { //Game.PrintMessage("New OLD " + k.Mob.Name + " / " + i, Game.Val_GreenBlue); current = k; break; } } } if (current == null && last != null && last.NeedCommand()) { current = last; } //Game.PrintMessage("Mobs [" + mobQueue.Count + "]", Game.Val_GreenBlue); string command = null; UOColor sayColor = Game.Val_LightGreen; UOCharacter finalEnemy = new UOCharacter(Serial.Invalid); if (current != null) { command = current.Mob.Name + " kill"; current.CommandCount++; current.LastCommandTime = DateTime.Now; sayColor = Game.GetAlieColorByHits(current.Mob.Serial); current.Mob.PrintMessage(Game.RenameSufix(current.Mob.Name) + (!String.IsNullOrEmpty(current.CommandReasonCode) && Game.Debug ? " [" + current.CommandReasonCode + "]" : ""), sayColor);//zatim pro debug if (!current.Enemy.ExistCust()) { current.Enemy = current.GetEnemy(); } finalEnemy = current.Enemy; lastMob = current.Mob.Serial; } else if (mobQueue.Count == 0) { command = "all kill"; } if (!String.IsNullOrEmpty(command) && finalEnemy.ExistCust() && finalEnemy.Distance < 22) { Targeting.ResetTarget(); Game.RunScriptCheck(250); Game.Wait(50); UO.WaitTargetObject(finalEnemy); UO.Say(sayColor, command); } if (finalEnemy.ExistCust()) { if (finalEnemy.Hits < 0) { finalEnemy.RequestStatus(150); } finalEnemy.PrintMessage(String.Format(">>{0}/{1}<<", finalEnemy.Hits, finalEnemy.MaxHits), Game.GetEnemyColorByHits(finalEnemy.Serial)); new StatusBar().Show(finalEnemy.Serial); } }
public bool UseMount() { var currChars = World.Characters.Where(ch => ch.Serial != World.Player.Serial && ch.Distance <= 6).ToArray(); var newChars = World.Characters.Where(ch => ch.Serial != World.Player.Serial && ch.Distance <= 6).ToArray(); var diff = newChars.Where(ch => currChars.Count(cch => cch.Serial == ch.Serial) == 0).ToArray(); UOItem currentMount = World.Player.Layers[Layer.Mount]; Serial originalMount = _Mount; bool dismount = currentMount.ExistCust(); _Mount = Serial.Invalid; if (dismount) { UOColor currentColor = currentMount.Color; World.Player.Use(); Game.Wait(100); newChars = World.Characters.Where(ch => ch.Serial != World.Player.Serial && ch.Distance <= 6).ToArray(); diff = newChars.Where(ch => currChars.Count(cch => cch.Serial == ch.Serial) == 0).ToArray(); diff = diff.OrderBy(ch => ch.Distance).ThenBy(ch => (ch.Color == currentColor ? 0 : 1)).ToArray(); if (diff.Count() > 0) { _Mount = diff.ToArray()[0].Serial; } } else { UOCharacter curr = new UOCharacter(originalMount); if (!curr.ExistCust()) { UOItem shrink = new UOItem(Serial.Invalid); foreach (UOItem itm in World.Player.Backpack.AllItems) { if (ItemLibrary.ShrinkMountTypes.Count(uot => uot.Graphic == itm.Graphic) > 0) { shrink = itm; break; } } List <UOCharacter> m = new List <UOCharacter>(); if (HasHumanBody)//nemam haluze { m.AddRange(currChars. Where(ch => !denyMounts.Contains(ch.GetUniqueKey()) && !skipMounts.Contains(ch.GetUniqueKey()) && ItemLibrary.MountTypes.Count(mt => mt.Graphic == ch.Model) > 0). OrderBy(ch => (ch.Renamable ? 0 : 1)). ThenBy(ch => ch.Distance).ToArray()); } else { m.AddRange(currChars. Where(ch => !denyMounts.Contains(ch.GetUniqueKey()) && !skipMounts.Contains(ch.GetUniqueKey())). OrderBy(ch => (ch.Renamable ? 0 : 1)). ThenBy(ch => ItemLibrary.MountTypes.Count(mt => mt.Graphic == ch.Model) > 0 ? 0 : 1). ThenBy(ch => ch.Distance).ToArray()); } if (m.Count > 0) { _Mount = m[0].Serial; } else { if (shrink.Exist) { Game.CurrentGame.CurrentPlayer.SwitchWarmode(); shrink.Use(); Game.Wait(150); newChars = World.Characters.Where(ch => ch.Serial != World.Player.Serial && ch.Distance <= 6).ToArray(); diff = newChars.Where(ch => currChars.Count(cch => cch.Serial == ch.Serial) == 0).ToArray(); diff = diff.OrderBy(ch => ch.Distance).ToArray(); if (diff.Count() > 0) { _Mount = diff.ToArray()[0].Serial; } } skipMounts.Clear(); } } else { _Mount = originalMount; } curr = new UOCharacter(_Mount); Journal.Clear(); if (curr.ExistCust()) { curr.Use(); if (Journal.WaitForText(true, 150, "You dont own that horse")) { curr.PrintMessage("[ deny add ]"); denyMounts.Add(curr.GetUniqueKey()); _Mount = Serial.Invalid; } else if (!World.Player.Layers[Layer.Mount].ExistCust()) { if (curr.Serial == originalMount && new UOCharacter(originalMount).Exist) { curr.PrintMessage("[ mount ]"); } else { curr.PrintMessage("[ skip add ]"); skipMounts.Add(curr.GetUniqueKey()); _Mount = Serial.Invalid; } } } else { World.Player.PrintMessage("[ neni mount ]"); } } return(_Mount.IsValidCust()); }