-
Notifications
You must be signed in to change notification settings - Fork 178
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
Loot/Core: LootManager MVP implementation - WIP #364
base: develop
Are you sure you want to change the base?
Conversation
VirtualItem support Client Loot support (Vacuum and Item) WorldEntity Loot assignment
@@ -182,6 +186,66 @@ private void CacheRewardPropertiesByTier() | |||
.ToImmutableList()); | |||
} | |||
|
|||
private void AddToTargets(TargetGroupEntry entry, ref List<uint> targetIds, ref List<TargetGroupType> unhandledTargetGroups) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say ref
isn't required here. You only add new elements and don't re assign the full list so it's not required.
|
||
private UpdateTimer updateTimer = new UpdateTimer(1d); | ||
|
||
public GlobalLootManager() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
singletons should not have public ctors
switch (type) | ||
{ | ||
case LootEntityType.Creature: | ||
if (!creatureLoot.ContainsKey(entityId)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use TryGetValue in here instead of ContainsKey + this[]. That saves some checks. The out parameter is passed by ref since it's a list.
Same for all other similar cases in this PR
var entries = ImmutableDictionary.CreateBuilder<uint, List<uint>>(); | ||
foreach (QuestObjectiveEntry questObjectiveEntry in GameTableManager.Instance.QuestObjective.Entries | ||
.Where(o => o.TargetGroupIdRewardPane > 0u || | ||
(QuestObjectiveType)o.Type == QuestObjectiveType.ActivateTargetGroup || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actual question: Why is QuestObjectiveType not used as field type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Truthfully, I don't know if we're adjusting the GameTable Entry Field Types from "standard" types (like float, int, etc.). We've never discussed it, and we're commonly casting from int to enum, for example, so I tend to follow what's already been done.
What's your thoughts on this, @Rawaho ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues I can see if we wanted to do so.
- Does the current GameTable loading code handle enums?
- Since the GameTable models are stored in the shared project, all enums will have to moved out of the world project.
|
||
questObjectiveTargets = entries.ToImmutableDictionary(e => e.Key, e => e.Value.ToImmutableList()); | ||
|
||
string targetGroupTypes = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: can simply to string targetGroupTypes = string.Join(" ", unhandledTargetGroups);
private void RemoveExpiredLootInstances() | ||
{ | ||
foreach (LootInstance lootInstance in lootInstances.Where(i => i.HasExpired).ToList()) | ||
lootInstances.Remove(lootInstance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To save you the iteration, you can rewrite this as lootInstances.RemoveAll(i => i.HasExpired);
Replaces #280
Client Loot support (Vacuum and Item)
LootBag Support
VirtualItem support
WorldEntity Loot assignment