From adc688b3076af6a3c4aac03f14d7856e8dc4e633 Mon Sep 17 00:00:00 2001
From: Katalam <goerss99@gmail.com>
Date: Sun, 10 Feb 2019 16:25:02 +0100
Subject: [PATCH] IMPROVED: Painkillers

Painkillers will now avaible via addItemTo. ATTENTION: New Classname
---
 addons/kat_acecirculation/config.cpp          | 30 ++++++++++---------
 .../functions/fn_removeItemfromMag.sqf        |  4 +++
 addons/kat_acecirculation/stringtable.xml     |  2 +-
 3 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/addons/kat_acecirculation/config.cpp b/addons/kat_acecirculation/config.cpp
index 77313b9..2be02c4 100644
--- a/addons/kat_acecirculation/config.cpp
+++ b/addons/kat_acecirculation/config.cpp
@@ -2,11 +2,11 @@
 class CfgPatches {
     class kat_aceCirculation {
         units[] = {
-            "KAT_PainkillersItem",
+            "KAT_Painkiller_Item",
             "KAT_X_AEDItem"
         };
         weapons[] = {
-            "KAT_Painkillers",
+            "KAT_Painkiller",
             "KAT_bloodIV_O",
             "KAT_bloodIV_A",
             "KAT_bloodIV_B",
@@ -28,8 +28,8 @@ class CfgPatches {
             "adv_aceCPR",
             "cba_settings"
         };
-        version = "0.9";
-        versionStr = "0.9";
+        version = "0.9.5";
+        versionStr = "0.9.5";
         author = "[SeL] Katalam";
         authorUrl = "http://spezialeinheit-luchs.de/";
     };
@@ -164,7 +164,7 @@ class cfgWeapons {
     class KAT_bloodIV_AB_250: ACE_bloodIV_250 {
         displayName = "$STR_KAT_aceCirculation_BloodIV_AB_250";
     };
-    class KAT_Painkillers: ACE_ItemCore {
+    class KAT_Painkiller_Item: ACE_ItemCore {
         scope = 1; // no mistake, just a placeholder, cause ACE can't handle magazines. DO NOT USE!
         author = "Katalam";
         displayName = "$STR_KAT_aceCirculation_Painkillers_Box_Display";
@@ -189,7 +189,7 @@ class cfgWeapons {
 class cfgMagazines {
     class CA_Magazine;
 
-    class KAT_Painkillers: CA_Magazine {
+    class KAT_Painkiller: CA_Magazine {
         author = "Katalam";
         scope = 2;
 
@@ -216,14 +216,14 @@ class cfgVehicles {
         class TransportMagazines;
     };
 
-    class KAT_PainkillersItem: WeaponHolder_Single_limited_item_F {
+    class KAT_PainkillerItem: WeaponHolder_Single_limited_item_F {
         scope = 2;
         scopeCurator = 2;
         displayName= "$STR_KAT_aceCirculation_Painkillers_Box_Display";
         author = "Katalam";
         vehicleClass = "Magazines";
         class TransportItems {
-            MACRO_ADDITEM(KAT_Painkillers,1);
+            MACRO_ADDITEM(KAT_Painkiller,1);
         };
     };
     class KAT_X_AEDItem: adv_aceCPR_AEDItem {
@@ -243,7 +243,7 @@ class cfgVehicles {
             MACRO_ADDITEM(KAT_X_AED,1);
         };
         class TransportMagazines: TransportMagazines {
-            MACRO_ADDMAGAZINE(KAT_Painkillers,10);
+            MACRO_ADDMAGAZINE(KAT_Painkiller,10);
         };
     };
     class KAT_medicalSupplyCrate: ACE_medicalSupplyCrate {
@@ -274,7 +274,7 @@ class Man;
                 class CheckBloodPressure {}; // Remove the ability to check blood pressure at the head
                 class Painkillers {
                     displayName = "$STR_KAT_aceCirculation_Inject_Box_Painkillers";
-                    condition = "('KAT_Painkillers' in (magazines _player) || 'KAT_Painkillers' in (magazines _target))";
+                    condition = "('KAT_Painkiller' in (magazines _player) || 'KAT_Painkiller' in (magazines _target))";
                     statement = "[_player, _target, 'head', 'Painkillers'] call ace_medical_fnc_treatment";
                     showDisabled = 0;
                     exceptions[] = {"isNotSitting"};
@@ -316,7 +316,7 @@ class Man;
                         class CheckBloodPressure {}; // Remove the ability to check blood pressure at the head
                         class Painkillers {
                             displayName = "$STR_KAT_aceCirculation_Inject_Box_Painkillers";
-                            condition = "('KAT_Painkillers' in (magazines _player) || 'KAT_Painkillers' in (magazines _target))";
+                            condition = "('KAT_Painkiller' in (magazines _player) || 'KAT_Painkiller' in (magazines _target))";
                             statement = "[_player, _target, 'head', 'Painkillers'] call ace_medical_fnc_treatment";
                             showDisabled = 0;
                             exceptions[] = {"isNotSitting"};
@@ -361,7 +361,7 @@ class Man;
                     class CheckBloodPressure {};
                     class Painkillers {
                         displayName = "$STR_KAT_aceCirculation_Inject_Box_Painkillers";
-                        condition = "'KAT_Painkillers' in (magazines _player)";
+                        condition = "'KAT_Painkiller' in (magazines _player)";
                         statement = "[_player, _target, 'head', 'Painkillers'] call ace_medical_fnc_treatment";
                         showDisabled = 0;
                         exceptions[] = {"isNotInside", "isNotSitting"};
@@ -403,8 +403,8 @@ class ACE_Medical_Actions {
             displayNameProgress = $STR_KAT_aceCirculation_Using;
             allowedSelections[] = {"head"};
             items[] = {};
-            callbackSuccess = "['KAT_Painkillers', _player, _target, _selectionName, 'Painkillers'] call kat_aceCirculation_fnc_removeItemfromMag";
-            condition = "('KAT_Painkillers' in (magazines _player) || 'KAT_Painkillers' in (magazines _target))";
+            callbackSuccess = "['KAT_Painkiller', _player, _target, _selectionName, 'Painkillers'] call kat_aceCirculation_fnc_removeItemfromMag";
+            condition = "('KAT_Painkiller' in (magazines _player) || 'KAT_Painkiller' in (magazines _target))";
         };
         class CheckDogtags: checkPulse {
             displayName = $STR_KAT_aceCirculation_DogTag;
@@ -522,6 +522,8 @@ class ACE_Medical_Advanced {
                 // The viscosity of a fluid is a measure of its resistance to gradual deformation by shear stress or tensile stress. For liquids, it corresponds to the informal concept of "thickness".
                 // This value will increase/decrease the viscoty of the blood with the percentage given. Where 100 = max. Using the minus will decrease viscosity
                 viscosityChange = 5;
+                // item class name
+                itemClassName = "KAT_Painkiller_Item";
             };
         };
     };
diff --git a/addons/kat_acecirculation/functions/fn_removeItemfromMag.sqf b/addons/kat_acecirculation/functions/fn_removeItemfromMag.sqf
index 632a031..7147a8e 100644
--- a/addons/kat_acecirculation/functions/fn_removeItemfromMag.sqf
+++ b/addons/kat_acecirculation/functions/fn_removeItemfromMag.sqf
@@ -32,4 +32,8 @@ if ((_oldMag select 1) > 1) then {
 
 playsound3D ["kat_aceCirculation\sounds\take_painkillers.wav", _player, false, getPosASL _player, 8, 1, 15];
 
+if (isText (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication" >> _className >> "itemClassName")) then {
+	_mag = getText (configFile >> "ACE_Medical_Advanced" >> "Treatment" >> "Medication" >> _className >> "itemClassName");
+};
+
 [_player, _target, _selectionName, _className, [_mag]] call ace_medical_fnc_treatmentAdvanced_medication;
diff --git a/addons/kat_acecirculation/stringtable.xml b/addons/kat_acecirculation/stringtable.xml
index a97aaf7..f7d0a4b 100644
--- a/addons/kat_acecirculation/stringtable.xml
+++ b/addons/kat_acecirculation/stringtable.xml
@@ -180,7 +180,7 @@
 			<Spanish>Analgésicos</Spanish>
 		</Key>
 		<Key ID="STR_KAT_aceCirculation_Inject_Box_Painkillers">
-			<English>Use Painkillers</English>
+			<English>Take Painkillers</English>
 			<German>Schlucke Schmerzmittel</German>
 			<Polish>Użyj leku przeciwbólowego</Polish>
 			<Spanish>Usar analgésico</Spanish>