Core/Reputation: Implemented renown reputation (Dragonflight)
Port From (https://github.com/TrinityCore/TrinityCore/commit/d64d84dfa68da4ff83f0b88ad4e88dccc5ace623)
This commit is contained in:
@@ -122,7 +122,7 @@ namespace Game.Entities
|
||||
uint count = iece.CurrencyCount[i];
|
||||
uint currencyid = iece.CurrencyID[i];
|
||||
if (count != 0 && currencyid != 0)
|
||||
ModifyCurrency((CurrencyTypes)currencyid, (int)count, true, true);
|
||||
ModifyCurrency(currencyid, (int)count, true, true);
|
||||
}
|
||||
|
||||
// Grant back money
|
||||
@@ -2452,7 +2452,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
if (iece.CurrencyID[i] != 0)
|
||||
ModifyCurrency((CurrencyTypes)iece.CurrencyID[i], -(int)(iece.CurrencyCount[i] * stacks), true, true);
|
||||
ModifyCurrency(iece.CurrencyID[i], -(int)(iece.CurrencyCount[i] * stacks), true, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3178,7 +3178,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
ModifyCurrency((CurrencyTypes)currency, (int)count, true, true);
|
||||
ModifyCurrency(currency, (int)count, true, true);
|
||||
if (iece != null)
|
||||
{
|
||||
for (byte i = 0; i < ItemConst.MaxItemExtCostItems; ++i)
|
||||
@@ -3197,7 +3197,7 @@ namespace Game.Entities
|
||||
if (iece.Flags.HasAnyFlag((byte)((uint)ItemExtendedCostFlags.RequireSeasonEarned1 << i)))
|
||||
continue;
|
||||
|
||||
ModifyCurrency((CurrencyTypes)iece.CurrencyID[i], -(int)(iece.CurrencyCount[i] * stacks), false, true);
|
||||
ModifyCurrency(iece.CurrencyID[i], -(int)(iece.CurrencyCount[i] * stacks), false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace Game.Entities
|
||||
|
||||
var rewardCurrencyTypes = Global.DB2Mgr.GetRewardPackCurrencyTypesByRewardID(rewardPackEntry.Id);
|
||||
foreach (RewardPackXCurrencyTypeRecord currency in rewardCurrencyTypes)
|
||||
ModifyCurrency((CurrencyTypes)currency.CurrencyTypeID, currency.Quantity);
|
||||
ModifyCurrency(currency.CurrencyTypeID, currency.Quantity);
|
||||
|
||||
var rewardPackXItems = Global.DB2Mgr.GetRewardPackItemsByRewardID(rewardPackEntry.Id);
|
||||
foreach (RewardPackXItemRecord rewardPackXItem in rewardPackXItems)
|
||||
|
||||
@@ -968,7 +968,7 @@ namespace Game.Entities
|
||||
DestroyItemCount((uint)obj.ObjectID, (uint)obj.Amount, true);
|
||||
break;
|
||||
case QuestObjectiveType.Currency:
|
||||
ModifyCurrency((CurrencyTypes)obj.ObjectID, -obj.Amount, false, true);
|
||||
ModifyCurrency((uint)obj.ObjectID, -obj.Amount, false, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1036,7 +1036,7 @@ namespace Game.Entities
|
||||
{
|
||||
for (uint i = 0; i < SharedConst.QuestRewardChoicesCount; ++i)
|
||||
if (quest.RewardChoiceItemId[i] != 0 && quest.RewardChoiceItemType[i] == LootItemType.Currency && quest.RewardChoiceItemId[i] == rewardId)
|
||||
ModifyCurrency((CurrencyTypes)quest.RewardChoiceItemId[i], (int)quest.RewardChoiceItemCount[i]);
|
||||
ModifyCurrency(quest.RewardChoiceItemId[i], (int)quest.RewardChoiceItemCount[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1044,7 +1044,7 @@ namespace Game.Entities
|
||||
for (byte i = 0; i < SharedConst.QuestRewardCurrencyCount; ++i)
|
||||
{
|
||||
if (quest.RewardCurrencyId[i] != 0)
|
||||
ModifyCurrency((CurrencyTypes)quest.RewardCurrencyId[i], (int)quest.RewardCurrencyCount[i]);
|
||||
ModifyCurrency(quest.RewardCurrencyId[i], (int)quest.RewardCurrencyCount[i]);
|
||||
}
|
||||
|
||||
uint skill = quest.RewardSkillId;
|
||||
|
||||
@@ -1043,7 +1043,7 @@ namespace Game.Entities
|
||||
ModifyMoney(-amount);
|
||||
break;
|
||||
case TraitCurrencyType.CurrencyTypesBased:
|
||||
ModifyCurrency((CurrencyTypes)traitCurrency.CurrencyTypesID, -amount);
|
||||
ModifyCurrency((uint)traitCurrency.CurrencyTypesID, -amount);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -1098,6 +1098,7 @@ namespace Game.Entities
|
||||
_currencyStorage[(uint)id] = cur;
|
||||
}
|
||||
}
|
||||
|
||||
public uint GetCurrency(uint id)
|
||||
{
|
||||
var playerCurrency = _currencyStorage.LookupByKey(id);
|
||||
@@ -1106,7 +1107,8 @@ namespace Game.Entities
|
||||
|
||||
return playerCurrency.Quantity;
|
||||
}
|
||||
public void ModifyCurrency(CurrencyTypes id, int count, bool printLog = true, bool ignoreMultipliers = false)
|
||||
|
||||
public void ModifyCurrency(uint id, int count, bool printLog = true, bool ignoreMultipliers = false)
|
||||
{
|
||||
if (count == 0)
|
||||
return;
|
||||
@@ -1127,7 +1129,7 @@ namespace Game.Entities
|
||||
return;
|
||||
}
|
||||
|
||||
if (id == CurrencyTypes.Azerite)
|
||||
if (id == (uint)CurrencyTypes.Azerite)
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
@@ -1151,7 +1153,7 @@ namespace Game.Entities
|
||||
cur.WeeklyQuantity = 0;
|
||||
cur.TrackedQuantity = 0;
|
||||
cur.Flags = 0;
|
||||
_currencyStorage[(uint)id] = cur;
|
||||
_currencyStorage[id] = cur;
|
||||
playerCurrency = _currencyStorage.LookupByKey(id);
|
||||
}
|
||||
else
|
||||
@@ -1203,19 +1205,19 @@ namespace Game.Entities
|
||||
if (playerCurrency.state != PlayerCurrencyState.New)
|
||||
playerCurrency.state = PlayerCurrencyState.Changed;
|
||||
|
||||
CurrencyChanged((uint)id, count);
|
||||
CurrencyChanged(id, count);
|
||||
|
||||
playerCurrency.Quantity = (uint)newTotalCount;
|
||||
playerCurrency.WeeklyQuantity = (uint)newWeekCount;
|
||||
playerCurrency.TrackedQuantity = (uint)newTrackedCount;
|
||||
|
||||
if (count > 0)
|
||||
UpdateCriteria(CriteriaType.CurrencyGained, (uint)id, (uint)count);
|
||||
UpdateCriteria(CriteriaType.CurrencyGained, id, (uint)count);
|
||||
|
||||
_currencyStorage[(uint)id] = playerCurrency;
|
||||
_currencyStorage[id] = playerCurrency;
|
||||
|
||||
SetCurrency packet = new();
|
||||
packet.Type = (uint)id;
|
||||
packet.Type = id;
|
||||
packet.Quantity = newTotalCount;
|
||||
packet.SuppressChatLog = !printLog;
|
||||
packet.WeeklyQuantity = newWeekCount;
|
||||
@@ -1226,6 +1228,7 @@ namespace Game.Entities
|
||||
SendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasCurrency(uint id, uint count)
|
||||
{
|
||||
var playerCurrency = _currencyStorage.LookupByKey(id);
|
||||
|
||||
Reference in New Issue
Block a user