コード例 #1
0
ファイル: FateWatcher.cs プロジェクト: MaikoTan/cactbot
        public FateWatcher(CactbotEventSource client, string language, ILogger logger)
        {
            client_ = client;
            logger_ = logger;
            if (language == "ko")
            {
                region_ = "ko";
            }
            else if (language == "cn")
            {
                region_ = "cn";
            }
            else
            {
                region_ = "intl";
            }

            ready = false;

            fateSemaphore = new SemaphoreSlim(0, 1);
            ceSemaphore   = new SemaphoreSlim(0, 1);
            acselfopcodes = new Dictionary <string, ACSelfOPCodes>();
            acselfopcodes.Add("ko", acself_v5_2);
            acselfopcodes.Add("cn", acself_v5_2);
            acselfopcodes.Add("intl", acself_v5_2);

            cedirectoropcodes = new Dictionary <string, CEDirectorOPCodes>();
            cedirectoropcodes.Add("ko", cedirector_ko);
            cedirectoropcodes.Add("cn", cedirector_cn);
            cedirectoropcodes.Add("intl", cedirector_intl);

            fates = new Dictionary <int, int>();
            ces   = new Dictionary <int, CEDirectorData>();
            try {
                var FFXIV = GetPluginData();
                if (FFXIV != null)
                {
                    try {
                        subscription = (IDataSubscription)FFXIV.pluginObj.GetType().GetProperty("DataSubscription").GetValue(FFXIV.pluginObj);
                    } catch (Exception ex) {
                        logger.Log(LogLevel.Error, ex.ToString());
                    }
                }

                var mach = Assembly.Load("Machina.FFXIV");
                MessageType = mach.GetType("Machina.FFXIV.Headers.Server_MessageType");

                actorControlself  = new ActorControlSelf(MessageType, mach);
                headerOffset      = GetOffset(actorControlself.packetType, "MessageHeader");
                messageHeader     = actorControlself.packetType.GetField("MessageHeader").FieldType;
                messageTypeOffset = headerOffset + GetOffset(messageHeader, "MessageType");
                ready             = true;
            } catch (Exception e) {
                logger.Log(LogLevel.Error, "Error loading OPCodes, FATE info will be unavailable.");
                logger.Log(LogLevel.Error, "{0}\r\n{1}", e.Message, e.StackTrace);
            }
        }
コード例 #2
0
ファイル: WipeDetector.cs プロジェクト: tianzep/cactbot
        public WipeDetector(CactbotEventSource client)
        {
            this.client_           = client;
            client_.OnLogsChanged += OnLogsChanged;
            // See: https://gist.github.com/quisquous/250001cbce232a48e6a9ce772a56675a
            var pattern = @" 21:........:40000010:";

            wipe_regex_ = new Regex(pattern);
        }
コード例 #3
0
        public CactbotEventSourceConfigPanel(CactbotEventSource source)
        {
            InitializeComponent();

            this.source = source;
            this.config = source.Config;

            SetupControlProperties();
            SetupConfigEventHandlers();
        }
コード例 #4
0
ファイル: FateWatcher.cs プロジェクト: kuwoyuki/cactbot
        public FateWatcher(CactbotEventSource client, string language)
        {
            client_ = client;
            if (language == "ko")
            {
                region_ = "ko";
            }
            else if (language == "cn")
            {
                region_ = "cn";
            }
            else
            {
                region_ = "intl";
            }

            fateSemaphore = new SemaphoreSlim(0, 1);
            ceSemaphore   = new SemaphoreSlim(0, 1);
            ac143opcodes  = new Dictionary <string, AC143OPCodes>();
            ac143opcodes.Add("ko", ac143_v5_2);
            ac143opcodes.Add("cn", ac143_v5_2);
            ac143opcodes.Add("intl", ac143_v5_2);

            cedirectoropcodes = new Dictionary <string, CEDirectorOPCodes>();
            cedirectoropcodes.Add("ko", cedirector_ko);
            cedirectoropcodes.Add("cn", cedirector_cn);
            cedirectoropcodes.Add("intl", cedirector_intl);

            fates = new Dictionary <int, int>();
            ces   = new Dictionary <int, CEDirectorData>();

            var FFXIV = ActGlobals.oFormActMain.ActPlugins.FirstOrDefault(x => x.lblPluginTitle.Text == "FFXIV_ACT_Plugin.dll");

            if (FFXIV != null && FFXIV.pluginObj != null)
            {
                try {
                    subscription = (IDataSubscription)FFXIV.pluginObj.GetType().GetProperty("DataSubscription").GetValue(FFXIV.pluginObj);
                } catch (Exception ex) {
                    client_.LogError(ex.ToString());
                }
            }

            var mach = Assembly.Load("Machina.FFXIV");

            MessageType = mach.GetType("Machina.FFXIV.Headers.Server_MessageType");

            actorControl143   = new ActorControl143(MessageType, mach);
            headerOffset      = GetOffset(actorControl143.packetType, "MessageHeader");
            messageHeader     = actorControl143.packetType.GetField("MessageHeader").FieldType;
            messageTypeOffset = headerOffset + GetOffset(messageHeader, "MessageType");
        }
コード例 #5
0
ファイル: FateWatcher.cs プロジェクト: oott123/cactbot
        public FateWatcher(CactbotEventSource client, string language)
        {
            client_ = client;
            if (language == "ko")
            {
                region_ = "ko";
            }
            else if (language == "cn")
            {
                region_ = "cn";
            }
            else
            {
                region_ = "intl";
            }

            opcodes = new Dictionary <string, OPCodes>();
            opcodes.Add("ko", v5_1);
            opcodes.Add("cn", v5_1);
            opcodes.Add("intl", v5_2);

            fates = new ConcurrentDictionary <int, int>();

            var FFXIV = ActGlobals.oFormActMain.ActPlugins.FirstOrDefault(x => x.lblPluginTitle.Text == "FFXIV_ACT_Plugin.dll");

            if (FFXIV != null && FFXIV.pluginObj != null)
            {
                try {
                    subscription = (IDataSubscription)FFXIV.pluginObj.GetType().GetProperty("DataSubscription").GetValue(FFXIV.pluginObj);
                } catch (Exception ex) {
                    client_.LogError(ex.ToString());
                }
            }

            var mach = Assembly.Load("Machina.FFXIV");

            MessageType          = mach.GetType("Machina.FFXIV.Headers.Server_MessageType");
            ActorControl143      = mach.GetType("Machina.FFXIV.Headers.Server_ActorControl143");
            ActorControl143_Size = Marshal.SizeOf(ActorControl143);

            Header_Offset = GetOffset(ActorControl143, "MessageHeader");
            msgHeader     = ActorControl143.GetField("MessageHeader").FieldType;

            MessageType_Offset = Header_Offset + GetOffset(msgHeader, "MessageType");

            Category_Offset = GetOffset(ActorControl143, "category");
            Param1_Offset   = GetOffset(ActorControl143, "param1");
            Param2_Offset   = GetOffset(ActorControl143, "param2");

            ActorControl143_Opcode = GetOpcode("ActorControl143");
        }