Ejemplo n.º 1
0
 private void HandlePartyMemberRemoveMessage(IAccount account, PartyMemberRemoveMessage message)
 {
     if (PartyMembers.ContainsKey(message.LeavingPlayerId))
     {
         Logger.Default.Log($"Player <{PartyMembers[message.LeavingPlayerId].Name}> was removed from your party.", LogMessageType.Party);
         PartyMembers.Remove(message.LeavingPlayerId);
         if (PartyMembers.Count == 1)
         {
             Logger.Default.Log($"Your party has been disbanded.", LogMessageType.Party);
             PartyMembers.Clear();
         }
         else
         {
             Logger.Default.Log($"Your party has now {PartyMembers.Count} members", LogMessageType.Party);
         }
     }
     else
     {
         Logger.Default.Log($"Player <{message.LeavingPlayerId}> is not a member of your party. It can't be removed.", LogMessageType.Party);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Remove a party member.  If the party member was the last in the
        /// party, then the party is dissolved.
        /// </summary>
        /// <param name="Creature">Supplies the creature to remove.</param>
        public void RemovePartyMember(CreatureObject Creature)
        {
            if (Creature.Party != this)
            {
                throw new ApplicationException(String.Format(
                                                   "Removing creature {0} from party, but it is not in this party."));
            }

            PartyMembers.Remove(Creature);
            Creature.Party = null;

            if (PartyLeader == Creature)
            {
                PartyLeader = null;
            }

            if (PartyMembers.Count == 0)
            {
                PartyManager.RemoveParty(this);
            }

            switch ((AIType)Creature.TacticsType)
            {
            case AIType.BEHAVIOR_TYPE_ANIMAL:
                PartyAnimals.Remove(Creature);
                break;

            case AIType.BEHAVIOR_TYPE_ARCHER:
                PartyArchers.Remove(Creature);
                break;

            case AIType.BEHAVIOR_TYPE_BUFFS:
                PartyBuffs.Remove(Creature);
                break;

            case AIType.BEHAVIOR_TYPE_CONTROL:
                PartyControls.Remove(Creature);
                break;

            case AIType.BEHAVIOR_TYPE_COWARD:
                PartyCowards.Remove(Creature);
                break;

            case AIType.BEHAVIOR_TYPE_FLANK:
                PartyFlanks.Remove(Creature);
                break;

            case AIType.BEHAVIOR_TYPE_MEDIC:
                PartyMedics.Remove(Creature);
                break;

            case AIType.BEHAVIOR_TYPE_MINDLESS:
                PartyMindless.Remove(Creature);
                break;

            case AIType.BEHAVIOR_TYPE_NUKE:
                PartyNukes.Remove(Creature);
                break;

            case AIType.BEHAVIOR_TYPE_SHOCK:
                PartyShocks.Remove(Creature);
                break;

            case AIType.BEHAVIOR_TYPE_SKIRMISH:
                PartySkrimishers.Remove(Creature);
                break;

            case AIType.BEHAVIOR_TYPE_TANK:
                PartyTanks.Remove(Creature);
                break;

            default:
                break;
            }

            if (PartyMembers.Count > 0 && PartyLeader == null)
            {
                int nCha = 0;
                foreach (CreatureObject Member in PartyMembers)
                {
                    if (Member.Script.GetAbilityModifier(CLRScriptBase.ABILITY_CHARISMA, Member.ObjectId) > nCha)
                    {
                        nCha        = Member.Script.GetAbilityModifier(CLRScriptBase.ABILITY_CHARISMA, Member.ObjectId);
                        PartyLeader = Member;
                    }
                }
            }
        }