| CODE |
| /* ce pnj est fait pour recevoir 10 "shards" qui sont un objet composant d'une quete la difference par rapport a un pnj normal c'est qu'il aura une prorpiete en plus (nombre de shards recus) il aura aussi une methode OnSpeech qui va permettre le dialogue avec les joueurs et une methode OnDragDrop qui permettra de traiter les objets recus */ using System; using System.Collections; using Server; using Server.Network; using Server.Items; namespace Server.Mobiles { public class Tristal : BaseCreature { private int m_Shards = 0; //Propriete pour les "shards" recus [CommandProperty( AccessLevel.GameMaster )] //Acces a la propriete public int Shards { get { return m_Shards; } set { m_Shards = value; InvalidateProperties(); } } [Constructable] //constructeur de pnj basique public Tristal() : base( AIType.AI_Mage, FightMode.Agressor, 22, 1, 0.2, 1.0 ) { InitStats( 100, 100, 25 ); //stats et initialisations, vetements Name = "Tristal"; //couleur des paroles etc Title = "the mage"; Hue = 1010; Blessed = true; CantWalk = true; NameHue = 0x35; SpeechHue = Utility.RandomList( 0x57, 0x67, 0x77, 0x87, 0x117 ); Body = 0x190; AddItem( new FancyShirt() ); AddItem( new WizardsHat( 1172 ) ); AddItem( new Sandals( 1 ) ); AddItem( new Robe( 1172 ) ); AddItem( new PonyTail( 88 ) ); AddItem( new GnarledStaff() ); } public override bool ClickTitle{ get{ return false; } } public Tristal( Serial serial ) : base( serial ) { } public override void Serialize( GenericWriter writer ) //la seule serialisation est bien sur le nombre de shards { base.Serialize( writer ); writer.Write( (int) 0 ); // version writer.Write( (int) m_Shards ); } public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); int m_Shards = reader.ReadInt(); } public override void OnSpeech( SpeechEventArgs args ) //gestion de la parole { base.OnSpeech( args ); Mobile from = args.Mobile; if( args.Mobile.InRange( this, 4 ) && !args.Handled ) //verification si a portee { if ( args.HasKeyword( 0xE ) ) // *quest* //si il parle de *quest* { args.Handled = true; //Reponse du pnj a la question base.SayTo( from, true, "I am greatly interested in strange rock that fell near Yew."); base.SayTo( from, true, "Bring me any kind of research you can gather."); } } } public override bool OnDragDrop( Mobile from, Item dropped ) //reception d'objets { if ( dropped is MeteorCrystalShard ) //si l'objet est MeteorCrystalShard on repond et on fait des choses (recompenses...) { Shards++; if ( Shards < 5 ) { Say( true, "Good work. This will help some but I will need more to finish my research." ); } else { Say( true, "Excellent! All I need now is a Ice Diamond to cut it with." ); Say( true, "The only place I know where those come from is a wyrm's nest." ); } BankCheck check = new BankCheck( 10000 ); from.BankBox.DropItem( check ); from.SendLocalizedMessage( 1042764, "10000" ); return true; } else //si l'objet n'est pas ce qu on attends, on envoie au diable :) { SayTo( from, true, "That will not aid my research." ); return false; } } } } |
| CODE |
if ( !args.Handled && Insensitive.Equals( args.Speech, "Quete" ) ) //remplacer le mot quete { base.SayTo( from, true, "Je recherche 10 shard" ); base.SayTo( from, true, "J'ai {0} shard en ma possession.", Convert.ToString(m_Shards)); args.Handled = true; //Reponse du pnj a la question } |
| CODE |
private int m_Shard; //Bounty [CommandProperty( AccessLevel.GameMaster )] //Bounty public int Shards //Bounty { //Bounty get{ return m_Shard; } //Bounty set{ m_Shard = value; } //Bounty } //Bounty |
| CODE |
case 6: { m_Shard = reader.ReadInt(); //Bounty NextTailorBulkOrder = reader.ReadTimeSpan(); goto case 5; } |
| CODE |
writer.Write( (int) m_Shard ); //Bounty writer.Write( NextTailorBulkOrder ); |
| CODE |
m_Shard = reader.ReadInt(); //Bounty NextSmithBulkOrder = reader.ReadTimeSpan(); goto case 4; |
| CODE |
private int m_Shards = 0; //Propriete pour les "shards" recus [CommandProperty( AccessLevel.GameMaster )] //Acces a la propriete public int Shards { get { return m_Shards; } set { m_Shards = value; InvalidateProperties(); } } |
| CODE |
public override bool OnDragDrop( Mobile from, Item dropped ) //reception d'objets { if ( dropped is MeteorCrystalShard ) //si l'objet est MeteorCrystalShard on repond et on fait des choses (recompenses...) { if (from != null) //Modification PlayerMobile player = (PlayerMobile) from; //Modification player.Shards++; //Modification if ( player.Shards < 5 ) //Modification { Say( true, "Good work. This will help some but I will need more to finish my research." ); } else { Say( true, "Excellent! All I need now is a Ice Diamond to cut it with." ); Say( true, "The only place I know where those come from is a wyrm's nest." ); } BankCheck check = new BankCheck( 10000 ); from.BankBox.DropItem( check ); from.SendLocalizedMessage( 1042764, "10000" ); player.Shards = 0; //Modification return true; } else //si l'objet n'est pas ce qu on attends, on envoie au diable :) { SayTo( from, true, "That will not aid my research." ); return false; } } //Modification } |
| CODE |
public override void OnSpeech( SpeechEventArgs e ) { if ((e.Speech == "heal") || (e.Speech =="Heal")) { m_RessurectTimer.Stop(); m_RessurectTimer.Delay = TimeSpan.FromSeconds( Utility.Random(1, 5) ); m_RessurectTimer.Start(); } } |