Beispiel #1
0
 private static void Prompt_ASCII(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     int prompt = pvSrc.ReadInt32();
     int num3 = pvSrc.ReadInt32();
     string text = pvSrc.ReadString().Trim();
     Engine.Prompt = new ASCIIPrompt(serial, prompt, text);
 }
Beispiel #2
0
 private static void Command_Damage(PacketReader pvSrc)
 {
     if (pvSrc.ReadByte() != 1)
     {
         pvSrc.Trace();
     }
     Mobile m = World.FindMobile(pvSrc.ReadInt32());
     if (m != null)
     {
         int damage = pvSrc.ReadByte();
         if (damage > 0)
         {
             Gumps.Desktop.Children.Add(new GDamageLabel(damage, m));
         }
     }
 }
Beispiel #3
0
 private static void Command_EquipInfo(PacketReader pvSrc)
 {
     if (Engine.Features.AOS)
     {
         int serial = pvSrc.ReadInt32();
         int num2 = pvSrc.ReadInt32();
         Item item = World.FindItem(serial);
         if (item != null)
         {
             item.PropertyID = num2;
             if (((item.Parent != null) && ((item.Parent.ID & 0x3fff) == 0x2006)) && (item.PropertyList == null))
             {
                 item.QueryProperties();
             }
         }
         Mobile mobile = World.FindMobile(serial);
         if (mobile != null)
         {
             mobile.PropertyID = num2;
         }
     }
     else
     {
         int num5;
         IFont uniFont = Engine.GetUniFont(3);
         IHue bright = Hues.Bright;
         int num3 = pvSrc.ReadInt32();
         int number = pvSrc.ReadInt32();
         AddMessage(num3, uniFont, bright, 6, "You see", Localization.GetString(number));
         ArrayList dataStore = Engine.GetDataStore();
         while (!pvSrc.Finished && ((num5 = pvSrc.ReadInt32()) != -1))
         {
             if (num5 < 0)
             {
                 switch (num5)
                 {
                     case -4:
                     {
                         AddMessage(num3, uniFont, bright, 6, "", "[" + Localization.GetString(0xfd6b0) + "]");
                         continue;
                     }
                     case -3:
                     {
                         int fixedLength = pvSrc.ReadInt16();
                         string str = pvSrc.ReadString(fixedLength).Trim();
                         if (str.Length > 0)
                         {
                             AddMessage(num3, uniFont, bright, 6, "", Localization.GetString(0xfd2d1) + " " + str);
                         }
                         continue;
                     }
                 }
                 Engine.ReleaseDataStore(dataStore);
                 pvSrc.Trace();
                 Engine.AddTextMessage(string.Format("Unknown sub message : {0}", num5));
                 return;
             }
             int num7 = pvSrc.ReadInt16();
             if (num7 != -1)
             {
                 dataStore.Add(Localization.GetString(num5) + ": " + num7);
             }
             else
             {
                 dataStore.Add(Localization.GetString(num5));
             }
         }
         if (dataStore.Count > 0)
         {
             StringBuilder builder = new StringBuilder();
             builder.Append('[');
             for (int i = 0; i < dataStore.Count; i++)
             {
                 builder.Append(dataStore[i]);
                 if (i != (dataStore.Count - 1))
                 {
                     builder.Append('/');
                 }
             }
             builder.Append(']');
             AddMessage(num3, uniFont, bright, 6, "", builder.ToString());
         }
         if (!pvSrc.Finished)
         {
             pvSrc.Trace();
         }
         Engine.ReleaseDataStore(dataStore);
     }
 }
Beispiel #4
0
 private static void CharacterList(PacketReader pvSrc)
 {
     bool flag;
     byte num = pvSrc.ReadByte();
     Cursor.Hourglass = false;
     Engine.CharacterCount = num;
     string[] strArray = Engine.CharacterNames = new string[5];
     int num2 = 0;
     for (int i = 0; i < 5; i++)
     {
         Engine.CharacterNames[i] = strArray[i] = pvSrc.ReadString(60);
         if (strArray[i].Length > 0)
         {
             num2++;
         }
     }
     pvSrc.ReadString(60);
     int num4 = pvSrc.ReadByte();
     while (--num4 >= 0)
     {
         byte num5 = pvSrc.ReadByte();
         string str = pvSrc.ReadString(0x1f);
         string str2 = pvSrc.ReadString(0x1f);
     }
     if (!pvSrc.Finished)
     {
         int num6 = pvSrc.ReadInt32();
         Engine.ServerFeatures.SingleChar = (num6 & 4) != 0;
         Engine.ServerFeatures.ContextMenus = (num6 & 8) != 0;
         Engine.ServerFeatures.AOS = (num6 & 0x20) != 0;
         if ((num6 & 4) != 0)
         {
             flag = num2 < 1;
         }
         else
         {
             flag = num2 < 5;
         }
     }
     else
     {
         flag = num2 < 5;
     }
     if (Engine.m_QuickLogin)
     {
         CharacterProfile charProfile = Engine.m_QuickEntry.CharProfile;
         if (charProfile != null)
         {
             ShardProfile shard = charProfile.Shard;
             for (int j = 0; j < 5; j++)
             {
                 string name = Engine.CharacterNames[j];
                 if (name.Length > 0)
                 {
                     CharacterProfile profile3 = null;
                     for (int k = 0; (profile3 == null) && (k < shard.Characters.Length); k++)
                     {
                         if (shard.Characters[k].Index == j)
                         {
                             profile3 = shard.Characters[k];
                         }
                     }
                     if (profile3 != null)
                     {
                         profile3.Name = name;
                     }
                     else
                     {
                         shard.AddCharacter(new CharacterProfile(shard, name, j));
                     }
                 }
                 else
                 {
                     CharacterProfile character = null;
                     for (int m = 0; (character == null) && (m < shard.Characters.Length); m++)
                     {
                         if (shard.Characters[m].Index == j)
                         {
                             character = shard.Characters[m];
                         }
                     }
                     if (character != null)
                     {
                         shard.RemoveCharacter(character);
                     }
                 }
             }
             Array.Sort(shard.Characters, new CharacterComparer());
             Timer timer = new Timer(new OnTick(PacketHandlers.Update_OnTick), 0, 1);
             timer.SetTag("shard", shard);
             timer.Start(false);
         }
         QuickLogin.Add(Engine.m_QuickEntry);
         Network.Send(new PCharSelect(Engine.m_QuickEntry.CharName, Engine.m_QuickEntry.CharID));
         if (Animations.IsLoading)
         {
             Gumps.Desktop.Children.Clear();
             xGumps.Display("AnimationLoad");
             do
             {
                 Engine.DrawNow();
             }
             while (!Animations.WaitLoading());
         }
         Gumps.Desktop.Children.Clear();
         xGumps.Display("EnterBritannia");
         Engine.DrawNow();
     }
     else
     {
         xGumps.SetVariable("CharSlotAvailable", flag ? "1" : "0");
         Gumps.Desktop.Children.Clear();
         xGumps.Display("CharacterList");
         int index = 0;
         int num11 = 0;
         while (index < 5)
         {
             if (strArray[index].Length > 0)
             {
                 xGumps.SetVariable("CharName", strArray[index]);
                 xGumps.SetVariable("CharDisplayIndex", num11++.ToString());
                 xGumps.SetVariable("CharIndex", index.ToString());
                 xGumps.Display("CharacterEntry", "CharacterList");
             }
             index++;
         }
     }
 }
Beispiel #5
0
 private static void Command_CloseDialog(PacketReader pvSrc)
 {
     int num = pvSrc.ReadInt32();
     int buttonID = pvSrc.ReadInt32();
     Gump[] gumpArray = Gumps.Desktop.Children.ToArray();
     for (int i = 0; i < gumpArray.Length; i++)
     {
         if (gumpArray[i] is GServerGump)
         {
             GServerGump g = (GServerGump) gumpArray[i];
             if (g.DialogID == num)
             {
                 GServerGump.SetCachedLocation(g.DialogID, g.X, g.Y);
                 Gumps.Destroy(g);
                 Network.Send(new PGumpButton(g, buttonID));
             }
         }
     }
 }
Beispiel #6
0
 private static void Book_PageInfo(PacketReader pvSrc)
 {
     int num = pvSrc.ReadInt32();
     int num2 = pvSrc.ReadUInt16();
 }
Beispiel #7
0
 private static void BulletinBoard_SetBody(PacketReader pvSrc)
 {
     Item board = World.FindItem(pvSrc.ReadInt32());
     if (board != null)
     {
         Item item2 = World.WantItem(pvSrc.ReadInt32());
         if (item2 != null)
         {
             int serial = pvSrc.ReadInt32();
             Item thread = null;
             if (serial >= 0x40000000)
             {
                 thread = World.WantItem(serial);
             }
             string poster = BulletinBoard_ReadString(pvSrc);
             string subject = BulletinBoard_ReadString(pvSrc);
             string time = BulletinBoard_ReadString(pvSrc);
             item2.BulletinHeader = new BBMessageHeader(board, thread, poster, subject, time);
             int body = pvSrc.ReadUInt16();
             int hue = pvSrc.ReadUInt16();
             BBPAItem[] items = new BBPAItem[pvSrc.ReadByte()];
             for (int i = 0; i < items.Length; i++)
             {
                 items[i].ItemID = pvSrc.ReadUInt16();
                 items[i].Hue = pvSrc.ReadUInt16();
             }
             string[] lines = new string[pvSrc.ReadByte()];
             for (int j = 0; j < lines.Length; j++)
             {
                 lines[j] = BulletinBoard_ReadString(pvSrc);
             }
             item2.BulletinBody = new BBMessageBody(new BBPosterAppearance(body, hue, items), lines);
         }
     }
 }
Beispiel #8
0
 private static void SecureTrade_Check(int serial, PacketReader pvSrc)
 {
     bool flag = pvSrc.ReadInt32() != 0;
     bool flag2 = pvSrc.ReadInt32() != 0;
     Item item = World.FindItem(serial);
     if (item != null)
     {
         item.TradeCheck1 = flag;
         item.TradeCheck2 = flag2;
         if (item.Container != null)
         {
             Gump gump = item.Container.Gump;
             if (gump != null)
             {
                 ((GSecureTradeCheck) gump.GetTag("Check1")).Checked = flag;
                 ((GSecureTradeCheck) gump.GetTag("Check2")).Checked = flag2;
             }
         }
     }
 }
Beispiel #9
0
 private static void SecureTrade_Open(int serial, PacketReader pvSrc)
 {
     string str;
     string str2;
     int num = pvSrc.ReadInt32();
     int num2 = pvSrc.ReadInt32();
     bool flag = pvSrc.ReadBoolean();
     Mobile player = World.Player;
     Mobile mobile2 = World.FindMobile(serial);
     if (((player == null) || ((str = player.Name) == null)) || ((str = str.Trim()).Length <= 0))
     {
         str = "Me";
     }
     if (flag)
     {
         str2 = pvSrc.ReadString();
     }
     else if (((mobile2 == null) || ((str2 = mobile2.Name) == null)) || ((str2 = str2.Trim()).Length <= 0))
     {
         str2 = "Them";
     }
     GSecureTrade toAdd = new GSecureTrade(num, null, str, str2);
     IFont uniFont = Engine.GetUniFont(1);
     IHue hue = Hues.Load(1);
     IHue hue2 = Hues.Load(0);
     Item item = World.WantItem(num);
     GSecureTradeCheck partner = new GSecureTradeCheck(250, 2, null, null);
     GSecureTradeCheck check2 = new GSecureTradeCheck(2, 2, item, partner);
     toAdd.Children.Add(check2);
     toAdd.Children.Add(partner);
     IContainer container = new GContainer(item, 0x52, hue2);
     toAdd.m_Container = container.Gump;
     container.Gump.X = 13;
     container.Gump.Y = 0x21;
     ((GContainer) container).m_TradeContainer = true;
     container.Gump.SetTag("Check1", check2);
     container.Gump.SetTag("Check2", partner);
     toAdd.Children.Add(container.Gump);
     item.Container = container;
     Item item2 = World.WantItem(num2);
     IContainer container2 = new GContainer(item2, 0x52, hue2) {
         Gump = { X = 0x8e, Y = 0x21 }
     };
     container2.Gump.SetTag("Check1", check2);
     container2.Gump.SetTag("Check2", partner);
     ((GContainer) container2).m_HitTest = false;
     ((GContainer) container2).m_TradeContainer = true;
     toAdd.Children.Add(container2.Gump);
     item2.Container = container2;
     if (Engine.Features.AOS)
     {
         toAdd.Tooltip = new ItemTooltip(item2);
     }
     Gumps.Desktop.Children.Add(toAdd);
 }
Beispiel #10
0
 private static void ScrollMessage(PacketReader pvSrc)
 {
     int num = pvSrc.ReadByte();
     int num2 = pvSrc.ReadInt32();
     string text = pvSrc.ReadString(pvSrc.ReadUInt16());
     if (text != "MISSING UPDATE")
     {
         Gumps.Desktop.Children.Add(new GUpdateScroll(text));
     }
 }
Beispiel #11
0
        private static void SecureTrade(PacketReader pvSrc)
        {
            byte num = pvSrc.ReadByte();
            int serial = pvSrc.ReadInt32();
            switch (num)
            {
                case 0:
                    pvSrc.ReturnName = "Initiate Secure Trade";
                    SecureTrade_Open(serial, pvSrc);
                    break;

                case 1:
                    pvSrc.ReturnName = "Close Secure Trade";
                    SecureTrade_Close(serial, pvSrc);
                    break;

                case 2:
                    pvSrc.ReturnName = "Update Secure Trade Status";
                    SecureTrade_Check(serial, pvSrc);
                    break;

                default:
                    pvSrc.Trace();
                    break;
            }
        }
Beispiel #12
0
 private static void PropertyListHash(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     int num2 = pvSrc.ReadInt32();
     Item item = World.FindItem(serial);
     if (item != null)
     {
         item.PropertyID = num2;
         if (((item.Parent != null) && ((item.Parent.ID & 0x3fff) == 0x2006)) && (item.PropertyList == null))
         {
             item.QueryProperties();
         }
     }
     Mobile mobile = World.FindMobile(serial);
     if (mobile != null)
     {
         mobile.PropertyID = num2;
     }
 }
Beispiel #13
0
 private static void PropertyListContent(PacketReader pvSrc)
 {
     int num = pvSrc.ReadUInt16();
     int serial = pvSrc.ReadInt32();
     int num3 = pvSrc.ReadByte();
     int num4 = pvSrc.ReadByte();
     int number = pvSrc.ReadInt32();
     if (((num != 1) || (num3 != 0)) || (num4 != 0))
     {
         pvSrc.Trace();
     }
     ArrayList dataStore = Engine.GetDataStore();
     while (true)
     {
         int num6 = pvSrc.ReadInt32();
         if (num6 == 0)
         {
             break;
         }
         int length = pvSrc.ReadUInt16();
         string arguments = Encoding.Unicode.GetString(pvSrc.ReadBytes(length));
         dataStore.Add(new ObjectProperty(num6, arguments));
     }
     ObjectPropertyList list2 = new ObjectPropertyList(serial, number, (ObjectProperty[]) dataStore.ToArray(typeof(ObjectProperty)));
     Engine.ReleaseDataStore(dataStore);
     Item item = World.FindItem(serial);
     if (item != null)
     {
         item.PropertyID = number;
     }
     Mobile mobile = World.FindMobile(serial);
     if (mobile != null)
     {
         mobile.PropertyID = number;
     }
     if (item != null)
     {
         object parent = item;
         bool flag = false;
         while (parent != null)
         {
             if (!(parent is Item))
             {
                 break;
             }
             Item item2 = (Item) parent;
             if (((item2.Container != null) && (item2.Container.Gump is GContainer)) && ((GContainer) item2.Container.Gump).m_TradeContainer)
             {
                 flag = true;
             }
             if (flag)
             {
                 break;
             }
             parent = item2.Parent;
         }
         if (flag && (parent is Item))
         {
             Item item3 = (Item) parent;
             if ((item3.Container != null) && (item3.Container.Gump.Tooltip is ItemTooltip))
             {
                 GObjectProperties gump = ((ItemTooltip) item3.Container.Gump.Tooltip).Gump as GObjectProperties;
                 if (gump != null)
                 {
                     gump.SetList(0xf9060 + (item3.ID & 0x3fff), item3.PropertyList);
                 }
             }
         }
     }
 }
Beispiel #14
0
 private static void Prompt_Unicode(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     int prompt = pvSrc.ReadInt32();
     int num3 = pvSrc.ReadInt32();
     pvSrc.Seek(4, SeekOrigin.Current);
     string text = "";
     if (pvSrc.ReadInt16() != 0)
     {
         pvSrc.Trace();
         pvSrc.Seek(-2, SeekOrigin.Current);
         text = pvSrc.ReadUnicodeLEString();
     }
     Engine.Prompt = new UnicodePrompt(serial, prompt, text);
 }
Beispiel #15
0
 private static void WorldItem(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     int itemID = pvSrc.ReadUInt16();
     int num3 = ((serial & 0x80000000L) != 0L) ? pvSrc.ReadInt16() : 0;
     if ((itemID & 0x8000) != 0)
     {
         itemID &= 0x7fff;
         itemID += pvSrc.ReadSByte();
     }
     int num4 = pvSrc.ReadInt16();
     int num5 = pvSrc.ReadInt16();
     bool flag2 = (num4 & 0x8000) != 0;
     bool flag3 = (num5 & 0x8000) != 0;
     bool flag4 = (num5 & 0x4000) != 0;
     int num6 = flag2 ? pvSrc.ReadByte() : 0;
     int num7 = pvSrc.ReadSByte();
     int hue = flag3 ? pvSrc.ReadUInt16() : 0;
     int num9 = flag4 ? pvSrc.ReadByte() : 0;
     serial &= 0x7fffffff;
     num4 &= 0x7fff;
     num5 &= 0x3fff;
     bool wasFound = false;
     Item i = World.WantItem(serial, ref wasFound);
     bool isMulti = i.IsMulti;
     i.IsMulti = itemID >= 0x4000;
     int id = 0;
     if (i.IsMulti)
     {
         id = itemID & 0x3fff;
         Engine.Multis.Register(i, id);
         itemID = 1;
     }
     else if (isMulti)
     {
         Engine.Multis.Unregister(i);
     }
     Engine.ItemArt.Translate(ref itemID, ref hue);
     itemID &= 0x3fff;
     i.SetLocation((short) num4, (short) num5, (short) num7);
     i.ID = (short) itemID;
     i.Amount = (short) num3;
     i.Direction = (byte) num6;
     i.Hue = (ushort) hue;
     i.Flags.Value = num9;
     if ((!i.Visible && (i.IsCorpse || i.IsBones)) && World.CharData.IncomingNames)
     {
         i.Look();
     }
     i.Visible = true;
     i.InWorld = true;
     if (i.IsEquip)
     {
         i.RemoveEquip();
     }
     if (i.Parent != null)
     {
         i.Parent.RemoveItem(i);
     }
     if ((itemID == 0x2006) && (i.CorpseSerial != 0))
     {
         Mobile mobile = World.FindMobile(i.CorpseSerial);
         if (mobile != null)
         {
             i.Direction = mobile.Direction;
             i.Visible = false;
         }
     }
     i.Update();
     if (i.IsMulti && Engine.GMPrivs)
     {
         Engine.AddTextMessage(string.Format("House serial: 0x{0:X}", serial));
     }
 }
Beispiel #16
0
 private static void SelectHue(PacketReader pvSrc)
 {
     GItemArt art;
     int num = pvSrc.ReadInt32();
     short num2 = pvSrc.ReadInt16();
     short itemID = pvSrc.ReadInt16();
     GAlphaBackground background = new GAlphaBackground(0, 0, 0xf4, 110) {
         m_NonRestrictivePicking = true
     };
     background.Center();
     art = new GItemArt(0xb7, 3, itemID) {
         X = art.X + (((0x3a - (art.Image.xMax - art.Image.xMin)) / 2) - art.Image.xMin),
         Y = art.Y + (((0x52 - (art.Image.yMax - art.Image.yMin)) / 2) - art.Image.yMin)
     };
     background.Children.Add(art);
     GHuePicker toAdd = new GHuePicker(4, 4) {
         Brightness = 1
     };
     toAdd.SetTag("ItemID", (int) itemID);
     toAdd.SetTag("Item Art", art);
     toAdd.SetTag("Dialog", background);
     toAdd.OnHueSelect = new OnHueSelect(Engine.HuePicker_OnHueSelect);
     background.Children.Add(toAdd);
     background.Children.Add(new GSingleBorder(3, 3, 0xa2, 0x52));
     background.Children.Add(new GSingleBorder(0xa4, 3, 0x11, 0x52));
     GBrightnessBar bar = new GBrightnessBar(0xa5, 4, 15, 80, toAdd);
     background.Children.Add(bar);
     bar.Refresh();
     GFlatButton button = new GFlatButton(0x7b, 0x57, 0x3a, 20, "Picker", new OnClick(Engine.HuePickerPicker_OnClick));
     GFlatButton okay = new GFlatButton(0xb7, 0x57, 0x3a, 20, "Okay", new OnClick(Engine.HuePickerOk_OnClick));
     okay.SetTag("Hue Picker", toAdd);
     okay.SetTag("Dialog", background);
     okay.SetTag("Serial", num);
     okay.SetTag("ItemID", itemID);
     okay.SetTag("Relay", num2);
     button.SetTag("Hue Picker", toAdd);
     button.SetTag("Brightness Bar", bar);
     background.Children.Add(new GQuickHues(toAdd, bar, okay));
     background.Children.Add(button);
     background.Children.Add(okay);
     Gumps.Desktop.Children.Add(background);
     Engine.HuePicker_OnHueSelect(toAdd.Hue, toAdd);
 }
Beispiel #17
0
 private static void Book_Open(PacketReader pvSrc)
 {
     int num = pvSrc.ReadInt32();
     bool flag = pvSrc.ReadBoolean();
     bool flag2 = pvSrc.ReadBoolean();
     int num2 = pvSrc.ReadInt16();
     int fixedLength = pvSrc.ReadInt16();
     string str = pvSrc.ReadString(fixedLength);
     int num4 = pvSrc.ReadInt16();
     string str2 = pvSrc.ReadString(num4);
     m_BookTitle = str;
     m_BookAuthor = str2;
     Engine.AddTextMessage("Books are not currently supported.");
 }
Beispiel #18
0
 private static void SellContent(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     int num2 = pvSrc.ReadInt16();
     SellInfo[] info = new SellInfo[num2];
     bool flag = false;
     for (int i = 0; i < num2; i++)
     {
         Item item = World.WantItem(pvSrc.ReadInt32());
         info[i] = new SellInfo(item, pvSrc.ReadInt16(), pvSrc.ReadUInt16(), pvSrc.ReadUInt16(), pvSrc.ReadUInt16(), pvSrc.ReadString(pvSrc.ReadUInt16()));
     }
     if (flag)
     {
         Engine.AddTextMessage("Selling items.");
         Network.Send(new PSellItems(serial, info));
     }
     else
     {
         Gumps.Desktop.Children.Add(new GSellGump(serial, info));
     }
 }
Beispiel #19
0
 private static void BulletinBoard_Display(PacketReader pvSrc)
 {
     if (World.FindItem(pvSrc.ReadInt32()) != null)
     {
     }
 }
Beispiel #20
0
 private static void ServerRelay(PacketReader pvSrc)
 {
     int serverIP = ((pvSrc.ReadByte() | (pvSrc.ReadByte() << 8)) | (pvSrc.ReadByte() << 0x10)) | (pvSrc.ReadByte() << 0x18);
     int port = pvSrc.ReadInt16();
     int gameSeed = pvSrc.ReadInt32();
     Network.Disconnect();
     if (!Network.Connect(serverIP, port))
     {
         Gumps.Desktop.Children.Clear();
         xGumps.SetVariable("FailMessage", "Couldn't connect to the game server.  Either the server is down, or an invalid host / port was specified in the server ini.");
         xGumps.Display("ConnectionFailed");
         Cursor.Hourglass = false;
     }
     else
     {
         Network.EnableUnpacking();
         Network.Send(new PGameSeed(gameSeed));
         if (Engine.m_QuickLogin)
         {
             Network.Send(new PGameLogin(gameSeed, Engine.m_QuickEntry.AccountName, Engine.m_QuickEntry.Password));
         }
         else
         {
             Network.Send(new PGameLogin(gameSeed, NewConfig.Username, NewConfig.Password));
         }
         Network.CheckCache();
     }
 }
Beispiel #21
0
 private static void BulletinBoard_SetHeader(PacketReader pvSrc)
 {
     Item board = World.FindItem(pvSrc.ReadInt32());
     if (board != null)
     {
         Item item2 = World.WantItem(pvSrc.ReadInt32());
         if (item2 != null)
         {
             int serial = pvSrc.ReadInt32();
             Item thread = null;
             if (serial >= 0x40000000)
             {
                 thread = World.WantItem(serial);
             }
             string poster = BulletinBoard_ReadString(pvSrc);
             string subject = BulletinBoard_ReadString(pvSrc);
             string time = BulletinBoard_ReadString(pvSrc);
             item2.BulletinHeader = new BBMessageHeader(board, thread, poster, subject, time);
         }
     }
 }
Beispiel #22
0
 private static void ShopContent(PacketReader pvSrc)
 {
     int num = pvSrc.ReadInt32();
     int num2 = pvSrc.ReadByte();
     if (num2 > 0)
     {
         m_BuyMenuSerial = num;
         m_BuyMenuNames = new string[num2];
         m_BuyMenuPrices = new int[num2];
         for (int i = 0; i < num2; i++)
         {
             m_BuyMenuPrices[i] = pvSrc.ReadInt32();
             string str = pvSrc.ReadString(pvSrc.ReadByte());
             try
             {
                 str = Localization.GetString(Convert.ToInt32(str));
             }
             catch
             {
             }
             m_BuyMenuNames[i] = str;
         }
     }
 }
Beispiel #23
0
 private static void CloseShopDialog(PacketReader pvSrc)
 {
     int num = pvSrc.ReadInt32();
     if (pvSrc.ReadByte() != 0)
     {
         pvSrc.Trace();
     }
     Gumps.Destroy(Gumps.FindGumpByGUID(string.Format("GSellGump-{0}", num)));
     Gumps.Destroy(Gumps.FindGumpByGUID(string.Format("GBuyGump-{0}", num)));
 }
Beispiel #24
0
 private static void StringQuery(PacketReader pvSrc)
 {
     GDragable dragable;
     GWrappedLabel label2;
     int num = pvSrc.ReadInt32();
     short num2 = pvSrc.ReadInt16();
     int fixedLength = pvSrc.ReadInt16();
     string text = pvSrc.ReadString(fixedLength);
     bool flag = pvSrc.ReadBoolean();
     byte num4 = pvSrc.ReadByte();
     int num5 = pvSrc.ReadInt32();
     int num6 = pvSrc.ReadInt16();
     string str2 = pvSrc.ReadString(num6);
     dragable = new GDragable(0x474, 0, 0) {
         CanClose = false,
         Modal = true,
         X = (Engine.ScreenWidth - dragable.Width) / 2,
         Y = (Engine.ScreenHeight - dragable.Height) / 2
     };
     GButton toAdd = new GButton(0x47b, 0x47d, 0x47c, 0x75, 190, new OnClick(Engine.StringQueryOkay_OnClick));
     GButton button2 = new GButton(0x478, 0x47a, 0x479, 0xcc, 190, flag ? new OnClick(Engine.StringQueryCancel_OnClick) : null);
     if (!flag)
     {
         button2.Enabled = false;
     }
     GImage image = new GImage(0x477, 60, 0x91);
     GWrappedLabel label = new GWrappedLabel(text, Engine.GetFont(2), Hues.Load(0x455), 60, 0x30, 0x110);
     label2 = new GWrappedLabel(str2, Engine.GetFont(2), Hues.Load(0x455), 60, 0x30, 0x110) {
         Y = image.Y - label2.Height
     };
     GTextBox box = new GTextBox(0, false, 0x44, 140, image.Width - 8, image.Height, "", Engine.GetFont(1), Hues.Load(0x455), Hues.Load(0x455), Hues.Load(0x455));
     box.Focus();
     if (num4 == 1)
     {
         box.MaxChars = num5;
     }
     toAdd.SetTag("Dialog", dragable);
     toAdd.SetTag("Serial", num);
     toAdd.SetTag("Type", num2);
     toAdd.SetTag("Text", box);
     button2.SetTag("Dialog", dragable);
     button2.SetTag("Serial", num);
     button2.SetTag("Type", num2);
     dragable.Children.Add(label);
     dragable.Children.Add(label2);
     dragable.Children.Add(image);
     dragable.Children.Add(box);
     dragable.Children.Add(button2);
     dragable.Children.Add(toAdd);
     dragable.m_CanDrag = true;
     Gumps.Desktop.Children.Add(dragable);
 }
Beispiel #25
0
 private static void Command_CustomHouse(PacketReader pvSrc)
 {
     int serial = pvSrc.ReadInt32();
     int revision = pvSrc.ReadInt32();
     Item item = World.WantItem(serial);
     if (item.Revision != revision)
     {
         item.Revision = revision;
         if (CustomMultiLoader.GetCustomMulti(serial, revision) == null)
         {
             Network.Send(new PQueryCustomHouse(serial));
         }
         else
         {
             Map.Invalidate();
             GRadar.Invalidate();
         }
     }
 }
Beispiel #26
0
 private static void Target(PacketReader pvSrc)
 {
     byte num = pvSrc.ReadByte();
     int targetID = pvSrc.ReadInt32();
     byte num3 = pvSrc.ReadByte();
     int num4 = pvSrc.ReadInt32();
     short num5 = pvSrc.ReadInt16();
     short num6 = pvSrc.ReadInt16();
     byte num7 = pvSrc.ReadByte();
     sbyte num8 = pvSrc.ReadSByte();
     short num9 = pvSrc.ReadInt16();
     if (m_CancelTarget)
     {
         m_CancelTarget = false;
     }
     else if (num3 == 3)
     {
         if (Engine.TargetHandler is ServerTargetHandler)
         {
             Engine.TargetHandler.OnCancel(TargetCancelType.UserCancel);
             Engine.TargetHandler = null;
         }
     }
     else
     {
         ServerTargetHandler handler;
         m_TimeLastCast = DateTime.Now;
         Engine.m_LastTargetID = targetID;
         if ((num > 1) || (((num3 != 1) && (num3 != 2)) && (num3 != 0)))
         {
             pvSrc.Trace();
         }
         Engine.TargetHandler = handler = new ServerTargetHandler(targetID, num != 1, (ServerTargetFlags) num3);
         TargetActions.Identify();
         if (handler.Action != TargetAction.Unknown)
         {
             for (int i = 0; i < Engine.m_AutoTarget.Count; i++)
             {
                 AutoTargetSession session = (AutoTargetSession) Engine.m_AutoTarget[i];
                 if (session.m_Action == handler.Action)
                 {
                     session.m_Timer.Delete();
                     Engine.m_AutoTarget.RemoveAt(i);
                     Engine.Target(session.m_Entity);
                     break;
                 }
             }
         }
     }
 }
Beispiel #27
0
 private static void Command_EditCustomHouse(PacketReader pvSrc)
 {
     if (World.FindItem(pvSrc.ReadInt32()) != null)
     {
         int num = pvSrc.ReadByte();
     }
 }
Beispiel #28
0
 private static void VersionRequest_Assist(PacketReader pvSrc)
 {
     pvSrc.Trace();
     Engine.AddTextMessage("Server is requesting the assist version.", Engine.GetFont(3), Hues.Load(0x22));
     Network.Send(new PAssistVersion(pvSrc.ReadInt32(), "4.0.8b"));
 }
Beispiel #29
0
 private static void Command_ExtendedStatus(PacketReader pvSrc)
 {
     int num = pvSrc.ReadByte();
     Mobile mobile = World.FindMobile(pvSrc.ReadInt32());
     if (mobile != null)
     {
         mobile.Bonded = pvSrc.ReadBoolean();
         if (num >= 2)
         {
             int num2 = pvSrc.ReadByte();
             if (num >= 3)
             {
                 pvSrc.Trace();
             }
         }
     }
 }
Beispiel #30
0
 private static void MultiTarget(PacketReader pvSrc)
 {
     pvSrc.ReadByte();
     Engine.m_MultiPreview = true;
     Engine.m_MultiSerial = pvSrc.ReadInt32();
     Engine.TargetHandler = new MultiTargetHandler(Engine.m_MultiSerial);
     pvSrc.Seek(12, SeekOrigin.Current);
     Engine.m_MultiID = pvSrc.ReadInt16();
     Engine.m_xMultiOffset = pvSrc.ReadInt16();
     Engine.m_yMultiOffset = pvSrc.ReadInt16();
     Engine.m_zMultiOffset = pvSrc.ReadInt16();
     ArrayList list = new ArrayList(Engine.Multis.Load(Engine.m_MultiID));
     int count = list.Count;
     int x = 0x3e8;
     int y = 0x3e8;
     int num4 = -1000;
     int num5 = -1000;
     for (int i = 0; i < count; i++)
     {
         MultiItem item = (MultiItem) list[i];
         if (item.X < x)
         {
             x = item.X;
         }
         if (item.X > num4)
         {
             num4 = item.X;
         }
         if (item.Y < y)
         {
             y = item.Y;
         }
         if (item.Y > num5)
         {
             num5 = item.Y;
         }
     }
     Engine.m_MultiMinX = x;
     Engine.m_MultiMinY = y;
     Engine.m_MultiMaxX = num4;
     Engine.m_MultiMaxY = num5;
     ArrayList list2 = new ArrayList(list.Count);
     for (int j = x; j <= num4; j++)
     {
         for (int k = y; k <= num5; k++)
         {
             ArrayList list3 = new ArrayList(8);
             count = list.Count;
             int index = 0;
             while (index < count)
             {
                 MultiItem item2 = (MultiItem) list[index];
                 if ((item2.X == j) && (item2.Y == k))
                 {
                     list3.Add(StaticItem.Instantiate(item2.ItemID, (sbyte) item2.Z, item2.Flags));
                     list.RemoveAt(index);
                     count--;
                 }
                 else
                 {
                     index++;
                 }
             }
             list3.Sort(TileSorter.Comparer);
             count = list3.Count;
             for (index = 0; index < count; index++)
             {
                 StaticItem item3 = (StaticItem) list3[index];
                 MultiItem item4 = new MultiItem {
                     X = (short) j,
                     Y = (short) k,
                     Z = item3.Z,
                     ItemID = (short) ((item3.ID & 0x3fff) | 0x4000),
                     Flags = item3.Serial
                 };
                 list2.Add(item4);
             }
         }
     }
     Engine.m_MultiList = list2;
 }