FakeDeck/FakeeDeck/ButtonType/HelldiversTwoMacro.cs

83 lines
4.1 KiB
C#
Raw Normal View History

2024-09-06 14:25:04 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2024-09-06 14:47:50 +00:00
using static System.Net.WebRequestMethods;
2024-09-06 14:25:04 +00:00
namespace FakeeDeck.ButtonType
{
2024-09-09 18:48:57 +00:00
class HelldiversTwoMacro : Button
2024-09-06 14:25:04 +00:00
{
2024-09-06 14:47:50 +00:00
//https://helldivers.wiki.gg/wiki/Stratagems
//https://helldivers.fandom.com/wiki/Stratagems_(Helldivers_2)
2024-09-06 14:25:04 +00:00
public static Dictionary<string, uint[]> stratogems = new Dictionary<string, uint[]>
{
{ "reinforce", new uint[] { 0x65, 0x68, 0x62, 0x66, 0x64, 0x68}},
{ "resupply", new uint[] { 0x65, 0x62, 0x62, 0x68, 0x66 }},
2024-09-06 14:47:50 +00:00
//Patriotic Administration Center
{ "anti-material", new uint[] { 0x65, 0x62, 0x64, 0x66, 0x68, 0x62}},
{ "flamethrower", new uint[] { 0x65, 0x62, 0x64, 0x68, 0x62, 0x68}},
{ "autocannon", new uint[] { 0x65, 0x62, 0x64, 0x62, 0x68, 0x68, 0x66}},
{ "grenade-launcher", new uint[] { 0x65, 0x62, 0x64, 0x68, 0x64, 0x62}},
//Orbital Cannons
{ "orbital-precision-strike", new uint[] { 0x65, 0x66, 0x66, 0x68}},
//Robotics Workshop
2024-09-06 14:25:04 +00:00
{ "mortar-sentry", new uint[] { 0x65, 0x62, 0x68, 0x66, 0x62}},
{ "gatling-sentry", new uint[] { 0x65, 0x62, 0x68, 0x66, 0x64}},
2024-09-06 14:47:50 +00:00
//Hangar
{ "rocket-pods", new uint[] { 0x65, 0x68, 0x66, 0x68, 0x64}},
{ "bomb", new uint[] { 0x65, 0x68, 0x66, 0x68, 0x64}},
2024-09-06 14:25:04 +00:00
};
public static Dictionary<string, string> stratogemsIcons = new Dictionary<string, string>
{
{ "reinforce", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/5/5a/HD2_Reinforce.png"},
{ "resupply", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/7/72/HD2_Resupply.png"},
{ "anti-material", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/c/c3/APW-1_Anti-Materiel_Rifle_Icon.png"},
2024-09-06 14:47:50 +00:00
{ "flamethrower", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/c/cc/FLAM-40_Flamethrower_Icon.png"},
{ "autocannon", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/c/c6/AC-8_Autocannon_Icon.png"},
{ "grenade-launcher","https://static.wikia.nocookie.net/helldivers_gamepedia/images/6/66/GL-21_Grenade_Launcher_Icon.png"},
{ "orbital-precision-strike", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/4/47/Orbital_Precision_Strike_Icon.png"},
2024-09-06 14:25:04 +00:00
{ "mortar-sentry", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/1/1d/A_M-12_Mortar_Sentry_Icon.png"},
{ "gatling-sentry","https://static.wikia.nocookie.net/helldivers_gamepedia/images/4/48/A_G-16_Gatling_Sentry_Icon.png"},
2024-09-06 14:47:50 +00:00
{ "rocket-pods","https://static.wikia.nocookie.net/helldivers_gamepedia/images/e/e3/Eagle_110MM_Rocket_Pods_Icon.png"},
{ "bomb","https://static.wikia.nocookie.net/helldivers_gamepedia/images/5/5a/Eagle_500KG_Bomb_Icon.png"},
2024-09-06 14:25:04 +00:00
};
2024-09-06 14:56:06 +00:00
public static string getButton(string Key)
{
return
"<div class=\"m-2\">" +
2024-09-09 18:48:57 +00:00
" <form style=\"margin-bottom: 0px;\" method=\"post\" action=\"button\\HelldiversTwoMacro\">" +
2024-09-06 14:56:06 +00:00
" <input type=\"hidden\" name=\"stratogem\" value=\"" + Key + "\">" +
2024-09-09 18:48:57 +00:00
" <input style=\"background-size: cover; background-image: url('" + stratogemsIcons[Key].ToString() + "'); width: 150px;height: 150px;background-color: aquamarine;\" type=\"submit\" value=\"" + FirstLetterToUpper(Key) + "\">" +
2024-09-06 14:56:06 +00:00
" </form>" +
"</div>";
}
2024-09-09 18:48:57 +00:00
public static bool invokeAction(string stratogem)
2024-09-06 14:56:06 +00:00
{
2024-09-09 18:48:57 +00:00
foreach (var key in stratogems[stratogem])
{
KeyboardMacro.SendKey(key);
Console.WriteLine(key);
}
return true;
2024-09-06 14:56:06 +00:00
}
2024-09-09 18:48:57 +00:00
private static string FirstLetterToUpper(string str)
2024-09-06 14:56:06 +00:00
{
if (str == null)
return null;
if (str.Length > 1)
return char.ToUpper(str[0]) + str.Substring(1);
return str.ToUpper();
}
2024-09-06 14:25:04 +00:00
}
}