公告

崩溃

FF14玩家群


欢迎来到Buddystore Rebornbuddy——TheBuddyBots,guabot辅助站,本站FF14 RB交流,这里是你游戏最佳集结地爽快游戏,从现在开始,我们不推荐使用任何破坏游戏行为的工具,若您使用纯属个人行为,我们建议合理游戏,回归真实生活,劳逸结合.群:FFXIV游戏交流群



Rebornbuddy FF14 FFXIV Team 

看到更多
看到更少

Quick coroutine in plugin example.

崩溃
这是一个置顶的主题.
X
X
崩溃
  • 过滤
  • 时间
  • 显示
清除所有
新帖子

    【教程教学】 Quick coroutine in plugin example.

    PHP代码:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using Buddy.Coroutines;
    using ff14bot.AClasses;
    using ff14bot.Behavior;
    using ff14bot.Enums;
    using ff14bot.Helpers;
    using ff14bot.Managers;
    using TreeSharp;

    namespace 
    BetterCoroutineExample
    {

        public class 
    BetterCoroutineExample BotPlugin
        
    {
            
    internal async Task<boolDoSomething()
            {

                foreach (var 
    bagslot in InventoryManager.EquippedItems)
                {
                    if (
    bagslot.BagId == InventoryBagId.Armory_MainHand)
                        continue;

                    if (
    bagslot.SpiritBond >= 100)
                    {
                        
    await CommonTasks.ConvertToMateria(bagslot);
                    }
                }
                
    //Don't block the logic below us in the tree.
                
    return false;
            }

            public 
    override void Dispose()
            {
            }

            public 
    override void Pulse()
            {

            }

            public 
    override string Author
            
    {
                
    get { return "Mastahg"; }
            }

            public 
    override Version Version
            
    {
                
    get { return new Version(001); }
            }

            public 
    override string Name
            
    {
                
    get { return "Better Coroutine example"; }
            }


            private 
    Composite _coroutine;
            public 
    void OnInitialize()
            {
                
    //OnInitialize only gets called once, so create the object here so that it can be properly removed later.
                
    _coroutine = new ActionRunCoroutine(=> DoSomething());
            }


            public 
    override void OnShutdown()
            {

            }


            public 
    override void OnDisabled()
            {
                
    //Remove our event handler and remove our coroutine from the logic tree
                
    TreeHooks.Instance.OnHooksCleared -= OnHooksCleared;
                
    TreeHooks.Instance.RemoveHook("TreeStart"_coroutine);
            }

            public 
    override void OnEnabled()
            {
                
    //Add our hook to the logic tree here and setup event handler for when the treehooks are cleared
                //We want to add our hook here incase the user enables the plugin once the bot is already running.
                
    TreeHooks.Instance.AddHook("TreeStart"_coroutine);
                
    TreeHooks.Instance.OnHooksCleared += OnHooksCleared;
            }

            private 
    void OnHooksCleared(object senderEventArgs args)
            {
                
    TreeHooks.Instance.AddHook("TreeStart"_coroutine);
            }

        }


工作中...
X