The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UO Packets
Author Message
Ankron
Apprentice
*

Posts: 20
Likes Given: 3
Likes Received: 2 in 2 posts
Joined: Jan 2015
Reputation: 0



Post: #9
RE: UO Packets
ok, so I've been trying to convert the compression code I found for the pole server to PHP with out much luck.
Here's the orignal code:
Code:
static uint[,] bit_table = new uint[,]
      {
          {0x02, 0x00},     {0x05, 0x1F},     {0x06, 0x22},     {0x07, 0x34},     {0x07, 0x75},     {0x06, 0x28},     {0x06, 0x3B},     {0x07, 0x32},
          {0x08, 0xE0},     {0x08, 0x62},     {0x07, 0x56},     {0x08, 0x79},     {0x09, 0x19D},    {0x08, 0x97},     {0x06, 0x2A},     {0x07, 0x57},
          {0x08, 0x71},     {0x08, 0x5B},     {0x09, 0x1CC},    {0x08, 0xA7},     {0x07, 0x25},     {0x07, 0x4F},     {0x08, 0x66},     {0x08, 0x7D},
          {0x09, 0x191},    {0x09, 0x1CE},     {0x07, 0x3F},     {0x09, 0x90},     {0x08, 0x59},     {0x08, 0x7B},     {0x08, 0x91},     {0x08, 0xC6},
          {0x06, 0x2D},     {0x09, 0x186},     {0x08, 0x6F},     {0x09, 0x93},     {0x0A, 0x1CC},    {0x08, 0x5A},     {0x0A, 0x1AE},    {0x0A, 0x1C0},
          {0x09, 0x148},    {0x09, 0x14A},     {0x09, 0x82},     {0x0A, 0x19F},     {0x09, 0x171},    {0x09, 0x120},     {0x09, 0xE7},     {0x0A, 0x1F3},
          {0x09, 0x14B},    {0x09, 0x100},    {0x09, 0x190},    {0x06, 0x13},     {0x09, 0x161},    {0x09, 0x125},    {0x09, 0x133},    {0x09, 0x195},
          {0x09, 0x173},    {0x09, 0x1CA},    {0x09, 0x86},     {0x09, 0x1E9},     {0x09, 0xDB},     {0x09, 0x1EC},    {0x09, 0x8B},     {0x09, 0x85},
          {0x05, 0x0A},     {0x08, 0x96},     {0x08, 0x9C},     {0x09, 0x1C3},     {0x09, 0x19C},    {0x09, 0x8F},     {0x09, 0x18F},    {0x09, 0x91},
          {0x09, 0x87},     {0x09, 0xC6},     {0x09, 0x177},    {0x09, 0x89},     {0x09, 0xD6},     {0x09, 0x8C},     {0x09, 0x1EE},    {0x09, 0x1EB},
          {0x09, 0x84},     {0x09, 0x164},     {0x09, 0x175},    {0x09, 0x1CD},     {0x08, 0x5E},     {0x09, 0x88},     {0x09, 0x12B},    {0x09, 0x172},
          {0x09, 0x10A},    {0x09, 0x8D},     {0x09, 0x13A},    {0x09, 0x11C},     {0x0A, 0x1E1},    {0x0A, 0x1E0},     {0x09, 0x187},    {0x0A, 0x1DC},
          {0x0A, 0x1DF},    {0x07, 0x74},     {0x09, 0x19F},    {0x08, 0x8D},    {0x08, 0xE4},     {0x07, 0x79},     {0x09, 0xEA},     {0x09, 0xE1},
          {0x08, 0x40},     {0x07, 0x41},     {0x09, 0x10B},    {0x09, 0xB0},     {0x08, 0x6A},     {0x08, 0xC1},     {0x07, 0x71},     {0x07, 0x78},
          {0x08, 0xB1},     {0x09, 0x14C},     {0x07, 0x43},     {0x08, 0x76},     {0x07, 0x66},     {0x07, 0x4D},     {0x09, 0x8A},     {0x06, 0x2F},
          {0x08, 0xC9},        {0x09, 0xCE},     {0x09, 0x149},    {0x09, 0x160},     {0x0A, 0x1BA},     {0x0A, 0x19E},     {0x0A, 0x39F},     {0x09, 0xE5},
          {0x09, 0x194},     {0x09, 0x184},     {0x09, 0x126},     {0x07, 0x30},     {0x08, 0x6C},     {0x09, 0x121},     {0x09, 0x1E8},     {0x0A, 0x1C1},
          {0x0A, 0x11D},     {0x0A, 0x163},     {0x0A, 0x385},     {0x0A, 0x3DB},     {0x0A, 0x17D},     {0x0A, 0x106},     {0x0A, 0x397},     {0x0A, 0x24E},
          {0x07, 0x2E},     {0x08, 0x98},     {0x0A, 0x33C},     {0x0A, 0x32E},     {0x0A, 0x1E9},     {0x09, 0xBF},     {0x0A, 0x3DF},     {0x0A, 0x1DD},
          {0x0A, 0x32D},     {0x0A, 0x2ED},     {0x0A, 0x30B},     {0x0A, 0x107},     {0x0A, 0x2E8},     {0x0A, 0x3DE},     {0x0A, 0x125},     {0x0A, 0x1E8},
          {0x09, 0xE9},     {0x0A, 0x1CD},     {0x0A, 0x1B5},     {0x09, 0x165},     {0x0A, 0x232},     {0x0A, 0x2E1},     {0x0B, 0x3AE},     {0x0B, 0x3C6},
          {0x0B, 0x3E2},     {0x0A, 0x205},     {0x0A, 0x29A},     {0x0A, 0x248},     {0x0A, 0x2CD},     {0x0A, 0x23B},     {0x0B, 0x3C5},     {0x0A, 0x251},
          {0x0A, 0x2E9},     {0x0A, 0x252},     {0x09, 0x1EA},     {0x0B, 0x3A0},     {0x0B, 0x391},     {0x0A, 0x23C},     {0x0B, 0x392},     {0x0B, 0x3D5},
          {0x0A, 0x233},     {0x0A, 0x2CC},     {0x0B, 0x390},     {0x0A, 0x1BB},     {0x0B, 0x3A1},     {0x0B, 0x3C4},     {0x0A, 0x211},     {0x0A, 0x203},
          {0x09, 0x12A},     {0x0A, 0x231},     {0x0B, 0x3E0},     {0x0A, 0x29B},     {0x0B, 0x3D7},     {0x0A, 0x202},     {0x0B, 0x3AD},     {0x0A, 0x213},
          {0x0A, 0x253},     {0x0A, 0x32C},     {0x0A, 0x23D},     {0x0A, 0x23F},     {0x0A, 0x32F},     {0x0A, 0x11C},     {0x0A, 0x384},     {0x0A, 0x31C},
          {0x0A, 0x17C},     {0x0A, 0x30A},     {0x0A, 0x2E0},     {0x0A, 0x276},     {0x0A, 0x250},     {0x0B, 0x3E3},     {0x0A, 0x396},     {0x0A, 0x18F},
          {0x0A, 0x204},     {0x0A, 0x206},     {0x0A, 0x230},     {0x0A, 0x265},     {0x0A, 0x212},     {0x0A, 0x23E},     {0x0B, 0x3AC},     {0x0B, 0x393},
          {0x0B, 0x3E1},     {0x0A, 0x1DE},     {0x0B, 0x3D6},     {0x0A, 0x31D},     {0x0B, 0x3E5},     {0x0B, 0x3E4},     {0x0A, 0x207},     {0x0B, 0x3C7},
          {0x0A, 0x277},     {0x0B, 0x3D4},     {0x08, 0xC0},    {0x0A, 0x162},     {0x0A, 0x3DA},     {0x0A, 0x124},     {0x0A, 0x1B4},     {0x0A, 0x264},
          {0x0A, 0x33D},     {0x0A, 0x1D1},     {0x0A, 0x1AF},     {0x0A, 0x39E},     {0x0A, 0x24F},     {0x0B, 0x373},     {0x0A, 0x249},     {0x0B, 0x372},
          {0x09, 0x167},     {0x0A, 0x210},     {0x0A, 0x23A},     {0x0A, 0x1B8},     {0x0B, 0x3AF},     {0x0A, 0x18E},     {0x0A, 0x2EC},     {0x07, 0x62},
          {0x04, 0x0D}
      }

      byte[] Compress(byte[] source, int length)
      {
          byte[] retval = new byte[0];
          int nrBits = 0, cBits = 0, val = 0;
          byte current = 0;

          if(source == null || length == 0) return null;

          for(int i = 0; i < length; i++)
          {
              nrBits = (int)bit_table[source[i], 0] - 1;
              val = (int)bit_table[source[i], 1];

              for(int n = nrBits; n >= 0; n--)
              {
                  int x = (val >> n) % 2;
                  current <<= 1;
                  current += (byte)x;

                  cBits++;
                  if(cBits == 8)
                  {
                      byte[] temp = new byte[retval.Length + 1];
                      retval.CopyTo(temp, 0);
                      temp[temp.Length - 1] = current;
                      retval = new byte[temp.Length];
                      temp.CopyTo(retval, 0);
                      temp = null;
                      cBits = 0;
                  }
              }
          }

          nrBits = (int)bit_table[256, 0] - 1;
          val = (int)bit_table[256, 1];

          for(int n = nrBits; n >= 0; n--)
          {
              int x = (val >> n) % 2;
              current <<= 1;
              current += (byte)x;

              cBits++;
              if(cBits == 8)
              {
                  byte[] temp = new byte[retval.Length + 1];
                  retval.CopyTo(temp, 0);
                  temp[temp.Length - 1] = current;
                  retval = new byte[temp.Length];
                  temp.CopyTo(retval, 0);
                  temp = null;
                  cBits = 0;
              }
          }

          while(cBits != 0)
          {
              current <<= 1;
              cBits++;

              if(cBits == 8)
              {
                  byte[] temp = new byte[retval.Length + 1];
                  retval.CopyTo(temp, 0);
                  temp[temp.Length - 1] = current;
                  retval = new byte[temp.Length];
                  temp.CopyTo(retval, 0);
                  temp = null
                  cBits = 0;
              }
          }

          return retval;
      }

Here's what I made
Code:
function build_dictionary(){
        $this->bit_table=array(
          array(hexdec("02"), hexdec("0000")),        array(hexdec("05"), hexdec("001F")),        array(hexdec("06"), hexdec("0022")),        array(hexdec("07"), hexdec("0034")),        array(hexdec("07"), hexdec("0075")),        array(hexdec("06"), hexdec("0028")),        array(hexdec("06"), hexdec("003B")),        array(hexdec("07"), hexdec("0032")),
          array(hexdec("08"), hexdec("00E0")),        array(hexdec("08"), hexdec("0062")),        array(hexdec("07"), hexdec("0056")),        array(hexdec("08"), hexdec("0079")),        array(hexdec("09"), hexdec("019D")),        array(hexdec("08"), hexdec("0097")),        array(hexdec("06"), hexdec("002A")),        array(hexdec("07"), hexdec("0057")),
          array(hexdec("08"), hexdec("0071")),        array(hexdec("08"), hexdec("005B")),        array(hexdec("09"), hexdec("01CC")),        array(hexdec("08"), hexdec("00A7")),        array(hexdec("07"), hexdec("0025")),        array(hexdec("07"), hexdec("004F")),        array(hexdec("08"), hexdec("0066")),        array(hexdec("08"), hexdec("007D")),
          array(hexdec("09"), hexdec("0191")),        array(hexdec("09"), hexdec("01CE")),        array(hexdec("07"), hexdec("003F")),        array(hexdec("09"), hexdec("0090")),        array(hexdec("08"), hexdec("0059")),        array(hexdec("08"), hexdec("007B")),        array(hexdec("08"), hexdec("0091")),        array(hexdec("08"), hexdec("00C6")),
          array(hexdec("06"), hexdec("002D")),        array(hexdec("09"), hexdec("0186")),          array(hexdec("08"), hexdec("006F")),        array(hexdec("09"), hexdec("0093")),        array(hexdec("0A"), hexdec("01CC")),        array(hexdec("08"), hexdec("005A")),        array(hexdec("0A"), hexdec("01AE")),        array(hexdec("0A"), hexdec("01C0")),
          array(hexdec("09"), hexdec("0148")),        array(hexdec("09"), hexdec("014A")),        array(hexdec("09"), hexdec("0082")),        array(hexdec("0A"), hexdec("019F")),        array(hexdec("09"), hexdec("0171")),        array(hexdec("09"), hexdec("0120")),        array(hexdec("09"), hexdec("00E7")),        array(hexdec("0A"), hexdec("01F3")),
          array(hexdec("09"), hexdec("014B")),        array(hexdec("09"), hexdec("0100")),        array(hexdec("09"), hexdec("0190")),        array(hexdec("06"), hexdec("0013")),        array(hexdec("09"), hexdec("0161")),        array(hexdec("09"), hexdec("0125")),        array(hexdec("09"), hexdec("0133")),        array(hexdec("09"), hexdec("0195")),
          array(hexdec("09"), hexdec("0173")),        array(hexdec("09"), hexdec("01CA")),        array(hexdec("09"), hexdec("0086")),        array(hexdec("09"), hexdec("01E9")),        array(hexdec("09"), hexdec("00DB")),        array(hexdec("09"), hexdec("01EC")),        array(hexdec("09"), hexdec("008B")),        array(hexdec("09"), hexdec("0085")),
          array(hexdec("05"), hexdec("000A")),        array(hexdec("08"), hexdec("0096")),           array(hexdec("08"), hexdec("009C")),        array(hexdec("09"), hexdec("01C3")),        array(hexdec("09"), hexdec("019C")),        array(hexdec("09"), hexdec("008F")),        array(hexdec("09"), hexdec("018F")),        array(hexdec("09"), hexdec("0091")),
          array(hexdec("09"), hexdec("0087")),        array(hexdec("09"), hexdec("00C6")),        array(hexdec("09"), hexdec("0177")),        array(hexdec("09"), hexdec("0089")),        array(hexdec("09"), hexdec("00D6")),        array(hexdec("09"), hexdec("008C")),        array(hexdec("09"), hexdec("01EE")),        array(hexdec("09"), hexdec("01EB")),
          array(hexdec("09"), hexdec("0084")),        array(hexdec("09"), hexdec("0164")),          array(hexdec("09"), hexdec("0175")),        array(hexdec("09"), hexdec("01CD")),        array(hexdec("08"), hexdec("005E")),        array(hexdec("09"), hexdec("0088")),        array(hexdec("09"), hexdec("012B")),        array(hexdec("09"), hexdec("0172")),
          array(hexdec("09"), hexdec("010A")),        array(hexdec("09"), hexdec("008D")),           array(hexdec("09"), hexdec("013A")),        array(hexdec("09"), hexdec("011C")),        array(hexdec("0A"), hexdec("01E1")),        array(hexdec("0A"), hexdec("01E0")),        array(hexdec("09"), hexdec("0187")),        array(hexdec("0A"), hexdec("01DC")),
          array(hexdec("0A"), hexdec("01DF")),        array(hexdec("07"), hexdec("0074")),           array(hexdec("09"), hexdec("019F")),        array(hexdec("08"), hexdec("008D")),        array(hexdec("08"), hexdec("00E4")),        array(hexdec("07"), hexdec("0079")),        array(hexdec("09"), hexdec("00EA")),        array(hexdec("09"), hexdec("00E1")),
          array(hexdec("08"), hexdec("0040")),        array(hexdec("07"), hexdec("0041")),           array(hexdec("09"), hexdec("010B")),        array(hexdec("09"), hexdec("00B0")),        array(hexdec("08"), hexdec("006A")),        array(hexdec("08"), hexdec("00C1")),        array(hexdec("07"), hexdec("0071")),        array(hexdec("07"), hexdec("0078")),
          array(hexdec("08"), hexdec("00B1")),        array(hexdec("09"), hexdec("014C")),        array(hexdec("07"), hexdec("0043")),        array(hexdec("08"), hexdec("0076")),        array(hexdec("07"), hexdec("0066")),        array(hexdec("07"), hexdec("004D")),        array(hexdec("09"), hexdec("008A")),        array(hexdec("06"), hexdec("002F")),
          array(hexdec("08"), hexdec("00C9")),        array(hexdec("09"), hexdec("00CE")),        array(hexdec("09"), hexdec("0149")),        array(hexdec("09"), hexdec("0160")),        array(hexdec("0A"), hexdec("01BA")),        array(hexdec("0A"), hexdec("019E")),        array(hexdec("0A"), hexdec("039F")),        array(hexdec("09"), hexdec("00E5")),
          array(hexdec("09"), hexdec("0194")),        array(hexdec("09"), hexdec("0184")),        array(hexdec("09"), hexdec("0126")),        array(hexdec("07"), hexdec("0030")),        array(hexdec("08"), hexdec("006C")),        array(hexdec("09"), hexdec("0121")),        array(hexdec("09"), hexdec("01E8")),        array(hexdec("0A"), hexdec("01C1")),
          array(hexdec("0A"), hexdec("011D")),        array(hexdec("0A"), hexdec("0163")),        array(hexdec("0A"), hexdec("0385")),        array(hexdec("0A"), hexdec("03DB")),        array(hexdec("0A"), hexdec("017D")),        array(hexdec("0A"), hexdec("0106")),        array(hexdec("0A"), hexdec("0397")),        array(hexdec("0A"), hexdec("024E")),
          array(hexdec("07"), hexdec("002E")),        array(hexdec("08"), hexdec("0098")),        array(hexdec("0A"), hexdec("033C")),        array(hexdec("0A"), hexdec("032E")),        array(hexdec("0A"), hexdec("01E9")),        array(hexdec("09"), hexdec("00BF")),        array(hexdec("0A"), hexdec("03DF")),        array(hexdec("0A"), hexdec("01DD")),
          array(hexdec("0A"), hexdec("032D")),        array(hexdec("0A"), hexdec("02ED")),        array(hexdec("0A"), hexdec("030B")),        array(hexdec("0A"), hexdec("0107")),        array(hexdec("0A"), hexdec("02E8")),        array(hexdec("0A"), hexdec("03DE")),        array(hexdec("0A"), hexdec("0125")),        array(hexdec("0A"), hexdec("01E8")),
          array(hexdec("09"), hexdec("00E9")),        array(hexdec("0A"), hexdec("01CD")),        array(hexdec("0A"), hexdec("01B5")),        array(hexdec("09"), hexdec("0165")),        array(hexdec("0A"), hexdec("0232")),        array(hexdec("0A"), hexdec("02E1")),        array(hexdec("0B"), hexdec("03AE")),        array(hexdec("0B"), hexdec("03C6")),
          array(hexdec("0B"), hexdec("03E2")),        array(hexdec("0A"), hexdec("0205")),        array(hexdec("0A"), hexdec("029A")),        array(hexdec("0A"), hexdec("0248")),        array(hexdec("0A"), hexdec("02CD")),        array(hexdec("0A"), hexdec("023B")),        array(hexdec("0B"), hexdec("03C5")),        array(hexdec("0A"), hexdec("0251")),
          array(hexdec("0A"), hexdec("02E9")),        array(hexdec("0A"), hexdec("0252")),        array(hexdec("09"), hexdec("01EA")),        array(hexdec("0B"), hexdec("03A0")),        array(hexdec("0B"), hexdec("0391")),        array(hexdec("0A"), hexdec("023C")),        array(hexdec("0B"), hexdec("0392")),        array(hexdec("0B"), hexdec("03D5")),
          array(hexdec("0A"), hexdec("0233")),        array(hexdec("0A"), hexdec("02CC")),        array(hexdec("0B"), hexdec("0390")),        array(hexdec("0A"), hexdec("01BB")),        array(hexdec("0B"), hexdec("03A1")),        array(hexdec("0B"), hexdec("03C4")),        array(hexdec("0A"), hexdec("0211")),        array(hexdec("0A"), hexdec("0203")),
          array(hexdec("09"), hexdec("012A")),        array(hexdec("0A"), hexdec("0231")),        array(hexdec("0B"), hexdec("03E0")),        array(hexdec("0A"), hexdec("029B")),        array(hexdec("0B"), hexdec("03D7")),        array(hexdec("0A"), hexdec("0202")),        array(hexdec("0B"), hexdec("03AD")),        array(hexdec("0A"), hexdec("0213")),
          array(hexdec("0A"), hexdec("0253")),        array(hexdec("0A"), hexdec("032C")),        array(hexdec("0A"), hexdec("023D")),        array(hexdec("0A"), hexdec("023F")),        array(hexdec("0A"), hexdec("032F")),        array(hexdec("0A"), hexdec("011C")),        array(hexdec("0A"), hexdec("0384")),        array(hexdec("0A"), hexdec("031C")),
          array(hexdec("0A"), hexdec("017C")),        array(hexdec("0A"), hexdec("030A")),        array(hexdec("0A"), hexdec("02E0")),        array(hexdec("0A"), hexdec("0276")),        array(hexdec("0A"), hexdec("0250")),        array(hexdec("0B"), hexdec("03E3")),        array(hexdec("0A"), hexdec("0396")),        array(hexdec("0A"), hexdec("018F")),
          array(hexdec("0A"), hexdec("0204")),        array(hexdec("0A"), hexdec("0206")),        array(hexdec("0A"), hexdec("0230")),        array(hexdec("0A"), hexdec("0265")),        array(hexdec("0A"), hexdec("0212")),        array(hexdec("0A"), hexdec("023E")),        array(hexdec("0B"), hexdec("03AC")),        array(hexdec("0B"), hexdec("0393")),
          array(hexdec("0B"), hexdec("03E1")),        array(hexdec("0A"), hexdec("01DE")),        array(hexdec("0B"), hexdec("03D6")),        array(hexdec("0A"), hexdec("031D")),        array(hexdec("0B"), hexdec("03E5")),        array(hexdec("0B"), hexdec("03E4")),        array(hexdec("0A"), hexdec("0207")),        array(hexdec("0B"), hexdec("03C7")),
          array(hexdec("0A"), hexdec("0277")),        array(hexdec("0B"), hexdec("03D4")),        array(hexdec("08"), hexdec("00C0")),        array(hexdec("0A"), hexdec("0162")),        array(hexdec("0A"), hexdec("03DA")),        array(hexdec("0A"), hexdec("0124")),        array(hexdec("0A"), hexdec("01B4")),        array(hexdec("0A"), hexdec("0264")),
          array(hexdec("0A"), hexdec("033D")),        array(hexdec("0A"), hexdec("01D1")),        array(hexdec("0A"), hexdec("01AF")),        array(hexdec("0A"), hexdec("039E")),        array(hexdec("0A"), hexdec("024F")),        array(hexdec("0B"), hexdec("0373")),        array(hexdec("0A"), hexdec("0249")),        array(hexdec("0B"), hexdec("0372")),
          array(hexdec("09"), hexdec("0167")),        array(hexdec("0A"), hexdec("0210")),        array(hexdec("0A"), hexdec("023A")),        array(hexdec("0A"), hexdec("01B8")),        array(hexdec("0B"), hexdec("03AF")),        array(hexdec("0A"), hexdec("018E")),        array(hexdec("0A"), hexdec("02EC")),        array(hexdec("07"), hexdec("0062")),
          array(hexdec("04"), hexdec("000D"))
        );
        
    }
    
    function Compress($string)
      {
          if (!isset($this->bit_table)){
              $this->build_dictionary();
          }
          $nrBits = 0;
          $cBits = 0;
          $val = 0;
          $current = 0;
          $retval="";
          
          $length=strlen($string);
          echo "Encoding Packet: \n";
          if($string == null || $length == 0){
              return null;
          }else{

              for($i = 0; $i < $length; $i++)
              {
                  $bits = $this->bit_table[ord(substr($string, $i, 1))];
                  $nrBits = $bits[0];
                  $val = $bits[1];
                  
                  for($n = $nrBits; $n >= 0; $n--)
                  {
                      $x = ($val >> $n) % 2;
                      
                      $current <<= 1;
                      $current += $x;
                      $cBits++;
                      if($cBits == 8)
                      {
                        $retval= $current;
                        $cBits=0;
                      }
                  }
              }
              $bits = $this->bit_table[256];
              $nrBits = $bits[0];
              $val = $bits[1];

              for($n = $nrBits; $n >= 0; $n--)
              {
                  $x = ($val >> $n) % 2;

                  $current = $current << 1;

                  $current += $x;

                  $cBits++;
                  if($cBits == 8)
                  {

                      $retval= $current;
                      $cBits=0;
                  }
              }

              while($cBits != 0)
              {
                  $current <<= 1;
                  $cBits++;

                  if($cBits == 8)
                  {
                      $retval=$current;
                      $current=0;
                      $cBits=0;
                  }
              }
              
            
              $string=dechex($retval);
              echo $retval." ".$string."\n";
              $retval="";
              for($i=strlen($retval)/2;$i=>0; $i--){
                  $retval.=chr(hexdec(substr($string, ($i-2)*2, 2)));
              }
              echo strlen($retval)."\n";
              return $retval;
          }
      }
07-26-2015 05:27 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Messages In This Thread
UO Packets - Ankron - 07-12-2015, 01:18 PM
RE: UO Packets - XuN - 07-12-2015, 05:17 PM
RE: UO Packets - Shaklaban - 07-13-2015, 12:52 AM
RE: UO Packets - Ankron - 07-14-2015, 04:55 AM
RE: UO Packets - Ankron - 07-17-2015, 04:58 AM
RE: UO Packets - Ankron - 07-25-2015, 03:04 AM
RE: UO Packets - WRWR - 07-25-2015, 06:36 AM
RE: UO Packets - Ankron - 07-25-2015, 06:13 PM
RE: UO Packets - Ankron - 07-26-2015 05:27 AM
RE: UO Packets - Ankron - 07-28-2015, 12:44 PM
RE: UO Packets - Ankron - 07-31-2015, 10:06 AM
RE: UO Packets - Ankron - 08-01-2015, 03:54 AM
RE: UO Packets - Ankron - 08-07-2015, 04:40 AM
RE: UO Packets - escribano - 08-07-2015, 05:31 AM
RE: UO Packets - escribano - 08-12-2015, 02:57 AM
RE: UO Packets - Ultima One - 08-13-2015, 12:08 AM
RE: UO Packets - escribano - 08-13-2015, 02:49 AM
RE: UO Packets - Ankron - 08-14-2015, 03:29 AM
RE: UO Packets - escribano - 08-14-2015, 03:49 AM
RE: UO Packets - escribano - 08-14-2015, 06:18 AM
RE: UO Packets - Ankron - 08-14-2015, 08:36 AM
RE: UO Packets - escribano - 08-15-2015, 01:00 PM
RE: UO Packets - escribano - 08-16-2015, 08:44 AM
RE: UO Packets - escribano - 08-16-2015, 03:20 PM
RE: UO Packets - escribano - 08-17-2015, 02:14 PM
RE: UO Packets - Coruja - 09-29-2015, 10:32 AM
RE: UO Packets - escribano - 09-30-2015, 10:32 AM

Forum Jump:


User(s) browsing this thread: 2 Guest(s)