Exemple #1
0
 public Account()
 {
     ActorClass = ActorClass.Invalid;
     CurrentAccountName = String.Empty;
     CurrentHeroName = String.Empty;
     CurrentLevel = 0;
 }
Exemple #2
0
 public Character(string CharacterName, int level, ActorClass AC)
 {
     Name = CharacterName;
     Level = level;
     Class = AC;
     InventoryItems = new List<TrackedItem>();
     EquippedItems = new List<TrackedItem>();
 }
Exemple #3
0
        //Base class for each individual class!
        public Player(ActorClass a)
        {
            AC=a;
                     RefreshHotbar();
                     RefreshPassives();
                     UpdateRepeatAbilityTimes();

                     Logging.WriteVerbose("[Funky] Finished Creating Player Class");
        }
Exemple #4
0
        //Base class for each individual class!
        public Wizard(ActorClass a)
            : base(a)
        {
            this.RecreateAbilities();
                     HasSignatureAbility=(this.HotbarPowers.Contains(SNOPower.Wizard_MagicMissile)||this.HotbarPowers.Contains(SNOPower.Wizard_ShockPulse)||
                                    this.HotbarPowers.Contains(SNOPower.Wizard_SpectralBlade)||this.HotbarPowers.Contains(SNOPower.Wizard_Electrocute));

                     //Check passive critical mass
                     this.bUsingCriticalMassPassive=base.PassivePowers.Contains(SNOPower.Wizard_Passive_CriticalMass);
        }
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (TextBoxActor.Text != String.Empty)
     {
         Actor newActor = new Actor();
         newActor.Name = TextBoxActor.Text;
         ActorClass actorClasse = new ActorClass();
         actorClasse.Insert(newActor);
         Response.Redirect(Request.RawUrl, true);
     }
     else
     {
         Response.Write("Veld is leeg.");
     }
 }
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (TextBoxActorID.Text != String.Empty)
     {
         Actor newActor = new Actor();
         ActorClass actorClasse = new ActorClass();
         int test;
         test = int.Parse(TextBoxActorID.Text);
         actorClasse.SelectOne(test);
     }
     else
     {
         Response.Write("ID is leeg of bestaat niet.");
     }
 }
Exemple #7
0
        public void OnEnabled()
        {
            var level = ZetaDia.Service.CurrentHero.Level;
            _name = ZetaDia.Service.CurrentHero.Name;
            _heroClass = ZetaDia.Service.CurrentHero.Class;

            Logging.Write("[WatchFox] watching " + _name + ": lvl " + level + " " + _heroClass + " @ " + ZetaDia.Service.CurrentHero.CurrentDifficulty);

            _sender = new SocketEventSender();

            SubscribeEvents();

            _sender.Enable();

            Logging.Write("WatchFox " + Version +" enabled");
        }
Exemple #8
0
        /// <summary>
        /// 获取父class类
        /// </summary>
        public static MetaClass GetMetaClass(ActorClass actorClass)
        {
            MetaClass v = MetaClass.Warrier;

            switch (actorClass)
            {
            case ActorClass.Berserker:
                v = MetaClass.Warrier;
                break;

            case ActorClass.Alchemist:
                v = MetaClass.Mage;
                break;
            }
            return(v);
        }
Exemple #9
0
        /// <summary>
        /// 根据种族和职业赋值初始化的属性
        /// </summary>
        public void InitAttr(ActorClass actorClass, ActorRace actorRace, float healthRank)
        {
            m_class = actorClass;
            m_race  = actorRace;
            var classMeta = ClassMetaManager.GetMeta((int)m_class);
            var raceMeta  = RaceMetaManager.GetMeta((int)m_race);

            m_primaryAttr = new SwordPrimaryAttributeSet();
            m_primaryAttr.InitFromClassAndRace(classMeta, raceMeta);

            m_powerAttr = new SwordPowerAttributeSet(m_primaryAttr);

            m_armorAttr = new SwordArmorAttributeSet(m_primaryAttr);

            m_resAttr = new SwordResourceAttributeSet(m_primaryAttr);
            m_resAttr.InitClassAndRace(classMeta, raceMeta, healthRank);
        }
Exemple #10
0
        public void OnEnabled()
        {
            var level = ZetaDia.Service.CurrentHero.Level;

            _name      = ZetaDia.Service.CurrentHero.Name;
            _heroClass = ZetaDia.Service.CurrentHero.Class;

            Logging.Write("[WatchFox] watching " + _name + ": lvl " + level + " " + _heroClass + " @ " + ZetaDia.Service.CurrentHero.CurrentDifficulty);

            _sender = new SocketEventSender();

            SubscribeEvents();

            _sender.Enable();

            Logging.Write("WatchFox " + Version + " enabled");
        }
Exemple #11
0
        private PlayerAttributeType GetAttributeTypeForClass(ActorClass actorClass)
        {
            switch (actorClass)
            {
            case ActorClass.Crusader:
            case ActorClass.Barbarian:
                return(PlayerAttributeType.Strength);

            case ActorClass.Monk:
            case ActorClass.DemonHunter:
                return(PlayerAttributeType.Dexterity);

            case ActorClass.Necromancer:
            case ActorClass.Witchdoctor:
            case ActorClass.Wizard:
                return(PlayerAttributeType.Intelligence);
            }

            return(PlayerAttributeType.None);
        }
Exemple #12
0
        public Npc SpawnActor(uint classId, string uniqueId, float x, float y, float z, float rot = 0, ushort state = 0, uint animId = 0, bool isMob = false)
        {
            lock (mActorList)
            {
                ActorClass actorClass = Server.GetWorldManager().GetActorClass(classId);

                if (actorClass == null)
                {
                    return(null);
                }

                uint zoneId;
                if (this is PrivateArea)
                {
                    zoneId = ((PrivateArea)this).GetParentZone().actorId;
                }
                else
                {
                    zoneId = actorId;
                }

                Npc npc;
                if (isMob)
                {
                    npc = new BattleNpc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null);
                }
                else
                {
                    npc = new Npc(mActorList.Count + 1, actorClass, uniqueId, this, x, y, z, rot, state, animId, null);
                }

                npc.LoadEventConditions(actorClass.eventConditions);
                npc.SetMaxHP(100);
                npc.SetHP(100);
                npc.ResetMoveSpeeds();

                AddActorToZone(npc);

                return(npc);
            }
        }
Exemple #13
0
        public void OnEnabled()
        {
            var level = ZetaDia.Service.CurrentHero.Level;
            _name = ZetaDia.Service.CurrentHero.Name;
            _heroClass = ZetaDia.Service.CurrentHero.Class;

            Logging.Write("[WatchFox] watching " + _name + ": lvl " + level + " " + _heroClass + " @ " + ZetaDia.Service.CurrentHero.CurrentDifficulty);

            _sender = new SocketEventSender();

            BotMain.OnStart += Start;
            BotMain.OnStop += Stop;
            GameEvents.OnLevelUp += OnLevelUp;
            GameEvents.OnItemLooted += OnItemLooted;
            GameEvents.OnGameJoined += OnGameJoined;
            GameEvents.OnGameLeft += OnGameLeft;

            _sender.Enable();

            Logging.Write("WatchFox " + Version +" enabled");
        }
Exemple #14
0
        ///<summary>
        ///Updates Account Name, Current Hero Name and Class Variables
        ///</summary>
        internal void UpdateCurrentAccountDetails()
        {
            //Clear Cache -- (DB reuses values, even if it is incorrect!)
            ZetaDia.Memory.ClearCache();

            try
            {
                using (ZetaDia.Memory.AcquireFrame())
                {

                    ActorClass = ZetaDia.Service.Hero.Class;
                    CurrentAccountName = ZetaDia.Service.Hero.BattleTagName;
                    CurrentHeroName = ZetaDia.Service.Hero.Name;
                    CurrentLevel = ZetaDia.Service.Hero.Level;
                }
            }
            catch (Exception)
            {
                Logger.DBLog.DebugFormat("[Funky] Exception Attempting to Update Current Account Details.");
            }
        }
Exemple #15
0
        ///<summary>
        ///Updates Account Name, Current Hero Name and Class Variables
        ///</summary>
        internal void UpdateCurrentAccountDetails()
        {
            //Clear Cache -- (DB reuses values, even if it is incorrect!)
            ZetaDia.Memory.ClearCache();


            try
            {
                using (ZetaDia.Memory.AcquireFrame())
                {
                    ActorClass         = ZetaDia.Service.Hero.Class;
                    CurrentAccountName = ZetaDia.Service.Hero.BattleTagName;
                    CurrentHeroName    = ZetaDia.Service.Hero.Name;
                    CurrentLevel       = ZetaDia.Service.Hero.Level;
                }
            }
            catch (Exception)
            {
                Logger.DBLog.DebugFormat("[Funky] Exception Attempting to Update Current Account Details.");
            }
        }
Exemple #16
0
        public Npc(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot, uint layout, uint instance)
            : base((4 << 28 | spawnedArea.actorId << 19 | (uint)actorNumber))
        {
            this.positionX        = posX;
            this.positionY        = posY;
            this.positionZ        = posZ;
            this.rotation         = rot;
            this.currentMainState = 0;
            this.animationId      = 0;

            this.displayNameId = actorClass.displayNameId;

            this.uniqueIdentifier = uniqueId;

            this.zoneId = spawnedArea.actorId;
            this.zone   = spawnedArea;

            this.actorClassId = actorClass.actorClassId;

            LoadNpcAppearance(actorClass.actorClassId);

            this.classPath = actorClass.classPath;
            className      = classPath.Substring(classPath.LastIndexOf("/") + 1);

            for (int i = 0; i < 32; i++)
            {
                charaWork.property[i] = (byte)(((int)actorClass.propertyFlags >> i) & 1);
            }

            npcWork.pushCommand         = actorClass.pushCommand;
            npcWork.pushCommandSub      = actorClass.pushCommandSub;
            npcWork.pushCommandPriority = actorClass.pushCommandPriority;

            this.isMapObj = true;
            this.layout   = layout;
            this.instance = instance;

            GenerateActorName((int)actorNumber);
            this.aiContainer = new AIContainer(this, null, new PathFind(this), new TargetFind(null));
        }
Exemple #17
0
        public void OnEnabled()
        {
            var level = ZetaDia.Service.CurrentHero.Level;

            _name      = ZetaDia.Service.CurrentHero.Name;
            _heroClass = ZetaDia.Service.CurrentHero.Class;

            Logging.Write("[WatchFox] watching " + _name + ": lvl " + level + " " + _heroClass + " @ " + ZetaDia.Service.CurrentHero.CurrentDifficulty);

            _sender = new SocketEventSender();

            BotMain.OnStart         += Start;
            BotMain.OnStop          += Stop;
            GameEvents.OnLevelUp    += OnLevelUp;
            GameEvents.OnItemLooted += OnItemLooted;
            GameEvents.OnGameJoined += OnGameJoined;
            GameEvents.OnGameLeft   += OnGameLeft;

            _sender.Enable();

            Logging.Write("WatchFox " + Version + " enabled");
        }
Exemple #18
0
 /// <summary>
 /// All skills for the specified class
 /// </summary>
 public static List<Rune> ByActorClass(ActorClass Class)
 {
     if (ZetaDia.Me.IsValid)
     {
         switch (ZetaDia.Me.ActorClass)
         {
             case ActorClass.Barbarian:
                 return Runes.Barbarian.ToList();
             case ActorClass.Crusader:
                 return Runes.Crusader.ToList();
             case ActorClass.DemonHunter:
                 return Runes.DemonHunter.ToList();
             case ActorClass.Monk:
                 return Runes.Monk.ToList();
             case ActorClass.Witchdoctor:
                 return Runes.WitchDoctor.ToList();
             case ActorClass.Wizard:
                 return Runes.Wizard.ToList();
         }
     }
     return new List<Rune>();
 }
        public BattleNpc(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot,
                         ushort actorState, uint animationId, string customDisplayName)
            : base(actorNumber, actorClass, uniqueId, spawnedArea, posX, posY, posZ, rot, actorState, animationId, customDisplayName)
        {
            this.aiContainer = new AIContainer(this, new BattleNpcController(this), new PathFind(this), new TargetFind(this));

            //this.currentSubState = SetActorStatePacket.SUB_STATE_MONSTER;
            //this.currentMainState = SetActorStatePacket.MAIN_STATE_ACTIVE;

            //charaWork.property[2] = 1;
            //npcWork.hateType = 1;

            this.hateContainer = new HateContainer(this);
            this.allegiance    = CharacterTargetingAllegiance.BattleNpcs;

            spawnX = posX;
            spawnY = posY;
            spawnZ = posZ;

            despawnTime = 10;
            CalculateBaseStats();
        }
Exemple #20
0
        public void SetBehaviorPulse(object sender, EventArgs args)
        {
            if (!WorldTransferTimeoutTimer.IsFinished)
            {
                return;
            }

            if (ZetaDia.IsInGame && !ZetaDia.IsLoadingWorld && ZetaDia.Me != null && ZetaDia.Me.CommonData != null)
            {
                if (_combat == null || ZetaDia.Me.IsValid && Class != _lastClass)
                {
                    if (!CreateBehaviors())
                    {
                        BotMain.Stop();
                        return;
                    }

                    Log.Info("Behaviors created");
                    _lastClass = Class;
                }
            }
            Avoidance.IsAvoidanceCacheResetRequired = true;
        }
Exemple #21
0
        /// <summary>
        /// Initializes this <see cref="CombatRoutine"/>.
        /// </summary>
        /// <remarks>Created 2012-04-03</remarks>
        public override void Initialize()
        {
            GameEvents.OnLevelUp            += Monk.MonkOnLevelUp;
            GameEvents.OnLevelUp            += Wizard.WizardOnLevelUp;
            GameEvents.OnLevelUp            += WitchDoctor.WitchDoctorOnLevelUp;
            GameEvents.OnLevelUp            += DemonHunter.DemonHunterOnLevelUp;
            GameEvents.OnLevelUp            += Barbarian.BarbarianOnLevelUp;
            GameEvents.OnWorldTransferStart += HandleWorldTransfer;

            if (!CreateBehaviors())
            {
                BotMain.Stop();
                return;
            }

            _lastClass            = Class;
            Pulsator.OnPulse     += SetBehaviorPulse;
            Navigator.PlayerMover = new BelphegorPlayerMover();

            //Navigator.SearchGridProvider = BelphegorCachedSearchAreaProvider.Instance;
            //CombatTargeting.Instance.Provider = BelphegorCombatTargetingProvider.Instance; No longer needed cause the internal one is doing almost the same stuff.

            Logger.Write("Behaviors created");
        }
Exemple #22
0
        public Npc(int actorNumber, ActorClass actorClass, string uniqueId, Area spawnedArea, float posX, float posY, float posZ, float rot, ushort actorState, uint animationId, string customDisplayName)
            : base((4 << 28 | spawnedArea.actorId << 19 | (uint)actorNumber))
        {
            this.positionX        = posX;
            this.positionY        = posY;
            this.positionZ        = posZ;
            this.rotation         = rot;
            this.currentMainState = actorState;
            this.animationId      = animationId;

            this.displayNameId     = actorClass.displayNameId;
            this.customDisplayName = customDisplayName;

            this.uniqueIdentifier = uniqueId;

            this.zoneId = spawnedArea.actorId;
            this.zone   = spawnedArea;

            this.actorClassId = actorClass.actorClassId;

            this.currentSubState.motionPack = (ushort)animationId;

            LoadNpcAppearance(actorClass.actorClassId);

            className      = actorClass.classPath.Substring(actorClass.classPath.LastIndexOf("/") + 1);
            this.classPath = String.Format("{0}/{1}", actorClass.classPath.Substring(0, actorClass.classPath.LastIndexOf('/')).ToLower(), className);

            charaWork.battleSave.potencial = 1.0f;

            // todo: these really need to be read from db etc
            {
                charaWork.parameterSave.state_mainSkill[0]   = 3;
                charaWork.parameterSave.state_mainSkill[2]   = 3;
                charaWork.parameterSave.state_mainSkillLevel = 1;

                charaWork.parameterSave.hp[0]    = 80;
                charaWork.parameterSave.hpMax[0] = 80;
            }
            for (int i = 0; i < 32; i++)
            {
                charaWork.property[i] = (byte)(((int)actorClass.propertyFlags >> i) & 1);
            }

            npcWork.pushCommand         = actorClass.pushCommand;
            npcWork.pushCommandSub      = actorClass.pushCommandSub;
            npcWork.pushCommandPriority = actorClass.pushCommandPriority;

            if (actorClassId == 1080078 || actorClassId == 1080079 || actorClassId == 1080080 || (actorClassId >= 1080123 && actorClassId <= 1080135) || (actorClassId >= 5000001 && actorClassId <= 5000090) || (actorClassId >= 5900001 && actorClassId <= 5900038))
            {
                isMapObj = true;
                List <LuaParam> lParams = LuaEngine.GetInstance().CallLuaFunctionForReturn(null, this, "init", false);
                if (lParams == null || lParams.Count < 6)
                {
                    isMapObj = false;
                }
                else
                {
                    layout   = (uint)(Int32)lParams[4].value;
                    instance = (uint)(Int32)lParams[5].value;
                    isStatic = true;
                }
            }
            GenerateActorName((int)actorNumber);
            this.aiContainer = new AIContainer(this, null, new PathFind(this), new TargetFind(this));
        }
Exemple #23
0
 public static List<Skill> GetSkillsForItemType(TrinityItemType itemType, ActorClass actorClass = ActorClass.Invalid)
 {
     var result = new List<Skill>();
     if (actorClass != ActorClass.Invalid)
     {
         var kvp = new KeyValuePair<TrinityItemType, ActorClass>(itemType, actorClass);
         result.AddRange(SkillDamageByItemTypeAndClass[kvp]);
     }
     else
     {
         var actorClasses = new List<ActorClass>
         {
                 ActorClass.Monk,
                 ActorClass.DemonHunter,
                 ActorClass.Witchdoctor,
                 ActorClass.Wizard,
                 ActorClass.Crusader,
                 ActorClass.Barbarian               
         };
         foreach (var ac in actorClasses)
         {
             var kvp = new KeyValuePair<TrinityItemType, ActorClass>(itemType, ac);
             result.AddRange(SkillDamageByItemTypeAndClass[kvp]);
         }             
     }
     return result;
 }
Exemple #24
0
            private static UIElement SelectHeroType(ActorClass type)
            {
                UIElement thisClassButton = null;
                switch (type)
                {
                    case ActorClass.Barbarian:
                        thisClassButton = UIElement.FromHash(0x98976D3F43BBF74);
                        break;
                    case ActorClass.DemonHunter:
                        thisClassButton = UIElement.FromHash(0x98976D3F43BBF74);
                        break;
                    case ActorClass.Monk:
                        thisClassButton = UIElement.FromHash(0x7733072C07DABF11);
                        break;
                    case ActorClass.Witchdoctor:
                        thisClassButton = UIElement.FromHash(0x1A2DB1F47C26A8C2);
                        break;
                    case ActorClass.Wizard:
                        thisClassButton = UIElement.FromHash(0xBC3AA6A915972065);
                        break;
                }

                return thisClassButton;
            }
        public void LoadActorClasses()
        {
            int count = 0;

            using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
            {
                try
                {
                    conn.Open();

                    string query = @"
                                    SELECT 
                                    gamedata_actor_class.id,
                                    classPath,                                    
                                    displayNameId,
                                    propertyFlags,
                                    eventConditions,
                                    pushCommand,
                                    pushCommandSub,
                                    pushCommandPriority
                                    FROM gamedata_actor_class
                                    LEFT JOIN gamedata_actor_pushcommand
                                    ON gamedata_actor_class.id = gamedata_actor_pushcommand.id
                                    WHERE classPath <> ''
                                    ";

                    MySqlCommand cmd = new MySqlCommand(query, conn);

                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            uint   id              = reader.GetUInt32("id");
                            string classPath       = reader.GetString("classPath");
                            uint   nameId          = reader.GetUInt32("displayNameId");
                            string eventConditions = null;

                            uint propertyFlags = reader.GetUInt32("propertyFlags");

                            if (!reader.IsDBNull(4))
                            {
                                eventConditions = reader.GetString("eventConditions");
                            }
                            else
                            {
                                eventConditions = "{}";
                            }

                            ushort pushCommand         = 0;
                            ushort pushCommandSub      = 0;
                            byte   pushCommandPriority = 0;

                            if (!reader.IsDBNull(reader.GetOrdinal("pushCommand")))
                            {
                                pushCommand         = reader.GetUInt16("pushCommand");
                                pushCommandSub      = reader.GetUInt16("pushCommandSub");
                                pushCommandPriority = reader.GetByte("pushCommandPriority");
                            }

                            ActorClass actorClass = new ActorClass(id, classPath, nameId, propertyFlags, eventConditions, pushCommand, pushCommandSub, pushCommandPriority);
                            actorClasses.Add(id, actorClass);
                            count++;
                        }
                    }
                }
                catch (MySqlException e)
                { Console.WriteLine(e); }
                finally
                {
                    conn.Dispose();
                }
            }

            Program.Log.Info(String.Format("Loaded {0} actor classes.", count));
        }
Exemple #26
0
        public static Composite GetComposite(ActorClass actorClass, BehaviorType behavior, out int behaviourCount)
        {
            behaviourCount = 0;
            if (Methods.Count <= 0)
            {
                Logger.Write("Building method list");
                foreach (var type in Assembly.GetExecutingAssembly().GetTypes())
                {
                    Methods.AddRange(type.GetMethods(BindingFlags.Static | BindingFlags.Public));
                }
                Logger.Write("Added " + Methods.Count + " methods");
            }
            var matchedMethods = new Dictionary<int, PrioritySelector>();

            foreach (MethodInfo mi in
                Methods.Where(
                    mi =>
                    !mi.IsGenericMethod &&
                    mi.GetParameters().Length == 0)
                    .Where(
                        mi =>
                        mi.ReturnType == typeof(Composite) ||
                        mi.ReturnType.IsSubclassOf(typeof(Composite))))
            {
                //Logger.WriteDebug("[CompositeBuilder] Checking attributes on " + mi.Name);
                bool classMatches = false;
                bool behaviorMatches = false;
                bool hasIgnore = false;
                int thePriority = 0;
                var theBehaviourType = BehaviorType.All;
                var theIgnoreType = BehaviorType.All;
                try
                {
                    foreach (object ca in mi.GetCustomAttributes(false))
                    {
                        if (ca is ClassAttribute)
                        {
                            var attrib = ca as ClassAttribute;
                            // Class specific
                            if (attrib.CharacterClass != actorClass)
                            {
                                //Logger.Write("Attribute Class does not match. [" + attrib.SpecificClass + " != " + torClass + "]");
                                continue;
                            }

                            //Logger.WriteDebug(mi.Name + " has my class");
                            classMatches = true;
                        }
                        else if (ca is BehaviorAttribute)
                        {
                            var attrib = ca as BehaviorAttribute;
                            if ((attrib.Type & behavior) == 0)
                            {
                                continue;
                            }
                            //Logger.WriteDebug(mi.Name + " has my behavior");
                            theBehaviourType = attrib.Type;
                            behaviourCount++;
                            behaviorMatches = true;
                        }
                        else if (ca is PriorityAttribute)
                        {
                            var attrib = ca as PriorityAttribute;
                            thePriority = attrib.PriorityLevel;
                        }
                        else if (ca is IgnoreBehaviorCountAttribute)
                        {
                            var attrib = ca as IgnoreBehaviorCountAttribute;
                            hasIgnore = true;
                            theIgnoreType = attrib.Type;
                        }
                    }
                }
                catch
                {
                    Logger.Write("Error getting custom attributes for " + mi.Name);
                    continue;
                }

                if (behaviorMatches && hasIgnore && theBehaviourType == theIgnoreType)
                {
                    behaviourCount--;
                }

                // If all our attributes match, then mark it as wanted!
                if (classMatches && behaviorMatches)
                {
                    Logger.Write("{0} is a match!", mi.Name);
                    Logger.Write("Using {0} for {1} (Priority: {2})", mi.Name, behavior, thePriority);
                    Composite matched;
                    try
                    {
                        matched = (Composite)mi.Invoke(null, null);
                    }
                    catch (Exception e)
                    {
                        Logger.Write("ERROR Creating composite: {0}\n{1}", mi.Name, e.StackTrace);
                        continue;
                    }
                    if (!matchedMethods.ContainsKey(thePriority))
                    {
                        matchedMethods.Add(thePriority, new PrioritySelector(matched));
                    }
                    else
                    {
                        matchedMethods[thePriority].AddChild(matched);
                    }
                }
            }
            // If we found no methods, rofls!
            if (matchedMethods.Count <= 0)
            {
                return null;
            }

            // Return the composite match we found. (Note: ANY composite return is fine)
            return matchedMethods.OrderByDescending(mm => mm.Key).First().Value;
        }
Exemple #27
0
        public bool IsUsableByClass(ActorClass actorClass)
        {
            switch (TrinityItemType)
            {
            case TrinityItemType.Mojo:
            case TrinityItemType.CeremonialKnife:
            case TrinityItemType.VoodooMask:
                if (actorClass != ActorClass.Witchdoctor)
                {
                    return(false);
                }
                break;

            case TrinityItemType.SpiritStone:
            case TrinityItemType.FistWeapon:
            case TrinityItemType.TwoHandDaibo:
                if (actorClass != ActorClass.Monk)
                {
                    return(false);
                }
                break;

            case TrinityItemType.MightyBelt:
            case TrinityItemType.MightyWeapon:
            case TrinityItemType.TwoHandMighty:
                if (actorClass != ActorClass.Barbarian)
                {
                    return(false);
                }
                break;

            case TrinityItemType.Orb:
            case TrinityItemType.WizardHat:
            case TrinityItemType.Wand:
                if (actorClass != ActorClass.Wizard)
                {
                    return(false);
                }
                break;

            case TrinityItemType.Flail:
            case TrinityItemType.TwoHandFlail:
            case TrinityItemType.CrusaderShield:
                if (actorClass != ActorClass.Crusader)
                {
                    return(false);
                }
                break;

            case TrinityItemType.Cloak:
            case TrinityItemType.Quiver:
            case TrinityItemType.TwoHandBow:
            case TrinityItemType.HandCrossbow:
            case TrinityItemType.TwoHandCrossbow:
                if (actorClass != ActorClass.DemonHunter)
                {
                    return(false);
                }
                break;

            case TrinityItemType.Scythe:
            case TrinityItemType.Phylactery:
            case TrinityItemType.TwoHandScythe:
                if (actorClass != ActorClass.Necromancer)
                {
                    return(false);
                }
                break;
            }

            return(true);
        }
Exemple #28
0
        private static float ValueThisItem(ACDItem thisitem, ActorClass AC, bool bIsEquipped)
        {
            float iTempPoints=0;
                float iThisPrimaryStat=0;
                // Deal with armor and jewelry together
                GilesItemType thisGilesType=DetermineItemType(thisitem.InternalName, thisitem.ItemType, thisitem.FollowerSpecialType);
                GilesBaseItemType thisGilesBaseType=DetermineBaseType(thisGilesType);
                if (thisGilesBaseType==GilesBaseItemType.Armor||thisGilesBaseType==GilesBaseItemType.Jewelry||thisGilesBaseType==GilesBaseItemType.Offhand)
                {
                     // Work out the primary stat based on your class
                     switch (AC)
                     {
                          case ActorClass.Barbarian:
                                iThisPrimaryStat=thisitem.Stats.Strength;
                                break;
                          case ActorClass.Monk:
                          case ActorClass.DemonHunter:
                                iThisPrimaryStat=thisitem.Stats.Dexterity;
                                break;
                          case ActorClass.Wizard:
                          case ActorClass.WitchDoctor:
                                iThisPrimaryStat=thisitem.Stats.Intelligence;
                                break;

                     } // Switch on your actorclass
                     // Give 5 points free - so it values something without any supported stats over an empty inventory slot
                     iTempPoints=5;
                     iTempPoints+=(iThisPrimaryStat*iWeightPrimary); // primary stat
                     iTempPoints+=(thisitem.Stats.Vitality*iWeightVitality); // vitality
                     iTempPoints+=((float)thisitem.Stats.ArmorTotal*iWeightArmor); // total armor of item
                     iTempPoints+=(thisitem.Stats.MovementSpeed*iWeightMovementSpeed); // movement speed %
                     iTempPoints+=(thisitem.Stats.ResistAll*iWeightResistAll); // resist all
                     iTempPoints+=(thisitem.Stats.CritPercent*iWeightCritPercent); // Crit chance %
                     iTempPoints+=(thisitem.Stats.CritDamagePercent*iWeightCritDamagePercent); // crit damage bonus %
                     iTempPoints+=(thisitem.Stats.MinDamage*iWeightMinDamage); // Min damage bonus (currently broken in DB)
                     iTempPoints+=(thisitem.Stats.MaxDamage*iWeightMaxDamage); // Max damage bonus (currently broken in DB)
                     iTempPoints+=(thisitem.Stats.Sockets*iWeightSocket); // Sockets
                     iTempPoints+=(thisitem.Stats.LifeOnHit*iWeightLifeOnHit); // Lifeonhit
                }
                // Now deal with weapons
                else if (thisGilesBaseType==GilesBaseItemType.WeaponOneHand||thisGilesBaseType==GilesBaseItemType.WeaponTwoHand||thisGilesBaseType==GilesBaseItemType.WeaponRange)
                {
                     // Work out the primary stat based on your class
                     switch (AC)
                     {
                          case ActorClass.Barbarian:
                                iThisPrimaryStat=thisitem.Stats.Strength;
                                break;
                          case ActorClass.Monk:
                          case ActorClass.DemonHunter:
                                iThisPrimaryStat=thisitem.Stats.Dexterity;
                                break;
                          case ActorClass.Wizard:
                          case ActorClass.WitchDoctor:
                                iThisPrimaryStat=thisitem.Stats.Intelligence;
                                break;

                     } // Switch on your actorclass
                     // If it's an already-equipped weapon, don't check for appropriateness etc. just weight it on it's stats
                     if (bIsEquipped)
                     {
                          iTempPoints+=(thisitem.Stats.WeaponDamagePerSecond*iWeightWeaponDPS); // DPS
                          iTempPoints+=(iThisPrimaryStat*iWeightWeaponPrimary); // Primary stat
                          iTempPoints+=(thisitem.Stats.Vitality*iWeightWeaponVitality); // Vitality
                          iTempPoints+=(thisitem.Stats.Sockets*iWeightWeaponSocket); // Sockets
                          iTempPoints+=(thisitem.Stats.LifeOnHit*iWeightWeaponLifeOnHit); // LifeOnHit
                          // LifeOnHit needed
                          // Check if it's 2-handed melee (player's own weapon), in which case flag it so we don't try using an off-hander
                          if (thisGilesBaseType==GilesBaseItemType.WeaponTwoHand)
                          {
                                bMyUsingTwoHandedMelee=true;
                          }
                     }
                     // Complex checks if it's not an already-equipped weapon, as we limit to class-appropriate one-handers (or bows/xbows for DH's)
                     else if (!bIsEquipped)
                     {
                          if (thisGilesBaseType==GilesBaseItemType.WeaponOneHand||thisGilesBaseType==GilesBaseItemType.WeaponRange)
                          {
                                switch (AC)
                                {
                                     case ActorClass.Barbarian:
                                          if (thisGilesType==GilesItemType.Axe||thisGilesType==GilesItemType.Dagger||thisGilesType==GilesItemType.Mace||
                                                thisGilesType==GilesItemType.Spear||thisGilesType==GilesItemType.Sword||thisGilesType==GilesItemType.MightyWeapon)
                                          {
                                                iTempPoints+=(thisitem.Stats.WeaponDamagePerSecond*iWeightWeaponDPS); // DPS
                                                iTempPoints+=(iThisPrimaryStat*iWeightWeaponPrimary); // Primary stat
                                                iTempPoints+=(thisitem.Stats.Vitality*iWeightWeaponVitality); // Vitality
                                                iTempPoints+=(thisitem.Stats.Sockets*iWeightWeaponSocket); // Sockets
                                                iTempPoints+=(thisitem.Stats.LifeOnHit*iWeightWeaponLifeOnHit); // LifeOnHit
                                          }
                                          break;
                                     case ActorClass.Monk:
                                          if (thisGilesType==GilesItemType.Axe||thisGilesType==GilesItemType.Dagger||thisGilesType==GilesItemType.FistWeapon||
                                                thisGilesType==GilesItemType.Mace||thisGilesType==GilesItemType.Spear||thisGilesType==GilesItemType.Sword)
                                          {
                                                iTempPoints+=(thisitem.Stats.WeaponDamagePerSecond*iWeightWeaponDPS); // DPS
                                                iTempPoints+=(iThisPrimaryStat*iWeightWeaponPrimary); // Primary stat
                                                iTempPoints+=(thisitem.Stats.Vitality*iWeightWeaponVitality); // Vitality
                                                iTempPoints+=(thisitem.Stats.Sockets*iWeightWeaponSocket); // Sockets
                                                iTempPoints+=(thisitem.Stats.LifeOnHit*iWeightWeaponLifeOnHit); // LifeOnHit
                                          }
                                          break;
                                     case ActorClass.DemonHunter:
                                          if (thisGilesType==GilesItemType.TwoHandCrossbow||thisGilesType==GilesItemType.TwoHandBow||thisGilesType==GilesItemType.HandCrossbow)
                                          {
                                                iTempPoints+=(thisitem.Stats.WeaponDamagePerSecond*iWeightWeaponDPS); // DPS
                                                iTempPoints+=(iThisPrimaryStat*iWeightWeaponPrimary); // Primary stat
                                                iTempPoints+=(thisitem.Stats.Vitality*iWeightWeaponVitality); // Vitality
                                                iTempPoints+=(thisitem.Stats.Sockets*iWeightWeaponSocket); // Sockets
                                                iTempPoints+=(thisitem.Stats.LifeOnHit*iWeightWeaponLifeOnHit); // LifeOnHit
                                          }
                                          break;
                                     case ActorClass.Wizard:
                                          if (thisGilesType==GilesItemType.Axe||thisGilesType==GilesItemType.Dagger||thisGilesType==GilesItemType.Mace||
                                                thisGilesType==GilesItemType.Spear||thisGilesType==GilesItemType.Sword||thisGilesType==GilesItemType.Wand)
                                          {
                                                iTempPoints+=(thisitem.Stats.WeaponDamagePerSecond*iWeightWeaponDPS); // DPS
                                                iTempPoints+=(iThisPrimaryStat*iWeightWeaponPrimary); // Primary stat
                                                iTempPoints+=(thisitem.Stats.Vitality*iWeightWeaponVitality); // Vitality
                                                iTempPoints+=(thisitem.Stats.Sockets*iWeightWeaponSocket); // Sockets
                                                iTempPoints+=(thisitem.Stats.LifeOnHit*iWeightWeaponLifeOnHit); // LifeOnHit
                                          }
                                          break;
                                     case ActorClass.WitchDoctor:
                                          if (thisGilesType==GilesItemType.Axe||thisGilesType==GilesItemType.Dagger||thisGilesType==GilesItemType.Mace||
                                                thisGilesType==GilesItemType.Spear||thisGilesType==GilesItemType.Sword||thisGilesType==GilesItemType.CeremonialKnife)
                                          {
                                                iTempPoints+=(thisitem.Stats.WeaponDamagePerSecond*iWeightWeaponDPS); // DPS
                                                iTempPoints+=(iThisPrimaryStat*iWeightWeaponPrimary); // Primary stat
                                                iTempPoints+=(thisitem.Stats.Vitality*iWeightWeaponVitality); // Vitality
                                                iTempPoints+=(thisitem.Stats.Sockets*iWeightWeaponSocket); // Sockets
                                                iTempPoints+=(thisitem.Stats.LifeOnHit*iWeightWeaponLifeOnHit); // LifeOnHit
                                          }
                                          break;

                                } // Character class check
                          } // Is one-hander, or a bow or crossbow
                     } // Not an equipped item
                } // Is a base item type of weapon
                return iTempPoints;
        }
Exemple #29
0
 //Base class for each individual class!
 public WitchDoctor(ActorClass a)
     : base(a)
 {
     this.RecreateAbilities();
 }
Exemple #30
0
 // I know this is .NET 4.0. But for some reason, this is throwing attribute format exceptions when used with a default
 // argument. So this specific ctor overload is to prevent issues finding the correct class/advclass combos.
 public ClassAttribute(ActorClass @class)
 {
     CharacterClass = @class;
 }
 public BnetCharacterEntry()
 {
     Index = -1;
     Name  = String.Empty;
     Class = ActorClass.Invalid;
 }
 public BnetCharacterEntry(int index, string name, ActorClass actorclass)
 {
     Index = index;
     Name  = name;
     Class = actorclass;
 }
Exemple #33
0
        /// <summary>
        /// Find fresh targets, start main BehaviorTree if needed, cast any buffs needed etc.
        /// </summary>
        /// <param name="ret"></param>
        /// <returns></returns>
        internal static bool CheckHasTarget(object ret)
        {
            using (new PerformanceLogger("Trinity.CheckHasTarget"))
            {
                // If we aren't in the game or a world is loading, don't do anything yet
                if (!ZetaDia.IsInGame || !ZetaDia.Me.IsValid || ZetaDia.IsLoadingWorld)
                {
                    return(false);
                }

                if (ZetaDia.Me.IsDead)
                {
                    GoldInactivity.ResetCheckGold();
                }
                else if (GoldInactivity.GoldInactive())
                {
                    BotMain.PauseWhile(GoldInactivity.GoldInactiveLeaveGame);
                    return(false);
                }

                if (lastWorldId != PlayerStatus.WorldID)
                {
                    ISearchAreaProvider mgp = Navigator.SearchGridProvider;
                }

                if (!HotbarRefreshTimer.IsRunning)
                {
                    HotbarRefreshTimer.Start();
                }

                if (!HasMappedPlayerAbilities || HotbarRefreshTimer.ElapsedMilliseconds > 10000 || ShouldRefreshHotbarAbilities)
                {
                    // Update the cached player's cache
                    ActorClass tempClass = ActorClass.Invalid;
                    try
                    {
                        tempClass = PlayerStatus.ActorClass;
                    }
                    catch
                    {
                        DbHelper.Log(TrinityLogLevel.Verbose, LogCategory.GlobalHandler, "Safely handled exception trying to get character class.");
                    }

                    GilesPlayerCache.RefreshHotbar();

                    dictAbilityRepeatDelay = new Dictionary <SNOPower, int>(dictAbilityRepeatDefaults);
                    if (ZetaDia.CPlayer.PassiveSkills.Contains(SNOPower.Wizard_Passive_CriticalMass) && PlayerStatus.ActorClass == ActorClass.Wizard)
                    {
                        dictAbilityRepeatDelay[SNOPower.Wizard_FrostNova]          = 25;
                        dictAbilityRepeatDelay[SNOPower.Wizard_ExplosiveBlast]     = 25;
                        dictAbilityRepeatDelay[SNOPower.Wizard_DiamondSkin]        = 100;
                        dictAbilityRepeatDelay[SNOPower.Wizard_SlowTime]           = 6000;
                        dictAbilityRepeatDelay[SNOPower.Wizard_WaveOfForce]        = 1500;
                        dictAbilityRepeatDelay[SNOPower.Wizard_MirrorImage]        = 1500;
                        dictAbilityRepeatDelay[SNOPower.Wizard_Archon_ArcaneBlast] = 1500;
                        dictAbilityRepeatDelay[SNOPower.Wizard_Teleport]           = 2700;
                        dictAbilityRepeatDelay[SNOPower.Wizard_Archon_SlowTime]    = 1500;
                        dictAbilityRepeatDelay[SNOPower.Wizard_Archon_Teleport]    = 2700;
                    }
                    if (PlayerStatus.ActorClass == ActorClass.WitchDoctor && ZetaDia.CPlayer.PassiveSkills.Contains(SNOPower.Witchdoctor_Passive_GraveInjustice))
                    {
                        dictAbilityRepeatDelay[SNOPower.Witchdoctor_SoulHarvest]     = 1000;
                        dictAbilityRepeatDelay[SNOPower.Witchdoctor_SpiritWalk]      = 1000;
                        dictAbilityRepeatDelay[SNOPower.Witchdoctor_Horrify]         = 1000;
                        dictAbilityRepeatDelay[SNOPower.Witchdoctor_Gargantuan]      = 20000;
                        dictAbilityRepeatDelay[SNOPower.Witchdoctor_SummonZombieDog] = 20000;
                        dictAbilityRepeatDelay[SNOPower.Witchdoctor_GraspOfTheDead]  = 500;
                        dictAbilityRepeatDelay[SNOPower.Witchdoctor_SpiritBarrage]   = 2000;
                        dictAbilityRepeatDelay[SNOPower.Witchdoctor_Locust_Swarm]    = 2000;
                        dictAbilityRepeatDelay[SNOPower.Witchdoctor_Haunt]           = 2000;
                        dictAbilityRepeatDelay[SNOPower.Witchdoctor_Hex]             = 3000;
                        dictAbilityRepeatDelay[SNOPower.Witchdoctor_MassConfusion]   = 15000;
                        dictAbilityRepeatDelay[SNOPower.Witchdoctor_FetishArmy]      = 20000;
                        dictAbilityRepeatDelay[SNOPower.Witchdoctor_BigBadVoodoo]    = 20000;
                    }
                    if (PlayerStatus.ActorClass == ActorClass.Barbarian && ZetaDia.CPlayer.PassiveSkills.Contains(SNOPower.Barbarian_Passive_BoonOfBulKathos))
                    {
                        dictAbilityRepeatDelay[SNOPower.Barbarian_Earthquake]          = 90500;
                        dictAbilityRepeatDelay[SNOPower.Barbarian_CallOfTheAncients]   = 90500;
                        dictAbilityRepeatDelay[SNOPower.Barbarian_WrathOfTheBerserker] = 90500;
                    }
                    // Pick an appropriate health set etc. based on class
                    switch (PlayerStatus.ActorClass)
                    {
                    case ActorClass.Barbarian:
                        // What health % should we use a potion, or look for a globe
                        PlayerEmergencyHealthPotionLimit = Settings.Combat.Barbarian.PotionLevel;
                        PlayerEmergencyHealthGlobeLimit  = Settings.Combat.Barbarian.HealthGlobeLevel;
                        PlayerKiteDistance = Settings.Combat.Barbarian.KiteLimit;
                        break;

                    case ActorClass.Monk:
                        // What health % should we use a potion, or look for a globe
                        PlayerEmergencyHealthPotionLimit = Settings.Combat.Monk.PotionLevel;
                        PlayerEmergencyHealthGlobeLimit  = Settings.Combat.Monk.HealthGlobeLevel;
                        // Monks never kite :)
                        PlayerKiteDistance = 0;
                        break;

                    case ActorClass.Wizard:
                        // What health % should we use a potion, or look for a globe
                        PlayerEmergencyHealthPotionLimit = Settings.Combat.Wizard.PotionLevel;
                        PlayerEmergencyHealthGlobeLimit  = Settings.Combat.Wizard.HealthGlobeLevel;
                        PlayerKiteDistance = Settings.Combat.Wizard.KiteLimit;
                        break;

                    case ActorClass.WitchDoctor:
                        // What health % should we use a potion, or look for a globe
                        PlayerEmergencyHealthPotionLimit = Settings.Combat.WitchDoctor.PotionLevel;
                        PlayerEmergencyHealthGlobeLimit  = Settings.Combat.WitchDoctor.HealthGlobeLevel;
                        PlayerKiteDistance = Settings.Combat.WitchDoctor.KiteLimit;
                        break;

                    case ActorClass.DemonHunter:
                        // What health % should we use a potion, or look for a globe
                        PlayerEmergencyHealthPotionLimit = Settings.Combat.DemonHunter.PotionLevel;
                        PlayerEmergencyHealthGlobeLimit  = Settings.Combat.DemonHunter.HealthGlobeLevel;
                        PlayerKiteDistance = Settings.Combat.DemonHunter.KiteLimit;
                        break;
                    }
                }
                // Clear target current and reset key variables used during the target-handling function

                //CurrentTarget = null;
                bDontMoveMeIAmDoingShit = false;
                TimesBlockedMoving      = 0;
                IsAlreadyMoving         = false;
                lastMovementCommand     = DateTime.Today;
                IsWaitingForPower       = false;
                IsWaitingAfterPower     = false;
                IsWaitingForPotion      = false;
                wasRootedLastTick       = false;

                ClearBlacklists();
                using (new PerformanceLogger("CheckHasTarget.RefreshCache"))
                {
                    // Refresh Cache if needed
                    bool CacheWasRefreshed = RefreshDiaObjectCache();
                }

                // We have a target, start the target handler!
                if (CurrentTarget != null)
                {
                    IsWholeNewTarget        = true;
                    bDontMoveMeIAmDoingShit = true;
                    ShouldPickNewAbilities  = true;
                    return(true);
                }

                //Monk_MaintainTempestRush();


                // Pop a potion when necessary
                if (PlayerStatus.CurrentHealthPct <= PlayerEmergencyHealthPotionLimit)
                {
                    if (!PlayerStatus.IsIncapacitated && GilesUseTimer(SNOPower.DrinkHealthPotion))
                    {
                        ACDItem thisBestPotion = ZetaDia.Me.Inventory.Backpack.Where(i => i.IsPotion).OrderByDescending(p => p.HitpointsGranted).ThenBy(p => p.ItemStackQuantity).FirstOrDefault();
                        if (thisBestPotion != null)
                        {
                            WaitWhileAnimating(4, true);
                            ZetaDia.Me.Inventory.UseItem((thisBestPotion.DynamicId));
                        }
                        dictAbilityLastUse[SNOPower.DrinkHealthPotion] = DateTime.Now;
                        WaitWhileAnimating(3, true);
                    }
                }
                sStatusText = "[Trinity] No more targets - DemonBuddy/profile management is now in control";

                if (Settings.Advanced.DebugInStatusBar && bResetStatusText)
                {
                    bResetStatusText   = false;
                    BotMain.StatusText = sStatusText;
                }

                // Nothing to do... do we have some maintenance we can do instead, like out of combat buffing?

                if (DateTime.Now.Subtract(lastMaintenanceCheck).TotalMilliseconds > 150)
                {
                    lastMaintenanceCheck = DateTime.Now;

                    // Out of combat buffing etc. but only if we don't want to return to town etc.
                    ACDAnimationInfo myAnimationState = ZetaDia.Me.CommonData.AnimationInfo;

                    if (!PlayerStatus.IsInTown && !IsReadyToTownRun && !ForceVendorRunASAP && myAnimationState != null &&
                        myAnimationState.State != AnimationState.Attacking &&
                        myAnimationState.State != AnimationState.Casting &&
                        myAnimationState.State != AnimationState.Channeling)
                    {
                        bDontSpamOutofCombat = false;

                        powerBuff = AbilitySelector(false, true, false);

                        if (powerBuff.SNOPower != SNOPower.None)
                        {
                            WaitWhileAnimating(4, true);
                            DbHelper.Log(TrinityLogLevel.Verbose, LogCategory.Behavior, "Using OOC Buff: {0}", powerBuff.SNOPower.ToString());
                            if (powerBuff.WaitTicksBeforeUse > 0)
                            {
                                BotMain.PauseFor(new TimeSpan(0, 0, 0, 0, (int)powerBuff.WaitBeforeUseDelay));
                            }
                            ZetaDia.Me.UsePower(powerBuff.SNOPower, powerBuff.TargetPosition, powerBuff.TargetDynamicWorldId, powerBuff.TargetRActorGUID);
                            LastPowerUsed = powerBuff.SNOPower;
                            dictAbilityLastUse[powerBuff.SNOPower] = DateTime.Now;
                            if (powerBuff.WaitTicksAfterUse > 0)
                            {
                                BotMain.PauseFor(new TimeSpan(0, 0, 0, 0, (int)powerBuff.WaitAfterUseDelay));
                            }
                            WaitWhileAnimating(3, true);
                        }
                    }
                    else if (myAnimationState != null)
                    {
                        // Check if we are portalling to town, if so increase our kill radius temporarily
                        switch (myAnimationState.Current)
                        {
                        case SNOAnim.barbarian_male_HTH_Recall_Channel_01:
                        case SNOAnim.Barbarian_Female_HTH_Recall_Channel_01:
                        case SNOAnim.Monk_Male_recall_channel:
                        case SNOAnim.Monk_Female_recall_channel:
                        case SNOAnim.WitchDoctor_Male_recall_channel:
                        case SNOAnim.WitchDoctor_Female_recall_channel:
                        case SNOAnim.Wizard_Male_HTH_recall_channel:
                        case SNOAnim.Wizard_Female_HTH_recall_channel:
                        case SNOAnim.Demonhunter_Male_HTH_recall_channel:
                        case SNOAnim.Demonhunter_Female_HTH_recall_channel:
                            iKeepKillRadiusExtendedFor      = 20;
                            timeKeepKillRadiusExtendedUntil = DateTime.Now.AddSeconds(iKeepKillRadiusExtendedFor);
                            break;
                        }
                    }
                }
                CurrentTarget = null;

                if ((GilesTrinity.ForceVendorRunASAP || GilesTrinity.IsReadyToTownRun) && TownRun.TownRunTimerRunning())
                {
                    DbHelper.Log(TrinityLogLevel.Normal, LogCategory.UserInformation, "Waiting for town run timer", true);
                    return(true);
                }

                // Ok let DemonBuddy do stuff this loop, since we're done for the moment
                //DbHelper.Log(TrinityLogLevel.Verbose, LogCategory.GlobalHandler, sStatusText);

                return(false);
            }
        }
Exemple #34
0
 //Base class for each individual class!
 public Monk(ActorClass a)
     : base(a)
 {
     this.RecreateAbilities();
 }
Exemple #35
0
 public void CreateClassSettings(ActorClass actorclass)
 {
     if (actorclass != ActorClass.Invalid)
     {
         switch (actorclass)
         {
             case ActorClass.Barbarian:
                 Barbarian = new SettingBarbarian();
                 break;
             case ActorClass.Crusader:
                 Crusader = new SettingCrusader();
                 break;
             case ActorClass.DemonHunter:
                 DemonHunter = new SettingDemonHunter();
                 break;
             case ActorClass.Monk:
                 Monk = new SettingMonk();
                 break;
             case ActorClass.Witchdoctor:
                 WitchDoctor = new SettingWitchDoctor();
                 break;
             case ActorClass.Wizard:
                 Wizard = new SettingWizard();
                 break;
         }
     }
 }
Exemple #36
0
 //Base class for each individual class!
 public DemonHunter(ActorClass a)
     : base(a)
 {
     this.RecreateAbilities();
 }
Exemple #37
0
 /// <summary>
 /// 获取职业的string
 /// </summary>
 public static string GetClassName(ActorClass actorClass)
 {
     return(actorClass.ToString());
 }
Exemple #38
0
        public static Composite GetComposite(ActorClass actorClass, BehaviorType behavior, out int behaviourCount)
        {
            behaviourCount = 0;
            if (Methods.Count <= 0)
            {
                Log.Info("Building method list");
                foreach (Type type in Assembly.GetExecutingAssembly().GetTypes())
                {
                    Methods.AddRange(type.GetMethods(BindingFlags.Static | BindingFlags.Public));
                }
                Log.Info("Added " + Methods.Count + " methods");
            }
            var matchedMethods = new Dictionary <int, PrioritySelector>();

            foreach (MethodInfo mi in
                     Methods.Where(
                         mi =>
                         !mi.IsGenericMethod &&
                         mi.GetParameters().Length == 0)
                     .Where(
                         mi =>
                         mi.ReturnType == typeof(Composite) ||
                         mi.ReturnType.IsSubclassOf(typeof(Composite))))
            {
                //Logger.WriteDebug("[CompositeBuilder] Checking attributes on " + mi.Name);
                bool classMatches     = false;
                bool behaviorMatches  = false;
                bool hasIgnore        = false;
                int  thePriority      = 0;
                var  theBehaviourType = BehaviorType.All;
                var  theIgnoreType    = BehaviorType.All;
                try
                {
                    foreach (object ca in mi.GetCustomAttributes(false))
                    {
                        if (ca is ClassAttribute)
                        {
                            var attrib = ca as ClassAttribute;
                            // Class specific
                            if (attrib.CharacterClass != actorClass)
                            {
                                //Log.Info("Attribute Class does not match. [" + attrib.SpecificClass + " != " + torClass + "]");
                                continue;
                            }

                            //Logger.WriteDebug(mi.Name + " has my class");
                            classMatches = true;
                        }
                        else if (ca is BehaviorAttribute)
                        {
                            var attrib = ca as BehaviorAttribute;
                            if ((attrib.Type & behavior) == 0)
                            {
                                continue;
                            }
                            //Logger.WriteDebug(mi.Name + " has my behavior");
                            theBehaviourType = attrib.Type;
                            behaviourCount++;
                            behaviorMatches = true;
                        }
                        else if (ca is PriorityAttribute)
                        {
                            var attrib = ca as PriorityAttribute;
                            thePriority = attrib.PriorityLevel;
                        }
                        else if (ca is IgnoreBehaviorCountAttribute)
                        {
                            var attrib = ca as IgnoreBehaviorCountAttribute;
                            hasIgnore     = true;
                            theIgnoreType = attrib.Type;
                        }
                    }
                }
                catch
                {
                    Log.Info("Error getting custom attributes for " + mi.Name);
                    continue;
                }

                if (behaviorMatches && hasIgnore && theBehaviourType == theIgnoreType)
                {
                    behaviourCount--;
                }

                // If all our attributes match, then mark it as wanted!
                if (classMatches && behaviorMatches)
                {
                    Log.InfoFormat("{0} is a match!", mi.Name);
                    Log.InfoFormat("Using {0} for {1} (Priority: {2})", mi.Name, behavior, thePriority);
                    Composite matched;
                    try
                    {
                        matched = (Composite)mi.Invoke(null, null);
                    }
                    catch (Exception e)
                    {
                        Log.InfoFormat("ERROR Creating composite: {0}\n{1}", mi.Name, e.StackTrace);
                        continue;
                    }
                    if (!matchedMethods.ContainsKey(thePriority))
                    {
                        matchedMethods.Add(thePriority, new PrioritySelector(matched));
                    }
                    else
                    {
                        matchedMethods[thePriority].AddChild(matched);
                    }
                }
            }
            // If we found no methods, rofls!
            if (matchedMethods.Count <= 0)
            {
                return(null);
            }

            // Return the composite match we found. (Note: ANY composite return is fine)
            return(matchedMethods.OrderByDescending(mm => mm.Key).First().Value);
        }
Exemple #39
0
 public PlayerInfoCache(
     DateTime lastUpdated, bool incapacitated, bool isRooted, bool isInTown, double currentHealth, double currentEnergy, double currentEnergyPct,
     double discipline, double disciplinePct, Vector3 currentPosition, bool waitingReserve, int dynamicId, int level, ActorClass actorClass, string battleTag)
 {
     LastUpdated             = lastUpdated;
     IsIncapacitated         = incapacitated;
     IsRooted                = isRooted;
     IsInTown                = isInTown;
     CurrentHealthPct        = currentHealth;
     PrimaryResource         = currentEnergy;
     PrimaryResourcePct      = currentEnergyPct;
     SecondaryResource       = discipline;
     SecondaryResourcePct    = disciplinePct;
     Position                = currentPosition;
     WaitingForReserveEnergy = waitingReserve;
     MyDynamicID             = dynamicId;
     Level       = level;
     ActorClass  = actorClass;
     BattleTag   = battleTag;
     SceneId     = -1;
     LevelAreaId = -1;
     Scene       = new SceneInfo()
     {
         SceneId    = -1,
         LastUpdate = DateTime.UtcNow
     };
 }
Exemple #40
0
 //Base class for each individual class!
 public Barbarian(ActorClass a)
     : base(a)
 {
     this.RecreateAbilities();
 }
Exemple #41
0
        /// <summary>
        /// Initializes this <see cref="CombatRoutine"/>.
        /// </summary>
        /// <remarks>Created 2012-04-03</remarks>
        public override void Initialize()
        {
            GameEvents.OnLevelUp += Monk.MonkOnLevelUp;
            GameEvents.OnLevelUp += Wizard.WizardOnLevelUp;
            GameEvents.OnLevelUp += WitchDoctor.WitchDoctorOnLevelUp;
            GameEvents.OnLevelUp += DemonHunter.DemonHunterOnLevelUp;
            GameEvents.OnLevelUp += Barbarian.BarbarianOnLevelUp;

            if (!CreateBehaviors())
            {
                BotMain.Stop();
                return;
            }

            _lastClass = Class;
            Pulsator.OnPulse += SetBehaviorPulse;
            //Navigator.PlayerMover = new BelphegorPlayerMover();

            Logger.Write("Behaviors created");
        }
Exemple #42
0
 // I know this is .NET 4.0. But for some reason, this is throwing attribute format exceptions when used with a default
 // argument. So this specific ctor overload is to prevent issues finding the correct class/advclass combos.
 public ClassAttribute(ActorClass @class)
 {
     CharacterClass = @class;
 }
Exemple #43
0
        public void SetBehaviorPulse(object sender, EventArgs args)
        {
            if (ZetaDia.IsInGame && !ZetaDia.IsLoadingWorld && ZetaDia.Me != null && ZetaDia.Me.CommonData != null)
            {
                if (_combat == null || ZetaDia.Me.IsValid && Class != _lastClass)
                {
                    if (!CreateBehaviors())
                    {
                        BotMain.Stop();
                        return;
                    }

                    Logger.Write("Behaviors created");
                    _lastClass = Class;
                }
            }
        }
Exemple #44
0
 public static HashSet <int> GetRankedIds(ActorClass actorClass, double minPercent = 10, int minSampleSize = 10, int betterThanRank = 5)
 {
     return(new HashSet <int>(GetRankedItems(actorClass, minPercent, minSampleSize, betterThanRank).Select(v => v.Item.Id)));
 }
 public BnetCharacterEntry(int index, string name, ActorClass actorclass)
 {
     Index = index;
     Name = name;
     Class = actorclass;
 }