Пример #1
0
    // Use this for initialization
    void Start()
    {
        _manager = gameObject.AddComponent <CooldownManager>();

        PRESET_KEYS        = PRESET_ITEMS.Keys.ToArray();
        _nextRandomizedKey = GetRandomKey();
    }
Пример #2
0
        protected BasicCombatClass(AmeisenBotStateMachine stateMachine)
        {
            WowInterface = WowInterface.I;
            StateMachine = stateMachine;

            Configureables = new Dictionary <string, dynamic>()
            {
                { "HealingItemHealthThreshold", 30.0 },
                { "HealingItemManaThreshold", 30.0 }
            };

            CooldownManager      = new CooldownManager(WowInterface.CharacterManager.SpellBook.Spells);
            RessurrectionTargets = new Dictionary <string, DateTime>();

            TargetManagerDps  = new TargetManager(new DpsTargetSelectionLogic(), TimeSpan.FromMilliseconds(250));
            TargetManagerTank = new TargetManager(new TankTargetSelectionLogic(), TimeSpan.FromMilliseconds(250));
            TargetManagerHeal = new TargetManager(new HealTargetSelectionLogic(), TimeSpan.FromMilliseconds(250));

            MyAuraManager     = new AuraManager(() => WowInterface.ObjectManager.Player?.Auras);
            TargetAuraManager = new AuraManager(() => WowInterface.ObjectManager.Target?.Auras);

            GroupAuraManager = new GroupAuraManager(WowInterface);

            TargetInterruptManager = new InterruptManager(new List <WowUnit>()
            {
                WowInterface.ObjectManager.Target
            }, null);

            EventCheckFacing = new TimegatedEvent(TimeSpan.FromMilliseconds(500));
            EventAutoAttack  = new TimegatedEvent(TimeSpan.FromMilliseconds(500));
        }
Пример #3
0
        internal static bool IsSpellReady(string name)
        {
            name = name.Replace("()", "");
            if (!CooldownManager.Contains("GCD") && !CooldownManager.Contains(name))
            {
                string   LuaStatement = "eins, zwei, drei = isSpellReady('" + name + "')";
                string[] result       = Calls.GetText(LuaStatement, new string[] { "eins", "zwei", "drei" }, 20);
                if (result[0].Trim() == "0")
                {
                    return(true);
                }
                else
                {
                    if (result[0] != "" && result[1] != "")
                    {
                        double timeStamp = Convert.ToDouble(result[0].Replace(".", ""));
                        double secCd     = TimeSpan.FromSeconds(Convert.ToDouble(result[1].Replace(".", ","))).TotalMilliseconds;

                        if (result[2] == "1")
                        {
                            if (secCd == 1500)
                            {
                                CooldownManager.Add("GCD", timeStamp + secCd);
                            }
                            CooldownManager.Add(name, timeStamp + secCd);
                        }
                    }
                }
            }
            return(false);
        }
Пример #4
0
        protected BasicCombatClass(WowInterface wowInterface, AmeisenBotFsm stateMachine)
        {
            WowInterface = wowInterface;
            StateMachine = stateMachine;

            C = new Dictionary <string, dynamic>()
            {
                { "HealingItemHealthThreshold", 30.0 },
                { "HealingItemManaThreshold", 30.0 }
            };

            CooldownManager      = new CooldownManager(WowInterface.CharacterManager.SpellBook.Spells);
            RessurrectionTargets = new Dictionary <string, DateTime>();

            TargetManagerDps  = new TargetManager(new DpsTargetSelectionLogic(wowInterface), TimeSpan.FromMilliseconds(250));
            TargetManagerTank = new TargetManager(new TankTargetSelectionLogic(wowInterface), TimeSpan.FromMilliseconds(250));
            TargetManagerHeal = new TargetManager(new HealTargetSelectionLogic(wowInterface), TimeSpan.FromMilliseconds(250));

            MyAuraManager     = new AuraManager(wowInterface);
            TargetAuraManager = new AuraManager(wowInterface);

            GroupAuraManager = new GroupAuraManager(wowInterface);

            TargetInterruptManager = new InterruptManager();

            EventCheckFacing = new(TimeSpan.FromMilliseconds(500));
            EventAutoAttack  = new(TimeSpan.FromMilliseconds(500));
        }
Пример #5
0
        private bool HandleDeadPartymembers()
        {
            if (!Spells.ContainsKey(resurrectionSpell))
            {
                Spells.Add(resurrectionSpell, CharacterManager.SpellBook.GetSpellByName(resurrectionSpell));
            }

            if (Spells[resurrectionSpell] != null &&
                !CooldownManager.IsSpellOnCooldown(resurrectionSpell) &&
                Spells[resurrectionSpell].Costs < ObjectManager.Player.Mana)
            {
                IEnumerable <WowPlayer> players      = ObjectManager.WowObjects.OfType <WowPlayer>();
                List <WowPlayer>        groupPlayers = players.Where(e => e.IsDead && e.Health == 0 && ObjectManager.PartymemberGuids.Contains(e.Guid)).ToList();

                if (groupPlayers.Count > 0)
                {
                    HookManager.TargetGuid(groupPlayers.First().Guid);
                    HookManager.CastSpell(resurrectionSpell);
                    CooldownManager.SetSpellCooldown(resurrectionSpell, (int)HookManager.GetSpellCooldown(resurrectionSpell));
                    return(true);
                }
            }

            return(false);
        }
Пример #6
0
    void OnMapGenerate()
    {
        CreatePlayer();
        //CreateUnit(0);

        CooldownManager.AddInfinityCooldown(OnTick);
    }
Пример #7
0
        public override void HandleCommand(NotifyTextMessageEvent evt, string command, List <string> parameters, Action <string> messageCallback)
        {
            CooldownManager.ThrowIfCooldown(evt.InvokerUniqueId, "command:daily");

            int currentBalance = EconomyManager.GetBalanceForUser(evt.InvokerUniqueId);

            if (currentBalance + Settings.DailyReward > Settings.EcoSoftBalanceLimit)
            {
                messageCallback.Invoke(ColorCoder.ErrorBright($"You would have more than {ColorCoder.Currency(Settings.EcoSoftBalanceLimit, Settings.EcoPointUnitName)}, {ColorCoder.Username(evt.InvokerName)}. Your balance: {ColorCoder.Currency(currentBalance, Settings.EcoPointUnitName)} |  Daily reward: {ColorCoder.Currency(Settings.DailyReward, Settings.EcoPointUnitName)}"));
                return;
            }


            DateTime cooldownDue = DateTime.Today.AddDays(1).AddHours(7);
            DateTime todayCheck  = DateTime.Today.AddHours(7);

            if (todayCheck > DateTime.Now)
            {
                cooldownDue = todayCheck;
            }

            CooldownManager.SetCooldown(evt.InvokerUniqueId, "command:daily", cooldownDue);

            EconomyManager.ChangeBalanceForUser(evt.InvokerUniqueId, Settings.DailyReward);
            messageCallback.Invoke(ColorCoder.SuccessDim($"{ColorCoder.Currency(Settings.DailyReward, Settings.EcoPointUnitName)} have been added to your balance as daily reward, {ColorCoder.Username(evt.InvokerName)}"));
        }
Пример #8
0
    void UpdateDirect()
    {
        direcr = Mathf.Sign(TargetManager.PlayerController.transform.position.x - pysicItem.Position.x);


        cooldownItem = CooldownManager.AddCooldown(1, null, UpdateDirect);
    }
Пример #9
0
    private void Start()
    {
        healthSystem = GetComponent <IHealth>();

        cooldownManager = CooldownManager.instance;

        ChangeState(idle);
    }
Пример #10
0
 private void Start()
 {
     cooldownManager = CooldownManager.instance;
     healthSystem    = GetComponent <IHealth>();
     if (!chamberSuit)
     {
         ChangeSuit();
     }
     ChangeState(idle);
 }
Пример #11
0
        /// <summary>
        /// new Cooldown 를 호출해서 의미 없음
        /// 적과 공유함
        /// </summary>
        /// <param name="__instance"></param>
        /// <param name="__result"></param>
        /// <returns></returns>
        //[HarmonyPatch(typeof(CooldownManager), "Add")]
        //[HarmonyPrefix]
        // public void Add(string givenID, float givenTime, StatData givenData = null, Player.SkillState givenSS = null)
        static bool Add(
            CooldownManager __instance
            )
        {
            UnityEngine.Debug.Log("CooldownManager Add  : ");

            return(true);

            return(false);
        }
Пример #12
0
        protected override void Load()
        {
            Inst     = this;
            Conf     = Configuration.Instance;
            MsgColor = UnturnedChat.GetColorFromName(Configuration.Instance.MessageColor, Color.green);
            Database = new CooldownManager();

            Logger.LogWarning("[RFSpawnCommand] Plugin loaded successfully!");
            Logger.LogWarning("[RFSpawnCommand] RFSpawnCommand v1.0.2");
            Logger.LogWarning("[RFSpawnCommand] Made with 'rice' by RiceField Plugins!");
        }
Пример #13
0
 // Use this for initialization
 private void Awake()
 {
     Subject.AddObserver(this);
     hasFairy          = false;
     cameraControl     = GameObject.Find("CameraRig").GetComponent <CameraControl>();
     cdmanager         = GetComponent <CooldownManager>();
     uiManager         = GetComponent <UIManager>();
     currentClassIndex = 0;
     InitPlayerObject();
     SetAxis();
 }
Пример #14
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     if (instance != this)
     {
         Destroy(this);
     }
 }
Пример #15
0
 public void ReSpawnFromDead()
 {
     gameObject.SetActive(false);
     CooldownManager.AddCooldown(3, null, () => {
         pysicItem.AddVelocity(-pysicItem.velocity);
         transform.position = new Vector3(spawnPos.x * TileDataProvider.TileSize, spawnPos.y * TileDataProvider.TileSize + 3, transform.position.z);
         pysicItem.SetPosition(transform.position);
         SetHP(100);
         gameObject.SetActive(true);
     });
 }
        private void Init()
        {
            PluginInstance = this;
            PluginConfig   = Config.ReadObject <CarCodeLocksConfig>();
            UIManager      = new CodeLockUIManager(PluginConfig.UISettings);

            permission.RegisterPermission(PermissionUse, this);
            permission.RegisterPermission(PermissionUI, this);
            permission.RegisterPermission(PermissionFreeLock, this);

            CraftCooldowns = new CooldownManager(PluginConfig.CooldownSeconds);
        }
Пример #17
0
 // Start is called before the first frame update
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(this);
     }
     DontDestroyOnLoad(this);
 }
Пример #18
0
        // public float GetRemainingTime(string cooldownID)
        static bool GetRemainingTime(
            CooldownManager __instance
            , float __result
            , string cooldownID
            )
        {
            UnityEngine.Debug.Log("CooldownManager GetRemainingTime  : " + cooldownID);
            __result = 0f;
            return(false);

            return(true);
        }
        public void FixShipPlayerLookAt()
        {
            IMyPlayer player = Context.Player;

            long playerId;

            if (player == null)
            {
                Context.Respond("Console has no Grids so cannot use this command. Use !fixshipmod <Gridname> instead!");
                return;
            }
            else
            {
                playerId = player.IdentityId;
            }

            IMyCharacter character = player.Character;

            if (character == null)
            {
                Context.Respond("You have no Character currently. Make sure to spawn and be out of cockpit!");
                return;
            }

            CooldownManager cooldownManager = Plugin.CommandCooldownManager;

            var steamId = new SteamIdCooldownKey(PlayerUtils.GetSteamId(Context.Player));

            if (!cooldownManager.CheckCooldown(steamId, null, out long remainingSeconds))
            {
                Log.Info("Cooldown for Player " + player.DisplayName + " still running! " + remainingSeconds + " seconds remaining!");
                Context.Respond("Command is still on cooldown for " + remainingSeconds + " seconds.");
                return;
            }

            if (!CheckConformation(steamId, playerId, "nogrid", character))
            {
                return;
            }

            try {
                var result = Plugin.FixShip(character, playerId);
                WriteResponse(result);

                if (result == CheckResult.SHIP_FIXED)
                {
                    Log.Info("Cooldown for Player " + player.DisplayName + " started!");
                    cooldownManager.StartCooldown(steamId, null, Plugin.Cooldown);
                }
            } catch (Exception e) {
                Log.Error(e, "Error on fixing ship");
            }
        }
Пример #20
0
 public override void SyncData(IDataStore dataStore)
 {
     dataStore.SyncData("_cooldownManager", ref _cooldownManager);
     if (dataStore.IsLoading)
     {
         if (_cooldownManager == null)
         {
             _cooldownManager = new CooldownManager();
         }
         _cooldownManager.Sync();
     }
 }
 public override void Update()
 {
     base.Update();
     if (CooldownManager.GetCooldown(CommonComponents.EntityController) == 0.0f && CommonComponents.EntityController.Target && m_NextState)
     {
         if (CommonComponents.TranslationalController != null)
         {
             CommonComponents.TranslationalController.StopMove();
         }
         EntityStateMachine.SetNextState(m_NextState);
     }
 }
Пример #22
0
        public static void ApplyPeace(Kingdom kingdomMakingPeace, Kingdom otherKingdom, bool forcePlayerCharacterCosts = false)
        {
            HybridCost diplomacyCost = DiplomacyCostCalculator.DetermineCostForMakingPeace(kingdomMakingPeace, otherKingdom, forcePlayerCharacterCosts);

            if (!otherKingdom.Leader.IsHumanPlayerCharacter)
            {
                AcceptPeace(kingdomMakingPeace, otherKingdom, diplomacyCost);
            }
            else if (!CooldownManager.HasPeaceProposalCooldownWithPlayerKingdom(kingdomMakingPeace))
            {
                CreatePeaceInquiry(kingdomMakingPeace, otherKingdom, diplomacyCost);
            }
        }
Пример #23
0
    public void Init(float dutarion, float maxColorSize, float gravityY, Vector2 startVelocity)
    {
        this.maxColorSize = maxColorSize;
        var physicItem = MonoBehaviourPhysicItem.GetPhysicItem();

        physicItem.SetGravity(new Vector2(0, gravityY));
        physicItem.SetPosition(transform.position);
        physicItem.AddVelocity(-physicItem.velocity);
        physicItem.AddVelocity(startVelocity);
        physicItem.IsCollisionTerrain = false;
        physicItem.IsReactExplosion   = false;
        cooldown = CooldownManager.AddCooldown(dutarion, CooldownUpdate, UnSpawn, 0, Time.fixedDeltaTime);
    }
Пример #24
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);

            StompIcon.gameObject.SetActive(StompSkillActive);
            FireIcon.gameObject.SetActive(FireSkillActive);

            SceneManager.sceneLoaded += OnSceneLoadedListener;
        }
    }
Пример #25
0
        public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject textObject, bool forcePlayerCharacterCosts = false)
        {
            textObject = null;
            bool hasEnoughTimeElapsed = CooldownManager.HasExceededMinimumWarDuration(kingdom, otherKingdom, out float elapsedDaysUntilNow);

            if (!hasEnoughTimeElapsed)
            {
                textObject = new TextObject(TOO_SOON);
                textObject.SetTextVariable("ELAPSED_DAYS", (float)Math.Floor(elapsedDaysUntilNow));
                textObject.SetTextVariable("REQUIRED_DAYS", Settings.Instance.MinimumWarDurationInDays);
            }
            return(hasEnoughTimeElapsed);
        }
Пример #26
0
        public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject?textObject, bool forcePlayerCharacterCosts = false, bool bypassCosts = false)
        {
            textObject = null;
            var hasEnoughTimeElapsed = !CooldownManager.HasBreakAllianceCooldown(kingdom, otherKingdom, out var elapsedDaysUntilNow);

            if (!hasEnoughTimeElapsed)
            {
                textObject = new TextObject(TOO_SOON);
                textObject.SetTextVariable("ELAPSED_DAYS", (float)Math.Floor(elapsedDaysUntilNow));
                textObject.SetTextVariable("REQUIRED_DAYS", Settings.Instance !.MinimumAllianceDuration);
            }

            return(hasEnoughTimeElapsed);
        }
Пример #27
0
        public override void HandleCommand(NotifyTextMessageEvent evt, string command, List <string> parameters, Action <string> messageCallback)
        {
            string targetUid  = evt.InvokerUniqueId;
            string targetName = evt.InvokerName;

            if (TargetNamePart != null)
            {
                Client target = Parent.Client.GetClientByNamePart(TargetNamePart);
                targetUid  = target.UniqueId;
                targetName = target.Nickname;
            }

            CooldownManager.ResetCooldowns(targetUid);
            messageCallback.Invoke(ColorCoder.Success($"Reset all cooldowns for {ColorCoder.Username(targetName)}"));
        }
Пример #28
0
        public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject textObject, bool forcePlayerCharacterCosts = false)
        {
            textObject = null;
            bool hasDeclareWarCooldown = CooldownManager.HasDeclareWarCooldown(kingdom, otherKingdom, out float elapsedTime);

            if (hasDeclareWarCooldown)
            {
                int declareWarCooldownDuration = Settings.Instance.DeclareWarCooldownInDays;

                textObject = new TextObject(DECLARE_WAR_COOLDOWN);
                textObject.SetTextVariable("ELAPSED_DAYS", (float)Math.Floor(elapsedTime));
                textObject.SetTextVariable("REQUIRED_DAYS", declareWarCooldownDuration);
            }
            return(!hasDeclareWarCooldown);
        }
Пример #29
0
        // Start is called before the first frame update
        void Start()
        {
            if (!isLocalPlayer)
            {
                return;
            }
            print("Seeker spawned");
            abilityOne = GameObject.Find("AbilityOne").GetComponent <CooldownManager>();
            abilityTwo = GameObject.Find("AbilityTwo").GetComponent <CooldownManager>();

            abilityOneCharge = abilityOneCooldown;
            abilityTwoCharge = abilityTwoCooldown;
            baseSpeed        = GetComponent <CharacterBase>().speedMultiplier;
            icon             = GameObject.Find("footicon 2");
            icon2            = GameObject.Find("Fire");
        }
Пример #30
0
    public void Init(Color color, string text)
    {
        label.color       = color;
        label.effectColor = Color.black;
        label.text        = text;

        tweenAlpha.duration = 1;
        tweenScale.duration = 1;

        tweenScale.ResetToBeginning();
        tweenAlpha.ResetToBeginning();
        tweenScale.Play();
        tweenAlpha.Play();

        cooldown = CooldownManager.AddCooldown(tweenAlpha.duration, null, UnSpawn, 0, Time.fixedDeltaTime);
    }