Example #1
0
        public void SwitchTeams(Mobile from, CTFTeam team)
        {
            CTFTeam old = GetTeam(from);

            if (old == team)
            {
                return;
            }
            else if (old != null)
            {
                old.RemoveMember(from);
            }

            team.AddMember(from);
            from.Delta(MobileDelta.Noto);

            Item robe = from.FindItemOnLayer(Layer.OuterTorso);

            if (robe is CTFRobe)
            {
                robe.Name = team.Name + " Game Robe";
                robe.Hue  = team.Hue;
            }
            else
            {
                if (robe != null)
                {
                    if (robe.Movable)
                    {
                        from.AddToBackpack(robe);
                    }
                    else
                    {
                        robe.Delete();
                    }
                }

                robe = new CTFRobe(team);
                from.EquipItem(robe);
            }
        }
Example #2
0
        public void LeaveGame(Mobile m)
        {
            CTFTeam t = GetTeam(m);

            if (t != null)
            {
                t.RemoveMember(m);
            }

            if (m.AccessLevel == AccessLevel.Player && !m.Blessed)
            {
                if (m.Alive)
                {
                    m.Kill();
                    if (m.Corpse != null && !m.Corpse.Deleted)
                    {
                        m.Corpse.Delete();
                    }
                }
                m.Resurrect();
            }

            Item robe = m.FindItemOnLayer(Layer.OuterTorso);

            if (robe is CTFRobe)
            {
                robe.Delete();
            }
            if (m.Backpack != null)
            {
                Item[] robes = m.Backpack.FindItemsByType(typeof(CTFRobe));
                for (int i = 0; i < robes.Length; i++)
                {
                    robes[i].Delete();
                }
            }

            m.Delta(MobileDelta.Noto);
        }