diff --git a/X2CommunityHighlander.XCOM_sln b/X2CommunityHighlander.XCOM_sln index 5af6ad3..4f5f13e 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", "{2B0DCA36-C993-41FB-8A29-C4670602A0B5}" +Project("{5DAE07AF-E217-45C1-8DE7-FF99D6011E8A}") = "X2CommunityHighlander", "X2CommunityHighlander\X2CommunityHighlander.x2proj", "{831439B0-C5B9-453D-8742-5BFA39F4B691}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Default|XCOM 2 = Default|XCOM 2 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2B0DCA36-C993-41FB-8A29-C4670602A0B5}.Debug|XCOM 2.ActiveCfg = Debug|XCOM 2 - {2B0DCA36-C993-41FB-8A29-C4670602A0B5}.Debug|XCOM 2.Build.0 = Debug|XCOM 2 - {2B0DCA36-C993-41FB-8A29-C4670602A0B5}.Default|XCOM 2.ActiveCfg = Debug|XCOM 2 - {2B0DCA36-C993-41FB-8A29-C4670602A0B5}.Default|XCOM 2.Build.0 = Debug|XCOM 2 + {831439B0-C5B9-453D-8742-5BFA39F4B691}.Debug|XCOM 2.ActiveCfg = Debug|XCOM 2 + {831439B0-C5B9-453D-8742-5BFA39F4B691}.Debug|XCOM 2.Build.0 = Debug|XCOM 2 + {831439B0-C5B9-453D-8742-5BFA39F4B691}.Default|XCOM 2.ActiveCfg = Debug|XCOM 2 + {831439B0-C5B9-453D-8742-5BFA39F4B691}.Default|XCOM 2.Build.0 = Debug|XCOM 2 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/X2CommunityHighlander/Src/XComGame/Classes/LootTableHelper.uc b/X2CommunityHighlander/Src/XComGame/Classes/LootTableHelper.uc index 8ff1dbb..920d9c8 100644 --- a/X2CommunityHighlander/Src/XComGame/Classes/LootTableHelper.uc +++ b/X2CommunityHighlander/Src/XComGame/Classes/LootTableHelper.uc @@ -2,40 +2,39 @@ class LootTableHelper extends Object; static function AddEntryToLootTable(name TableName, LootTableEntry AddTableEntry) { - local X2LootTable LootTableCDO; + local X2LootTableManager LootManager; local LootTableEntry TableEntry; local int Index, TableEntryIndex; - local array SumChances; - local int NewSumChances, OldChance; + local int NewSumChances, OldChance, SumChances; - LootTableCDO = X2LootTable (class'Engine'.static.FindClassDefaultObject("X2LootTable")); + LootManager = X2LootTableManager(class'Engine'.static.FindClassDefaultObject("X2LootTableManager")); - Index = LootTableCDO.default.LootTables.Find('TableName', TableName); + Index = LootManager.default.LootTables.Find('TableName', TableName); if (Index != INDEX_NONE) { - foreach LootTableCDO.default.LootTables[Index].Loots(TableEntry) + foreach LootManager.default.LootTables[Index].Loots(TableEntry) { - SumChances[TableEntry.RollGroup] += TableEntry.Chance; + if (TableEntry.RollGroup == AddTableEntry.RollGroup) + SumChances += TableEntry.Chance; } // Recalculate the chances - NewSumChances = SumChances[AddTableEntry.RollGroup] + AddTableEntry.Chance; + NewSumChances = SumChances + AddTableEntry.Chance; if (NewSumChances > 0) { - for (TableEntryIndex = 0; TableEntryIndex < LootTableCDO.default.LootTables[Index].Loots.Length; TableEntryIndex++) + for (TableEntryIndex = 0; TableEntryIndex < LootManager.default.LootTables[Index].Loots.Length; TableEntryIndex++) { - if (LootTableCDO.default.LootTables[Index].Loots[TableEntryIndex].RollGroup == AddTableEntry.RollGroup) + if (LootManager.default.LootTables[Index].Loots[TableEntryIndex].RollGroup == AddTableEntry.RollGroup) { - OldChance = LootTableCDO.default.LootTables[Index].Loots[TableEntryIndex].Chance; - LootTableCDO.default.LootTables[Index].Loots[TableEntryIndex].Chance = Round(100 / NewSumChances * OldChance); - + OldChance = LootManager.default.LootTables[Index].Loots[TableEntryIndex].Chance; + LootManager.default.LootTables[Index].Loots[TableEntryIndex].Chance = Round(100 / NewSumChances * OldChance); } } AddTableEntry.Chance = Round(100 / NewSumChances * AddTableEntry.Chance); } // Add the new table entry - LootTableCDO.default.LootTables[Index].Loots.AddItem(AddTableEntry); + LootManager.default.LootTables[Index].Loots.AddItem(AddTableEntry); } } \ No newline at end of file