/// <summary> /// Update <see cref="RewardPropertyType"/> with supplied value and data. /// </summary> /// <remarks> /// A positive value will increment and a negative value will decrement the value. /// </remarks> public void UpdateRewardProperty(RewardPropertyType type, float value, uint data = 0u) { RewardProperty rewardProperty = UpdateRewardPropertyInternal(type, value, data); session.EnqueueMessageEncrypted(new ServerRewardPropertySet { Properties = rewardProperty.Build().ToList() }); }
private RewardProperty UpdateRewardPropertyInternal(RewardPropertyType type, float value, uint data) { RewardPropertyEntry entry = GameTableManager.Instance.RewardProperty.GetEntry((ulong)type); if (entry == null) { throw new ArgumentException(); } if (!rewardProperties.TryGetValue(type, out RewardProperty rewardProperty)) { rewardProperty = new RewardProperty(entry); rewardProperties.Add(type, rewardProperty); } rewardProperty.UpdateValue(data, value); return(rewardProperty); }
/// <summary> /// Returns a <see cref="RewardProperty"/> with the supplied <see cref="RewardPropertyType"/>. /// </summary> public RewardProperty GetRewardProperty(RewardPropertyType type) { return(rewardProperties.TryGetValue(type, out RewardProperty rewardProperty) ? rewardProperty : null); }