diff --git a/Mappy/API.cs b/Mappy/API.cs index 9536163..acb5fae 100644 --- a/Mappy/API.cs +++ b/Mappy/API.cs @@ -16,9 +16,30 @@ static class API private static int total = 0; private static bool requestInAction = false; - // - // Submit data - // + /// + /// Check an API key can submit data to XIVAPI + /// + /// + public static async void CheckApiKey(string key) + { + try + { + Logger.Add("Validating XIVAPI key..."); + + dynamic response = await $"http://xivapi.local/mappy/verify?key={key}".GetJsonAsync(); + App.Instance.ToggleSubmitting(response.allowed); + } + catch (Exception ex) + { + Logger.Exception(ex, "Mappy -> CheckApiKey"); + } + } + + /// + /// Submit some data (Even if you hard code this, there are server checks XD) + /// + /// + /// public static async void SubmitData(string type, List data) { // if submit turned off @@ -39,9 +60,9 @@ public static async void SubmitData(string type, List data) try { // submit to api - await "http://xivapi.local/data/submit".PostJsonAsync(new + string key = Properties.Settings.Default.ApiKey; + await $"http://xivapi.local/mappy/submit?key={key}".PostJsonAsync(new { - key = Properties.Settings.Default.ApiKey, id, type, data, @@ -53,9 +74,10 @@ public static async void SubmitData(string type, List data) } } - // - // Get map image list - // + /// + /// Get map image from XIVAPI + /// + /// public static async void GetMapImage(uint id) { // if a request is in action or id is zero, do nothing diff --git a/Mappy/App.Designer.cs b/Mappy/App.Designer.cs index a78a838..204be2f 100644 --- a/Mappy/App.Designer.cs +++ b/Mappy/App.Designer.cs @@ -168,8 +168,6 @@ private void InitializeComponent() // Settings_Submit // this.Settings_Submit.AutoSize = true; - this.Settings_Submit.Checked = true; - this.Settings_Submit.CheckState = System.Windows.Forms.CheckState.Checked; this.Settings_Submit.Font = new System.Drawing.Font("Segoe UI", 11F); this.Settings_Submit.Location = new System.Drawing.Point(19, 325); this.Settings_Submit.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); @@ -426,7 +424,8 @@ private void InitializeComponent() this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(335, 51); this.label11.TabIndex = 60; - this.label11.Text = "View the XIVAPI #beta channel on discord for the key. (This is not an apps key)"; + this.label11.Text = "Enter your apps key, only valid keys can submit data to the API. Ask @Vekien for " + + "approval."; // // label12 // diff --git a/Mappy/App.cs b/Mappy/App.cs index 194f546..237c751 100644 --- a/Mappy/App.cs +++ b/Mappy/App.cs @@ -87,6 +87,9 @@ private void Initialized() }; aTimer.Interval = Properties.Settings.Default.ScanTimerSpeed; aTimer.Enabled = true; + + // check key + API.CheckApiKey(Properties.Settings.Default.ApiKey); } #region Log View Window @@ -321,6 +324,18 @@ private void BtnOpenDebug_Click(object sender, EventArgs e) #region Settings + public void ToggleSubmitting(bool enable) + { + Settings_Submit.Checked = enable; + Properties.Settings.Default.Submit = Settings_Submit.Checked; + Properties.Settings.Default.Save(); + + Logger.Add(enable + ? "XIVAPI key enabled! Data will submit. If you have enabled the API key after memory scan, you will need to restart the app to pickup the existing data." + : "XIVAPI key does not have permission to submit data. Ask @Vekien for permission!" + ); + } + private void LoadSettings() { TopMost = Properties.Settings.Default.AlwaysOnTop; @@ -338,12 +353,17 @@ private void Settings_Submit_CheckedChanged(object sender, EventArgs e) { Properties.Settings.Default.Submit = Settings_Submit.Checked; Properties.Settings.Default.Save(); + + if (Settings_Submit.Checked) { + API.CheckApiKey(Properties.Settings.Default.ApiKey); + } } private void Settings_AlwaysOnTop_CheckedChanged(object sender, EventArgs e) { Properties.Settings.Default.AlwaysOnTop = Settings_AlwaysOnTop.Checked; Properties.Settings.Default.Save(); + } private void Settings_MapBoundaries_CheckedChanged(object sender, EventArgs e) diff --git a/signatures-x64.json b/signatures-x64.json index 394ae9c..a2a58ec 100644 --- a/signatures-x64.json +++ b/signatures-x64.json @@ -1,149 +1,148 @@ [ { - "Key": "MAPINFO", - "Value": "E8********CCCCCCCCCC48895C2408574883EC208B05", + "Key": "TARGET", + "Value": "41bc000000e041bd01000000493bc47555488d0d", "ASMSignature": true, "PointerPath": [ 0, - 16 + 144 ] }, { - "Key": "ZONEINFO", - "Value": "8B9084000000E8****0000EB**833D******000275**833D******000075**833D******000074**48C705", + "Key": "CHATLOG", + "Value": "e8********85c0740e488b0d********33D2E8********488b0d", "ASMSignature": true, "PointerPath": [ 0, - -4 + 0, + 48, + 908 ] }, - { + "Key": "CHARMAP", + "Value": "488b420848c1e8033da701000077248bc0488d0d", "ASMSignature": true, - "Key": "TARGET", "PointerPath": [ 0, - 144 - ], - "Value": "41bc000000e041bd01000000493bc47555488d0d" + 0 + ] }, { + "Key": "PARTYMAP", + "Value": "488D7C242066660F1F840000000000488B17488D0D", "ASMSignature": true, - "Key": "CHATLOG", "PointerPath": [ 0, - 0, - 48, - 908 - ], - "Value": "e8********85c0740e488b0d********33D2E8********488b0d" + 752 + ] }, { + "Key": "PARTYCOUNT", + "Value": "488D7C242066660F1F840000000000488B17488D0D", "ASMSignature": true, - "Key": "CHARMAP", "PointerPath": [ 0, - 0 - ], - "Value": "488b420848c1e8033da701000077248bc0488d0d" + -26920 + ] }, { + "Key": "MAPINFO", + "Value": "E8********CCCCCCCCCC48895C2408574883EC208B05", "ASMSignature": true, - "Key": "PARTYMAP", "PointerPath": [ 0, - 384 - ], - "Value": "488D7C242066660F1F840000000000488B17488D0D" + 16 + ] }, { + "Key": "ZONEINFO", + "Value": "8B9084000000E8****0000EB**833D******000275**833D******000075**833D******000074**48C705", "ASMSignature": true, - "Key": "PARTYCOUNT", "PointerPath": [ 0, - 14784 - ], - "Value": "488D7C242066660F1F840000000000488B17488D0D" + -4 + ] }, { - "ASMSignature": true, "Key": "PLAYERINFO", + "Value": "83f9ff7412448b048e8bd3488d0d", + "ASMSignature": true, "PointerPath": [ 0, 0 - ], - "Value": "83f9ff7412448b048e8bd3488d0d" + ] }, { - "ASMSignature": true, "Key": "ENMITYMAP", + "Value": "83f9ff7412448b048e8bd3488d0d", + "ASMSignature": true, "PointerPath": [ 0, -4656 - ], - "Value": "83f9ff7412448b048e8bd3488d0d" + ] }, { - "ASMSignature": true, "Key": "ENMITY_COUNT", + "Value": "83f9ff7412448b048e8bd3488d0d", + "ASMSignature": true, "PointerPath": [ 0, -2352 - ], - "Value": "83f9ff7412448b048e8bd3488d0d" + ] }, { - "ASMSignature": true, "Key": "AGROMAP", + "Value": "83f9ff7412448b048e8bd3488d0d", + "ASMSignature": true, "PointerPath": [ 0, -2344 - ], - "Value": "83f9ff7412448b048e8bd3488d0d" + ] }, { - "ASMSignature": true, "Key": "AGRO_COUNT", + "Value": "83f9ff7412448b048e8bd3488d0d", + "ASMSignature": true, "PointerPath": [ 0, -40 - ], - "Value": "83f9ff7412448b048e8bd3488d0d" + ] }, { - "ASMSignature": false, "Key": "HOTBAR", + "Value": "9C640000000000002C2C000000000000", + "ASMSignature": false, "PointerPath": [ 0, - 56, - 48, - 40, - 32, - 0, + 56, + 48, + 40, + 32, + 0, 0 - ], - "Value": "F783843E****0000" + ] }, { - "ASMSignature": false, "Key": "RECAST", + "Value": "9C640000000000002C2C000000000000", + "ASMSignature": false, "PointerPath": [ 0, - 56, - 24, - 48, - 32, + 56, + 24, + 48, + 32, 60 - ], - "Value": "F783843E****0000" + ] }, { - "ASMSignature": true, "Key": "INVENTORY", + "Value": "48895C2408488974241048897C2418488B3D", + "ASMSignature": true, "PointerPath": [ 0, 0 - ], - "Value": "48895C2408488974241048897C2418488B3D" + ] } ] \ No newline at end of file diff --git a/structures-x64.json b/structures-x64.json index bc5a9a0..c351c47 100644 --- a/structures-x64.json +++ b/structures-x64.json @@ -1,229 +1,231 @@ { "ActorItem": { - "ActionStatus": 5866, - "AgroFlags": 5990, - "CastingID": 6452, - "CastingProgress": 6500, - "CastingTargetID": 6464, - "CastingTime": 6504, - "ClaimedByID": 440, - "CombatFlags": 5988, - "CPCurrent": 5910, - "CPMax": 5912, + "SourceSize": 9200, "DefaultBaseOffset": 0, "DefaultStatOffset": 0, - "DefaultStatusEffectOffset": 6072, - "DifficultyRank": 5965, - "Distance": 146, - "EntityCount": 474, - "EventObjectType": 190, - "Fate": 232, - "GatheringInvisible": 148, - "GatheringStatus": 145, - "GPCurrent": 5906, - "GPMax": 5908, - "GrandCompany": 5961, - "GrandCompanyRank": 5961, - "Heading": 176, - "HitBoxRadius": 192, - "HPCurrent": 5888, - "HPMax": 5892, - "Icon": 5948, - "ID": 116, - "IsCasting1": 6440, - "IsCasting2": 6441, - "IsGM": 396, - "Job": 5944, - "Level": 5946, - "ModelID": 5848, - "MPCurrent": 5896, - "MPMax": 5900, + "DefaultStatusEffectOffset": 6152, "Name": 48, + "ID": 116, "NPCID1": 120, "NPCID2": 128, "OwnerID": 132, - "SourceSize": 9200, - "Status": 5954, - "TargetFlags": 148, - "TargetID": 5736, - "TargetType": 464, - "Title": 5918, - "TPCurrent": 5904, "Type": 140, + "GatheringStatus": 145, + "Distance": 146, + "TargetFlags": 148, + "GatheringInvisible": 148, "X": 160, + "Z": 164, "Y": 168, - "Z": 164 + "Heading": 176, + "EventObjectType": 190, + "HitBoxRadius": 192, + "Fate": 228, + "IsGM": 396, + "ClaimedByID": 440, + "TargetType": 464, + "EntityCount": 474, + "TargetID": 5816, + "ModelID": 5928, + "ActionStatus": 5946, + "HPCurrent": 5968, + "HPMax": 5972, + "MPCurrent": 5976, + "MPMax": 5980, + "TPCurrent": 5984, + "GPCurrent": 5986, + "GPMax": 5988, + "CPCurrent": 5990, + "CPMax": 5992, + "Title": 5998, + "Job": 6024, + "Level": 6026, + "Icon": 6028, + "Status": 6034, + "GrandCompany": 6041, + "GrandCompanyRank": 6041, + "DifficultyRank": 6045, + "CombatFlags": 6068, + "AgroFlags": 6070, + "IsCasting1": 6896, + "IsCasting2": 6897, + "CastingID": 6900, + "CastingTargetID": 6912, + "CastingProgress": 6948, + "CastingTime": 6952 }, "ChatLogPointers": { - "LogEnd": 92, - "LogNext": 84, - "LogStart": 76, - "OffsetArrayEnd": 68, + "OffsetArrayStart": 52, "OffsetArrayPos": 60, - "OffsetArrayStart": 52 + "OffsetArrayEnd": 68, + "LogStart": 76, + "LogNext": 84, + "LogEnd": 92 }, "CurrentPlayer": { - "ACN": 142, - "ACN_CurrentEXP": 232, - "ALC": 132, - "ALC_CurrentEXP": 212, - "ARC": 112, - "ARC_CurrentEXP": 172, - "ARM": 124, - "ARM_CurrentEXP": 196, - "AST": 150, - "AST_CurrentEXP": 248, - "AttackMagicPotency": 452, - "AttackPower": 400, - "BaseDexterity": 300, - "BaseIntelligence": 308, - "BaseMind": 312, - "BasePiety": 316, - "BaseStrength": 296, - "BaseVitality": 304, - "BluntResistance": 0, - "BSM": 122, - "BSM_CurrentEXP": 192, - "BTN": 138, - "BTN_CurrentEXP": 224, - "CNJ": 118, - "CNJ_CurrentEXP": 184, - "Control": 604, - "CPMax": 364, - "CPT": 120, - "CPT_CurrentEXP": 188, - "Craftmanship": 600, - "CriticalHitRate": 428, - "CUL": 134, - "CUL_CurrentEXP": 216, - "Defense": 404, - "Determination": 496, - "Dexterity": 328, - "DirectHit": 408, - "DRK": 148, - "DRK_CurrentEXP": 244, - "EarthResistance": 0, - "FireResistance": 0, - "FSH": 140, - "FSH_CurrentEXP": 228, - "Gathering": 608, - "GLD": 108, - "GLD_CurrentEXP": 164, - "GPMax": 360, - "GSM": 126, - "GSM_CurrentEXP": 200, - "HealingMagicPotency": 456, - "HPMax": 348, - "IceResistance": 0, - "Intelligence": 336, - "JobID": 102, - "LightningResistance": 0, - "LNC": 114, - "LNC_CurrentEXP": 176, - "LTW": 128, - "LTW_CurrentEXP": 204, - "MagicDefense": 416, - "MCH": 146, - "MCH_CurrentEXP": 240, - "MIN": 136, - "MIN_CurrentEXP": 220, - "Mind": 340, - "MPMax": 352, - "MRD": 110, - "MRD_CurrentEXP": 168, - "Perception": 612, - "PGL": 106, - "PGL_CurrentEXP": 160, - "PiercingResistance": 0, - "Piety": 344, - "RDM": 154, - "RDM_CurrentEXP": 256, - "ROG": 144, - "ROG_CurrentEXP": 236, - "SAM": 152, - "SAM_CurrentEXP": 252, - "SkillSpeed": 500, - "SlashingResistance": 0, - "SourceSize": 620, - "SpellSpeed": 504, - "Strength": 324, - "Tenacity": 396, - "THM": 116, - "THM_CurrentEXP": 180, - "TPMax": 356, - "Vitality": 332, - "WaterResistance": 0, - "WindResistance": 0, - "WVR": 130, - "WVR_CurrentEXP": 208 + "SourceSize": 620, + "JobID": 102, + "PGL": 106, + "GLD": 108, + "MRD": 110, + "ARC": 112, + "LNC": 114, + "THM": 116, + "CNJ": 118, + "CPT": 120, + "BSM": 122, + "ARM": 124, + "GSM": 126, + "LTW": 128, + "WVR": 130, + "ALC": 132, + "CUL": 134, + "MIN": 136, + "BTN": 138, + "FSH": 140, + "ACN": 142, + "ROG": 144, + "MCH": 146, + "DRK": 148, + "AST": 150, + "SAM": 152, + "RDM": 154, + "PGL_CurrentEXP": 160, + "GLD_CurrentEXP": 164, + "MRD_CurrentEXP": 168, + "ARC_CurrentEXP": 172, + "LNC_CurrentEXP": 176, + "THM_CurrentEXP": 180, + "CNJ_CurrentEXP": 184, + "CPT_CurrentEXP": 188, + "BSM_CurrentEXP": 192, + "ARM_CurrentEXP": 196, + "GSM_CurrentEXP": 200, + "LTW_CurrentEXP": 204, + "WVR_CurrentEXP": 208, + "ALC_CurrentEXP": 212, + "CUL_CurrentEXP": 216, + "MIN_CurrentEXP": 220, + "BTN_CurrentEXP": 224, + "FSH_CurrentEXP": 228, + "ACN_CurrentEXP": 232, + "ROG_CurrentEXP": 236, + "MCH_CurrentEXP": 240, + "DRK_CurrentEXP": 244, + "AST_CurrentEXP": 248, + "SAM_CurrentEXP": 252, + "RDM_CurrentEXP": 256, + "BaseStrength": 296, + "BaseDexterity": 300, + "BaseVitality": 304, + "BaseIntelligence": 308, + "BaseMind": 312, + "BasePiety": 316, + "Strength": 324, + "Dexterity": 328, + "Vitality": 332, + "Intelligence": 336, + "Mind": 340, + "Piety": 344, + "HPMax": 348, + "MPMax": 352, + "TPMax": 356, + "GPMax": 360, + "CPMax": 364, + "Tenacity": 396, + "AttackPower": 400, + "Defense": 404, + "DirectHit": 408, + "MagicDefense": 416, + "CriticalHitRate": 428, + "AttackMagicPotency": 452, + "HealingMagicPotency": 456, + "Determination": 496, + "SkillSpeed": 500, + "SpellSpeed": 504, + "FireResistance": 0, + "IceResistance": 0, + "WindResistance": 0, + "EarthResistance": 0, + "LightningResistance": 0, + "WaterResistance": 0, + "SlashingResistance": 0, + "PiercingResistance": 0, + "BluntResistance": 0, + "Craftmanship": 600, + "Control": 604, + "Gathering": 608, + "Perception": 612 }, "EnmityItem": { - "Enmity": 68, - "ID": 64, + "SourceSize": 72, "Name": 0, - "SourceSize": 114 + "ID": 64, + "Enmity": 68 }, "HotBarItem": { "ContainerSize": 3456, - "ID": 150, "ItemSize": 216, + "Name": 0, "KeyBinds": 103, - "Name": 0 + "ID": 150 }, "InventoryContainer": { "Amount": 8 }, "InventoryItem": { + "Slot": 4, + "ID": 8, "Amount": 12, + "SB": 16, "Durability": 18, - "GlamourID": 48, - "ID": 8, "IsHQ": 20, - "SB": 16, - "Slot": 4 + "GlamourID": 48 }, "PartyMember": { + "SourceSize": 912, "DefaultStatusEffectOffset": 152, + "X": 0, + "Y": 4, + "Z": 8, + "ID": 24, "HPCurrent": 36, "HPMax": 40, - "ID": 24, - "Job": 117, - "Level": 118, "MPCurrent": 44, "MPMax": 46, + "TPCurrent": 48, "Name": 52, - "SourceSize": 528, - "X": 0, - "Y": 4, - "Z": 8 + "Job": 117, + "Level": 118 }, "RecastItem": { - "ActionProc": 21, - "Amount": 32, - "Category": 0, "ContainerSize": 640, - "CoolDownPercent": 20, - "Icon": 16, + "ItemSize": 44, + "Category": 0, + "Type": 8, "ID": 12, - "InRange": 36, + "Icon": 16, + "CoolDownPercent": 20, + "ActionProc": 21, "IsAvailable": 24, - "ItemSize": 40, "RemainingCost": 28, - "Type": 8 + "Amount": 32, + "InRange": 36 }, "StatusItem": { - "CasterID": 8, - "Duration": 4, + "SourceSize": 12, + "StatusID": 0, "Stacks": 2, - "StatusID": 0 + "Duration": 4, + "CasterID": 8 }, "TargetInfo": { - "Current": 0, - "CurrentID": 192, - "Focus": 160, - "MouseOver": 58, - "Previous": 136, "Size": 9200, - "SourceSize": 200 + "SourceSize": 200, + "Current": 40, + "MouseOver": 58, + "Previous": 160, + "Focus": 136, + "CurrentID": 192 } } \ No newline at end of file