Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic interface for loot table manipulation. #274

Merged
merged 10 commits into from
Aug 31, 2017

Conversation

Musashi1584
Copy link
Contributor

@Musashi1584 Musashi1584 commented Aug 13, 2017

Provides a mod friendly way to manipulate loot tables.
A interface in X2LootTable allows mods to add/remove whole tables or items to loot tables without ini juggling.
Drop chances are recalculated accordingly.
For pre start state manipulation of loot tables use the static methods in OnPostTemplatesCreated like this
class'X2LootTableManager'.static.AddEntryStatic(LootTableName, LootTableEntry);

At runtime you can use the singleton instance like

LootManager = class'X2LootTableManager'.static.GetLootTableManager();
LootManager.AddEntry(LootTableName, LootTableEntry);
LootManager.InitLootTables();

this will also reinitialise the loot tables.

For bulk add to loot tables you can move the chance recalculation to the end:

LootManager.AddEntry(TableName, EntryToAdd, false);
LootManager.AddEntry(TableName, EntryToAdd, false);
LootManager.AddEntry(TableName, EntryToAdd, false);
LootManager.RecalculateLootTableChance(TableName);

This way your chance ratio is preserved.

@Musashi1584 Musashi1584 changed the title Added generic helper for loot tables. Added generic interface for loot table manipulation. Aug 17, 2017
@Musashi1584 Musashi1584 changed the title Added generic interface for loot table manipulation. Add generic interface for loot table manipulation. Aug 17, 2017
@MalucoMarinero MalucoMarinero merged commit 170eb34 into X2CommunityCore:master Aug 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants