public void RefreshTimeLine() { IOrderedEnumerable <Fighter> redFighters = Fight.RedTeam.Fighters. OrderByDescending(GetRealInitiative); IOrderedEnumerable <Fighter> blueFighters = Fight.BlueTeam.Fighters. OrderByDescending(GetRealInitiative); bool redFighterFirst = !(Fight.RedTeam.Fighters.Count == 0 || Fight.BlueTeam.Fighters.Count == 0) && GetRealInitiative(redFighters.First()) > GetRealInitiative(blueFighters.First()); IEnumerator <Fighter> redEnumerator = redFighters.GetEnumerator(); IEnumerator <Fighter> blueEnumerator = blueFighters.GetEnumerator(); var timeLine = new List <Fighter>(); bool hasRed; bool hasBlue = false; while ((hasRed = redEnumerator.MoveNext()) || (hasBlue = blueEnumerator.MoveNext())) { if (redFighterFirst) { if (hasRed) { timeLine.Add(redEnumerator.Current); } if (hasBlue) { timeLine.Add(blueEnumerator.Current); } } else { if (hasBlue) { timeLine.Add(blueEnumerator.Current); } if (hasRed) { timeLine.Add(redEnumerator.Current); } } } m_fighters.Clear(); foreach (var fighter in timeLine) { m_fighters.Add(fighter); } }
/// <summary> /// Add an actor. Returns false is existing actor has been replaced /// </summary> /// <param name="actor"></param> /// <returns></returns> public virtual bool AddActor(T actor) { if (_actors.ContainsKey(actor.Id)) { RemoveActor(actor.Id); _actors.Add(actor.Id, actor); _collectionActors.Add(actor); return(false); } _actors.Add(actor.Id, actor); _collectionActors.Add(actor); return(true); }
// Initializes full SpellsBook public void Update(SpellListMessage msg) { if (msg == null) { throw new ArgumentNullException("msg"); } m_spells.Clear(); foreach (SpellItem spell in msg.spells) { m_spells.Add(new Spell(spell)); } SpellPrevisualization = msg.spellPrevisualization; //FullDump(); }
public bool AddSummon(Fighter fighter) { if (!fighter.Summoned || fighter.Summoner != this) { return(false); } m_summons.Add(fighter); return(true); }
public void AddInteractive(InteractiveObject interactive) { m_interactives.Add(interactive); Tuple <uint, Cell> element = m_elements.FirstOrDefault(x => x.Item1 == interactive.Id); if (element != null) { interactive.DefinePosition(element.Item2); } }
public void Update(JobDescriptionMessage msg) { if (msg == null) { throw new ArgumentNullException("msg"); } m_jobs.Clear(); foreach (var job in msg.jobsDescription) { m_jobs.Add(new Job(this, job)); } }
public void Update(EmoteListMessage msg) { if (msg == null) { throw new ArgumentNullException("msg"); } m_emotes.Clear(); foreach (var emoteId in msg.emoteIds) { m_emotes.Add(ObjectDataManager.Instance.Get <Emoticon>(emoteId)); } }
public void Update(InteractiveElement interactive) { if (interactive == null) { throw new ArgumentNullException("interactive"); } Type = interactive.elementTypeId > 0 ? ObjectDataManager.Instance.Get <Interactive>(interactive.elementTypeId) : null; m_enabledSkills.Clear(); foreach (var skill in interactive.enabledSkills) { m_enabledSkills.Add(new InteractiveSkill(this, skill)); } m_disabledSkills.Clear(); foreach (var skill in interactive.disabledSkills) { m_disabledSkills.Add(new InteractiveSkill(this, skill)); } }
public void Update(ObjectItem item) { if (item == null) { throw new ArgumentNullException("item"); } Guid = item.objectUID; Template = ObjectDataManager.Instance.Get <Protocol.Data.Item>(item.objectGID); m_effects.Clear(); foreach (EffectBase x in item.effects.Select(EffectBase.CreateInstance)) { m_effects.Add(x); } Quantity = item.quantity; PowerRate = item.powerRate; OverMax = item.overMax; Position = (CharacterInventoryPositionEnum)item.position; }
public void Add(T shortcut) { m_shortcuts.Add(shortcut); }
internal void AddItem(Item item) { m_items.Add(item); _lastAddedItem = item; _lastQuantity = item.Quantity; }
private void OnMesssageDispatched(MessageDispatcher dispatcher, Message message) { if (IsPaused && !OnTheFly) { return; } var dumper = new TreeDumper(message); ObjectDumpNode tree = dumper.GetDumpTree(); NetworkMessage networkMessage = message as NetworkMessage; if (networkMessage != null) { tree.TimeStamp = DateTime.Now; tree.Id = networkMessage.MessageId; tree.From = networkMessage.From; foreach (ObjectDumpNode child in tree.Childrens) { if (m_seeProperties) { child.IsVisible = true; } else if (child.IsProperty) { child.IsVisible = false; } } if (!IsPaused) { m_messages.Add(tree); #region Cleaning : avoid memory overflow on a long run if (NbMessagesToKeep > 0 && m_messages.Count > NbMessagesToKeep) { m_messages.RemoveAt(0); } #endregion Cleaning : avoid memory overflow on a long run } #region Record On the fly if (OnTheFly) { FlushOnTheFly(tree.ExportToString(true)); } #endregion Record On the fly } else if (OnTheFly) { if (message is InformationMessage) { #region Record On the fly if (OnTheFly) { FlushOnTheFly((message as InformationMessage).Message + "\n"); } #endregion Record On the fly } } }
public void AddSpellCast(SpellCast cast) { m_casts.Add(cast); }