public static PopupMenuData Parse(ref StackDataReader p) { ushort mode = p.ReadUInt16BE(); bool isNewCliloc = mode >= 2; uint serial = p.ReadUInt32BE(); byte count = p.ReadUInt8(); PopupMenuItem[] items = new PopupMenuItem[count]; for (int i = 0; i < count; i++) { ushort hue = 0xFFFF, replaced = 0; int cliloc; ushort index, flags; if (isNewCliloc) { cliloc = (int)p.ReadUInt32BE(); index = p.ReadUInt16BE(); flags = p.ReadUInt16BE(); } else { index = p.ReadUInt16BE(); cliloc = p.ReadUInt16BE() + 3000000; flags = p.ReadUInt16BE(); if ((flags & 0x84) != 0) { p.Skip(2); } if ((flags & 0x40) != 0) { p.Skip(2); } if ((flags & 0x20) != 0) { replaced = (ushort)(p.ReadUInt16BE()); } } if ((flags & 0x01) != 0) { hue = 0x0386; } items[i] = new PopupMenuItem ( cliloc, index, hue, replaced, flags ); } return(new PopupMenuData(serial, items)); }
private void ParseCharacterList(ref StackDataReader p) { int count = p.ReadUInt8(); Characters = new string[count]; for (ushort i = 0; i < count; i++) { Characters[i] = p.ReadASCII(30).TrimEnd('\0'); p.Skip(30); } }
private void ParseCities(ref StackDataReader p) { byte count = p.ReadUInt8(); Cities = new CityInfo[count]; bool isNew = Client.Version >= ClientVersion.CV_70130; string[] descriptions = null; if (!isNew) { descriptions = ReadCityTextFile(count); } Point[] oldtowns = { new Point(105, 130), new Point(245, 90), new Point(165, 200), new Point(395, 160), new Point(200, 305), new Point(335, 250), new Point(160, 395), new Point(100, 250), new Point(270, 130), new Point(0xFFFF, 0xFFFF) }; for (int i = 0; i < count; i++) { CityInfo cityInfo; if (isNew) { byte cityIndex = p.ReadUInt8(); string cityName = p.ReadASCII(32); string cityBuilding = p.ReadASCII(32); ushort cityX = (ushort)p.ReadUInt32BE(); ushort cityY = (ushort)p.ReadUInt32BE(); sbyte cityZ = (sbyte)p.ReadUInt32BE(); uint cityMapIndex = p.ReadUInt32BE(); uint cityDescription = p.ReadUInt32BE(); p.Skip(4); cityInfo = new CityInfo ( cityIndex, cityName, cityBuilding, ClilocLoader.Instance.GetString((int)cityDescription), cityX, cityY, cityZ, cityMapIndex, isNew ); } else { byte cityIndex = p.ReadUInt8(); string cityName = p.ReadASCII(31); string cityBuilding = p.ReadASCII(31); cityInfo = new CityInfo ( cityIndex, cityName, cityBuilding, descriptions != null ? descriptions[i] : string.Empty, (ushort)oldtowns[i % oldtowns.Length].X, (ushort)oldtowns[i % oldtowns.Length].Y, 0, 0, isNew ); } Cities[i] = cityInfo; } }