| CODE |
| ///////////////////////////////// // using Didi.Brain; // < ericmas@ouellet.com > // >> 20 novembre 2003 << ///////////////////////////////// using System; using Server.Mobiles; using Server.Items; namespace Server.Mobiles { [CorpseName( "a chicken corpse" )] public class Chicken : BaseCreature { [Constructable] public Chicken() : base( AIType.AI_Animal, FightMode.Agressor, 10, 1, 0.2, 0.4 ) { Name = "a chicken"; Body = 0xD0; BaseSoundID = 0x6E; SetStr( 5 ); SetDex( 15 ); SetInt( 5 ); SetHits( 3 ); SetMana( 0 ); SetDamage( 1 ); SetDamageType( ResistanceType.Physical, 100 ); SetResistance( ResistanceType.Physical, 1, 5 ); SetSkill( SkillName.MagicResist, 4.0 ); SetSkill( SkillName.Tactics, 5.0 ); SetSkill( SkillName.Wrestling, 5.0 ); Fame = 150; Karma = 0; VirtualArmor = 2; Tamable = true; ControlSlots = 1; MinTameSkill = -0.9; Timer PondTimer = new InternalTimer(this); PondTimer.Start(); } public override int Meat{ get{ return 1; } } public override MeatType MeatType{ get{ return MeatType.Bird; } } public override FoodType FavoriteFood{ get{ return FoodType.GrainsAndHay; } } public override int Feathers{ get{ return 25; } } public Chicken(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write((int) 0); } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); Timer PondTimer = new InternalTimer(this); PondTimer.Start(); } public class InternalTimer: Timer { private Chicken Poule; // public InternalTimer(Mobile p): base( TimeSpan.FromMinutes( 5.0), TimeSpan.FromMinutes( 5.0)) public InternalTimer(Mobile p): base( TimeSpan.FromMinutes( 60.0), TimeSpan.FromMinutes( 60.0)) { Priority = TimerPriority.FiftyMS; Poule = ((Chicken) p); } protected override void OnTick() { object oeuf = new Eggs(); Eggs spawn = (Eggs) Activator.CreateInstance(oeuf.GetType() ); spawn.Map = Poule.Map; spawn.Location = Poule.Location; } } } } |
| CODE |
| ///////////////////////////////// // using Didi.Brain; // < ericmas@ouellet.com > // >> 20 novembre 2003 << ///////////////////////////////// using System; using System.Text; using System.Reflection; using System.Collections; using Server; using Server.Misc; using Server.Mobiles; namespace Server.Mobiles { [CorpseName( "Cadavre de poussin" )] public class Poussin : BaseCreature { private Timer GrowTimer; private int GrowTime; // Il reste X heure avant qu'il devienne une poule [CommandProperty( AccessLevel.GameMaster )] public int GrowTimeLeft { get{return GrowTime;} set{GrowTime = value;} } [Constructable] public Poussin() : base( AIType.AI_Animal, FightMode.Agressor, 10, 1, 0.2, 0.4 ) { Name = "Poussin"; Body = 0x6; BaseSoundID = 27; Hue = 52; SetStr( 1 ); SetDex( 2 ); SetInt( 1 ); SetHits( 1 ); SetMana( 0 ); SetDamage( 1 ); SetDamageType( ResistanceType.Physical, 100 ); SetResistance( ResistanceType.Physical, 1, 5 ); SetSkill( SkillName.MagicResist, 4.0 ); SetSkill( SkillName.Tactics, 5.0 ); SetSkill( SkillName.Wrestling, 5.0 ); Fame = 150; Karma = 0; VirtualArmor = 2; Tamable = false; ControlSlots = 1; MinTameSkill = -0.9; // this.GrowTimeLeft = 3; this.GrowTimeLeft = 240; GrowTimer = new InternalTimer(this); GrowTimer.Start(); } public override int Meat{ get{ return 1; } } public override MeatType MeatType{ get{ return MeatType.Bird; } } public override FoodType FavoriteFood{ get{ return FoodType.GrainsAndHay; } } public override int Feathers{ get{ return 5; } } public Poussin(Serial serial) : base(serial) { } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 ); // version writer.Write( GrowTime ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 0: { GrowTime = reader.ReadInt(); GrowTimer = new InternalTimer(this); GrowTimer.Start(); break; } } } private class InternalTimer: Timer { private Poussin poussin; // public InternalTimer(Mobile p): base( TimeSpan.FromSeconds( 10.0), TimeSpan.FromSeconds( 10.0)) public InternalTimer(Mobile p): base( TimeSpan.FromMinutes( 30.0), TimeSpan.FromMinutes( 30.0)) { Priority = TimerPriority.FiftyMS; poussin = ((Poussin) p); } protected override void OnTick() { poussin.GrowTimeLeft--; if (poussin.GrowTimeLeft <= 0) { object poulet = new Chicken(); Mobile spawn = (Mobile) Activator.CreateInstance(poulet.GetType() ); spawn.Map = poussin.Map; spawn.Location = poussin.Location; poussin.Delete(); } } } } } |
| CODE |
| ///////////////////////////////// // using Didi.Brain; // < ericmas@ouellet.com > // >> 20 novembre 2003 << ///////////////////////////////// using System; using Server; using Server.Items; using Server.Gumps; using Server.Mobiles; using Server.Network; namespace Server.Items { public class Couveusenid : Item { private bool it_Oeuf; [CommandProperty( AccessLevel.GameMaster )] //accessible en jeu par .props public bool Oeuf { get{ return it_Oeuf;} set{ it_Oeuf = value;} } private bool it_Poule; [CommandProperty( AccessLevel.GameMaster )] //accessible en jeu par .props public bool Poule { get{ return it_Poule;} set{ it_Poule = value;} } private Point3D it_Debarquement; [CommandProperty( AccessLevel.GameMaster )] //accessible en jeu par .props public Point3D Debarquement { get{ return it_Debarquement;} set{ it_Debarquement = value;} } private int it_CouveTime; [CommandProperty( AccessLevel.GameMaster )] public int CouveTime { get{return it_CouveTime;} set{it_CouveTime = value;} } [Constructable] public Couveusenid() : base( 0x1ad5 ) { Weight = 5.0; Hue = 0x22c; Name = "Nid"; Timer CheckTime = new CheckTimer(this); CheckTime.Start(); } public Couveusenid( Serial serial ) : base( serial ) { } public override void OnDoubleClick( Mobile from ) { if( this.Movable ) { from.SendMessage( "L'objet doit etre fixer pour etre utiliser." ); return; } else if (! from.InRange( this.GetWorldLocation(), 2 )) { from.LocalOverheadMessage( MessageType.Regular, 906, 1019045 ); // I can't reach that. } else from.SendGump( new CouveuseGump(from ,this ) ); } public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 ); // version writer.Write( (bool) it_Poule); writer.Write( (bool) it_Oeuf); writer.Write( (Point3D) it_Debarquement); writer.Write( (int) it_CouveTime ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); it_Poule = reader.ReadBool(); it_Oeuf = reader.ReadBool(); it_Debarquement = reader.ReadPoint3D(); it_CouveTime = reader.ReadInt(); Timer CouveTimer = new InternalTimer(this); CouveTimer.Start(); Timer CheckTime = new CheckTimer(this); CheckTime.Start(); } public class InternalTimer: Timer { private Couveusenid Nid; private Point3D location; // public InternalTimer(Item c): base( TimeSpan.FromSeconds( 10.0), TimeSpan.FromSeconds( 10.0)) public InternalTimer(Item c): base( TimeSpan.FromMinutes( 30.0), TimeSpan.FromMinutes( 30.0)) { Priority = TimerPriority.FiftyMS; Nid = ((Couveusenid) c); } protected override void OnTick() { Nid.CouveTime--; if (Nid.CouveTime == 0 && Nid.Poule) { if (Nid.Debarquement == new Point3D(0,0,0)) location = Nid.Location; else location = Nid.Debarquement; object poulet = new Chicken(); object poussinet = new Poussin(); Mobile spawn = (Mobile) Activator.CreateInstance(poulet.GetType() ); spawn.Map = Nid.Map; spawn.Location = location; Mobile spawn2 = (Mobile) Activator.CreateInstance(poussinet.GetType() ); spawn2.Map = Nid.Map; spawn2.Location = location; Nid.Oeuf = false; Nid.Poule = false; Nid.Hue = 556; Nid.ItemID = 6869; Nid.Name = "Nid"; } } } public class CheckTimer: Timer { private Couveusenid Nid; private Point3D location; public CheckTimer(Item c): base( TimeSpan.FromSeconds( 0.1), TimeSpan.FromSeconds( 0.1)) // public CheckTimer(Item c): base( TimeSpan.FromMinutes( 30.0), TimeSpan.FromMinutes( 30.0)) { Priority = TimerPriority.FiftyMS; Nid = ((Couveusenid) c); } protected override void OnTick() { if (Nid.Movable) { Nid.Debarquement = new Point3D(0,0,0); Nid.Hue = 556; Nid.ItemID = 6869; Nid.Name = "Nid"; if (Nid.Oeuf) { object oeuf = new Eggs(); Eggs spawn = (Eggs) Activator.CreateInstance(oeuf.GetType() ); spawn.Map = Nid.Map; spawn.Location = Nid.Location; } Nid.Oeuf = false; if (Nid.Poule) { object poule = new Chicken(); Chicken spawn = (Chicken) Activator.CreateInstance(poule.GetType() ); spawn.Map = Nid.Map; spawn.Location = Nid.Location; } Nid.Poule = false; } } } } } |
| CODE |
| ///////////////////////////////// // using Didi.Brain; // < ericmas@ouellet.com > // >> 20 novembre 2003 << ///////////////////////////////// using System; using System.Reflection; using System.Collections; using Server; using Server.Items; using Server.Mobiles; using Server.Targeting; using Server.Network; using Server.Misc; namespace Server.Gumps { public class CouveuseGump : Gump { private PlayerMobile Player; private Couveusenid Nid; private string Etat; private int IdAction1; private int IdAction2; private int ActionNbr; private string Action1; private string Action2; private int heightsuppl; public void AddBlueBack( int width, int height ) { AddBackground ( 0, 0, width-00, height-00, 0xE10 ); AddBackground ( 8, 5, width-16, height-11, 0x053 ); AddImageTiled ( 15, 14, width-29, height-29, 0xE14 ); AddAlphaRegion( 15, 14, width-29, height-29 ); } public void AddButtonLabeled( int x, int y, int buttonID, string text ) { AddButton( x, y - 1, 4005, 4007, buttonID, GumpButtonType.Reply, 0x174 ); AddLabel( x+35, y, 0x174, ""+text+"" ); } public CouveuseGump(Mobile m ,Item item) : base ( 150, 120) { Nid = ((Couveusenid) item); Player = ((PlayerMobile) m); if (Nid.Oeuf && !Nid.Poule) { Etat = "En attente de poule couveuse"; IdAction1 = 2; IdAction2 = 3; ActionNbr = 2; Action1 = "Choisir une poule couveuse"; Action2 = "Ramasser les oeufs"; } else if (Nid.Oeuf && Nid.Poule) { Etat = "En couvaison"; IdAction1 = 4; ActionNbr = 1; Action1 = "Reprendre la poule"; } else if (!Nid.Oeuf && !Nid.Poule) { Etat = "Vide"; IdAction1 = 1; ActionNbr = 1; Action1 = "Déposer un oeuf"; } else { Etat = "Brisé"; IdAction1 = 5; ActionNbr = 1; Action1 = "Jeter le nid brisé"; } heightsuppl = 0; if(ActionNbr >= 2) { heightsuppl = 30; } // Fond AddBlueBack( 280, heightsuppl+213 ); //Titre AddLabel( 85, 20, 0x26, "Nid de couvaison" ); AddLabel( 35, 45, 0x55, "État:" ); AddLabel( 70, 45, 160, "" + Etat ); if(ActionNbr >= 1) { AddButtonLabeled(35,80,IdAction1,Action1); } if(ActionNbr >= 2) { AddButtonLabeled(35,110,IdAction2,Action2); } AddLabel(35,heightsuppl+110,0x55,"Où les poules debarqueront-t-elles ?"); AddImageTiled( 35, heightsuppl+140, 182, 23, 0x52 ); AddImageTiled( 36, heightsuppl+141, 180, 21, 0xBBC ); if (Nid.Debarquement == new Point3D(0,0,0)) AddLabelCropped( 46, heightsuppl+141, 160, 21, 0, "Non-Définie"); else AddLabelCropped( 46, heightsuppl+141, 160, 21, 0, "" + Nid.Debarquement); AddButtonLabeled(220,heightsuppl+141,6,""); AddLabel( 180, heightsuppl+176, 1, "Made by Didi" ); } public override void OnResponse(NetState sender, RelayInfo info) { int val = info.ButtonID; switch(val) { case 0: break; case 1: { if (!Nid.Deleted) { Container Pack = Player.Backpack; ArrayList list = new ArrayList( Pack.Items ); Item Oeuf = new Eggs(); Type OeufType = Oeuf.GetType(); int EggsNbr = 0; if (list.Count>1) { foreach ( Item item in list ) { Type ItemType = item.GetType(); if ( ItemType == OeufType && EggsNbr <=0) { item.Delete(); EggsNbr++; } } if ( EggsNbr == 1) { Player.SendMessage("Vous déposez l'oeuf dans le nid"); Nid.Oeuf = true; Nid.ItemID = 6868; Nid.Name = "Nid avec un oeuf"; } else Player.SendMessage("Vous ne trouvez pas d'oeufs dans votre sac"); } Player.SendGump( new CouveuseGump(Player ,Nid ) ); Oeuf.Delete(); } break; } case 2: { if (!Nid.Deleted) { Player.SendMessage("Pointez la poule qui couvera l'oeuf"); Player.Target = new PouleTarget(Player,Nid); } break; } case 3: { if (!Nid.Deleted) { Nid.Oeuf = false; Nid.ItemID = 6869; Nid.Name = "Nid"; Player.AddToBackpack( new Eggs() ); Player.SendGump( new CouveuseGump(Player ,Nid ) ); Player.SendMessage("Vous déposez les oeufs dans votre sac"); } break; } case 4: { if (!Nid.Deleted) { Nid.Poule = false; Nid.Hue = 556; Nid.Name = "Nid avec un oeuf"; object poulet = new Chicken(); Mobile spawn = (Mobile) Activator.CreateInstance(poulet.GetType() ); spawn.Map = Player.Map; spawn.Location = Player.Location; Player.SendMessage("Vous déposez la poule a vos pieds"); Player.SendGump( new CouveuseGump(Player ,Nid ) ); } break; } case 5: { if (!Nid.Deleted) { Nid.Delete(); } break; } case 6: { if (!Nid.Deleted) { Player.Target = new LocationTarget(Player,Nid); Player.SendMessage("Choisissez l'endroit ou débarquerons la poule et le poussin"); } break; } } } } public class LocationTarget : Target { private Couveusenid Nid; private PlayerMobile Player; public LocationTarget(Mobile m, Item item) : base(10,true,TargetFlags.None) { Nid = ((Couveusenid) item); Player = ((PlayerMobile) m); } protected override void OnTarget(Mobile m, object targ) { IPoint3D p = targ as IPoint3D; Nid.Debarquement = new Point3D( p ); Player.SendGump( new CouveuseGump(Player ,Nid ) ); } } public class PouleTarget : Target { private Couveusenid Nid; private PlayerMobile Player; public PouleTarget(Mobile m, Item item) : base(10,true,TargetFlags.None) { Nid = ((Couveusenid) item); Player = ((PlayerMobile) m); } protected override void OnTarget(Mobile m, object targ) { if(targ is Chicken ) { Chicken Poule = targ as Chicken; Poule.Delete(); Nid.Poule = true; Nid.Hue = 40; Nid.Name = "Nid en couvaison"; // Nid.CouveTime = 5; Nid.CouveTime = 144; Timer CouveTimer = new Server.Items.Couveusenid.InternalTimer(Nid); CouveTimer.Start(); Player.SendGump( new CouveuseGump(Player ,Nid ) ); } else { Player.SendMessage("Ceci n'est pas une poule"); Player.SendGump( new CouveuseGump(Player ,Nid ) ); } } } } |