public Outfit(Creature creature, ushort looktype, byte head, byte body, byte legs, byte feet, byte addons) { this.creature = creature; this.lookType = looktype; this.head = head; this.body = body; this.legs = legs; this.feet = feet; this.addons = addons; }
public void Execute(Creature creature, Inventory inventory) { switch (this.Type) { case FightExtra.ItemEquip: ItemLocation loc = new ItemLocation(); this.Item.Move(inventory.GetItemInSlot(this.Slot).Location); break; case FightExtra.ItemUse: this.Item.Use(creature); break; case FightExtra.Spell: this.Item.Client.Console.Say(this.Spell); break; case FightExtra.AutoSpell: DamageType type = creature.Data.GetWeakness(SpellTypes.Keys.ToList()); this.Item.Client.Console.Say(SpellTypes[type]); break; } }
public void Update(Creature c) { name = c.Name; location = c.Location; hpBar = c.HPBar; }
public MapMarker(Creature c, bool drawHP) { drawHPBar = drawHP; creature = c; Update(); }
public MapMarker(Creature c) : this(c, true) { }
public void SelectTarget() { if (!Core.Client.LoggedIn) { return; } Creature selected = null; Target selectedTarget = null; Dictionary<string, int[]> verifier = new Dictionary<string, int[]>(4); verifier.Add("distance", new int[2] { 0, 0 }); verifier.Add("health", new int[2] { 0, 0 }); verifier.Add("priority", new int[2] { 0, 0 }); verifier.Add("stick", new int[2] { 0, 0 }); List<KeyValuePair<string, byte>> items = TargetSelection.OrderByDescending(s => s.Value).ToList(); List<Creature> creatures = Core.Client.BattleList.GetCreatures().ToList(); creatures.RemoveAll(c => c.Z != Core.Player.Z || c.IsSelf() || c.HPBar == 0 || c.Type != CreatureType.NPC); foreach (Creature creature in creatures) { Target target = Targets.Find(delegate(Target t) { return (string.Compare(t.Name, "All", false) == 0 || string.Compare(t.Name, creature.Name, true) == 0 && (t.HPRange[0] <= creature.HPBar && t.HPRange[1] >= creature.HPBar)); }); if (target == null) { continue; } if (AttackedOnly && !creature.IsAttacking()) { continue; } try { if (Reachable && !creature.IsReachable()) { continue; } } catch { } if (OthersMonsters > 0) { var playersAround = Core.Client.BattleList.GetCreatures().ToList().FindAll(delegate(Creature c) { return c.DistanceBetween(creature.Location) <= OthersMonsters && (c.Z == creature.Location.Z) && (c.Type == CreatureType.Player) && (!c.IsSelf()); }); if (playersAround.Count > 0 && !creature.IsAttacking()) { continue; } } if (selected == null) { selected = creature; selectedTarget = target; continue; } if (selectedTarget.Action != FightActions.Attack && target.Action == FightActions.Attack) { selected = creature; selectedTarget = target; continue; } verifier["distance"][0] = selected.Distance(); verifier["health"][0] = selected.HPBar; verifier["priority"][0] = -selectedTarget.Priority; verifier["stick"][0] = (int) selected.Id; verifier["distance"][1] = creature.Distance(); verifier["health"][1] = creature.HPBar; verifier["priority"][1] = -target.Priority; verifier["stick"][1] = (int) creature.Id; foreach (KeyValuePair<string, byte> v in items) { if (v.Key == "stick") { if (creature.Id == Core.Player.RedSquare) { selected = creature; selectedTarget = target; } break; } if (verifier[v.Key][0] > verifier[v.Key][1]) { selected = creature; selectedTarget = target; break; } } } this.target = selectedTarget; this.creature = selected; }
/// <summary> /// Draw a creature on the map /// </summary> /// <param name="c"></param> /// <param name="hpBar">if true the color of the name will be based on the creatures hp bar</param> public void DrawCreatureMarker(Creature c, bool hpBar) { if (hpBar) DrawMarker(c.Location, c.Name, Color.Yellow, Color.Black, Color.White, Color.Black, c.HPBar); else DrawMarker(c.Location, c.Name); }