Skip to content

Commit b2070e0

Browse files
committed
Added Keys config to ini file
Rearranged config file (new "Other" section)
1 parent 1b8cfb7 commit b2070e0

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

EntryPoint.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@
77
using System.Drawing;
88
using System.Linq;
99
using System.Text.RegularExpressions;
10-
using System.Windows.Forms;
1110

12-
[assembly: Rage.Attributes.Plugin("HAHTD", Description = "A plugin displaying the player's life and armour with an icon and its value. Also add an hunger and thirst system", Author = "SSStuart")]
11+
[assembly: Rage.Attributes.Plugin("HAHTDisplay", Description = "A plugin displaying the player's life and armour with an icon and its value. Also add an hunger and thirst system", Author = "SSStuart")]
1312

1413

1514
namespace HealthArmourDisplay
1615
{
1716
public class EntryPoint
1817
{
19-
public static string pluginName = "HAHTD";
18+
public static string pluginName = "HAHTDisplay";
2019
public static string pluginVersion = "v 0.0.1";
2120

2221
private static MenuPool myMenuPool;
@@ -327,7 +326,7 @@ public static void Main()
327326
}
328327
if (distance < 2 && !storeHelpDisplayed)
329328
{
330-
Game.DisplayHelp("Press ~b~E~w~ to buy food and drinks");
329+
Game.DisplayHelp("Press ~b~"+Settings.StoreKey+"~w~ to buy food and drinks");
331330
storeHelpDisplayed = true;
332331
}else { storeHelpDisplayed = false;}
333332
}
@@ -427,7 +426,7 @@ private static void ProcessMenus()
427426
}
428427
}
429428

430-
if (Game.IsKeyDown(Keys.E) && !Game.IsControlKeyDownRightNow) // the open/close trigger
429+
if (Game.IsKeyDown(Settings.StoreKey) && !Game.IsControlKeyDownRightNow) // the open/close trigger
431430
{
432431
if (storeMenu.Visible)
433432
{
@@ -441,7 +440,7 @@ private static void ProcessMenus()
441440
}
442441
}
443442

444-
if (Game.IsKeyDown(Keys.I) && Game.IsControlKeyDownRightNow) {
443+
if (Game.IsKeyDown(Settings.InventoryKey) && Game.IsKeyDownRightNow(Settings.InventoryModifier)) {
445444
if (inventoryMenu.Visible) {
446445
inventoryMenu.Visible = false;
447446
} else if (!UIMenu.IsAnyMenuVisible && !TabView.IsAnyPauseMenuVisible) {

IniFile.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Rage;
22
using RAGENativeUI;
3+
using System.Windows.Forms;
34

45
namespace HealthArmourDisplay
56
{
@@ -45,7 +46,11 @@ internal static class Settings
4546
internal static string StoreLocations = "29.537, -1345.474, 28.497 | -2969.773, 393.134, 14.043 | -1490.112, -378.83, 39.163 | 1137.569, -983.894, 45.416 | 1704.031, 4929.222, 41.064 | 1156.47, -322.609, 68.205 | -1827.282, 789.701, 137.254 | -1222.331, -904.582, 11.326 | -714.432, -912.26, 18.216 | -52.042, -1751.564, 28.421 | 544.2, 2668.531, 41.156 | 1963.312, 3744.618, 31.344 | 2555.542, 386.205, 107.623 | 377.961, 327.06, 102.566 | 2678.844, 3284.787, 54.241 | 1733.24, 6414.755, 34.037 | -3042.428, 588.687, 6.909 | -3243.83, 1005.144, 11.831 | 1164.038, 2707.052, 37.158";
4647
internal static string Drinks = "eCola: 2 | Pisswasser: 2 | Sprunk: 2";
4748
internal static string Foods = "EgoChaser: 3 | Meteorite Bar: 5 | P's & Q's: 2";
49+
4850
internal static bool AutoConsume = false;
51+
internal static Keys StoreKey = Keys.E;
52+
internal static Keys InventoryKey = Keys.I;
53+
internal static Keys InventoryModifier = Keys.LControlKey;
4954

5055
internal static Common.EFont FontFamily = Common.EFont.Pricedown;
5156
internal static float FontSize = 0.4f;
@@ -100,7 +105,11 @@ internal static void LoadSettings()
100105
StoreLocations = ini.ReadString("Stores", "StoreLocations", "29.537, -1345.474, 28.497 | -2969.773, 393.134, 14.043 | -1490.112, -378.83, 39.163 | 1137.569, -983.894, 45.416 | 1704.031, 4929.222, 41.064 | 1156.47, -322.609, 68.205 | -1827.282, 789.701, 137.254 | -1222.331, -904.582, 11.326 | -714.432, -912.26, 18.216 | -52.042, -1751.564, 28.421 | 544.2, 2668.531, 41.156 | 1963.312, 3744.618, 31.344 | 2555.542, 386.205, 107.623 | 377.961, 327.06, 102.566 | 2678.844, 3284.787, 54.241 | 1733.24, 6414.755, 34.037 | -3042.428, 588.687, 6.909 | -3243.83, 1005.144, 11.831 | 1164.038, 2707.052, 37.158");
101106
Drinks = ini.ReadString("Stores", "Drinks", "eCola: 2 | Pisswasser: 2 | Sprunk: 2");
102107
Foods = ini.ReadString("Stores", "Foods", "EgoChaser: 3 | Meteorite Bar: 5 | P's & Q's: 2");
103-
AutoConsume = ini.ReadBoolean("Stores", "AutoConsume", false);
108+
109+
AutoConsume = ini.ReadBoolean("Other", "AutoConsume", false);
110+
StoreKey = ini.ReadEnum("Other", "StoreKey", Keys.E);
111+
InventoryKey = ini.ReadEnum("Other", "InventoryKey", Keys.I);
112+
InventoryModifier = ini.ReadEnum("Other", "InventoryModifier", Keys.LControlKey);
104113

105114
FontFamily = ini.ReadEnum("Font", "FontFamily", Common.EFont.Pricedown);
106115
FontSize = ini.ReadSingle("Font", "FontSize", 0.4f);

0 commit comments

Comments
 (0)