Skip to content

Commit

Permalink
Merge pull request #109 from AlexBond2/spawn
Browse files Browse the repository at this point in the history
Add ItemSpec for SpawnSpec.Spawn
  • Loading branch information
Crypto137 authored Jan 12, 2025
2 parents e9fb788 + ba4ee0b commit 6da94a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/MHServerEmu.Games/Loot/LootManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public ItemSpec CreateItemSpec(PrototypeId itemProtoRef, LootContext lootContext

_resolver.SetContext(lootContext, player);

AvatarPrototype avatarProto = player.CurrentAvatar?.AvatarPrototype;
AvatarPrototype avatarProto = player?.CurrentAvatar?.AvatarPrototype;

using DropFilterArguments filterArgs = ObjectPoolManager.Instance.Get<DropFilterArguments>();
filterArgs.ItemProto = itemProto;
Expand Down
3 changes: 3 additions & 0 deletions src/MHServerEmu.Games/Populations/SpawnSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ public bool Spawn()
settings.SpawnSpec = this;
settings.IsPopulation = true;

if (entityProto is ItemPrototype)
settings.ItemSpec = Game.LootManager.CreateItemSpec(EntityRef, LootContext.CashShop, null);

ActiveEntity = manager.CreateEntity(settings) as WorldEntity;

var twinBoost = GameDatabase.PopulationGlobalsPrototype.TwinEnemyBoost;
Expand Down

0 comments on commit 6da94a1

Please sign in to comment.