| CODE |
using System; using System.Collections; using System.Reflection; using Server; using Server.Items; using Server.Mobiles; using Server.Network; using Server.Targeting; using Server.Regions; namespace Server.Scripts.Commands { public class Clone { public static void Initialize() { Server.Commands.Register( "Clone", AccessLevel.GameMaster, new CommandEventHandler( Clone_OnCommand ) ); Server.Commands.Register( "Unclone", AccessLevel.GameMaster, new CommandEventHandler( Unclone_OnCommand ) ); } [Usage( "Clone" )] [Description( "Vous transforme en une copie exacte du mobile ciblé et le cache." )] public static void Clone_OnCommand( CommandEventArgs e ) { e.Mobile.Target = new cloneTarget(); } public class cloneTarget : Target { public cloneTarget() : base( 12, false, TargetFlags.None ) { } protected override void OnTarget( Mobile from, object targeted ) { if ( targeted is Mobile ) { Mobile targ = (Mobile)targeted; if ( !from.CanSee( targ ) ) { from.SendMessage( "Vous ne voyez pas la cible!" ); } else { targ.SendMessage( "S'il vous plait attendez ce ne sera pas long et vous pourrez continuer à jouer!" ); targ.SendMessage( "" ); targ.SendMessage( "Ne parlez pas et ne chattez pas s'il vous plait!" ); targ.Hidden = true; targ.Frozen = true; from.Hidden = false; from.EmoteHue = targ.EmoteHue; from.Kills = targ.Kills; from.Dex = targ.Dex; from.Int = targ.Int; from.Str = targ.Str; from.Fame = targ.Fame; from.Karma = targ.Fame; from.NameHue = targ.NameHue; from.SpeechHue = targ.SpeechHue; from.Criminal = targ.Criminal; from.Name = targ.Name; from.Title = targ.Title; from.Female = targ.Female; from.Body = targ.Body; from.Hue = targ.Hue; from.Hits = targ.Hits; from.Mana = targ.Mana; from.Stam = targ.Stam; from.BodyMod = targ.Body; from.Map = targ.Map; from.Location = targ.Location; from.Direction = targ.Direction; from.Poison = targ.Poison; from.Combatant = targ.Combatant; for (int i=0; i<targ.Skills.Length; i++) from.Skills[i].Base = targ.Skills[i].Base; // Tous les objets équipés ArrayList items = new ArrayList( targ.Items ); for (int i=0; i<items.Count; i++) { Item item = (Item)items[i]; if((( item != null ) && ( item.Parent == targ ) && ( item != targ.Backpack ))) { Type type = item.GetType(); Item newitem = Loot.Construct( type ); CopyProperties( newitem, item ); from.AddItem( newitem ); } } // Tous les objets du pack Container pack = targ.Backpack; if( pack != null ) { ArrayList t_items = new ArrayList( pack.Items ); for (int i=0; i<t_items.Count; i++) { Item item = (Item)t_items[i]; if(( item != null ) && ( item.IsChildOf( pack ))) { Type type = item.GetType(); Item newitem = Loot.Construct( type ); CopyProperties( newitem, item ); from.PlaceInBackpack( newitem ); } } } } } } } private static void CopyProperties ( Item dest, Item src ) { PropertyInfo[] props = src.GetType().GetProperties(); for ( int i = 0; i < props.Length; i++ ) { try { if ( props[i].CanRead && props[i].CanWrite ) { props[i].SetValue( dest, props[i].GetValue( src, null ), null ); } } catch { } } } [Usage( "Unclone" )] [Description( "Vous cache et met la personne ciblé à votre place." )] public static void Unclone_OnCommand( CommandEventArgs e ) { e.Mobile.Target = new uncloneTarget(); } public class uncloneTarget : Target { public uncloneTarget() : base( 12, false, TargetFlags.None ) { } protected override void OnTarget( Mobile from, object targeted ) { if ( targeted is Mobile ) { Mobile targ = (Mobile)targeted; if ( !from.CanSee( targ ) ) { from.SendMessage( "Vous ne voyez pas la cible!" ); } else { targ.SendMessage( "Merci de votre compréhension vous pouvez maintenant continuer à jouer!" ); from.Hidden = true; targ.Hidden = false; targ.Frozen = false; targ.Map = from.Map; targ.Location = from.Location; targ.Direction = from.Direction; targ.Hits = from.Hits; targ.Mana = from.Mana; targ.Stam = from.Stam; } } } } } } |
| CODE |
from.BodyMod = targ.Body; |
| CODE |
targ.BodyMod = null; |