public override void Remove(AgentItem by, long removedDuration, int removedStacks, long time, ParseEnum.BuffRemove removeType, uint id) { switch (removeType) { case ParseEnum.BuffRemove.All: foreach (BuffStackItem stackItem in BuffStack) { WasteSimulationResult.Add(new BuffSimulationItemWasted(stackItem.Src, stackItem.Duration, time)); if (stackItem.Extensions.Count > 0) { foreach ((AgentItem src, long value) in stackItem.Extensions) { WasteSimulationResult.Add(new BuffSimulationItemWasted(src, value, time)); } } } BuffStack.Clear(); break; case ParseEnum.BuffRemove.Single: for (int i = 0; i < BuffStack.Count; i++) { BuffStackItem stackItem = BuffStack[i]; if (Math.Abs(removedDuration - stackItem.TotalBoonDuration()) < GeneralHelper.ServerDelayConstant) { WasteSimulationResult.Add(new BuffSimulationItemWasted(stackItem.Src, stackItem.Duration, time)); if (stackItem.Extensions.Count > 0) { foreach ((AgentItem src, long value) in stackItem.Extensions) { WasteSimulationResult.Add(new BuffSimulationItemWasted(src, value, time)); } } BuffStack.RemoveAt(i); break; } } break; default: break; } _logic.Sort(Log, BuffStack); }
public override void Remove(AgentItem by, long removedDuration, int removedStacks, long time, ArcDPSEnums.BuffRemove removeType, uint stackID) { switch (removeType) { case ArcDPSEnums.BuffRemove.All: foreach (BuffStackItem stackItem in BuffStack) { WasteSimulationResult.Add(new BuffSimulationItemWasted(stackItem.Src, stackItem.Duration, time)); if (stackItem.Extensions.Any()) { foreach ((AgentItem src, long value) in stackItem.Extensions) { WasteSimulationResult.Add(new BuffSimulationItemWasted(src, value, time)); } } } BuffStack.Clear(); break; case ArcDPSEnums.BuffRemove.Single: for (int i = 0; i < BuffStack.Count; i++) { BuffStackItem stackItem = BuffStack[i]; if (Math.Abs(removedDuration - stackItem.TotalDuration) < ParserHelper.BuffSimulatorDelayConstant) { WasteSimulationResult.Add(new BuffSimulationItemWasted(stackItem.Src, stackItem.Duration, time)); if (stackItem.Extensions.Any()) { foreach ((AgentItem src, long value) in stackItem.Extensions) { WasteSimulationResult.Add(new BuffSimulationItemWasted(src, value, time)); } } BuffStack.RemoveAt(i); break; } } break; default: break; } }
public override void Remove(AgentItem by, long removedDuration, int removedStacks, long time, ArcDPSEnums.BuffRemove removeType, uint stackID) { BuffStackItemID toRemove; switch (removeType) { case ArcDPSEnums.BuffRemove.All: // remove all due to despawn event if (removedStacks == BuffRemoveAllEvent.FullRemoval) { BuffStack.Clear(); return; } if (BuffStack.Count != 1) { if (BuffStack.Count < removedStacks) { //removedStacks = BuffStack.Count; throw new EIBuffSimulatorIDException("Remove all failed"); } // buff cleanse all for (int i = 0; i < removedStacks; i++) { BuffStackItem stackItem = BuffStack[i]; WasteSimulationResult.Add(new BuffSimulationItemWasted(stackItem.Src, stackItem.Duration, time)); if (stackItem.Extensions.Any()) { foreach ((AgentItem src, long value) in stackItem.Extensions) { WasteSimulationResult.Add(new BuffSimulationItemWasted(src, value, time)); } } } BuffStack = BuffStack.GetRange(removedStacks, BuffStack.Count - removedStacks); return; } toRemove = BuffStack[0]; break; case ArcDPSEnums.BuffRemove.Single: toRemove = BuffStack.FirstOrDefault(x => x.StackID == stackID); break; default: throw new InvalidDataException("Unknown remove type"); } if (toRemove == null) { //return; throw new EIBuffSimulatorIDException("Remove has failed"); } BuffStack.Remove(toRemove); if (removedDuration > ParserHelper.BuffSimulatorDelayConstant) { // safe checking, this can happen when an inactive stack is being removed but it was actually active if (Math.Abs(removedDuration - toRemove.TotalDuration) > ParserHelper.BuffSimulatorDelayConstant && !toRemove.Active) { toRemove.Activate(); toRemove.Shift(0, Math.Abs(removedDuration - toRemove.TotalDuration)); } // Removed due to override //(long duration, AgentItem src)? candidate = OverrideCandidates.FirstOrDefault(x => Math.Abs(x.duration - removedDuration) < ParserHelper.BuffSimulatorDelayConstant); if (by == ParserHelper._unknownAgent) { //(long duration, AgentItem candSrc) = candidate.Value; //OverrideCandidates.Remove(candidate.Value); WasteSimulationResult.Add(new BuffSimulationItemWasted(toRemove.Src, toRemove.Duration, time)); if (toRemove.Extensions.Any()) { foreach ((AgentItem src, long value) in toRemove.Extensions) { WasteSimulationResult.Add(new BuffSimulationItemWasted(src, value, time)); } } } // Removed due to a cleanse else { WasteSimulationResult.Add(new BuffSimulationItemWasted(toRemove.Src, toRemove.Duration, time)); if (toRemove.Extensions.Any()) { foreach ((AgentItem src, long value) in toRemove.Extensions) { WasteSimulationResult.Add(new BuffSimulationItemWasted(src, value, time)); } } } } }