Esempio n. 1
0
        public FFXIV_OverlayAPI(ACTWebSocketCore core)
        {
            this.core = core;

            outD = CombatantData.DamageTypeDataOutgoingDamage;
            outH = CombatantData.DamageTypeDataOutgoingHealing;

            SetExportVariables();
            AttachACTEvent();
        }
Esempio n. 2
0
        public FFXIV_OverlayAPI(ACTWebSocketCore core)
        {
            Config.SortKey  = "encdps";
            Config.SortType = MiniParseSortType.NumericAscending;

            this.core = core;

            outD = CombatantData.DamageTypeDataOutgoingDamage;
            outH = CombatantData.DamageTypeDataOutgoingHealing;

            SetExportVariables();
            AttachACTEvent();
        }
Esempio n. 3
0
        JObject overlayWindows = new JObject(); // 설정 전부

        public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
        {
            if (core == null)
            {
                core = new ACTWebSocketCore();
                core.pluginDirectory      = pluginDirectory;
                core.overlaySkinDirectory = overlaySkinDirectory;
                core.hwnd = Handle;
            }
            lblStatus = pluginStatusText;         // Hand the status label's reference to our local var
            pluginScreenSpace.Controls.Add(this); // Add this UserControl to the tab ACT provides
            Dock = DockStyle.Fill;                // Expand the UserControl to fill the tab's client space
            LoadSettings();



            //if (core != null)
            //{
            //    core.Filters["/BeforeLogLineRead"] = BeforeLogLineReadUse.Checked;
            //    core.Filters["/OnLogLineRead"] = OnLogLineReadUse.Checked;
            //    core.Filters["/MiniParse"] = MiniParseUse.Checked;
            //    core.Config.SortKey = MiniParseSortKey.Text.Trim();
            //    core.Config.SortType = (MiniParseSortType)sortType.SelectedIndex;
            //}
            //try
            //{
            //    core.StartUIServer();

            //    if (autostart.Checked)
            //    {
            //        StartServer();
            //    }
            //    else
            //    {
            //        StopServer();
            //    }
            //}
            //catch(Exception e)
            //{
            //    MessageBox.Show(e.Message);
            //    core.StopUIServer();
            //    StopServer();
            //}
            // Create some sort of parsing event handler.  After the "+=" hit TAB twice and the code will be generated for you.
            ActGlobals.oFormActMain.BeforeLogLineRead += oFormActMain_BeforeLogLineRead;
            ActGlobals.oFormActMain.OnLogLineRead     += oFormActMain_OnLogLineRead;
            var s = ActGlobals.oFormActMain.ActPlugins;

            lblStatus.Text = "Plugin Started";
        }
Esempio n. 4
0
        public async Task Update()
        {
            if (ACTWebSocketCore.CheckIsActReady())
            {
                if (prevEncounterId == ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.EncId &&
                    prevEndDateTime == ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.EndTime &&
                    prevEncounterActive == ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.Active)
                {
                    return;
                }

                prevEncounterId     = ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.EncId;
                prevEndDateTime     = ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.EndTime;
                prevEncounterActive = ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.Active;

                core.Broadcast("/MiniParse", CreateEncounterJsonData());
            }
        }
        public void Update()
        {
            if (ACTWebSocketCore.CheckIsActReady())
            {
                if (prevEncounterId == ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.EncId &&
                    prevEndDateTime == ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.EndTime &&
                    prevEncounterActive == ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.Active)
                {
                    return;
                }

                prevEncounterId     = ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.EncId;
                prevEndDateTime     = ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.EndTime;
                prevEncounterActive = ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.Active;

                core.Broadcast("/MiniParse", SendMessageType.CombatData.ToString(), CreateEncounterJsonData());
            }
        }
Esempio n. 6
0
        public string CreateEncounterJsonData()
        {
            if (DateTime.Now -
                ACTWebSocketCore.updateStringCacheLastUpdate < ACTWebSocketCore.updateStringCacheExpireInterval)
            {
                return(ACTWebSocketCore.updateStringCache);
            }

            if (!ACTWebSocketCore.CheckIsActReady())
            {
                return("");
            }

            var allies = ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.GetAllies();
            Dictionary <string, string> encounter = null;
            List <KeyValuePair <CombatantData, Dictionary <string, string> > > combatant = null;

            var encounterTask = Task.Run(() =>
            {
                encounter = GetEncounterDictionary(allies);
            });
            var combatantTask = Task.Run(() =>
            {
                combatant = GetCombatantList(allies);
                core.SortCombatantList(combatant);
            });

            Task.WaitAll(encounterTask, combatantTask);

            var builder = new StringBuilder();

            builder.Append("{\"typeText\": \"encounter\", \"detail\": {");
            builder.Append("\"Encounter\": {");
            var isFirst1 = true;

            foreach (var pair in encounter)
            {
                if (isFirst1)
                {
                    isFirst1 = false;
                }
                else
                {
                    builder.Append(",");
                }
                var valueString = pair.Value.ReplaceNaN().JSONSafeString();
                builder.AppendFormat("\"{0}\":\"{1}\"", pair.Key.JSONSafeString(), valueString);
            }
            builder.Append("},");
            builder.Append("\"Combatant\": {");
            var isFirst2 = true;

            foreach (var pair in combatant)
            {
                if (isFirst2)
                {
                    isFirst2 = false;
                }
                else
                {
                    builder.Append(",");
                }
                builder.AppendFormat("\"{0}\": {{", pair.Key.Name.JSONSafeString());
                var isFirst3 = true;
                foreach (var pair2 in pair.Value)
                {
                    if (isFirst3)
                    {
                        isFirst3 = false;
                    }
                    else
                    {
                        builder.Append(",");
                    }
                    var valueString = pair2.Value.ReplaceNaN().JSONSafeString();
                    builder.AppendFormat("\"{0}\":\"{1}\"", pair2.Key.JSONSafeString(), valueString);
                }
                builder.Append("}");
            }
            builder.Append("},");
            builder.AppendFormat("\"isActive\": {0}", ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.Active ? "true" : "false");
            builder.Append("}}");


            var result = builder.ToString();

            ACTWebSocketCore.updateStringCache           = result;
            ACTWebSocketCore.updateStringCacheLastUpdate = DateTime.Now;

            return(result);
        }
        internal JObject CreateEncounterJsonData()
        {
            if (DateTime.Now - updateStringCacheLastUpdate < updateStringCacheExpireInterval)
            {
                return(updateStringCache);
            }

            if (!ACTWebSocketCore.CheckIsActReady())
            {
                return(new JObject());
            }

            object o0 = ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.GetCombatant("YOU");
            object o1 = null;

            if (CurrentPlayerID != 0)
            {
                o1 = ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.GetCombatant(CurrentPlayerName);
            }

            // CharName Adjust
            if (o0 != null)
            {
                ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.CharName = "YOU";
            }
            else if (o1 != null)
            {
                ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.CharName = CurrentPlayerName;
            }

            var allies = ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.GetAllies();

            Dictionary <string, string> encounter = null;
            List <KeyValuePair <CombatantData, Dictionary <string, string> > > combatant = null;

            var encounterTask = Task.Run(() =>
            {
                encounter = GetEncounterDictionary(allies);
            });
            var combatantTask = Task.Run(() =>
            {
                combatant = GetCombatantList(allies);
                SortCombatantList(combatant);
            });

            Task.WaitAll(encounterTask, combatantTask);

            JObject obj = new JObject();

            {
                JObject Encounter = new JObject();
                foreach (var pair in encounter)
                {
                    Encounter[pair.Key] = pair.Value.ReplaceNaN();
                }
                obj["Encounter"] = Encounter;
                JObject Combatant = new JObject();
                foreach (var pair in combatant)
                {
                    JObject o = new JObject();
                    foreach (var pair2 in pair.Value)
                    {
                        o[pair2.Key] = pair2.Value.ReplaceNaN();
                    }
                    if (CurrentPlayerID != 0 && pair.Key.Name == CurrentPlayerName)
                    {
                        // CharName Adjust
                        Combatant["YOU"]         = o;
                        Combatant["YOU"]["name"] = "YOU";
                    }
                    else
                    {
                        Combatant[pair.Key.Name] = o;
                    }
                }
                obj["Combatant"] = Combatant;
                obj["isActive"]  = ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.Active;
            }

            updateStringCache           = obj;
            updateStringCacheLastUpdate = DateTime.Now;

            return(obj);
        }