diff --git a/X2CommunityHighlander.XCOM_sln b/X2CommunityHighlander.XCOM_sln index 8124e9c..a5a06c8 100644 --- a/X2CommunityHighlander.XCOM_sln +++ b/X2CommunityHighlander.XCOM_sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # XCOM ModBuddy Solution File, Format Version 11.00 VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{5DAE07AF-E217-45C1-8DE7-FF99D6011E8A}") = "X2CommunityHighlander", "X2CommunityHighlander\X2CommunityHighlander.x2proj", "{7AD29FBC-D864-4EAF-B8E6-2D3E5CECE537}" +Project("{5DAE07AF-E217-45C1-8DE7-FF99D6011E8A}") = "X2CommunityHighlander", "X2CommunityHighlander\X2CommunityHighlander.x2proj", "{B6499644-295D-4FEF-A98C-894D4C57D9C0}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Default|XCOM 2 = Default|XCOM 2 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7AD29FBC-D864-4EAF-B8E6-2D3E5CECE537}.Debug|XCOM 2.ActiveCfg = Debug|XCOM 2 - {7AD29FBC-D864-4EAF-B8E6-2D3E5CECE537}.Debug|XCOM 2.Build.0 = Debug|XCOM 2 - {7AD29FBC-D864-4EAF-B8E6-2D3E5CECE537}.Default|XCOM 2.ActiveCfg = Debug|XCOM 2 - {7AD29FBC-D864-4EAF-B8E6-2D3E5CECE537}.Default|XCOM 2.Build.0 = Debug|XCOM 2 + {B6499644-295D-4FEF-A98C-894D4C57D9C0}.Debug|XCOM 2.ActiveCfg = Debug|XCOM 2 + {B6499644-295D-4FEF-A98C-894D4C57D9C0}.Debug|XCOM 2.Build.0 = Debug|XCOM 2 + {B6499644-295D-4FEF-A98C-894D4C57D9C0}.Default|XCOM 2.ActiveCfg = Debug|XCOM 2 + {B6499644-295D-4FEF-A98C-894D4C57D9C0}.Default|XCOM 2.Build.0 = Debug|XCOM 2 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/X2CommunityHighlander/Src/XComGame/Classes/X2LootTable.uc b/X2CommunityHighlander/Src/XComGame/Classes/X2LootTable.uc index eda40f3..fb1774e 100644 --- a/X2CommunityHighlander/Src/XComGame/Classes/X2LootTable.uc +++ b/X2CommunityHighlander/Src/XComGame/Classes/X2LootTable.uc @@ -18,15 +18,15 @@ native function RollForLootTable(const out name LootTableName, out array R // Start Issue #275 - Add a loot table interface // static function are for use in the DLCInfo OnPostTemplatesCreated event -public function AddEntryAndReload(name TableName, LootTableEntry AddTableEntry) +public function AddEntryAndReload(name TableName, LootTableEntry TableEntry) { - AddEntry(TableName, AddTableEntry); + AddEntry(self, TableName, TableEntry); InitLootTables(); } public function RemoveEntryAndReload(name TableName, LootTableEntry TableEntry) { - RemoveEntry(TableName, TableEntry); + RemoveEntry(self, TableName, TableEntry); InitLootTables(); } @@ -35,7 +35,7 @@ public function AddLootTableAndReload(LootTable AddLootTable) local LootTableEntry Loot; foreach AddLootTable.Loots(Loot) { - AddEntry(AddLootTable.TableName, Loot); + AddEntry(self, AddLootTable.TableName, Loot); } InitLootTables(); } @@ -48,10 +48,13 @@ public function RemoveLootTableAndReload(LootTable LootTable) public static function AddLootTable(LootTable AddLootTable) { + local X2LootTable LootTable; local LootTableEntry Loot; + + LootTable = X2LootTable(class'Engine'.static.FindClassDefaultObject(string(default.Class.Name))); foreach AddLootTable.Loots(Loot) { - AddEntry(AddLootTable.TableName, Loot); + AddEntry(LootTable, AddLootTable.TableName, Loot); } } @@ -65,15 +68,22 @@ public static function RemoveLootTable(LootTable RemoveLootTable) public static function AddEntryToLootTable(name TableName, LootTableEntry AddTableEntry) { - AddEntry(TableName, AddTableEntry); + local X2LootTable LootTable; + + LootTable = X2LootTable(class'Engine'.static.FindClassDefaultObject(string(default.Class.Name))); + AddEntry(LootTable, TableName, AddTableEntry); } -private static function RemoveEntry(name TableName, LootTableEntry TableEntry) +public static function RemoveEntryFromLootTable(name TableName, LootTableEntry TableEntry) { local X2LootTable LootTable; - local int Index; - LootTable = X2LootTable(class'Engine'.static.FindClassDefaultObject(string(default.Class.Name))); + RemoveEntry(LootTable, TableName, TableEntry); +} + +private static function RemoveEntry(X2LootTable LootTable, name TableName, LootTableEntry TableEntry) +{ + local int Index; Index = LootTable.LootTables.Find('TableName', TableName); @@ -84,15 +94,11 @@ private static function RemoveEntry(name TableName, LootTableEntry TableEntry) } // When the sum of chances is greater 100% after adding an entry, recalculate chances to 100% total -private static function AddEntry(name TableName, LootTableEntry AddTableEntry) +private static function AddEntry(X2LootTable LootTable, name TableName, LootTableEntry AddTableEntry) { - local X2LootTable LootTable; local LootTableEntry TableEntry; local int Index, OldChance, NewChance, SumChances, TableEntryIndex; - LootTable = X2LootTable(class'Engine'.static.FindClassDefaultObject(string(default.Class.Name))); - `LOG(string(default.Class.Name) @ LootTable); - Index = LootTable.LootTables.Find('TableName', TableName); if (Index != INDEX_NONE)