コード例 #1
0
ファイル: SkillInfo.cs プロジェクト: arturino009/copilot
        internal static bool ManageCooldown(Skill skill, ActorSkill actorSkill, float customCooldown = 0)
        {
            if (skill.Cooldown > 0)
            {
                skill.Cooldown = MoveTowards(skill.Cooldown, 0, (float)deltaTime);
                return(false);
            }

            if (skill.Cooldown == 0 && actorSkill.TotalUses != skill.LastUsed)
            {
                skill.Cooldown = customCooldown == 0 ? actorSkill.Cooldown * 100 : customCooldown;
                skill.LastUsed = actorSkill.TotalUses;
                return(false);
            }
            if (!CoPilot.instance.GCD())
            {
                return(false);
            }
            actorSkill.Stats.TryGetValue(GameStat.ManaCost, out int manaCost);
            if (CoPilot.instance.player.CurMana < manaCost)
            {
                return(false);
            }
            if (skill.Cooldown == 0)
            {
                return(true);
            }
            return(false);
        }
コード例 #2
0
    public override void setThisActor(GameObject actor)
    {
        ActorSkill skill = actor.GetComponent <ActorSkill>();

        skill.launchSkill    = () => { Debug.Log("default skill launched"); };
        skill.terminateSkill = () => { Debug.Log("default skill terminated"); };
    }
コード例 #3
0
        internal static bool ManageCooldown(Skill skill, ActorSkill actorSkill)
        {
            if (skill.Cooldown > 0)
            {
                skill.Cooldown = MoveTowards(skill.Cooldown, 0, (float)deltaTime);
                return(false);
            }

            if (actorSkill.RemainingUses <= 0 && actorSkill.IsOnCooldown)
            {
                return(false);
            }
            if (!CoPilot.instance.GCD())
            {
                return(false);
            }

            actorSkill.Stats.TryGetValue(GameStat.ManaCost, out int manaCost);
            if (CoPilot.instance.player.CurMana < manaCost)
            {
                return(false);
            }

            return(true);
        }
コード例 #4
0
        internal static bool ManageCooldown(Skill skill, ActorSkill actorSkill)
        {
            if (skill.Cooldown > 0)
            {
                skill.Cooldown = Helper.MoveTowards(skill.Cooldown, 0, _deltaTime);
                return(false);
            }

            if (actorSkill.RemainingUses <= 0 && actorSkill.IsOnCooldown)
            {
                return(false);
            }
            if (!CoPilot.instance.Gcd())
            {
                return(false);
            }

            if (!actorSkill.Stats.TryGetValue(GameStat.ManaCost, out var manaCost))
            {
                manaCost = 0;
            }

            if (CoPilot.instance.player.CurMana >= manaCost)
            {
                return(true);
            }
            if (!CoPilot.instance.localPlayer.Stats.TryGetValue(GameStat.VirtualEnergyShieldProtectsMana,
                                                                out var hasEldritchBattery))
            {
                hasEldritchBattery = 0;
            }

            return(hasEldritchBattery > 0 && CoPilot.instance.player.CurES > manaCost);
        }
コード例 #5
0
ファイル: BuffUtil.cs プロジェクト: IlliumIv/BuffUtil
        private Buff GetBuff(string buffName, ActorSkill skill = null)
        {
            if (buffs == null)
            {
                if (showErrors)
                {
                    LogError("Requested buff retrieval, but buff list is empty.", 1);
                }
                return(null);
            }

            return(buffs.FirstOrDefault(b => string.Compare(b.Name, buffName, StringComparison.OrdinalIgnoreCase) == 0 &&
                                        (skill == null || b.SkillIndex() == skill.SlotIdentifier())));
        }
コード例 #6
0
ファイル: BuffUtil.cs プロジェクト: IlliumIv/BuffUtil
        private bool?HasBuff(string buffName, ActorSkill skill = null)
        {
            if (buffs == null)
            {
                if (showErrors)
                {
                    LogError("Requested buff check, but buff list is empty.", 1);
                }
                return(null);
            }

            return(buffs.Any(b => string.Compare(b.Name, buffName, StringComparison.OrdinalIgnoreCase) == 0 &&
                             (skill == null || b.SkillIndex() == skill.SlotIdentifier())));
        }
コード例 #7
0
ファイル: AutoSkill.cs プロジェクト: IlliumIv/AutoSkill
        private void SkillMain()
        {
            if (GameController == null || GameController.Window == null || GameController.Game.IngameState.Data.LocalPlayer == null || GameController.Game.IngameState.Data.LocalPlayer.Address == 0x00)
            {
                return;
            }

            if (!GameController.Window.IsForeground())
            {
                return;
            }

            if (!GameController.Game.IngameState.Data.LocalPlayer.IsValid)
            {
                return;
            }

            var playerLife = GameController.Game.IngameState.Data.LocalPlayer.GetComponent <Life>();

            if (playerLife == null || IsTownOrHideout || IsChatOpen)
            {
                return;
            }

            try
            {
                if (ShouldUseSkill())
                {
                    ActorSkill actorSkill = null;
                    try
                    {
                        var actorSkills = GameController.Game.IngameState.Data.LocalPlayer.GetComponent <Actor>().ActorSkills;
                        actorSkill = actorSkills.FirstOrDefault(CanUseSkill);
                    }
                    catch { }

                    if (CanUseSkill(actorSkill))
                    {
                        keyboard.KeyPressRelease(Settings.SkillKeyPressed.Value);
                        intervalStopwatch.Restart();
                    }
                }
            }
            catch (Exception ex)
            {
                LogError(ex.Message, 3);
            }
        }
コード例 #8
0
ファイル: Actor.cs プロジェクト: mengtest/skilldemo
    public override void Load(XTransform param)
    {
        AddCommands();

        //mActorAct = new ActorAct(this);
        mActorSkill = new ActorSkill(this);
        this.Obj    = ZTPool.Instance.GetGo("Model/Actor/" + this.Id);
        //this.Obj = ZTPool.Instance.GetGo("Model/Actor/50006");
        if (this.Obj == null)
        {
            Debug.LogError("对象为空");
            return;
        }
        this.Obj.transform.localPosition = Vector3.zero;
        this.mBornParam     = param;
        this.CacheTransform = Obj.transform;
        this.mCharacter     = Obj.GetComponent <CharacterController>();
        this.Init();
    }
コード例 #9
0
        public static List <Data> CurrentSkills()
        {
            List <Data> ReturnSkills = new List <Data>();

            try
            {
                List <ushort> ids = CurrentIDS();
                if (ids == null)
                {
                    return(ReturnSkills);
                }
                if (ids.Count > 100)
                {
                    BasePlugin.API.LogError("CurrentIDS.Count > 500", 10);
                    return(ReturnSkills);
                }
                //BasePlugin.API.LogError($"ids Count: {ids.Count}", 10);

                for (int index = 0; index < ids.Count; index++)
                {
                    if (GetSkill(ids[index]) == null)
                    {
                        continue;
                    }

                    ActorSkill Skill = GetSkill(ids[index]);

                    ReturnSkills.Add(new Data
                    {
                        Skill        = Skill,
                        SkillStats   = Skill.Stats,
                        SkillElement = BasePlugin.API.GameController.Game.IngameState.IngameUi.SkillBar.Children[index]
                    });
                }
            }
            catch (Exception e)
            {
                BasePlugin.API.LogError(e, 10);
            }

            return(ReturnSkills);
        }
コード例 #10
0
ファイル: AutoSkill.cs プロジェクト: IlliumIv/AutoSkill
        private bool CanUseSkill(ActorSkill skill)
        {
            if (skill != null)
            {
                if (!skill.CanBeUsed || !skill.SkillSlotIndex.Equals(Settings.ConnectedSkill.Value - 1))
                {
                    return(false);
                }

                // Skip using phase run when we already have the buff
                if (skill.Name.Equals("NewPhaseRun"))
                {
                    var buffs = GameController.Game.IngameState.Data.LocalPlayer.GetComponent <Buffs>().BuffsList;
                    if (buffs != null && buffs.Any(x => x.Name.Equals("new_phase_run")))
                    {
                        return(false);
                    }
                }
            }
            ;
            return(true);
        }
コード例 #11
0
 private bool isTravelingSkill(ActorSkill skill)
 {
     return(travelingSkills.Contains(skill.EffectsPerLevel.SkillGemWrapper.ActiveSkill.DisplayName));
 }
コード例 #12
0
ファイル: AutoGolem.cs プロジェクト: miooor/AutoGolem
        private void GolemMain()
        {
            if (GameController == null || GameController.Window == null || GameController.Game.IngameState.Data.LocalPlayer == null || GameController.Game.IngameState.Data.LocalPlayer.Address == 0x00)
            {
                return;
            }

            if (!GameController.Window.IsForeground())
            {
                return;
            }

            if (!GameController.Game.IngameState.Data.LocalPlayer.IsValid)
            {
                return;
            }

            var playerLife = GameController.Game.IngameState.Data.LocalPlayer.GetComponent <Life>();

            if (playerLife == null || isTown)
            {
                return;
            }

            try
            {
                if (Settings.DontCastOnNearbyMonster.Value)
                {
                    Vector3 positionPlayer = GameController.Game.IngameState.Data.LocalPlayer.GetComponent <Render>().Pos;

                    foreach (EntityWrapper monster in nearbyMonsters)
                    {
                        if (monster.IsValid && monster.IsAlive)
                        {
                            Render positionMonster = monster.GetComponent <Render>();
                            int    distance        = (int)Math.Sqrt(Math.Pow((double)(positionPlayer.X - positionMonster.X), 2.0) + Math.Pow((double)(positionPlayer.Y - positionMonster.Y), 2.0));
                            if (distance <= Settings.NearbyMonsterRange.Value)
                            {
                                return;  //don't cast if monsters are nearby
                            }
                        }
                    }
                }

                int countChaosGolem     = 0;
                int countFireGolem      = 0;
                int countIceGolem       = 0;
                int countLightningGolem = 0;
                int countStoneGolem     = 0;

                if (Settings.UseAlternativeDetectionMethod.Value)
                {
                    List <Buff> buffs = GameController.Game.IngameState.Data.LocalPlayer.GetComponent <Life>().Buffs;

                    Buff chaosGolem = buffs.FirstOrDefault(x => x.Name.Equals("chaos_elemental_buff"));
                    if (chaosGolem != null)
                    {
                        countChaosGolem = chaosGolem.Charges;
                    }

                    Buff fireGolem = buffs.FirstOrDefault(x => x.Name.Equals("fire_elemental_buff"));
                    if (fireGolem != null)
                    {
                        countFireGolem = fireGolem.Charges;
                    }

                    Buff iceGolem = buffs.FirstOrDefault(x => x.Name.Equals("ice_elemental_buff"));
                    if (iceGolem != null)
                    {
                        countIceGolem = iceGolem.Charges;
                    }

                    Buff lightningGolem = buffs.FirstOrDefault(x => x.Name.Equals("lightning_elemental_buff"));
                    if (lightningGolem != null)
                    {
                        countLightningGolem = lightningGolem.Charges;
                    }

                    Buff stoneGolem = buffs.FirstOrDefault(x => x.Name.Equals("rock_golem_buff"));
                    if (stoneGolem != null)
                    {
                        countStoneGolem = stoneGolem.Charges;
                    }
                }
                else
                {
                    List <DeployedObject> deployedObjects = GameController.Game.IngameState.Data.LocalPlayer.GetComponent <Actor>().DeployedObjects;

                    countChaosGolem     = deployedObjects.Count(x => x.Entity.Path.Contains("ChaosElemental"));
                    countFireGolem      = deployedObjects.Count(x => x.Entity.Path.Contains("FireElemental"));
                    countIceGolem       = deployedObjects.Count(x => x.Entity.Path.Contains("IceElemental"));
                    countLightningGolem = deployedObjects.Count(x => x.Entity.Path.Contains("LightningGolem"));
                    countStoneGolem     = deployedObjects.Count(x => x.Entity.Path.Contains("RockGolem"));
                }

                List <ActorSkill> actorSkills = GameController.Game.IngameState.Data.LocalPlayer.GetComponent <Actor>().ActorSkills;

                if (Settings.ChaosGolem.Value && countChaosGolem < Settings.ChaosGolemMax.Value)
                {
                    ActorSkill skillChaosGolem = actorSkills.FirstOrDefault(x => x.Name == "SummonChaosGolem" && x.CanBeUsed && x.SkillSlotIndex.Equals(Settings.ChaosGolemConnectedSkill.Value - 1));

                    if (skillChaosGolem != null)
                    {
                        keyboard.KeyPressRelease(Settings.ChaosGolemKeyPressed.Value);
                    }
                }
                if (Settings.FireGolem.Value && countFireGolem < Settings.FireGolemMax.Value)
                {
                    ActorSkill skillFireGolem = actorSkills.FirstOrDefault(x => x.Name == "SummonFireGolem" && x.CanBeUsed && x.SkillSlotIndex.Equals(Settings.FireGolemConnectedSkill.Value - 1));

                    if (skillFireGolem != null)
                    {
                        keyboard.KeyPressRelease(Settings.FireGolemKeyPressed.Value);
                    }
                }
                if (Settings.IceGolem.Value && countIceGolem < Settings.IceGolemMax.Value)
                {
                    ActorSkill skillIceGolem = actorSkills.FirstOrDefault(x => x.Name == "SummonIceGolem" && x.CanBeUsed && x.SkillSlotIndex.Equals(Settings.IceGolemConnectedSkill.Value - 1));

                    if (skillIceGolem != null)
                    {
                        keyboard.KeyPressRelease(Settings.IceGolemKeyPressed.Value);
                    }
                }
                if (Settings.LightningGolem.Value && countLightningGolem < Settings.LightningGolemMax.Value)
                {
                    ActorSkill skillLightningGolem = actorSkills.FirstOrDefault(x => x.Name == "SummonLightningGolem" && x.CanBeUsed && x.SkillSlotIndex.Equals(Settings.LightningGolemConnectedSkill.Value - 1));

                    if (skillLightningGolem != null)
                    {
                        keyboard.KeyPressRelease(Settings.LightningGolemKeyPressed.Value);
                    }
                }
                if (Settings.StoneGolem.Value && countStoneGolem < Settings.StoneGolemMax.Value)
                {
                    ActorSkill skillStoneGolem = actorSkills.FirstOrDefault(x => x.Name == "SummonRockGolem" && x.CanBeUsed && x.SkillSlotIndex.Equals(Settings.StoneGolemConnectedSkill.Value - 1));

                    if (skillStoneGolem != null)
                    {
                        keyboard.KeyPressRelease(Settings.StoneGolemKeyPressed.Value);
                    }
                }
            }
            catch (Exception ex)
            {
                //LogError(ex.Message, 3);
            }
        }
コード例 #13
0
 void OnEnable()
 {
     actor = (ActorSkill)target;
     Debug.LogWarning("OnEnable");
 }
コード例 #14
0
ファイル: Extensions.cs プロジェクト: IlliumIv/BuffUtil
 public static int SlotIdentifier(this ActorSkill actorSkill)
 {
     return((actorSkill.Id >> 8) & 0xFF);
 }
コード例 #15
0
 public static Dictionary <GameStat, int> GetSkillStats(ActorSkill skill)
 {
     return(skill.Stats);
 }