diff --git a/src/Ninja/G1CP/Content/Fixes/Session/fix044_BugmeatCategory.d b/src/Ninja/G1CP/Content/Fixes/Session/fix044_BugmeatCategory.d index 7d2483c2..e76bbc5a 100644 --- a/src/Ninja/G1CP/Content/Fixes/Session/fix044_BugmeatCategory.d +++ b/src/Ninja/G1CP/Content/Fixes/Session/fix044_BugmeatCategory.d @@ -10,7 +10,5 @@ func int G1CP_044_BugmeatCategory() { ITEM_KAT_NONE = G1CP_GetIntConst("ITEM_KAT_NONE", 0, ITEM_KAT_NONE); ITEM_KAT_FOOD = G1CP_GetIntConst("ITEM_KAT_FOOD", 0, ITEM_KAT_FOOD); - // Replace any assignments to mainflag - var int itemId; itemId = G1CP_GetItemInstId("ItAt_Meatbug_01"); - return (G1CP_ReplaceAssignInt(itemId, 0, "C_ITEM.mainflag", 0, ITEM_KAT_NONE, ITEM_KAT_FOOD) > 0); + return G1CP_ItemChangeIntVar("ItAt_Meatbug_01", "mainflag", ITEM_KAT_NONE, ITEM_KAT_FOOD); }; diff --git a/src/Ninja/G1CP/Content/Fixes/Session/fix157_SpeedPotion2Value.d b/src/Ninja/G1CP/Content/Fixes/Session/fix157_SpeedPotion2Value.d index 1592836a..42082a41 100644 --- a/src/Ninja/G1CP/Content/Fixes/Session/fix157_SpeedPotion2Value.d +++ b/src/Ninja/G1CP/Content/Fixes/Session/fix157_SpeedPotion2Value.d @@ -24,7 +24,5 @@ func int G1CP_157_SpeedPotion2Value() { return FALSE; }; - // Replace any assignments to value - var int itemId; itemId = G1CP_GetItemInstId("ItFo_Potion_Haste_02"); - return (G1CP_ReplaceAssignInt(itemId, 0, "C_ITEM.value", 0, Value_Haste1, Value_Haste2) > 0); + return G1CP_ItemChangeIntVar("ItFo_Potion_Haste_02", "value", Value_Haste1, Value_Haste2); }; diff --git a/src/Ninja/G1CP/Content/Fixes/Session/fix158_SpeedPotion3Value.d b/src/Ninja/G1CP/Content/Fixes/Session/fix158_SpeedPotion3Value.d index c99fe795..8e12355b 100644 --- a/src/Ninja/G1CP/Content/Fixes/Session/fix158_SpeedPotion3Value.d +++ b/src/Ninja/G1CP/Content/Fixes/Session/fix158_SpeedPotion3Value.d @@ -24,7 +24,5 @@ func int G1CP_158_SpeedPotion3Value() { return FALSE; }; - // Replace any assignments to value - var int itemId; itemId = G1CP_GetItemInstId("ItFo_Potion_Haste_03"); - return (G1CP_ReplaceAssignInt(itemId, 0, "C_ITEM.value", 0, Value_Haste1, Value_Haste3) > 0); + return G1CP_ItemChangeIntVar("ItFo_Potion_Haste_03", "value", Value_Haste1, Value_Haste2); }; diff --git a/src/Ninja/G1CP/Content/Misc/item.d b/src/Ninja/G1CP/Content/Misc/item.d new file mode 100644 index 00000000..6041fcd9 --- /dev/null +++ b/src/Ninja/G1CP/Content/Misc/item.d @@ -0,0 +1,8 @@ +/* + * Change the value of an item's int variable. Returns true on success. + */ +func int G1CP_ItemChangeIntVar(var string name, var string prop, var int originalInt, var int correctedInt) { + var int itemId; itemId = G1CP_GetItemInstId(name); + + return (G1CP_ReplaceAssignInt(itemId, 0, ConcatStrings("C_Item.", prop), 0, originalInt, correctedInt) > 0); +} diff --git a/src/Ninja/G1CP/Content_G1.src b/src/Ninja/G1CP/Content_G1.src index 318f9e4a..5902bf44 100644 --- a/src/Ninja/G1CP/Content_G1.src +++ b/src/Ninja/G1CP/Content_G1.src @@ -39,6 +39,7 @@ Content\Misc\vobLight.d Content\Misc\npc.d Content\Misc\ou.d Content\Misc\routine.d +Content\Misc\item.d Content\Fixes\record.d