Exemple #1
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if (m_From is PlayerMobile)
            {
                if (m_Book.IsChildOf(m_From.Backpack))
                {
                    if (targeted is Mobile)
                    {
                        if (targeted is BaseCreature)
                        {
                            BaseCreature creature = (BaseCreature)targeted;
                            PlayerMobile caster   = (PlayerMobile)m_From;

                            //Important aspects of returning to normal.
                            String fromName    = caster.Name;
                            int    fromBodyMod = caster.BodyMod;
                            int    fromNameHue = caster.NameHue;
                            int    fromHue     = caster.Hue;
                            int    fromKills   = caster.Kills;

                            //Set all the aspects of the caster to those of the target
                            caster.Kills    = 0;
                            caster.Criminal = true;
                            caster.Name     = creature.Name;
                            caster.NameHue  = creature.NameHue;
                            caster.Hue      = creature.Hue;
                            caster.BodyMod  = creature.Body;

                            //Need to start a timer when impersonation starts.
                            ImpersonationTimer DispellTimer = new ImpersonationTimer(from,
                                                                                     fromName,
                                                                                     fromNameHue,
                                                                                     fromHue,
                                                                                     fromKills,
                                                                                     fromBodyMod,
                                                                                     TimeSpan.FromMinutes(1.0));

                            DispellTimer.Start();
                        }
                        else
                        {
                            from.SendMessage("You cannot impersonate that!");
                        }
                    }
                    else
                    {
                        from.SendMessage("You can only impersonate creatures.");
                    }
                }
                else
                {
                    from.SendMessage("The Spellbook must be in your pack.");
                }
            }
        }
		protected override void OnTarget( Mobile from, object targeted )
		{
			if ( m_From is PlayerMobile )
			{
				if (m_Book.IsChildOf( m_From.Backpack ) )
				{					
					if ( targeted is Mobile)
					{
						if ( targeted is BaseCreature )
						{
							BaseCreature creature = (BaseCreature) targeted;
							PlayerMobile caster = (PlayerMobile) m_From;
							
							//Important aspects of returning to normal.
							String fromName = caster.Name;
							int fromBodyMod = caster.BodyMod;
							int fromNameHue = caster.NameHue;
							int fromHue = caster.Hue;
							int fromKills = caster.Kills;
							
							//Set all the aspects of the caster to those of the target
							caster.Kills = 0;
							caster.Criminal = true;
							caster.Name = creature.Name;
							caster.NameHue = creature.NameHue;
							caster.Hue = creature.Hue;
							caster.BodyMod = creature.Body;
							
							//Need to start a timer when impersonation starts.
							ImpersonationTimer DispellTimer = new ImpersonationTimer( 	from, 
																						fromName,
																						fromNameHue,
																						fromHue,
																						fromKills,
																						fromBodyMod,
																						TimeSpan.FromMinutes( 1.0 ));
																	
							DispellTimer.Start();
						}
						else
						{
							from.SendMessage("You cannot impersonate that!");
						}	
					}
					else
					{
						from.SendMessage("You can only impersonate creatures.");
					}
				}
				else{
					from.SendMessage("The Spellbook must be in your pack.");
				}			
			}
		}