コード例 #1
0
    public bool Execute(WoWUnit target, bool force)
    {
        bool success = CombatUtil.CastSpell(this, target, force);

        if (success)
        {
            Logging.WriteFight("Fightclass successfully casted: " + this.FullName());
        }
        return(success);
    }
コード例 #2
0
        public LastTargetLoot(ILogger logger, ConfigurableInput input, Wait wait, AddonReader addonReader, StopMoving stopMoving, CombatUtil combatUtil)
        {
            this.logger = logger;
            this.input  = input;

            this.wait         = wait;
            this.playerReader = addonReader.PlayerReader;
            this.stopMoving   = stopMoving;
            this.bagReader    = addonReader.BagReader;

            this.combatUtil = combatUtil;
        }
コード例 #3
0
    public static bool HasDebuffType(this WoWUnit unit, string type)
    {
        string luaString = @"hasDebuff = false;
        for i=1,40 do
	        local _, _ debuffType = UnitDebuff(""{1}"", i);
            if debuffType == ""{0}"" then
                hasDebuff = true
                break;
            end
        end";
        return Lua.LuaDoString<bool>(FormatLua(luaString, type, CombatUtil.GetLuaId(unit)), "hasDebuff");
    }
コード例 #4
0
        public LootGoal(ILogger logger, ConfigurableInput input, Wait wait, AddonReader addonReader, StopMoving stopMoving, ClassConfiguration classConfiguration, NpcNameTargeting npcNameTargeting, CombatUtil combatUtil)
        {
            this.logger = logger;
            this.input  = input;

            this.wait         = wait;
            this.playerReader = addonReader.PlayerReader;
            this.areaDb       = addonReader.AreaDb;
            this.stopMoving   = stopMoving;
            this.bagReader    = addonReader.BagReader;

            this.classConfiguration = classConfiguration;
            this.npcNameTargeting   = npcNameTargeting;
            this.combatUtil         = combatUtil;
        }
コード例 #5
0
    public void Dispose()
    {
        _isLaunched = false;

        if (Hook.AllowFrameLock && Memory.WowMemory.FrameIsLocked)
        {
            Memory.WowMemory.UnlockFrame(true);
        }

        CombatUtil.Stop();

        FiniteStateMachineEvents.OnAfterRunState -= SpellUpdateHandler;

        Logging.Write("Unloaded Vanilla Fightclass");
    }
コード例 #6
0
    private void UseBuffs()
    {
        if (ObjectManager.Me.IsMounted || ObjectManager.Me.InCombat || Fight.InFight)
        {
            return;
        }

        Buffs.ForEach(CombatUtil.CastBuff);
        if (ObjectManager.Me.HaveBuff("Preparation"))
        {
            ObjectManager.GetObjectWoWPlayer().ForEach(o => {
                PartyBuffs.ForEach(b => CombatUtil.CastBuff(b, o));
            });
        }

        CombatUtil.CastBuff(Armor, Me);
    }
コード例 #7
0
    private void Rotation()
    {
        while (_isLaunched)
        {
            try
            {
                if (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !ObjectManager.Me.IsDead)
                {
                    UseBuffs();

                    if ((VanillaFightclassSetting.CurrentSetting.FrameLock || CombatUtil.GetGlobalCooldown() == 0) && (Fight.InFight || Conditions.IsAttackedAndCannotIgnore) && ObjectManager.Target.IsAttackable)
                    {
                        var watch = System.Diagnostics.Stopwatch.StartNew();

                        if (VanillaFightclassSetting.CurrentSetting.FrameLock && Hook.AllowFrameLock && !Memory.WowMemory.FrameIsLocked)
                        {
                            Memory.WowMemory.LockFrame();
                        }

                        foreach (var step in RotationActions)
                        {
                            if (step.ExecuteStep())
                            {
                                break;
                            }
                        }

                        if (Hook.AllowFrameLock && Memory.WowMemory.FrameIsLocked)
                        {
                            Memory.WowMemory.UnlockFrame(true);
                        }

                        watch.Stop();
                        if (watch.ElapsedMilliseconds > 100)
                        {
                            Logging.WriteFight("Iteration took " + watch.ElapsedMilliseconds + "ms");
                        }
                    }
                }
            }catch (Exception e)
            {
                Logging.WriteError("VanillaFightClass ERROR:" + e);
            }
            Thread.Sleep(VanillaFightclassSetting.CurrentSetting.FrameLock ? 100 : (int)(CombatUtil.GetGlobalCooldown() * 1000));
        }
    }
コード例 #8
0
        public SkinningGoal(ILogger logger, ConfigurableInput input, AddonReader addonReader, Wait wait, StopMoving stopMoving, NpcNameTargeting npcNameTargeting, CombatUtil combatUtil)
        {
            this.logger = logger;
            this.input  = input;

            this.playerReader    = addonReader.PlayerReader;
            this.wait            = wait;
            this.stopMoving      = stopMoving;
            this.bagReader       = addonReader.BagReader;
            this.equipmentReader = addonReader.EquipmentReader;

            this.npcNameTargeting = npcNameTargeting;
            this.combatUtil       = combatUtil;

            AddPrecondition(GoapKey.incombat, false);
            AddPrecondition(GoapKey.shouldskin, true);

            AddEffect(GoapKey.shouldskin, false);
        }
コード例 #9
0
        public override void PeriodicUpdate()
        {
            //戦闘距離外なら追いかけに移行
            var combatDistance = GetAntCommonData <SoldierAntCommonData>().CombatDistance;

            if (Vector3.Distance(_enemyAnt.transform.position, Controller.Ant.transform.position) > combatDistance)
            {
                Controller.ChangeStrategy(new SoldierChaseStrategy(_enemyAnt));
                return;
            }

            //倒した
            if (!_enemyAnt.Data.IsAlive)
            {
                Controller.ChangeStrategy(new SoldierStandbyStrategy());
            }

            CombatUtil.AttackToAnt(Controller.Ant, _enemyAnt);
        }
コード例 #10
0
    public void Initialize()
    {
        wManagerSetting.CurrentSetting.UseLuaToMove = true;
        wManagerSetting.CurrentSetting.RestingMana  = true;

        _isLaunched = true;

        VanillaFightclassSetting.Load();
        CombatUtil.Start();

        RotationActions.Sort((a, b) => a.Priority.CompareTo(b.Priority));
        UpdateRanks();

        FiniteStateMachineEvents.OnAfterRunState += SpellUpdateHandler;
        EventsLuaWithArgs.OnEventsLuaWithArgs    += CastingEventHandler;

        Logging.Write("Loaded VanillaFightClass");

        Rotation();
    }
コード例 #11
0
    public static bool IsPlayer(this WoWUnit unit)
    {
        string luaString = @"isPlayer = (UnitIsPlayer(""{0}"") == 1)";

        return(Lua.LuaDoString <bool>(FormatLua(luaString, CombatUtil.GetLuaId(unit)), "isPlayer"));
    }
コード例 #12
0
    public static bool IsCreatureType(this WoWUnit unit, string type)
    {
        string luaString = @"isCreatureType = (UnitCreatureType(""{1}"") == ""{0}"" or false);";

        return(Lua.LuaDoString <bool>(FormatLua(luaString, type, CombatUtil.GetLuaId(unit)), "isCreatureType"));
    }
コード例 #13
0
    public static bool HasMana(this WoWUnit unit)
    {
        string luaString = @"return (UnitPowerType(""{0}"") == 0 and UnitMana(""{0}"") > 1)";

        return(Lua.LuaDoString <bool>(FormatLua(luaString, CombatUtil.GetLuaId(unit))));
    }
コード例 #14
0
 public PostKillLootGoal(ILogger logger, ConfigurableInput input, Wait wait, AddonReader addonReader, StopMoving stopMoving, ClassConfiguration classConfiguration, NpcNameTargeting npcNameTargeting, CombatUtil combatUtil)
     : base(logger, input, wait, addonReader, stopMoving, classConfiguration, npcNameTargeting, combatUtil)
 {
 }