Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/GameLogic/NPC/AttackableNpcBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,39 @@ private async ValueTask HandleMoneyDropAsync(uint amount, Player killer)
return;
}

var partySize = killer.Party?.PartyList
.OfType<Player>()
.Count(p => p.CurrentMap == killer.CurrentMap && !p.IsAtSafezone() && p.Attributes is { }) ?? 1;
if (partySize > 1)
{
amount /= (uint)partySize;
}
Comment thread
nolt marked this conversation as resolved.
Outdated

var droppedMoney = new DroppedMoney((uint)(amount * killer.Attributes![Stats.MoneyAmountRate]), this.Position, this.CurrentMap);
Comment thread
nolt marked this conversation as resolved.
Outdated
await this.CurrentMap.AddAsync(droppedMoney).ConfigureAwait(false);
}

private async ValueTask DropItemAsync(int exp, Player killer)
{
// When the killer is in a party, DistributeExperienceAfterKillAsync returns a
// total party experience that does NOT include game rate (ExperienceRate) or
// personal experience rate multipliers. Since the money drop amount is
// derived from this experience value, party money drops were dramatically
// lower than solo drops. We recalculate the experience for money purposes
// using the solo formula so money is consistent regardless of party state.
if (killer.Party is not null && killer.SelectedCharacter?.CharacterClass is { } characterClass)
{
var baseExp = this.CalculateBaseExperience(killer.Attributes![Stats.TotalLevel]);
var isMaster = characterClass.IsMasterClass
&& (short)killer.Attributes[Stats.Level] == killer.GameContext.Configuration.MaximumLevel;
var expRateAttr = isMaster ? Stats.MasterExperienceRate : Stats.ExperienceRate;
var gameRate = isMaster ? killer.GameContext.MasterExperienceRate : killer.GameContext.ExperienceRate;

var experience = baseExp * gameRate * (killer.Attributes[expRateAttr] + killer.Attributes[Stats.BonusExperienceRate]);
experience *= killer.CurrentMap?.Definition.ExpMultiplier ?? 1;
exp = Rand.NextInt((int)(experience * 0.8), (int)(experience * 1.2));
}
Comment thread
nolt marked this conversation as resolved.
Outdated

var (generatedItems, droppedMoney) = await this._dropGenerator.GenerateItemDropsAsync(this.Definition, exp, killer).ConfigureAwait(false);
if (droppedMoney > 0)
{
Expand Down