/// <summary> /// Gets dynamic enumeration of party members and pets withing party range /// </summary> /// <returns></returns> public IEnumerable <Mobile> GetParty() { if (!PartyEffects) { yield break; } Party p = Party.Get(Caster); if (p != null) { IPooledEnumerable eable = Caster.Map.GetMobilesInRange(Caster.Location, PartyRange); foreach (Mobile mob in eable) { if (mob == Caster) { yield return(mob); } Mobile check = mob; if (mob is BaseCreature && (((BaseCreature)mob).Summoned || ((BaseCreature)mob).Controlled)) { check = ((BaseCreature)mob).GetMaster(); } if (check != null && p.Contains(check)) { if (PartyList == null) { PartyList = new List <Mobile>(); } if (!PartyList.Contains(mob)) { PartyList.Add(mob); } yield return(mob); } } eable.Free(); } else { if (Caster is PlayerMobile) { foreach (var m in ((PlayerMobile)Caster).AllFollowers.Where(x => Caster.InRange(x.Location, PartyRange))) { yield return(m); } } yield return(Caster); } }
public void PartySetting(int iIndex) { if (iIndex < m_CompanionList.Count) { CharPartyData Node = new CharPartyData(); PartySetting(Node, iIndex); PartyList.Add(Node); } }
protected void AddPartyMember(Mobile m) { PartyList.Add(m); AddPartyEffects(m); if (m is PlayerMobile) { foreach (var pet in ((PlayerMobile)m).AllFollowers.Where(p => !PartyList.Contains(p) && ValidPartyMember(p))) { AddPartyMember(pet); } } }
public List <Mobile> GetParty() { if (!PartyEffects) { return(null); } Party p = Party.Get(Caster); List <Mobile> list = new List <Mobile>(); if (p != null) { IPooledEnumerable eable = Caster.Map.GetMobilesInRange(Caster.Location, PartyRange); foreach (Mobile mob in eable) { Mobile check = mob; if (mob is BaseCreature && (((BaseCreature)mob).Summoned || ((BaseCreature)mob).Controlled)) { check = ((BaseCreature)mob).GetMaster(); } if (check != null && p.Contains(check)) { list.Add(mob); if (PartyList == null) { PartyList = new List <Mobile>(); } if (!PartyList.Contains(mob)) { PartyList.Add(mob); } } } eable.Free(); } if (!list.Contains(Caster)) { list.Add(Caster); } return(list); }
protected void AddPartyMember(Mobile m) { PartyList.Add(m); AddPartyEffects(m); if (m is PlayerMobile pm) { foreach (Mobile pet in pm.AllFollowers) { if (!PartyList.Contains(pet) && ValidPartyMember(pet)) { AddPartyMember(pet); } } } }
//__________________PARTY LOGIC_______________________________________________________ //add to party public async Task <bool> AddToParty(Character character) { var myData = Dataset.FirstOrDefault(arg => arg.Id == character.Id); if (myData == null) { return(false); } if (PartyList.Count < 6) { PartyList.Add(character.Id); DatasetParty.Add(character); _needsRefresh = true; return(true); } return(false); }
protected void AddPartyMember(Mobile m) { PartyList.Add(m); AddPartyEffects(m); if (m is PlayerMobile pm) { for (var index = 0; index < pm.AllFollowers.Count; index++) { Mobile pet = pm.AllFollowers[index]; if (!PartyList.Contains(pet) && ValidPartyMember(pet)) { AddPartyMember(pet); } } } }