Example #1
0
		public void Refresh( Mobile mob, Container cont )
		{
			if ( !mob.Alive )
			{
				mob.Resurrect();

				DeathRobe robe = mob.FindItemOnLayer( Layer.OuterTorso ) as DeathRobe;

				if ( robe != null )
					robe.Delete();

				if ( cont is Corpse )
				{
					Corpse corpse = (Corpse) cont;

					for ( int i = 0; i < corpse.EquipItems.Count; ++i )
					{
						Item item = corpse.EquipItems[i];

						if ( item.Movable && item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.IsChildOf( mob.Backpack ) )
							mob.EquipItem( item );
					}
				}
			}

			mob.Hits = mob.HitsMax;
			mob.Stam = mob.StamMax;
			mob.Mana = mob.ManaMax;

			mob.Poison = null;
		}
Example #2
0
        public static void ResurrectPlayers(string arglist, Mobile triggermob, object refobject, out string status_str)
        {
            status_str = null;
            Item refitem = null;
            Mobile refmob = null;
            if (refobject is Item)
            {
                refitem = (Item)refobject;
            }
            else
                if (refobject is Mobile)
                {
                    refmob = (Mobile)refobject;
                }
            // syntax is RESURRECT[,range][,PETS]
            // look for the range arg
            string[] str = ParseString(arglist, 3, ",");
            int range = 0;
            bool petres = false;

            if (str.Length > 1)
            {

                try
                {
                    range = int.Parse(str[1]);
                }
                catch { status_str = "bad range arg in RESURRECT"; }

            }
            if (str.Length > 2)
            {
                // get the range arg
                if (str[2] == "PETS")
                {
                    petres = true;
                }
            }

            try
            {
                if ((range > 0) || (triggermob != null && !triggermob.Deleted))
                {
                    // resurrect all players within range if range is > 0
                    if (range > 0)
                    {
                        IPooledEnumerable rangelist = null;
                        if (refitem != null && !refitem.Deleted)
                        {
                            rangelist = refitem.GetMobilesInRange(range);
                        }
                        else if (refmob != null && !refmob.Deleted)
                        {
                            rangelist = refmob.GetMobilesInRange(range);
                        }

                        if (rangelist != null)
                        {
                            foreach (Mobile p in rangelist)
                            {
                                if (!petres && p is PlayerMobile && p.Body.IsGhost)
                                {
                                    p.Resurrect();
                                }
                                else if (petres && p is BaseCreature && ((BaseCreature)p).ControlMaster == triggermob && ((BaseCreature)p).Controlled && ((BaseCreature)p).IsDeadPet)
                                {
                                    ((BaseCreature)p).ResurrectPet();
                                }
                            }
                            rangelist.Free();
                        }
                    }
                    else
                    {
                        // just send it to the mob who triggered
                        if (triggermob.Body.IsGhost)
                            triggermob.Resurrect();

                    }
                }
            }
            catch { }
        }
Example #3
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 );
        }
		public override void UseGate( Mobile m )
		{
			OptimizeItemsList();
			// Murderers are not allowed to use the gate.
			if ( m.Kills >= 5 )
			{
				m.SendLocalizedMessage( 1019004 );
			}
			// If you cast a spell, you are too busy to use the gate.
			else if ( m.Spell != null )
			{
				m.SendLocalizedMessage( 1049616 );
			}
			else if ( m_PlayerCountMax <= m_PlayersPassed && m_PlayerCountLimited )
			{
				m.SendMessage( m_PlayerCountExeededMessage );
			}
			else
			{
				if (_ChangesStats)
				{
					m.Str = this.m_Str;
					m.Dex = this.m_Dex;
					m.Int = this.m_Int;
				}

				if (_DoesResurrect && !m.Alive)
				{
					// THIS PART IS FOR "PERMADEATH" SHARDS...(or Semi-Permanent)
					// We (optionally) rename the character to show that the original
					// character 'died' and the new one takes their place.
					// Essentially, the 'New' character is like a child, who must start new
					// but inherits the property of the parent.
					if (_DoesRename)
					{
						string nam = m.Name;
						int last = nam.Length;
						if (nam.Substring(last-2,2) == " I") nam = nam + "I";
						else if (nam.Substring(last-3,3) == " II") nam = nam + "I";
						else if (nam.Substring(last-3,3) == "III") nam = nam.Substring(0,last-2) + "V";
						else if (nam.Substring(last-2,2) == "IV") nam = nam.Substring(0,last-2) + "V";
						else if (nam.EndsWith(" V"))
						{
							if ( m.Female )
								nam = NameList.RandomName( "female" );
							else
								nam = NameList.RandomName( "male" );
						}
						else nam = nam + " II";
					
						m.Name = nam;
					}
					m.Resurrect();
				}

				if (_DoesTeleport)
				{
					m.Map = this.TargetMap;
					m.Location = this.Target;
				}
				
				if (_ChangesSkills)
				{
					Server.Skills skills = m.Skills;
					for ( int i = 0; i < skills.Length; ++i ) skills[i].Base = gAllSkills[i];
				}
				
				if (_ChangesCaps)
				{
					Server.Skills skills = m.Skills;
					for ( int i = 0; i < skills.Length; ++i ) skills[i].Cap = gAllSkillCaps[i];
				}

				if (_ChangesHue) m.Hue = this.Hue;

				if (_SkillsGiveItems)
				{
					Server.Skills s = m.Skills;
					for ( int i = 0; i < s.Length; ++i )
						if (gAllSkills[i] >= _SkillsItemsMin)
							SkillsItems((SkillName)i, m);
				}
				
				if (m_TitleAdds)
				{
					m.Title = this.m_TitleToAdd;
				}

				//TODO: Create Method for how the Gate knows that you previously passed through...
				if ( m_TakesBackGivenItems )
				{
					if ( MC_ItemsToGive.Count > 0 )
					{
						for( int i = 0; i < MC_ItemsToGive.Count; i++)
						{
							if (MC_ItemsToGive[i] is Item)
							{
								m.Backpack.ConsumeUpTo( ((Item)(MC_ItemsToGive[i])).GetType(), ((Item)(MC_ItemsToGive[i])).Amount );
							}
						}
					}
				}

				//TODO: Create Method for how to tell the Gate what Items are included in this list...
				if (m_GivesItems)
				{
					if ( MC_ItemsToGive.Count > 0 )
					{
						for( int i = 0; i < MC_ItemsToGive.Count; i++)
						{
							if (MC_ItemsToGive[i] is Item)
							{
								Item item = (Item)MC_ItemsToGive[i];
								if (m_GivesBlessedItems) 
								{
									item.LootType = LootType.Blessed;
								}

								if( item.Stackable )
									PackItem( item, m ) ;
								else
								{
									int times = 0;
									int amount = item.Amount;
									item.Amount = 1;
									while( times < amount )
									{
										m.Backpack.AddItem( item );
										times++;
									}
								}
							}
						}
					}
				}


				m.PlaySound( 0x1FE );
				m_PlayersPassed++;
			}
		}
        public static bool ReDress(Mobile m)
        {
            UndressedPlayer ud;

            if ( !m_UndressedDictionary.TryGetValue(m, out ud) )
                m.SendMessage("Unfortunately we could not find your belongings, please contact the staff.");
            else
            {
                if ( !m.Alive )
                    m.Resurrect();

                Container pack = m.Backpack;

                if ( pack != null )
                {
                    foreach ( Item item in ud.WornList )
                    {
                        if (!item.CanEquip(m) || !m.EquipItem(item))
                            m.AddToBackpack(item);
                    }

                    foreach (Item item in ud.BackPackList)
                        m.AddToBackpack(item);

                    if (ud.Bag.Items.Count == 0)
                        ud.Bag.Delete();

                    if (ud.PetList.Count > 0)
                        ReturnPets(m, ud);

                    m.SendMessage("Your belongings have been returned to you.");
                    m_UndressedDictionary.Remove(m);

                    return true;
                }
                else
                    m.SendMessage("Unfortunately we could not return your belongings, as you have no backpack, please contact the staff.");
            }

            return false;
        }
        public static bool Undress(Mobile m, Predicate<Item> pred)
        {
            if (!m.Alive)
            {
                m.Resurrect();
                m.Hits = m.HitsMax;
            }

            if (m.Backpack != null)
            {
                Bag bag;
                UndressedPlayer ud;

                if (!m_UndressedDictionary.TryGetValue(m, out ud))
                {
                    bag = new Bag();
                    m.BankBox.DropItem(bag);
                    ud = new UndressedPlayer(bag);
                    m_UndressedDictionary[m] = ud;
                }

                else
                    return false;

                if (m.Holding != null)
                    m.Backpack.DropItem(m.Holding);

                StablePets(m, ud);

                for (int i = m.Items.Count - 1; i >= 0; --i)
                {
                    Item item = (Item)m.Items[i];
                    if (Array.BinarySearch(m_ExcludedLayers, item.Layer) < 0)
                    {
                        if (pred == null || pred(item))
                        {
                            ud.WornList.Add(item);
                            bag.DropItem(item);
                        }
                    }
                }

                for (int i = m.Backpack.Items.Count; i > 0; i--)
                {
                    Item item = m.Backpack.Items[i - 1];
                    if (pred == null || pred(item))
                    {
                        ud.BackPackList.Add(item);
                        bag.DropItem(item);
                    }
                }

                return true;
            }

            else
            {
                m.SendMessage("Unfortunately we could not undress you, as you have no backpack, please contact the staff.");
                return false;
            }
        }
		private void HandleMatchEnd(Mobile from, bool kick)
		{
			if(!from.Alive)
			{
				from.Resurrect();

				if(from.Corpse != null && from.Corpse is Corpse)
				{
					Corpse c = (Corpse)from.Corpse;

					for ( int i = 0; i < c.Items.Count; ++i )
					{
						Item item = c.Items[i];

						c.SetRestoreInfo( item, item.Location );
					}

					c.Open(from, true);
					c.Delete();
				}
			}

			from.Criminal = false;
			from.Blessed = false;
			from.Frozen = false;

			from.CurePoison(from);
			from.StatMods.Clear();
			from.Hits = from.HitsMax;
			from.Mana = from.ManaMax;
			from.Stam = from.StamMax;

			Targeting.Target.Cancel( from );
			from.MagicDamageAbsorb = 0;
			from.MeleeDamageAbsorb = 0;
			ProtectionSpell.Registry.Remove( from );
			DefensiveSpell.Nullify( from );
			from.Combatant = null;

			from.Delta( MobileDelta.Noto ); //Update notoriety

			from.Location = m_SpectatorDest;

			if(kick && from.NetState == null)
			{
				Match m = FindMatch(from);

				if(m.Attackers.Contains(from))
					m.Attackers.Remove(from);
				else if(m.Defenders.Contains(from))
					m.Defenders.Remove(from);
			}
		}
		private void PrepFighter(Mobile from)
		{
			if(!from.Alive)
				from.Resurrect();

			if(from.Mount != null)
				from.Mount.Rider = null;

			from.CurePoison(from);
			from.Blessed = true;
			from.Frozen = true;

			from.StatMods.Clear();
			from.Hits = from.HitsMax;
			from.Mana = from.ManaMax;
			from.Stam = from.StamMax;

			Targeting.Target.Cancel( from );
			from.MagicDamageAbsorb = 0;
			from.MeleeDamageAbsorb = 0;
			ProtectionSpell.Registry.Remove( from );
			DefensiveSpell.Nullify( from );
			from.Combatant = null;

			from.Delta( MobileDelta.Noto ); //Update notoriety

			from.SendMessage("The fight will begin in ten seconds.");
		}
		public void FinalPrep(Mobile from)
		{
			if(!from.Alive)
				from.Resurrect();

			from.CurePoison(from);
			from.Blessed = false;
			from.Frozen = false;

			from.StatMods.Clear();
			from.Hits = from.HitsMax;
			from.Mana = from.ManaMax;
			from.Stam = from.StamMax;

			Targeting.Target.Cancel( from );
			from.MagicDamageAbsorb = 0;
			from.MeleeDamageAbsorb = 0;
			ProtectionSpell.Registry.Remove( from );
			DefensiveSpell.Nullify( from );
			from.Combatant = null;

			from.Delta( MobileDelta.Noto ); //Update notoriety
		}
Example #10
0
			public void attrib(Mobile who)
			{
				PlayerMobile m = who as PlayerMobile;
			 	
				RemoveRing(m);
				m.Aggressed.Clear();
				m.Aggressors.Clear();
				if(!who.Alive)
					who.Resurrect();

				if(m.TempMount != null)
				{
					m.TempMount.Rider = m;
					m.TempMount = null;
				}			 	
				m.Criminal = false;
				m.Warmode = false;
				m.PlaySound( 0x214 );
				m.FixedEffect( 0x376A, 10, 16 );
				m.Hits = 125;
				m.Mana = 125;
				m.Stam = 125;					
			}
Example #11
0
		public void makeready(Mobile who)    
		{	
			PlayerMobile c = (PlayerMobile) who;
			if( !who.Alive )
				who.Resurrect();
			
			Container bp = c.Backpack;
			Container bankbag = new Bag();
			bankbag.Hue = 63;
			BankBox bank = c.BankBox;
			Item oncurs = c.Holding;
						
			if(oncurs != null)
				bp.DropItem(oncurs);
						
			c.SendMessage( "You have 10 seconds until the duel begins" );
			c.SendMessage( 63, "After one of you dies, both of you will be teleported out" );
						
			c.Criminal = true;
			c.CurePoison(c);
	
			c.Blessed = true;
			c.Frozen = true;

			c.Hits = c.HitsMax;
			c.Mana = c.ManaMax;
			c.Stam = c.StamMax;
			
			c.StatMods.Clear();

			if(bp != null)
			{
				Item toDisarm = c.FindItemOnLayer( Layer.OneHanded );
				
				if ( toDisarm == null || !toDisarm.Movable )
					toDisarm = c.FindItemOnLayer( Layer.TwoHanded );
				
				if (toDisarm != null)
					bp.DropItem(toDisarm);

				if ( c.Mount != null )
				{
					IMount mount = c.Mount;	
					mount.Rider = null;
					if( mount is BaseMount )
					{
						BaseMount oldMount = (BaseMount)mount;	
						oldMount.Map = Map.Internal;
						c.TempMount = oldMount;
					}
				}
				
				while((BasePotion)bp.FindItemByType(typeof(BasePotion)) != null)
				{
					BasePotion potion = (BasePotion)bp.FindItemByType(typeof(BasePotion)); 
					bankbag.DropItem(potion);
				}
				while((EtherealMount)bp.FindItemByType(typeof(EtherealMount)) != null)
				{
					EtherealMount mount = (EtherealMount)bp.FindItemByType(typeof(EtherealMount)); 
					bankbag.DropItem(mount);
				}
				/*Item[] weps = bp.FindItemsByType( typeof( BaseWeapon ) ); 
				for ( int i = 0; i < weps.Length; ++i ) 
				{ 
					Item item = (Item)weps[i];
					BaseWeapon weapon = item as BaseWeapon;
					if( weapon.DamageLevel > WeaponDamageLevel.Regular ) 
								bankbag.DropItem( item );
				}*/
				if( bankbag.Items.Count > 0 )
					bank.DropItem(bankbag);
				else
					bankbag.Delete();
			} 
		}