Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      Today at 12:52:54 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      Today at 12:52:50 PM
    • U Go Home: hey does anyone have allstarscape v2 i want to make it better something to do and try and bring back the good old days
      Today at 09:22:14 AM
    • ArtexAdv:[link] come check out the most
      November 18, 2019, 11:39:14 AM
    • ArtexAdv: Www.galaxy-rsps.net come check out the most unique custom rsps
      November 18, 2019, 11:38:50 AM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 17, 2019, 10:14:59 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure : [link]
      November 17, 2019, 10:14:50 PM
    • Mazeingmaze: last logged in 2008
      November 17, 2019, 06:46:52 PM
    • Mazeingmaze: Ayy BRO
      November 17, 2019, 06:46:46 PM
    • SuperNativeZ: WANT TO BE APART OF THE BEST RSPS? [link]
      November 17, 2019, 12:22:53 AM
    • SuperNativeZ: WHY CHOOSE GALAXY RSPS?  WE HAVE THE BEST UNIQUE GAMEPLAY [link]
      November 17, 2019, 12:22:42 AM
    • SuperNativeZ: WHY CHOOSE GALAXY RSPS?  WE HAVE THE BEST UNIQUE GAMEPLAY [link]
      November 17, 2019, 12:22:39 AM
    • ragnoroker: Brand new server, come join the fun - unique server - RuneGuild -[link]
      November 15, 2019, 12:46:05 PM
    • ragnoroker: Brand new server, come join the fun - unique server - RuneGuild -[link]
      November 15, 2019, 12:46:01 PM
    • Cole1497: join horney scape we are horney all the time and have a sex emote
      November 09, 2019, 05:14:33 PM
    • thewraith500: try autoscape,0rg brand new osrs CUSTOMS server! fight caves for flaming fire cape, upgrade them to infernal wings + more!
      November 09, 2019, 01:37:29 AM
    • SuperNativeZ: Come play brand new server [link]
      November 08, 2019, 02:13:24 PM
    • SuperNativeZ: Come play brand new server [link]
      November 08, 2019, 02:13:17 PM
    • SuperNativeZ: Come play brand new server [link]
      November 08, 2019, 02:13:14 PM
    • ragnoroker: Brand new server, come join the fun - unique server - RuneGuild - [link]
      November 07, 2019, 11:55:44 AM

    Author Topic: Almost completely refactored Player Update protocol (317)  (Read 929 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