/// <summary> /// Add AMP to <see cref="ActionSet"/> with supplied id. /// </summary> public void AddAmp(ushort id) { EldanAugmentationEntry entry = GameTableManager.Instance.EldanAugmentation.GetEntry(id); if (entry == null) { throw new ArgumentException($"Invalid eldan augmentation id {id}!"); } if (amps.TryGetValue(id, out ActionSetAmp amp) && !amp.PendingDelete) { throw new InvalidOperationException($"Failed to add AMP {id}, location is already occupied!"); } checked { AmpPoints -= (byte)entry.PowerCost; } if (amp != null) { amp.EnqueueDelete(false); } else { amps.Add(id, new ActionSetAmp(this, entry, true)); } saveMask |= ActionSetSaveMask.ActionSetAmps; log.Trace($"Added AMP {id} to action set {Index}."); }
/// <summary> /// Create a new <see cref="ActionSetAmp"/> from supplied <see cref="EldanAugmentationEntry"/>. /// </summary> public ActionSetAmp(ActionSet actionSet, EldanAugmentationEntry entry, bool isDirty) { Entry = entry; this.actionSet = actionSet; if (isDirty) { saveMask = AmpSaveMask.Create; } }
/// <summary> /// Add AMP to <see cref="ActionSet"/> from an existing database model. /// </summary> public void AddAmp(CharacterActionSetAmpModel model) { EldanAugmentationEntry entry = GameTableManager.Instance.EldanAugmentation.GetEntry(model.AmpId); if (entry == null) { throw new ArgumentException(); } checked { AmpPoints -= (byte)entry.PowerCost; } amps.Add(model.AmpId, new ActionSetAmp(this, entry, false)); }