Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • SuperNativeZ: 2009SCAPE - Perfect Realistic Emulation. Play Runescape like it was in 2009. [link]
      February 18, 2020, 01:04:45 PM
    • SuperNativeZ: 2009SCAPE - Perfect Realistic Emulation. Play Runescape like it was in 2009. [link]
      February 18, 2020, 01:04:39 PM
    • SuperNativeZ: 2009SCAPE - Perfect Realistic Emulation. Play Runescape like it was in 2009. [link]
      February 18, 2020, 01:04:35 PM
    • ragnoroker: Join RuneGuild Today! BIG DROP PARTY IN 1 HOUR JOIN NOW - Newish Server 30+ Online all the time - Very Unique - Play now : [link]
      February 15, 2020, 04:16:38 PM
    • ragnoroker: Join RuneGuild Today! BIG DROP PARTY IN 1 HOUR JOIN NOW - Discord : [link]
      February 15, 2020, 04:15:41 PM
    • ragnoroker: Join RuneGuild Today! BIG DROP PARTY IN 1 HOUR JOIN NOW :) - [link]
      February 15, 2020, 04:14:50 PM
    • friendlyhelper: Meet up with old and new friends and explore what Runescape Classic could have been had development continued [link]
      February 15, 2020, 03:55:17 PM
    • friendlyhelper: Meet up with old and new friends and explore what Runescape Classic could have been had development continued [link]
      February 15, 2020, 03:49:34 PM
    • friendlyhelper: After well over 6 years of continuous runtime, RSCR still most actively developed RSC server  [link]
      February 15, 2020, 03:49:29 PM
    • SnowRSPS: Checkout Snowrsps.com - Snow317.org - Snowscape.net Open 24.7 [link] !Do not join Galaxy!
      February 15, 2020, 08:15:39 AM
    • SnowRSPS: Checkout Snowrsps.com - Snow317.org - Snowscape.net Open 24.7 [link] !Do not join Galaxy!
      February 15, 2020, 08:15:32 AM
    • SuperNativeZ: GALAXY #1 UNIQUE CUSTOM RSPS [link][link]
      February 14, 2020, 12:27:16 PM
    • SuperNativeZ: GALAXY #1 UNIQUE CUSTOM RSPS [link][link]
      February 14, 2020, 12:27:11 PM
    • SuperNativeZ: GALAXY #1 UNIQUE CUSTOM RSPS [link][link]
      February 14, 2020, 12:27:00 PM
    • ragnoroker: Looking for a new server? Join RuneGuild : [link] You won't be disappointed.
      February 14, 2020, 07:49:42 AM
    • ragnoroker: Looking for a new server? Join RuneGuild : [link] You won't be disappointed.
      February 14, 2020, 07:49:37 AM
    • ragnoroker: Looking for a new server? Join RuneGuild : [link] You won't be disappointed.
      February 14, 2020, 07:49:33 AM
    • Tonystark2830: https: //discord .gg /AHeVSMQ
      February 13, 2020, 11:35:21 AM
    • Tonystark2830:[link]
      February 13, 2020, 11:35:06 AM
    • Tonystark2830:[link] who ever has the most invites will be given money weekly! whats the catch? you must have over 15 invites for the week!  if you are tied with someone else at the end of the week you will both be awarded the same amount "no it will not be split"
      February 13, 2020, 11:34:42 AM

    Author Topic: Almost completely refactored Player Update protocol (317)  (Read 968 times)

    0 Members and 1 Guest are viewing this topic.

    OfflineAmbokile

    • Member
    • ****
    • Posts: 3,009
    • Thanks: +0/-0
      • View Profile
    Here's a player updating protocol that I've refactored. Some of it has been from other sources although I'm not sure of their authors. A lot of it is my work.

    There are a few bits missing in the 0x100 (graphics) and 0x8 (animation) procedures which I simply can't find any meaning for. If you have any idea, please let me know.

    Code: Java
    1.     privatevoid updatePlayerupdateType(Stream stream, int updateType, Player player, int playerId)
    2.     {
    3.         if((updateType & 0x400)!=0)
    4.         {
    5.             player.startX= stream.getUnsignedByteS();
    6.             player.startY= stream.getUnsignedByteS();
    7.             player.endX= stream.getUnsignedByteS();
    8.             player.endY= stream.getUnsignedByteS();
    9.             player.speedToStart= stream.getUnsignedShortA()+ loopCycle;
    10.             player.speedToEnd= stream.getUnsignedLEShortA()+ loopCycle;
    11.             player.direction= stream.getUnsignedByteS();
    12.             player.resetPath();
    13.         }
    14.         if((updateType & 0x100)!=0)
    15.         {
    16.             player.graphicId= stream.getUnsignedShort();
    17.             int delay = stream.getInt();
    18.             player.graphicHeight= delay >>16;
    19.             player.graphicEndCycle= loopCycle +(delay & 0xffff);
    20.             player.currentAnimation=0;
    21.             player.anInt1522=0;
    22.             if(player.graphicEndCycle> loopCycle)
    23.                 player.currentAnimation=-1;
    24.             if(player.graphicId==65535)
    25.                 player.graphicId=-1;
    26.         }
    27.         if((updateType &8)!=0)
    28.         {
    29.             int animationId = stream.getUnsignedShort();
    30.             if(animationId ==65535)
    31.                 animationId =-1;
    32.             int animationDelay = stream.getUnsignedByteC();
    33.             if(animationId == player.animation&& animationId !=-1)
    34.             {
    35.                 int i3 = Animation.anims[animationId].anInt365;
    36.                 if(i3 ==1)
    37.                 {
    38.                     player.anInt1527=0;
    39.                     player.anInt1528=0;
    40.                     player.animationDelay= animationDelay;
    41.                     player.anInt1530=0;
    42.                 }
    43.                 if(i3 ==2)
    44.                     player.anInt1530=0;
    45.             }else
    46.             if(animationId ==-1|| player.animation==-1|| Animation.anims[animationId].anInt359>= Animation.anims[player.animation].anInt359)
    47.             {
    48.                 player.animation= animationId;
    49.                 player.anInt1527=0;
    50.                 player.anInt1528=0;
    51.                 player.animationDelay= animationDelay;
    52.                 player.anInt1530=0;
    53.                 player.anInt1542= player.pathLength;
    54.             }
    55.         }
    56.         if((updateType &4)!=0)
    57.         {
    58.             player.textSpoken= stream.getString();
    59.             if(player.textSpoken.charAt(0)=='~')
    60.             {
    61.                 player.textSpoken= player.textSpoken.substring(1);
    62.                 pushMessage(player.textSpoken, 2, player.name);
    63.             }else
    64.             if(player == localPlayer)
    65.                 pushMessage(player.textSpoken, 2, player.name);
    66.             player.chatColour=0;
    67.             player.chatEffect=0;
    68.             player.textCycle=150;
    69.         }
    70.         if((updateType & 0x80)!=0)
    71.         {
    72.             int colourAndEffect = stream.getUnsignedShort();
    73.             int rights = stream.getUnsignedByte();
    74.             int messageLength = stream.getUnsignedByteC();
    75.             int originalOffset = stream.currentOffset;
    76.             if(player.name!=null&& player.visible)
    77.             {
    78.                 long nameAsLong = TextClass.longForName(player.name);
    79.                 boolean ignored =false;
    80.                 if(rights <=1)
    81.                 {
    82.                     for(int p =0; p < ignoreCount; p++)
    83.                     {
    84.                         if(ignoreListAsLongs[p]!= nameAsLong)
    85.                             continue;
    86.                         ignored =true;
    87.                         break;
    88.                     }
    89.  
    90.                 }
    91.                 if(!ignored && inTutorial ==0)
    92.                     try
    93.                     {
    94.                         textStream.currentOffset=0;
    95.                         stream.getBytes(messageLength, 0, textStream.buffer);
    96.                         textStream.currentOffset=0;
    97.                         String text = TextInput.readFromStream(messageLength, textStream);
    98.                         text = Censor.doCensor(text);
    99.                         player.textSpoken= text;
    100.                         player.chatColour= colourAndEffect >>8;
    101.                             player.rights= rights;
    102.  
    103.                         //entityMessage(player);
    104.        
    105.                         player.chatEffect= colourAndEffect & 0xff;
    106.                         player.textCycle=150;
    107.                         if(rights ==2|| rights ==3)
    108.                             pushMessage(text, 1, "@[email protected]"+ player.name);
    109.                         else
    110.                         if(rights ==1)
    111.                             pushMessage(text, 1, "@[email protected]"+ player.name);
    112.                         else
    113.                             pushMessage(text, 2, player.name);
    114.                     }
    115.                     catch(Exception exception)
    116.                     {
    117.                         signlink.reporterror("cde2");
    118.                     }
    119.             }
    120.             stream.currentOffset= originalOffset + messageLength;
    121.         }
    122.         if((updateType &1)!=0)
    123.         {
    124.             player.interactingEntity= stream.getUnsignedShort();
    125.             if(player.interactingEntity==65535)
    126.                 player.interactingEntity=-1;
    127.         }
    128.         if((updateType & 0x10)!=0)
    129.         {
    130.             int appearanceBufferSize = stream.getUnsignedByteC();
    131.             byte _appearanceBuffer[]=newbyte[appearanceBufferSize];
    132.             Stream appearanceBuffer =new Stream(_appearanceBuffer);
    133.             stream.readBytes(appearanceBufferSize, 0, _appearanceBuffer);
    134.             playerBuffer[playerId]= appearanceBuffer;
    135.             player.updatePlayer(appearanceBuffer);
    136.         }
    137.         if((updateType &2)!=0)
    138.         {
    139.             player.faceTowardX= stream.getUnsignedShortA();
    140.             player.faceTowardY= stream.getUnsignedShort();
    141.         }
    142.         if((updateType & 0x20)!=0)
    143.         {
    144.             int hitDamage = stream.getUnsignedByte();
    145.             int hitType = stream.getUnsignedByteA();
    146.             player.updateHitData(hitType, hitDamage, loopCycle);
    147.             player.loopCycleStatus= loopCycle +300;
    148.             player.currentHealth= stream.getUnsignedByteC();
    149.             player.maxHealth= stream.getUnsignedByte();
    150.         }
    151.         if((updateType & 0x200)!=0)
    152.         {
    153.             int hitDamage = stream.getUnsignedByte();
    154.             int hitType = stream.getUnsignedByteS();
    155.             player.updateHitData(hitType, hitDamage, loopCycle);
    156.             player.loopCycleStatus= loopCycle +300;
    157.             player.currentHealth= stream.getUnsignedByte();
    158.             player.maxHealth= stream.getUnsignedByteC();
    159.         }
    160.     }
    « Last Edit: July 28, 2014, 01:51:03 PM by Ambokile »
    Runescape Gambling

     

    Copyright © 2017 MoparScape. All rights reserved.
    Powered by SMFPacks SEO Pro Mod |
    SimplePortal 2.3.5 © 2008-2012, SimplePortal