Welcome, guest! Please login or register.

    * Shoutbox

    RefreshHistory
    • SantaHoHo: you wont regret when u join really nice server
      December 10, 2019, 06:35:18 PM
    • SantaHoHo: need staff :)
      December 10, 2019, 06:35:08 PM
    • SantaHoHo: divinescape.eu5.org
      December 10, 2019, 06:35:00 PM
    • SantaHoHo:[link]
      December 10, 2019, 06:34:39 PM
    • Moneyking800: Yanille is back! We’re in beta looking for new players. We are small around 5-10 players on at anytime atm looking for active testers to build off of! Yanille-os.com
      December 10, 2019, 06:14:45 PM
    • drubrkletern: be honest with me boss
      December 06, 2019, 01:31:52 AM
    • drubrkletern: now is it really that unique
      December 06, 2019, 01:31:47 AM
    • SuperNativeZ: COME PLAY THE MOST UNIQUE CUSTOM RSPS #1 [link][link][link]
      December 05, 2019, 09:22:55 PM
    • SuperNativeZ: FASTEST GROWING #1 UNIQUE CUSTOM RSPS [link][link][link]
      December 05, 2019, 09:22:42 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure - 60+ online : [link]
      December 05, 2019, 02:48:39 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure - 40+ online : [link]
      December 05, 2019, 02:48:31 PM
    • Cole1497: you click any of these links? those boner pills theyre selling are wicked
      December 04, 2019, 05:58:03 PM
    • Cole1497: oh shit vain whats crackin
      December 04, 2019, 05:57:49 PM
    • ArtexAdv: FASTEST GROWING #1 UNIQUE CUSTOM RSPS [link]
      December 04, 2019, 06:30:27 AM
    • Vain_: where the boys at
      December 01, 2019, 03:20:36 PM
    • black evil111: They should close this down, mostly the downloads section. The mods dont know how to do their jobs worth shit and its no excuse like "we have real life stuff going on" everyones replacable. Speaking of replacable, fix download links! Before I go to rune-server.
      December 01, 2019, 01:50:26 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure - 40+ online : [link]
      November 28, 2019, 12:41:24 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure - 40+ online : [link]
      November 28, 2019, 12:40:42 PM
    • 1strangler77: how do i post pictures on a post
      November 24, 2019, 05:16:18 PM
    • ragnoroker: New Server - Unique - Awesome Community - Start your adventure - 40+ online : [link]
      November 23, 2019, 08:23:51 PM

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