| CODE |
| using System; using Server; using Server.Gumps; using Server.Network; using Server.Items; namespace Server.Gumps { public class GumpActions001 : Gump { public static void Initialize() { Commands.Register( "Actions", AccessLevel.Player, new CommandEventHandler( GumpActions001_OnCommand ) ); } private static void GumpActions001_OnCommand( CommandEventArgs e ) { e.Mobile.SendGump( new GumpActions001( e.Mobile ) ); } public GumpActions001( Mobile owner ) : base( 50,50 ) { AddPage( 0 ); AddBackground( 0, 0, 500, 320, 2600 ); AddImage( 320, 40, 60468, 0x34 ); AddImage( 320, 40, 120 ); AddImage( 320, 40, 60441 ); AddImage( 320, 40, 60999, 0x34 ); AddImage( 320, 40, 60476, 0x134 ); AddImage( 320, 40, 50937, 0x134 ); AddImage( 320, 40, 60438, 0x134 ); AddImage( 320, 40, 60439, 0x134 ); AddImage( 320, 40, 60440, 0x134 ); AddPage( 1 ); AddHtml( 20, 20, 460, 27," Désirez-vous vendre ou acheter ?", true, false ); AddButton( 35, 63, 0x2623, 0x2622, 11, GumpButtonType.Page, 2 ); AddLabel( 55, 60, 0x34, "Acheter" ); AddButton( 35, 93, 0x2623, 0x2622, 12, GumpButtonType.Page, 3 ); AddLabel( 55, 90, 0x34, "Vendre" ); AddPage( 2 ); AddHtml( 20, 20, 460, 27," Voici les différentes actions disponibles. ", true, false ); AddButton( 165, 260, 0x119a, 0x119a, 1, GumpButtonType.Page, 1 ); AddButton( 35, 63, 0x2623, 0x2622, 21, GumpButtonType.Reply, 0 ); AddLabel( 55, 60, 0x34, "Meliok (1000po)" ); AddButton( 35, 93, 0x2623, 0x2622, 22, GumpButtonType.Reply, 0 ); AddLabel( 55, 90, 0x34, "Christellya (2000po)" ); AddButton( 35, 123, 0x2623, 0x2622, 23, GumpButtonType.Reply, 0 ); AddLabel( 55, 120, 0x34, "Alchor (5000po)" ); AddPage( 3 ); AddHtml( 20, 20, 460, 27," Que désirez-vous vendre ? ", true, false ); AddButton( 165, 260, 0x119a, 0x119a, 1, GumpButtonType.Page, 1 ); AddButton( 35, 63, 0x2623, 0x2622, 31, GumpButtonType.Reply, 0 ); AddLabel( 55, 60, 0x34, "Meliok (1000po)" ); AddButton( 35, 93, 0x2623, 0x2622, 32, GumpButtonType.Reply, 0 ); AddLabel( 55, 90, 0x34, "Christellya (2000po)" ); AddButton( 35, 123, 0x2623, 0x2622, 33, GumpButtonType.Reply, 0 ); AddLabel( 55, 120, 0x34, "Alchor (5000po)" ); } public override void OnResponse( NetState state, RelayInfo info ) { Mobile from = state.Mobile; switch ( info.ButtonID ) { case 0: { break; } case 11: { break; } case 12: { break; } case 21: { Container pack = from.Backpack; if ( pack != null && pack.ConsumeTotal( typeof( Gold ), 990 ) ) // Lors de mise à jour, multiplier par 0,94 à 1,05 { from.SendMessage( "Voici votre Action" ); from.AddToBackpack( new ActionMELIOK ()); from.SendGump( new GumpActions001( from ) ); } else { from.SendMessage( 0x22, "Il vous faut plus d'or." ); from.SendGump( new GumpActions001( from ) ); } break; } case 22: { Container pack = from.Backpack; if ( pack != null && pack.ConsumeTotal( typeof( Gold ), 2000 ) ) // Lors de mise à jour, multiplier par 0,95 à 1,06 { from.SendMessage( "Voici votre Action" ); from.AddToBackpack( new ActionCHRISTELLYA ()); from.SendGump( new GumpActions001( from ) ); } else { from.SendMessage( 0x22, "Il vous faut plus d'or." ); from.SendGump( new GumpActions001( from ) ); } break; } case 23: { Container pack = from.Backpack; if ( pack != null && pack.ConsumeTotal( typeof( Gold ), 4700 ) ) // Lors de mise à jour, multiplier par 0,94 à 1,07 { from.SendMessage( "Voici votre Action" ); from.AddToBackpack( new ActionALCHOR ()); from.SendGump( new GumpActions001( from ) ); } else { from.SendMessage( 0x22, "Il vous faut plus d'or." ); from.SendGump( new GumpActions001( from ) ); } break; } case 31: { Container pack = from.Backpack; if ( pack != null && pack.ConsumeTotal( typeof( ActionMELIOK ), 1 ) ) { from.SendMessage( "Merci pour cet échange." ); from.AddToBackpack( new Gold (990)); from.SendGump( new GumpActions001( from ) ); } else { from.SendMessage( 0x22, "Vous n'avez pas d'action de ce type à vendre." ); from.SendGump( new GumpActions001( from ) ); } break; } case 32: { Container pack = from.Backpack; if ( pack != null && pack.ConsumeTotal( typeof( ActionCHRISTELLYA ), 1 ) ) { from.SendMessage( "Merci pour cet échange." ); from.AddToBackpack( new Gold (2000)); from.SendGump( new GumpActions001( from ) ); } else { from.SendMessage( 0x22, "Vous n'avez pas d'action de ce type à vendre." ); from.SendGump( new GumpActions001( from ) ); } break; } case 33: { Container pack = from.Backpack; if ( pack != null && pack.ConsumeTotal( typeof( ActionALCHOR ), 1 ) ) { from.SendMessage( "Merci pour cet échange." ); from.AddToBackpack( new Gold (4700)); from.SendGump( new GumpActions001( from ) ); } else { from.SendMessage( 0x22, "Vous n'avez pas d'action de ce type à vendre." ); from.SendGump( new GumpActions001( from ) ); } break; } } } } } |
| CODE |
| using System; using Server; using Server.Gumps; using Server.Network; using Server.Items; namespace Server.Items { public class BouledesActions : Item { private int m_VariabledesActions = 1; [CommandProperty( AccessLevel.GameMaster )] public int VariabledesActions { get { return m_VariabledesActions; } set { m_VariabledesActions = value; InvalidateProperties(); } } [Constructable] public BouledesActions() : base(0x139D) { Weight = 10; // poid de l'item Name = "Boule des Actions"; // Nom de l'item Hue = 2; // couleur de l'item } public override void OnDoubleClick( Mobile from ) // lorsqu'on doubleclique dessus { ActionsTimer timer = new ActionsTimer(from); //Il cré un objet nommé timer timer.Start(); //Il lance le timer from.SendGump( new GumpActions002( from ) ); } public BouledesActions(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write((int) 0); writer.Write( (int) m_VariabledesActions ); } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch ( version ) { case 0: { m_VariabledesActions = reader.ReadInt(); break; } } } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////LE TIMER//////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public class ActionsTimer : Timer { private Mobile m; //On utilisera une variable m plus loin, on indique que ce sera un mobile public ActionsTimer(Mobile from ) : base ( TimeSpan.FromSeconds (36000.0), TimeSpan.FromSeconds (36000.0) ) // On indique le temps que durera le script aux deux endroits. Ici 20 secondes { m = from; // on précise que la varibale m sera finalewment le mobile from m.SendMessage("Début du timer"); // on précise a celui qui a activer le Timer que celui-ci démare } protected override void OnTick() //Ici c'est la fin du timer, autrement dit ici apres 20 secondes { m_VariabledesActions = 990 * ((Rand 11 + 94) /100); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////GUMP DES ACTIONS//////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public class GumpActions002 : Gump { public static void Initialize() { Commands.Register( "Actions", AccessLevel.Player, new CommandEventHandler( GumpActions002_OnCommand ) ); } private static void GumpActions002_OnCommand( CommandEventArgs e ) { e.Mobile.SendGump( new GumpActions002( e.Mobile ) ); } public GumpActions002( Mobile owner ) : base( 50,50 ) { AddPage( 0 ); AddBackground( 0, 0, 500, 320, 2600 ); AddImage( 320, 40, 60468, 0x34 ); AddImage( 320, 40, 120 ); AddImage( 320, 40, 60441 ); AddImage( 320, 40, 60999, 0x34 ); AddImage( 320, 40, 60476, 0x134 ); AddImage( 320, 40, 50937, 0x134 ); AddImage( 320, 40, 60438, 0x134 ); AddImage( 320, 40, 60439, 0x134 ); AddImage( 320, 40, 60440, 0x134 ); AddPage( 1 ); AddHtml( 20, 20, 460, 27," Désirez-vous vendre ou acheter ?", true, false ); AddButton( 35, 63, 0x2623, 0x2622, 11, GumpButtonType.Page, 2 ); AddLabel( 55, 60, 0x34, "Acheter" ); AddButton( 35, 93, 0x2623, 0x2622, 12, GumpButtonType.Page, 3 ); AddLabel( 55, 90, 0x34, "Vendre" ); AddPage( 2 ); AddHtml( 20, 20, 460, 27," Voici les différentes actions disponibles. ", true, false ); AddButton( 165, 260, 0x119a, 0x119a, 1, GumpButtonType.Page, 1 ); AddButton( 35, 63, 0x2623, 0x2622, 21, GumpButtonType.Reply, 0 ); AddLabel( 55, 60, 0x34, "Meliok (980po)" ); AddButton( 35, 93, 0x2623, 0x2622, 22, GumpButtonType.Reply, 0 ); AddLabel( 55, 90, 0x34, "Christellya (1805po)" ); AddButton( 35, 123, 0x2623, 0x2622, 23, GumpButtonType.Reply, 0 ); AddLabel( 55, 120, 0x34, "Alchor (4841po)" ); AddPage( 3 ); AddHtml( 20, 20, 460, 27," Que désirez-vous vendre ? ", true, false ); AddButton( 165, 260, 0x119a, 0x119a, 1, GumpButtonType.Page, 1 ); AddButton( 35, 63, 0x2623, 0x2622, 31, GumpButtonType.Reply, 0 ); AddLabel( 55, 60, 0x34, "Meliok (980po)" ); AddButton( 35, 93, 0x2623, 0x2622, 32, GumpButtonType.Reply, 0 ); AddLabel( 55, 90, 0x34, "Christellya (1805po)" ); AddButton( 35, 123, 0x2623, 0x2622, 33, GumpButtonType.Reply, 0 ); AddLabel( 55, 120, 0x34, "Alchor (4841po)" ); } public override void OnResponse( NetState state, RelayInfo info ) { Mobile from = state.Mobile; switch ( info.ButtonID ) { case 0: { break; } case 11: { break; } case 12: { break; } case 21: { Container pack = from.Backpack; if ( pack != null && pack.ConsumeTotal( typeof( Gold ), 980 ) ) // Lors de mise à jour, multiplier par 0,94 à 1,05 { from.SendMessage( "Voici votre Action" ); from.AddToBackpack( new ActionMELIOK ()); from.SendGump( new GumpActions002( from ) ); } else { from.SendMessage( 0x22, "Il vous faut plus d'or." ); from.SendGump( new GumpActions002( from ) ); } break; } case 22: { Container pack = from.Backpack; if ( pack != null && pack.ConsumeTotal( typeof( Gold ), 1805 ) ) // Lors de mise à jour, multiplier par 0,95 à 1,06 { from.SendMessage( "Voici votre Action" ); from.AddToBackpack( new ActionCHRISTELLYA ()); from.SendGump( new GumpActions002( from ) ); } else { from.SendMessage( 0x22, "Il vous faut plus d'or." ); from.SendGump( new GumpActions002( from ) ); } break; } case 23: { Container pack = from.Backpack; if ( pack != null && pack.ConsumeTotal( typeof( Gold ), 4841 ) ) // Lors de mise à jour, multiplier par 0,94 à 1,07 { from.SendMessage( "Voici votre Action" ); from.AddToBackpack( new ActionALCHOR ()); from.SendGump( new GumpActions002( from ) ); } else { from.SendMessage( 0x22, "Il vous faut plus d'or." ); from.SendGump( new GumpActions002( from ) ); } break; } case 31: { Container pack = from.Backpack; if ( pack != null && pack.ConsumeTotal( typeof( ActionMELIOK ), 1 ) ) { from.SendMessage( "Merci pour cet échange." ); from.AddToBackpack( new Gold (980)); from.SendGump( new GumpActions002( from ) ); } else { from.SendMessage( 0x22, "Vous n'avez pas d'action de ce type à vendre." ); from.SendGump( new GumpActions002( from ) ); } break; } case 32: { Container pack = from.Backpack; if ( pack != null && pack.ConsumeTotal( typeof( ActionCHRISTELLYA ), 1 ) ) { from.SendMessage( "Merci pour cet échange." ); from.AddToBackpack( new Gold (1805)); from.SendGump( new GumpActions002( from ) ); } else { from.SendMessage( 0x22, "Vous n'avez pas d'action de ce type à vendre." ); from.SendGump( new GumpActions002( from ) ); } break; } case 33: { Container pack = from.Backpack; if ( pack != null && pack.ConsumeTotal( typeof( ActionALCHOR ), 1 ) ) { from.SendMessage( "Merci pour cet échange." ); from.AddToBackpack( new Gold (4841)); from.SendGump( new GumpActions002( from ) ); } else { from.SendMessage( 0x22, "Vous n'avez pas d'action de ce type à vendre." ); from.SendGump( new GumpActions002( from ) ); } break; } } } }} |
| CODE |
| //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////LE TIMER//////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public class ActionsTimer : Timer { private Mobile m; private int m_VariabledesActions; public ActionsTimer(Mobile from ) : base ( TimeSpan.FromSeconds (36000.0), TimeSpan.FromSeconds (36000.0) ) { m = from; m.SendMessage("Début du timer"); } protected override void OnTick() { m_VariabledesActions = 990 * ((Rand 11 + 94) /100); } } |
| CODE |
| m_VariabledesActions = 990 * ((Rand 11 + 94) /100); |
| CODE |
| m_VariabledesActions = 990 * ((RND 11 + 94) /100); |
| CODE |
| { case 0: m_VariabledesActions *= 0.95; break; case 1: m_VariabledesActions *= 0.96; break; case 2: m_VariabledesActions *= 0.97; break; case 3: m_VariabledesActions *= 0.98; break; case 4: m_VariabledesActions *= 0.99; break; case 5: m_VariabledesActions *= 1; break; case 6: m_VariabledesActions *= 1.01; break; case 7: m_VariabledesActions *= 1.02; break; case 8: m_VariabledesActions *= 1.03; break; case 9: m_VariabledesActions *= 1.04; break; case 10: m_VariabledesActions *= 1.05; break; case 11: m_VariabledesActions *= 1.06; break; case 12: m_VariabledesActions *= 1.07; break; } |