Advertisement
Guest User

Vorspire

a guest
Jul 7th, 2009
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.99 KB | None | 0 0
  1. #define RUNUO_2 //Comment this out to enable RunUO 1.0 Mode
  2.  
  3. using System;
  4. using Server;
  5. using Server.Items;
  6. using Server.Mobiles;
  7. using Server.Network;
  8.  
  9. namespace Server.Touring
  10. {
  11.     public class TourGuide : Mobile
  12.     {
  13.         public override bool ClickTitle { get { return false; } }
  14.  
  15.         [Constructable]
  16.         public TourGuide(Destination dest)
  17.         {
  18.             SpeechHue = 0x55;
  19.  
  20.             Hidden = true;
  21.             Blessed = true;
  22.             CantWalk = true;
  23.             Frozen = true;
  24.  
  25.             if (Utility.RandomBool())
  26.             {
  27.                 BodyValue = 401;
  28.                 Female = true;
  29.                 Name = NameList.RandomName("female");
  30.             }
  31.             else
  32.             {
  33.                 BodyValue = 400;
  34.                 Female = false;
  35.                 Name = NameList.RandomName("male");
  36.             }
  37.  
  38.             Title = "the tour guide";
  39.  
  40.             Dress();
  41.  
  42.             bool esc = false;
  43.             Point3D loc = new Point3D(0, 0, 0);
  44.  
  45.             for (int x = dest.Location.X - 2; x < dest.Location.X + 2; x++)
  46.             {
  47.                 for (int y = dest.Location.Y - 2; y < dest.Location.Y + 2; y++)
  48.                 {
  49.                     Point3D test = new Point3D(x, y, dest.Location.Z);//dest.Map.GetAverageZ(x, y));
  50.  
  51.                     if (test == dest.Location)
  52.                         continue;
  53.  
  54.                     if (dest.Map.CanSpawnMobile(test))
  55.                     {
  56.                         loc = test;
  57.                         esc = true;
  58.                         break;
  59.                     }
  60.                 }
  61.  
  62.                 if (esc)
  63.                     break;
  64.             }
  65.  
  66.             if (!Server.Spells.SpellHelper.IsInvalid(dest.Map, loc) && loc != new Point3D(0, 0, 0))
  67.                 MoveToWorld(loc, dest.Map);
  68.             else
  69.                 Delete();
  70.         }
  71.  
  72.         public void ShowTo(Mobile m)
  73.         {
  74.             if (m == null || m.Deleted)
  75.                 return;
  76.  
  77.             if (m is PlayerMobile)
  78.             {
  79.                 PlayerMobile pm = (PlayerMobile)m;
  80.  
  81.                 if (pm.NetState == null)
  82.                     return;
  83.  
  84.                 MobileUpdate p1 = new MobileUpdate(this);
  85.                 MobileIncoming p2 = new MobileIncoming(pm, this);
  86.  
  87.                 pm.NetState.Send(p1);
  88.                 pm.NetState.Send(p2);
  89.             }
  90.  
  91.             Direction = GetDirectionTo(m.Location);
  92.         }
  93.  
  94.         private int GetRandomHue()
  95.         {
  96.             switch (Utility.Random(6))
  97.             {
  98.                 default:
  99.                 case 0: return 0;
  100.                 case 1: return Utility.RandomBlueHue();
  101.                 case 2: return Utility.RandomGreenHue();
  102.                 case 3: return Utility.RandomRedHue();
  103.                 case 4: return Utility.RandomYellowHue();
  104.                 case 5: return Utility.RandomNeutralHue();
  105.             }
  106.         }
  107.  
  108.         private void Dress()
  109.         {
  110.             if (Female)
  111.                 AddItem(new PlainDress());
  112.             else
  113.                 AddItem(new Shirt(GetRandomHue()));
  114.  
  115.             int lowHue = GetRandomHue();
  116.  
  117.             AddItem(new ShortPants(lowHue));
  118.  
  119.             if (Female)
  120.                 AddItem(new Boots(lowHue));
  121.             else
  122.                 AddItem(new Shoes(lowHue));
  123.  
  124. #if(RUNUO_2)
  125.             Utility.AssignRandomHair(this);
  126. #else
  127.             AddItem(new FloppyHat());
  128. #endif
  129.         }
  130.  
  131.         public TourGuide(Serial serial)
  132.             : base(serial)
  133.         { }
  134.  
  135.         public override void Serialize(GenericWriter writer)
  136.         {
  137.             base.Serialize(writer);
  138.  
  139.             writer.Write((int)0); // version
  140.         }
  141.  
  142.         public override void Deserialize(GenericReader reader)
  143.         {
  144.             base.Deserialize(reader);
  145.  
  146.             int version = reader.ReadInt();
  147.  
  148.             switch (version)
  149.             {
  150.                 case 0: { Delete(); } break;
  151.             }
  152.         }
  153.  
  154.         public override bool OnMoveOver(Mobile m)
  155.         {
  156.             return true;
  157.         }
  158.     }
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement