Core/Players: Several currency fixes and improvements

Port From (https://github.com/TrinityCore/TrinityCore/commit/03918978c166c9fb191117a0cae9ba1285bf0e37)
This commit is contained in:
hondacrx
2023-02-11 23:28:57 -05:00
parent 90cc620c11
commit 4b798e7cab
25 changed files with 603 additions and 347 deletions
+1 -1
View File
@@ -4495,7 +4495,7 @@ namespace Game.Spells
}
foreach (var reagentsCurrency in m_spellInfo.ReagentsCurrency)
p_caster.ModifyCurrency(reagentsCurrency.CurrencyTypesID, -reagentsCurrency.CurrencyCount, false, true);
p_caster.RemoveCurrency(reagentsCurrency.CurrencyTypesID, -reagentsCurrency.CurrencyCount, CurrencyDestroyReason.Spell);
}
void HandleThreatSpells()
+13 -1
View File
@@ -4729,7 +4729,7 @@ namespace Game.Spells
if (!CliDB.CurrencyTypesStorage.ContainsKey(effectInfo.MiscValue))
return;
unitTarget.ToPlayer().ModifyCurrency((uint)effectInfo.MiscValue, damage);
unitTarget.ToPlayer().ModifyCurrency((uint)effectInfo.MiscValue, damage, CurrencyGainSource.Spell, CurrencyDestroyReason.Spell);
}
[SpellEffectHandler(SpellEffectName.CastButton)]
@@ -4847,6 +4847,18 @@ namespace Game.Spells
}
}
[SpellEffectHandler(SpellEffectName.IncreseCurrencyCap)]
void EffectIncreaseCurrencyCap()
{
if (effectHandleMode != SpellEffectHandleMode.HitTarget)
return;
if (damage <= 0)
return;
unitTarget.ToPlayer()?.IncreaseCurrencyCap((uint)effectInfo.MiscValue, (uint)damage);
}
[SpellEffectHandler(SpellEffectName.SummonRafFriend)]
void EffectSummonRaFFriend()
{
+1 -1
View File
@@ -384,7 +384,7 @@ namespace Game
if (!currencies.ContainsKey((int)currency.Id))
currencies[(int)currency.Id] = 0;
currencies[(int)currency.Id] += (int)player.GetCurrency((uint)currency.CurrencyTypesID);
currencies[(int)currency.Id] += (int)player.GetCurrencyQuantity((uint)currency.CurrencyTypesID);
break;
case TraitCurrencyType.TraitSourced:
var currencySources = _traitCurrencySourcesByCurrency.LookupByKey(currency.Id);