#region References
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Server.ContextMenus;
using Server.Engines.PartySystem;
using Server.Engines.Points;
using Server.Engines.Quests;
using Server.Engines.Quests.Doom;
using Server.Engines.Quests.Haven;
using Server.Engines.VvV;
using Server.Engines.XmlSpawner2;
using Server.Ethics;
using Server.Factions;
using Server.Items;
using Server.Misc;
using Server.Multis;
using Server.Network;
using Server.Prompts;
using Server.Regions;
using Server.Services.Virtues;
using Server.SkillHandlers;
using Server.Spells;
using Server.Spells.Bushido;
using Server.Spells.Necromancy;
using Server.Spells.Sixth;
using Server.Spells.SkillMasteries;
using Server.Spells.Spellweaving;
using Server.Targeting;
#endregion
namespace Server.Mobiles
{
#region Enums
///
/// Summary description for MobileAI.
///
public enum FightMode
{
None, // Never focus on others
Aggressor, // Only attack aggressors
Strongest, // Attack the strongest
Weakest, // Attack the weakest
Closest, // Attack the closest
Evil, // Only attack aggressor -or- negative karma
Good // Only attack aggressor -or- positive karma
}
public enum OrderType
{
None, //When no order, let's roam
Come, //"(All/Name) come" Summons all or one pet to your location.
Drop, //"(Name) drop" Drops its loot to the ground (if it carries any).
Follow, //"(Name) follow" Follows targeted being.
//"(All/Name) follow me" Makes all or one pet follow you.
Friend, //"(Name) friend" Allows targeted player to confirm resurrection.
Unfriend, // Remove a friend
Guard, //"(Name) guard" Makes the specified pet guard you. Pets can only guard their owner.
//"(All/Name) guard me" Makes all or one pet guard you.
Attack, //"(All/Name) kill",
//"(All/Name) attack" All or the specified pet(s) currently under your control attack the target.
Patrol, //"(Name) patrol" Roves between two or more guarded targets.
Release, //"(Name) release" Releases pet back into the wild (removes "tame" status).
Stay, //"(All/Name) stay" All or the specified pet(s) will stop and stay in current spot.
Stop, //"(All/Name) stop Cancels any current orders to attack, guard or follow.
Transfer //"(Name) transfer" Transfers complete ownership to targeted player.
}
[Flags]
public enum FoodType
{
None = 0x0000,
Meat = 0x0001,
FruitsAndVegies = 0x0002,
GrainsAndHay = 0x0004,
Fish = 0x0008,
Eggs = 0x0010,
Gold = 0x0020,
Metal = 0x0040,
BlackrockStew = 0x0080
}
[Flags]
public enum PackInstinct
{
None = 0x0000,
Canine = 0x0001,
Ostard = 0x0002,
Feline = 0x0004,
Arachnid = 0x0008,
Daemon = 0x0010,
Bear = 0x0020,
Equine = 0x0040,
Bull = 0x0080
}
public enum ScaleType
{
Red,
Yellow,
Black,
Green,
White,
Blue,
MedusaLight,
MedusaDark,
All
}
public enum MeatType
{
Ribs,
Bird,
LambLeg,
Rotworm
}
public enum HideType
{
Regular,
Spined,
Horned,
Barbed
}
public enum FurType
{
None,
Green,
LightBrown,
Yellow,
Brown
}
public enum TribeType
{
None,
Terathan,
Ophidian,
Savage,
Orc,
Fey,
Undead,
GrayGoblin,
GreenGoblin
}
#endregion
public class DamageStore : IComparable
{
public Mobile m_Mobile;
public int m_Damage;
public bool m_HasRight;
public DamageStore(Mobile m, int damage)
{
m_Mobile = m;
m_Damage = damage;
}
public int CompareTo(object obj)
{
DamageStore ds = (DamageStore)obj;
return ds.m_Damage - m_Damage;
}
}
[AttributeUsage(AttributeTargets.Class)]
public class FriendlyNameAttribute : Attribute
{
//future use: Talisman 'Protection/Bonus vs. Specific Creature
private readonly TextDefinition m_FriendlyName;
public TextDefinition FriendlyName { get { return m_FriendlyName; } }
public FriendlyNameAttribute(TextDefinition friendlyName)
{
m_FriendlyName = friendlyName;
}
public static TextDefinition GetFriendlyNameFor(Type t)
{
if (t.IsDefined(typeof(FriendlyNameAttribute), false))
{
var objs = t.GetCustomAttributes(typeof(FriendlyNameAttribute), false);
if (objs != null && objs.Length > 0)
{
FriendlyNameAttribute friendly = objs[0] as FriendlyNameAttribute;
return friendly.FriendlyName;
}
}
return t.Name;
}
}
public class BaseCreature : Mobile, IHonorTarget, IEngravable
{
public const int MaxLoyalty = 100;
private bool _LockDirection;
[CommandProperty(AccessLevel.GameMaster)]
public bool LockDirection
{
get
{
if (AIObject == null)
{
return _LockDirection;
}
return AIObject.DirectionLocked = _LockDirection;
}
set
{
_LockDirection = value;
if (AIObject != null)
{
AIObject.DirectionLocked = value;
}
}
}
[CommandProperty(AccessLevel.GameMaster)]
public bool CanMove { get; set; }
public virtual bool CanCallGuards
{
get { return !Deleted && Alive && !AlwaysMurderer && Kills < 5 && (Player || Body.IsHuman); }
}
#region Var declarations
private BaseAI m_AI; // THE AI
private AIType m_CurrentAI; // The current AI
private AIType m_DefaultAI; // The default AI
private FightMode m_FightMode; // The style the mob uses
private int m_iRangePerception; // The view area
private int m_iRangeFight; // The fight distance
private bool m_bDebugAI; // Show debug AI messages
private int m_iTeam; // Monster Team
private double m_ForceActiveSpeed;
private double m_ForcePassiveSpeed;
private double m_dActiveSpeed; // Timer speed when active
private double m_dPassiveSpeed; // Timer speed when not active
private double m_dCurrentSpeed; // The current speed, lets say it could be changed by something;
private Point3D m_pHome; // The home position of the creature, used by some AI
private int m_iRangeHome = 10; // The home range of the creature
private readonly List m_arSpellAttack; // List of attack spell/power
private readonly List m_arSpellDefense; // List of defensive spell/power
private bool m_bControlled; // Is controlled
private Mobile m_ControlMaster; // My master
private IDamageable m_ControlTarget; // My target mobile
private Point3D m_ControlDest; // My target destination (patrol)
private OrderType m_ControlOrder; // My order
private int m_Loyalty;
private double m_dMinTameSkill;
private double m_CurrentTameSkill;
private bool m_bTamable;
private bool m_bSummoned;
private DateTime m_SummonEnd;
private int m_iControlSlots = 1;
private bool m_bBardProvoked;
private bool m_bBardPacified;
private Mobile m_bBardMaster;
private Mobile m_bBardTarget;
private WayPoint m_CurrentWayPoint;
private IPoint2D m_TargetLocation;
private int _CurrentNavPoint;
private Dictionary