public virtual void EnqueueParty(PlayerMobile pm, Party party, PvPTeam team = null) { if (pm != null && !pm.Deleted && party != null && party.Active && party.Leader == pm) { party.Members.Where(pmi => pmi != null && pmi.Mobile != null && !pmi.Mobile.Deleted && pmi.Mobile != pm) .Select(pmi => (PlayerMobile)pmi.Mobile) .ForEach(m => Enqueue(m, team, false)); } }
public PartyMemberList( Party p ) : base( 0xBF ) { EnsureCapacity( 7 + p.Count*4 ); m_Stream.Write( (short) 0x0006 ); m_Stream.Write( (byte) 0x01 ); m_Stream.Write( (byte) p.Count ); for ( int i = 0; i < p.Count; ++i ) m_Stream.Write( (int) p[i].Mobile.Serial ); }
public PartyRemoveMember( Mobile removed, Party p ) : base( 0xBF ) { EnsureCapacity( 11 + p.Count*4 ); m_Stream.Write( (short) 0x0006 ); m_Stream.Write( (byte) 0x02 ); m_Stream.Write( (byte) p.Count ); m_Stream.Write( (int) removed.Serial ); for ( int i = 0; i < p.Count; ++i ) m_Stream.Write( (int) p[i].Mobile.Serial ); }
public override int Damage(int amount, Mobile from, bool informMount, bool checkfizzle) { if (from == null) { return(0); } if (Altar == null || Altar.Summoner == null) { amount = base.Damage(amount, from, informMount, checkfizzle); } else { bool good = false; if (from == Altar.Summoner || (Altar.DeadLine > DateTime.UtcNow && Altar.DeadLine - DateTime.UtcNow < TimeSpan.FromMinutes(10))) { good = true; } else if (from is BaseCreature && ((BaseCreature)from).GetMaster() == Altar.Summoner) { good = true; } else if (ShameAltar.AllowParties) { Server.Engines.PartySystem.Party p = Server.Engines.PartySystem.Party.Get(from); foreach (PartyMemberInfo info in p.Members) { if (info.Mobile == from) { good = true; break; } } } if (good) { amount = base.Damage(amount, from, informMount, checkfizzle); } else { amount = 0; from.SendLocalizedMessage(1151633); // You did not summon this champion, so you may not attack it at this time. } } return(amount); }
public AckPartyLocations( Mobile from, Party party ) : base(0x01, ( ( party.Members.Count - 1 ) * 9 ) + 4) { foreach ( PartyMemberInfo pmi in party.Members ) { if ( pmi == null || pmi.Mobile == from ) continue; Mobile m = pmi.Mobile; if ( from.InUpdateRange( m ) && from.CanSee( m ) ) continue; m_Stream.Write( (int) m.Serial ); m_Stream.Write( (short) m.X ); m_Stream.Write( (short) m.Y ); m_Stream.Write( (byte) ( m.Map == null ? 0 : m.Map.MapID ) ); } m_Stream.Write( (int) 0 ); }
public PartyTrack( Mobile from, Party party ) : base( 0x01, ( ( party.Members.Count - 1 ) * 9 ) + 4 ) { for ( int i = 0; i < party.Members.Count; ++i ) { PartyMemberInfo pmi = (PartyMemberInfo)party.Members[i]; if ( pmi == null || pmi.Mobile == from ) continue; Mobile mob = pmi.Mobile; if ( Utility.InUpdateRange( from, mob ) && from.CanSee( mob ) ) continue; m_Stream.Write( (int) mob.Serial ); m_Stream.Write( (short) mob.X ); m_Stream.Write( (short) mob.Y ); m_Stream.Write( (byte) ( mob.Map == null ? 0 : mob.Map.MapID ) ); } m_Stream.Write( (int) 0 ); }
private static void InternalCallback(Mobile attacker, Mobile defender, int damage, WeaponAbility a) { if (!defender.CanBeginAction(typeof(ClericSacrificeSpell))) { PSys.Party p = PSys.Party.Get(defender); if (p != null) { foreach (PSys.PartyMemberInfo info in p.Members) { Mobile m = info.Mobile; if (m != defender && m != attacker && !m.Poisoned) { m.Heal(damage / 2); m.PlaySound(0x202); m.FixedParticles(0x376A, 1, 62, 9923, 3, 3, EffectLayer.Waist); m.FixedParticles(0x3779, 1, 46, 9502, 5, 3, EffectLayer.Waist); } } } } }
public void BuildParties() { for ( int i = 0; i < m_Participants.Count; ++i ) { Participant p = (Participant)m_Participants[i]; if ( p.Players.Length > 1 ) { ArrayList players = new ArrayList(); for ( int j = 0; j < p.Players.Length; ++j ) { DuelPlayer dp = p.Players[j]; if ( dp == null ) continue; players.Add( dp.Mobile ); } if ( players.Count > 1 ) { for ( int leaderIndex = 0; (leaderIndex+1) < players.Count; leaderIndex += Party.Capacity ) { Mobile leader = (Mobile) players[leaderIndex]; Party party = Party.Get( leader ); if ( party == null ) { leader.Party = party = new Party( leader ); } else if ( party.Leader != leader ) { party.SendPublicMessage( leader, "I leave this party to fight in a duel." ); party.Remove( leader ); leader.Party = party = new Party( leader ); } for ( int j = leaderIndex+1; j < players.Count && j < leaderIndex+Party.Capacity; ++j ) { Mobile player = (Mobile)players[j]; Party existing = Party.Get( player ); if ( existing == party ) continue; if ( (party.Members.Count + party.Candidates.Count) >= Party.Capacity ) { player.SendMessage( "You could not be added to the team party because it is at full capacity." ); leader.SendMessage( "{0} could not be added to the team party because it is at full capacity." ); } else { if ( existing != null ) { existing.SendPublicMessage( player, "I leave this party to fight in a duel." ); existing.Remove( player ); } party.OnAccept( player, true ); } } } } } } }
public static void Invite( Mobile from, Mobile target ) { Faction ourFaction = Faction.Find( from ); Faction theirFaction = Faction.Find( target ); if ( ourFaction != null && theirFaction != null && ourFaction != theirFaction ) { from.SendLocalizedMessage( 1008088 ); // You cannot have players from opposing factions in the same party! target.SendLocalizedMessage( 1008093 ); // The party cannot have members from opposing factions. return; } Party p = Party.Get( from ); if ( p == null ) from.Party = p = new Party( from ); if ( !p.Candidates.Contains( target ) ) p.Candidates.Add( target ); // : You are invited to join the party. Type /accept to join or /decline to decline the offer. target.Send( new MessageLocalizedAffix( Serial.MinusOne, -1, MessageType.Label, 0x3B2, 3, 1008089, "", AffixType.Prepend | AffixType.System, from.Name, "" ) ); from.SendLocalizedMessage( 1008090 ); // You have invited them to join the party. target.Send( new PartyInvitation( from ) ); target.Party = from; DeclineTimer.Start( target, from ); }
public static bool TRYCREATEGROUPPARTY(TriggerObject trigObject, XmlGroup grp, Type mobType, bool participantsOnly) { if (grp == null) { return false; } var mobsToParty = new List<Mobile>(); var accountsToAdd = new List<Account>(); if (participantsOnly) { if (grp.Participants.Count < 2) { return false; } accountsToAdd.AddRange( grp.Participants.Cast<Mobile>().Where(mob => mob.Account is Account).Select(mob => (Account)mob.Account)); } else { if (grp.Members.Count < 2) { return false; } accountsToAdd.AddRange( grp.Members.Cast<Mobile>().Where(mob => mob.Account is Account).Select(mob => (Account)mob.Account)); } foreach (NetState state in NetState.Instances.Where(ns => ns.Account is Account)) { Account account = (Account)state.Account; if (!accountsToAdd.Contains(account)) { continue; } if (mobType != null) { if (IS(null, state.Mobile, mobType)) { mobsToParty.Add(state.Mobile); } } else { mobsToParty.Add(state.Mobile); } } if (mobsToParty.Count < 2) { return false; } // we need to bring them all into one party, so grab the first party available Party existingParty = null; var mobsToAddToExistingParty = new List<Mobile>(); foreach (Mobile mobToParty in mobsToParty) { if (mobToParty.Party is Party) { if (existingParty == null) { existingParty = (Party)mobToParty.Party; continue; } if (mobToParty.Party == existingParty) { continue; // already in the party } try // get them out of the party they were in { ((Party)mobToParty.Party).Remove(mobToParty); mobsToAddToExistingParty.Add(mobToParty); } catch { } } else { // not in a party yet mobsToAddToExistingParty.Add(mobToParty); } } if (existingParty == null) { // create a new party and add them in Party newParty = new Party(mobsToParty[0]); mobsToParty[0].Party = newParty; for (int i = 1; i < mobsToParty.Count; i++) { newParty.Add(mobsToParty[i]); } } else { // add the mobs that weren't in the party into the existing one foreach (Mobile mob in mobsToAddToExistingParty) { existingParty.Add(mob); } } return true; }
public static void ADDTOPARTY(TriggerObject trigObject, Party party, Mobile mob) { if (party == null || mob == null) { return; } if (mob.Party is Party) { ((Party)mob.Party).Remove(mob); } mob.Party = party; party.Add(mob); }
public SallosPartyTrack(Mobile from, Party party) : base(0x03, ((party.Members.Count - 1) * 10) + 4) { for (int i = 0; i < party.Members.Count; ++i) { PartyMemberInfo pmi = (PartyMemberInfo)party.Members[i]; if (pmi == null || pmi.Mobile == from) continue; Mobile mob = pmi.Mobile; m_Stream.Write((int)mob.Serial); m_Stream.Write((short)mob.X); m_Stream.Write((short)mob.Y); m_Stream.Write((byte)mob.Map.MapID); m_Stream.Write(true); } m_Stream.Write((int)0); }
public static void Invite( Mobile from, Mobile target ) { Party p = Party.Get( from ); if ( p == null ) from.Party = p = new Party( from ); if ( !p.Candidates.Contains( target ) ) p.Candidates.Add( target ); // : You are invited to join the party. Type /accept to join or /decline to decline the offer. target.Send( new MessageLocalizedAffix( Serial.MinusOne, -1, MessageType.Label, 0x3B2, 3, 1008089, "", AffixType.Prepend | AffixType.System, from.Name, "" ) ); from.SendLocalizedMessage( 1008090 ); // You have invited them to join the party. target.Send( new PartyInvitation( from ) ); target.Party = from; DeclineTimer.Start( target, from ); }