Ejemplo n.º 1
0
 public CommandHandler()
 {
     this.au = new ArrayUtils();
     this.su = new StringUtils();
     this.nu = new NumericalUtils();
     this.pu = new PacketsUtils();
 }
Ejemplo n.º 2
0
        public byte[] getBytes()
        {
            DynamicArray rpcStructure = new DynamicArray();

            byte [] totalMsgBlocks = NumericalUtils.uint16ToByteArrayShort((UInt16)addedMsgBlocks);
            byte [] currentCounter = getRpcBytes();

            rpcStructure.append(currentCounter);
            rpcStructure.append(totalMsgBlocks);
            rpcStructure.append(din.getBytes());

            // Increment RPC Counter

            incrementRpcCounter(addedMsgBlocks);

            return(rpcStructure.getBytes());
        }
Ejemplo n.º 3
0
        public void sendEmotePerform(WorldClient client, UInt32 emoteID)
        {
            double x = 0; double y = 0; double z = 0;

            byte[] Ltvector3d = Store.currentClient.playerInstance.Position.getValue();
            NumericalUtils.LtVector3dToDoubles(Ltvector3d, ref x, ref y, ref z);
            int   rotation = (int)Store.currentClient.playerInstance.YawInterval.getValue()[0];
            float xPos     = (float)x;
            float yPos     = (float)y;
            float zPos     = (float)z;

            /*
             * byte sampleEmoteMsg[] =
             * {
             *  0x03, 0x02, 0x00, 0x01, 0x28, 0xAA, 0x40, 0x00, 0x25, 0x01, 0x00, 0x00, 0x10, 0xBB, 0xBB, 0xBB,
             *  0xBB, 0xCC, 0xCC, 0xCC, 0xCC, 0xDD, 0xDD, 0xDD, 0xDD, 0x2A, 0x9F, 0x1E, 0x20, 0x00, 0x00,
             * };*/

            // Example REsponse for /rolldice  02 03 02 00 01 28 01 40 00 25 <ID> 00 00 10 cd a7 65 c7 00 00 be 42 33 ff 72 46 b9 51 32 22 00 00
            // Example REsponse for /rolldice  02 03 02 00 01 28 01 40 00 25 5c 00 00 10 cd a7 65 c7 00 00 be 42 33 ff 72 46 b9 51 32 22 00 00
            // Example Response for ClapEmote: 02 03 02 00 01 28 06 40 00 25 04 00 00 10 34 49 84 c7 00 00 be 42 27 a4 7f 46 b3 a6 5e 18 00 00
            // Python Example self.emotePacket="\x02\x03\x02\x00\x01\x28<emoteNum>\x40\x00\x25<emoteID>\x00\x00\x10<coordX><coordY><coordZ>\x2a\x9f\x1e\x20\x00\x00"
            //                                 02 03 02 00 01 28 01 40 00 25 01 00 00 ea 33 47 00 00 be 42 80 55 bd c7 b9 51 32 22 00 00


            // ToDo: parse list and get the f*****g id from uint
            DataLoader objectLoader = DataLoader.getInstance();
            byte       emoteByte    = new byte();

            emoteByte = objectLoader.findEmoteByLongId(emoteID);


            if (emoteByte > 0)
            {
                byte[]        emotePak = { 0x01, 0x28, 0x01, 0x40, 0x00, 0x25, emoteByte, 0x00, 0x00, 0x10 };
                PacketContent pak      = new PacketContent();
                pak.addUint16(2, 1);
                pak.addByteArray(emotePak);
                pak.addFloatLtVector3f(xPos, yPos, zPos);
                pak.addHexBytes("b9513222"); // We dont know what they are - maybe rotation ?
                pak.addByte(0x00);
                //pak.addByteArray(client.playerInstance.Position.getValue());
                client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
                client.flushQueue();
            }
        }
Ejemplo n.º 4
0
        public void sendChatMessage(WorldClient fromClient, string message, UInt32 charId, string handle, string scope)
        {
            byte typeByte;

            switch (scope)
            {
            case "TEAM":
                typeByte = 0x05;
                break;

            case "CREW":
                typeByte = 0x02;
                break;

            case "FACTION":
                typeByte = 0x03;
                break;

            case "AREA":
                typeByte = 0x10;
                break;

            default:
                typeByte = 0x07;
                break;
            }


            UInt16 messageSize = (UInt16)(message.Length + 1);

            byte[] messageSizeHex = NumericalUtils.uint16ToByteArray(messageSize, 1);

            UInt32        offsetMessage = (uint)handle.Length + 35 + 2 + 2;
            PacketContent pak           = new PacketContent();

            pak.addByte((byte)RPCResponseHeaders.SERVER_CHAT_MESSAGE_RESPONSE);
            pak.addByte(typeByte);
            pak.addUint32(charId, 0);
            pak.addUint16(36, 0);
            pak.addUint32(offsetMessage, 0);
            pak.addHexBytes("000000000000000000000000000000000000000000000000");
            pak.addSizedTerminatedString(handle);
            pak.addSizedTerminatedString(message);
            Store.world.sendRPCToAllOtherPlayers(Store.currentClient.playerData, pak.returnFinalPacket());
        }
Ejemplo n.º 5
0
        public int parseAttributes(ref byte[] buffer, int _offset)
        {
            int  offset = _offset;
            byte flag   = 0x00;

            flag = BufferHandler.readByte(ref buffer, ref offset);

            byte[] stateData = new byte[buffer.Length - offset + 2];
            ArrayUtils.copy(buffer, offset - 2, stateData, 0, buffer.Length - offset + 2);
            //Flag Bits{0,0,0,0,Vector3f Position Update,  Yaw Update,Animation Update, AttributesPacked Update?}


            switch (flag)
            {
            case 0x02:
                Action.setValue(BufferHandler.readBytes(ref buffer, ref offset, Action.getSize()));
                break;


            case 0x04:
                YawInterval.setValue(BufferHandler.readBytes(ref buffer, ref offset, YawInterval.getSize()));
                break;


            case 0x08:
                double x = (double)NumericalUtils.byteArrayToFloat(BufferHandler.readBytes(ref buffer, ref offset, 4), 1);
                double y = (double)NumericalUtils.byteArrayToFloat(BufferHandler.readBytes(ref buffer, ref offset, 4), 1);
                double z = (double)NumericalUtils.byteArrayToFloat(BufferHandler.readBytes(ref buffer, ref offset, 4), 1);
                Position.setValue(NumericalUtils.doublesToLtVector3d(x, y, z));
                break;

            case 0x0e:
                // UInt16 unknown + LtVector3f
                UInt16 unknown = NumericalUtils.ByteArrayToUint16(BufferHandler.readBytes(ref buffer, ref offset, 2), 1);
                float  xPos    = NumericalUtils.byteArrayToFloat(BufferHandler.readBytes(ref buffer, ref offset, 4), 1);
                float  yPos    = NumericalUtils.byteArrayToFloat(BufferHandler.readBytes(ref buffer, ref offset, 4), 1);
                float  zPos    = NumericalUtils.byteArrayToFloat(BufferHandler.readBytes(ref buffer, ref offset, 4), 1);
                Position.setValue(NumericalUtils.doublesToLtVector3d((double)xPos, (double)yPos, (double)zPos));
                break;
            }

            // TODO: update player attribute packets someday (announce it to my spawners)
            Store.world.sendViewPacketToAllPlayers(stateData, Store.currentClient.playerData.getCharID(), NumericalUtils.ByteArrayToUint16(Store.currentClient.playerInstance.GetGoid(), 1), Store.currentClient.playerData.getEntityId());
            return(offset);
        }
Ejemplo n.º 6
0
        public void processObjectDynamic(ref byte[] packet)
        {
            PacketReader reader = new PacketReader(packet);

            byte[] objectID = new byte[4];
            byte[] sectorID = new byte[2];
            ArrayUtils.copyTo(packet, 0, objectID, 0, 4);
            ArrayUtils.copyTo(objectID, 2, sectorID, 0, 2);

            UInt32 numericObjectId = NumericalUtils.ByteArrayToUint32(objectID, 1);


            // Ok sector Bytes are something like 30 39 (reversed but the result must be 39 03)
            UInt16 numericSectorId = NumericalUtils.ByteArrayToUint16(sectorID, 1);
            // strip out object id
            string id = StringUtils.bytesToString_NS(objectID);


            // get the type
            byte[] objectType = new byte[1];
            ArrayUtils.copy(packet, 4, objectType, 0, 1);
            int objectTypeID = packet[4];


            // create a new System message but fill it in the switch block
            ServerPackets pak = new ServerPackets();

            #if DEBUG
            pak.sendSystemChatMessage(Store.currentClient, "Object Type ID IS " + objectTypeID.ToString() + " Dynamic Object RPC : " + StringUtils.bytesToString_NS(packet), "BROADCAST");
            #endif

            switch (objectTypeID)
            {
            case (int)objectTypesDynamic.LOOT:
                UInt32[] theTestArrayLoots = new UInt32[2];
                theTestArrayLoots[0] = NumericalUtils.ByteArrayToUint32(StringUtils.hexStringToBytes("8e220000"), 1);
                pak.SendLootWindow(5000, Store.currentClient, theTestArrayLoots);
                break;


            default:
                pak.sendSystemChatMessage(Store.currentClient, "[OI HELPER] Unknown Object Type : " + objectTypeID.ToString() + "| Object ID :" + id, "MODAL");
                break;
            }
        }
Ejemplo n.º 7
0
        public byte[] loadEquippedAbilities()
        {
            DynamicArray din = new DynamicArray();

            //AbilityItem abTemp = AbilityDB.Find(delegate(AbilityItem a) { return a.getAbilityID() == id; });


            foreach (MarginAbilityItem ability in Abilities)
            {
                if (ability.getLoaded() == true)
                {
                    Int32 finalAblityID = ability.getAbilityID() + ability.getLevel();
                    din.append(NumericalUtils.uint16ToByteArray(ability.getSlot(), 1)); // slot
                    din.append(NumericalUtils.int32ToByteArray(finalAblityID, 1));
                }
            }
            return(din.getBytes());
        }
Ejemplo n.º 8
0
        private void deleteCharName(byte[] packet, NetworkStream client)
        {
            // Response should something like : 0e 44 87 1f 00 00 00 00 00 00 00 00 00

            // Get the charId from the packet
            byte[] charIDB = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
            ArrayUtils.copy(packet, 5, charIDB, 0, 8); //Offset for charID is 5 in request

            // Need for SQL Delete
            UInt64 charID = NumericalUtils.ByteArrayToUint32(charIDB, 1);

            Store.dbManager.MarginDbHandler.deleteCharacter(charID);

            // Create viewData
            string deleteRequestResponse = "0e" + StringUtils.bytesToString_NS(charIDB) + "0000000000000000";

            sendMarginData(deleteRequestResponse, client);
        }
Ejemplo n.º 9
0
        public void processWhereamiCommand(ref byte[] packet)
        {
            Output.WriteLine("[COMMAND HELPER] WHERE AM I ");
            double x = 0; double y = 0; double z = 0;

            byte[] Ltvector3d = Store.currentClient.playerInstance.Position.getValue();
            NumericalUtils.LtVector3dToDoubles(Ltvector3d, ref x, ref y, ref z);

            byte[] xPos = NumericalUtils.floatToByteArray((float)x, 1);
            byte[] yPos = NumericalUtils.floatToByteArray((float)y, 1);
            byte[] zPos = NumericalUtils.floatToByteArray((float)z, 1);

            string posHex = StringUtils.bytesToString_NS(xPos) + StringUtils.bytesToString_NS(yPos) + StringUtils.bytesToString_NS(zPos);

            ServerPackets serverpacket = new ServerPackets();

            serverpacket.sendWhereami(Store.currentClient, xPos, yPos, zPos);
        }
Ejemplo n.º 10
0
        public void sendJackoutEffect(WorldClient client)
        {
            PacketContent pak = new PacketContent();
            double        x = 0; double y = 0; double z = 0;

            byte[] Ltvector3d = client.playerInstance.Position.getValue();
            NumericalUtils.LtVector3dToDoubles(Ltvector3d, ref x, ref y, ref z);
            int   rotation = (int)client.playerInstance.YawInterval.getValue()[0];
            float xPos     = (float)x;
            float yPos     = (float)y;
            float zPos     = (float)z;

            pak.addUint16(2, 1); // ToDo: we should change this for other views ?
            pak.addHexBytes("032802C000740010");
            pak.addFloatLtVector3f(xPos, yPos, zPos);
            pak.addHexBytes("E93C991E8080808080801001000000"); // ToDo: analyze it more ?
            client.playerData.isJackoutInProgress = true;
            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
        }
Ejemplo n.º 11
0
        public void loadWorldObjectsDb(string path)
        {
            Output.Write("Loading Static Objects from " + path + " - please wait...");

            ArrayList         staticWorldObjects = loadCSV(path, ',');
            StaticWorldObject worldObject        = null;
            int linecount = 1;

            foreach (string[] data in staticWorldObjects)
            {
                if (linecount > 1)
                {
                    //Output.WriteLine("Show Colums for Line : " + linecount.ToString() + " GOID:  " + data[1].ToString() + " Name " + data[0].ToString());

                    worldObject = new StaticWorldObject();

                    worldObject.metrId   = Convert.ToUInt16(data[0]);
                    worldObject.sectorID = Convert.ToUInt16(data[1]);


                    worldObject.mxoId    = NumericalUtils.ByteArrayToUint32(StringUtils.hexStringToBytes(data[2]), 1);
                    worldObject.staticId = NumericalUtils.ByteArrayToUint32(StringUtils.hexStringToBytes(data[3]), 1);
                    worldObject.type     = StringUtils.hexStringToBytes(data[4].Substring(0, 4));
                    worldObject.exterior = Convert.ToBoolean(data[5]);
                    worldObject.pos_x    = double.Parse(data[6], CultureInfo.InvariantCulture);
                    worldObject.pos_y    = double.Parse(data[7], CultureInfo.InvariantCulture);
                    worldObject.pos_z    = double.Parse(data[8], CultureInfo.InvariantCulture);
                    worldObject.rot      = double.Parse(data[9], CultureInfo.InvariantCulture);
                    worldObject.quat     = data[10];

                    if (data[3] == "01003039")
                    {
                        Output.writeToLogForConsole("[DEMO DOOR] 01003039, X: " + worldObject.pos_x + ", Y: " + worldObject.pos_y + ", Z: " + worldObject.pos_z + ", ROT: " + worldObject.rot + ", TypeId: " + StringUtils.bytesToString_NS(worldObject.type));
                    }


                    WorldObjectsDB.Add(worldObject);
                    worldObject = null;
                }

                linecount++;
            }
        }
Ejemplo n.º 12
0
        public void processDecreaseCash(UInt16 amount, UInt16 type)
        {
            // send 02 04 01 00 16 01 0a 80 e4 ff 00 00 00 02 00 00 00;
            byte[] header  = { 0x80, 0xe4 };
            long   newCash = Store.currentClient.playerData.getInfo() - (long)amount;

            Store.currentClient.playerData.setInfo(newCash);

            Store.dbManager.WorldDbHandler.savePlayer(Store.currentClient);

            DynamicArray din = new DynamicArray();

            din.append(header);
            din.append(NumericalUtils.uint32ToByteArray((UInt32)newCash, 1));
            din.append(NumericalUtils.uint16ToByteArray(type, 1));
            din.append(0x00);
            din.append(0x00);
            Store.currentClient.messageQueue.addRpcMessage(din.getBytes());
        }
Ejemplo n.º 13
0
        public void processHardlineTeleport(ref byte[] packet)
        {
            // we dont care where the journey goes
            // just want to see IF the journey will do :)
            // for this just ack and send 0x42 packet
            byte[] sourceHardline = new byte[2];
            sourceHardline[0] = packet[0];
            sourceHardline[1] = packet[1];

            byte[] sourceDistrict = new byte[2];
            sourceDistrict[0] = packet[4];
            sourceDistrict[1] = packet[5];

            byte[] destHardline = new byte[2];
            destHardline[0] = packet[8];
            destHardline[1] = packet[9];

            byte[] destDistrict = new byte[2];
            destDistrict[0] = packet[12];
            destDistrict[1] = packet[13];

            UInt16 sourceHL  = NumericalUtils.ByteArrayToUint16(sourceHardline, 1);
            UInt16 sourceDIS = NumericalUtils.ByteArrayToUint16(sourceDistrict, 1);

            UInt16 destHL  = NumericalUtils.ByteArrayToUint16(destHardline, 1);
            UInt16 destDIS = NumericalUtils.ByteArrayToUint16(destDistrict, 1);

            // This should do the magic - we just catch
            Store.dbManager.WorldDbHandler.updateLocationByHL(destDIS, destHL);
            Store.dbManager.WorldDbHandler.updateSourceHlForObjectTracking(sourceDIS, sourceHL, Store.currentClient.playerData.lastClickedObjectId);

            #if DEBUG
            ServerPackets serverPak = new ServerPackets();
            serverPak.sendSystemChatMessage(Store.currentClient, "User wants teleport from : HL ID: " + sourceHL.ToString() + " (DIS: " + sourceDIS.ToString() + " ) TO HL ID: " + destHL.ToString() + " (DIS: " + destDIS.ToString() + ") ", "MODAL");
            #endif

            // Tell client we want to unload the World
            PacketContent pak = new PacketContent();
            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_LOAD_RPC_RESET, 0);
            Store.currentClient.messageQueue.addRpcMessage(pak.returnFinalPacket());
            Store.currentClient.FlushQueue();
        }
Ejemplo n.º 14
0
        // This is for team and crew invites
        public void processInviteAnswer(ref byte[] packet)
        {
            // read the important things
            byte[] maybeType  = new byte[2];
            byte[] sizeString = new byte[2];
            ArrayUtils.copyTo(packet, 3, maybeType, 0, 2);
            ArrayUtils.copyTo(packet, 7, sizeString, 0, 2);
            UInt16 sizeCharName = NumericalUtils.ByteArrayToUint16(sizeString, 1);

            byte[] characterNameBytes = new byte[sizeCharName];
            ArrayUtils.copyTo(packet, 9, characterNameBytes, 0, sizeCharName);

            string characterName = StringUtils.charBytesToString(characterNameBytes);

            // if it is 0 - then he has accepted the request - otherwise decline and ..we dont care

            switch (NumericalUtils.ByteArrayToUint16(maybeType, 1))
            {
            // Team Invites
            case 0:
                lock (WorldSocket.missionTeams)
                {
                    foreach (MissionTeam team in WorldSocket.missionTeams)
                    {
                        if (team.characterMasterName.Equals(characterName))
                        {
                            team.addMember(StringUtils.charBytesToString_NZ(Store.currentClient.playerInstance.CharacterName.getValue()));
                        }
                    }
                }
                break;

            // Crew Invites
            case 2:
                // ToDo: add to Crew and maybe to faction (if crew is part of faction)
                // ToDo: Generate Repsonse for all connected crew mates and the new member
                // ToDo: add to crew and figure out the responses that are necessary (like crew message , player update etc.)
                // ToDo: for this the "2_player_action" logs could be useful.

                break;
            }
        }
Ejemplo n.º 15
0
        public static byte[] createSystemMessage(string message, WorldClient client)
        {
            byte[] messageBytes = StringUtils.stringToBytes(message + "\x00");

            DynamicArray din = new DynamicArray();

            UInt16 messageSize = (UInt16)(message.Length + 1);

            byte[] messageSizeHex = NumericalUtils.uint16ToByteArray(messageSize, 1);

            byte[] hexContents = StringUtils.hexStringToBytes("0700000000000000000024000000000000000000000000000000000000000000000000");

            din.append((byte)RPCResponseHeaders.SERVER_CHAT_MESSAGE_RESPONSE);
            din.append(hexContents);
            din.append(messageSizeHex);
            din.append(messageBytes);


            return(din.getBytes());
        }
Ejemplo n.º 16
0
        /*
         * Add a RPC Message with size byte automatically to the queue
         */
        public void addRpcMessage(byte[] messageBlock)
        {
            byte[] rpcSizeByte;
            if (messageBlock.Length > 127)
            {
                rpcSizeByte = NumericalUtils.uint16ToByteArray((UInt16)(messageBlock.Length + 0x8000), 0);
            }
            else
            {
                rpcSizeByte = NumericalUtils.uint16ToByteArrayShort((UInt16)messageBlock.Length);
            }
            DynamicArray content = new DynamicArray();

            content.append(rpcSizeByte);
            content.append(messageBlock);

            SequencedMessage message = new SequencedMessage(content.getBytes());

            RPCMessagesQueue.Add(message);
        }
Ejemplo n.º 17
0
        public byte[] loadInventory(int charID)
        {
            List <MarginInventoryItem> Inventory = new List <MarginInventoryItem>();

            Inventory = Store.dbManager.MarginDbHandler.loadInventory(charID);

            DynamicArray din = new DynamicArray();

            foreach (MarginInventoryItem item in Inventory)
            {
                din.append(NumericalUtils.uint16ToByteArrayShort(item.getSlot())); // slot
                din.append(NumericalUtils.uint32ToByteArray(item.getItemID(), 1));

                din.append(0x00);
                din.append(0x00);
                din.append(0x00); // ToDo : Figure out the bit flags shit thing for amount
                din.append(0x0c); // ToDo : same for purity
            }
            return(din.getBytes());
        }
Ejemplo n.º 18
0
        private void charNameRequest(byte[] packet, NetworkStream client)
        {
            // Get the handle text
            byte[] handleSize = new byte[2];
            handleSize[0] = packet[5];
            handleSize[1] = packet[6];

            int size = (int)NumericalUtils.ByteArrayToUint16(handleSize, 1);

            byte[] handleB = new byte[size - 1];
            ArrayUtils.copy(packet, 7, handleB, 0, size - 1);
            string handleBStr = StringUtils.bytesToString_NS(handleB);             // Handle as "414141"
            string handleStr  = StringUtils.charBytesToString(handleB);            // Handle as "AAA"

            // Process DB to answer the client - we directly create the character
            UInt32 dbResult = Store.dbManager.MarginDbHandler.getNewCharnameID(handleStr, userID);

            // Add the new charId so that we can work with it

            // Create the answer
            string nameRequestResponse = "";

            if (dbResult == 0)
            {
                nameRequestResponse += "0b0f00010000110000000000000000";
                nameRequestResponse += StringUtils.bytesToString_NS(handleSize);
                nameRequestResponse += handleBStr + "00";
            }
            else
            {
                newCharID            = dbResult;
                nameRequestResponse += "0b0f0000000000";
                nameRequestResponse += StringUtils.bytesToString_NS(NumericalUtils.uint32ToByteArray((UInt32)dbResult, 1));
                nameRequestResponse += "0000000000";
                nameRequestResponse += StringUtils.bytesToString_NS(handleSize);
                nameRequestResponse += handleBStr + "00";
            }

            Output.writeToLogForConsole(nameRequestResponse);
            sendMarginData(nameRequestResponse, client);
        }
Ejemplo n.º 19
0
        public byte[] getBytesWithHeader(bool timedRPC)
        {
            DynamicArray rpcStructure = new DynamicArray();

            byte[] noTimedHeader = { 0x04 };
            byte[] timedHeader   = new byte[6];
            byte[] time          = TimeUtils.getUnixTime();

            timedHeader[0] = 0x82;

            ArrayUtils.copy(time, 0, timedHeader, 1, 4);
            timedHeader[5] = 0x04;             // This makes it "82aabbccdd04"

            if (timedRPC)
            {
                rpcStructure.append(timedHeader);
            }
            else
            {
                rpcStructure.append(noTimedHeader);
            }

            // Calculate blocks number


            if (rpcInside == 0)            // Is just 1 group of msgblocks
            {
                rpcInside = 1;
                rpcStructure.append(NumericalUtils.uint16ToByteArrayShort((UInt16)rpcInside));
                rpcStructure.append(getBytes());                 //Append our own content
            }
            else
            {
                rpcStructure.append(NumericalUtils.uint16ToByteArrayShort((UInt16)rpcInside));
                rpcStructure.append(din.getBytes());                 //Append our own content
            }


            return(rpcStructure.getBytes());
        }
Ejemplo n.º 20
0
        public void sendPlayerAnimation(WorldClient client, String hexAnimation)
        {
            // See animations.txt - hex animation is the first Id
            // Some samples:

            /*
             * 7312 1273 = Stand_Abil_ProgLauSelectivePhage2s_A
             * 7412 1274 = Stand_Abil_ProgLauSelectivePhage4s_A
             * 7512 1275 = Stand_Abil_ProgLauSelectivePhage6s_A
             * 7612 1276 = Stand_Abil_ProgLauSelectivePhage8s_A
             */
            Random rand = new Random();

            byte[] Ltvector3d = Store.currentClient.playerInstance.Position.getValue();
            double x          = 0;
            double y          = 0;
            double z          = 0;

            NumericalUtils.LtVector3dToDoubles(Ltvector3d, ref x, ref y, ref z);
            float xPos = (float)x;
            float yPos = (float)y;
            float zPos = (float)z;

            PacketContent pak = new PacketContent();

            pak.addUint16(2, 1);
            pak.addByteArray(new byte[] { 0x01, 0x28 });
            pak.addUintShort((ushort)rand.Next(0, 255));
            pak.addByteArray(new byte[] { 0x40, 00 });
            pak.addByte(0x29);
            pak.addHexBytes(hexAnimation);
            pak.addByteArray(new byte[] { 0x00, 0x01 });
            pak.addFloat(xPos, 1);
            pak.addFloat(yPos, 1);
            pak.addFloat(zPos, 1);
            pak.addByteArray(new byte[] { 0x20, 0x9f, 0x1e, 0x20 });
            pak.addUint16(0, 1);
            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            client.FlushQueue();
        }
Ejemplo n.º 21
0
        public void processHyperJumpCancel(ref byte[] rpcData)
        {
            double       xDest  = 0;
            double       yDest  = 0;
            double       zDest  = 0;
            PacketReader reader = new PacketReader(rpcData);

            xDest = reader.readDouble(1);
            yDest = reader.readDouble(1);
            zDest = reader.readDouble(1);

            // ToDo: figure out what this 6 bytes are could be
            // Skip 6 bytes as we currently didnt knew
            reader.incrementOffsetByValue(6);
            UInt32 maybeMaxHeight = reader.readUInt32(1);

            reader.setOffsetOverrideValue(rpcData.Length - 4);
            UInt32 clientJumpIdUnknown = reader.readUInt32(1);

            // Players current X Z Y
            double x = 0; double y = 0; double z = 0;

            byte[] Ltvector3d = Store.currentClient.playerInstance.Position.getValue();
            NumericalUtils.LtVector3dToDoubles(Ltvector3d, ref x, ref y, ref z);
            int   rotation = (int)Store.currentClient.playerInstance.YawInterval.getValue()[0];
            float xPos     = (float)x;
            float yPos     = (float)y;
            float zPos     = (float)z;

            float  distance = Maths.getDistance(xPos, yPos, zPos, (float)xDest, (float)yDest, (float)zDest);
            UInt16 duration = (UInt16)(distance * 0.5);

            UInt32 startTime = TimeUtils.getUnixTimeUint32();
            UInt32 endTime   = startTime + duration;

            ServerPackets packets = new ServerPackets();

            packets.sendHyperJumpID(clientJumpIdUnknown);
            packets.SendHyperJumpUpdate(xPos, yPos, zPos, (float)xDest, (float)yDest, (float)zDest, startTime, endTime);
        }
Ejemplo n.º 22
0
        // Shows the Animation of a target Player
        public void processFXfromPlayer(UInt16 viewID, byte[] animation)
        {
            Random rand = new Random();
            ushort updateViewCounter = (ushort)rand.Next(3, 200);

            byte[] updateCount = NumericalUtils.uint16ToByteArrayShort(updateViewCounter);

            DynamicArray din = new DynamicArray();

            din.append(NumericalUtils.uint16ToByteArray(viewID, 1));
            din.append(0x00);
            din.append(0x80);
            din.append(0x80);
            din.append(0x80);
            din.append(0x0c);
            din.append(animation); // uint32 anim ID
            din.append(updateCount);
            din.append(0x00);
            din.append(0x00);

            Store.currentClient.messageQueue.addObjectMessage(din.getBytes(), false);
        }
Ejemplo n.º 23
0
        public void processInitUDPSession(ref byte[] packetData)
        {
            byte[] cIDHex = new byte[4];
            cIDHex[0] = packetData[11];
            cIDHex[1] = packetData[12];
            cIDHex[2] = packetData[13];
            cIDHex[3] = packetData[14];

            Store.currentClient.playerData.setCharID(NumericalUtils.ByteArrayToUint32(cIDHex, 1));

            Store.dbManager.WorldDbHandler.setPlayerValues();
            Store.dbManager.WorldDbHandler.setRsiValues();

            // send the init UDP packet * 5
            byte[] response = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05 };
            Store.currentClient.messageQueue.addRawMessage(response);
            Store.currentClient.messageQueue.addRawMessage(response);
            Store.currentClient.messageQueue.addRawMessage(response);
            Store.currentClient.messageQueue.addRawMessage(response);
            Store.currentClient.messageQueue.addRawMessage(response);
            Store.currentClient.FlushQueue();
            Store.margin.sendUDPSessionReply(Store.currentClient.playerData.getCharID());
        }
Ejemplo n.º 24
0
        public void processAbility(ref byte[] packet)
        {
            byte[] ability    = { packet[0], packet[1] };
            byte[] targetView = { packet[2], packet[3] };
            UInt16 AbilityID  = NumericalUtils.ByteArrayToUint16(ability, 1);

            UInt16 viewId = 0;

            currentTargetViewId = NumericalUtils.ByteArrayToUint16(targetView, 1);


            // load the ability name from a list to see if we match the right ability
            DataLoader AbilityLoader = DataLoader.getInstance();

            this.currentAbility = AbilityLoader.getAbilityByID(AbilityID);

            // lets create a message for the client - we will later execute the right AbilityScript for it
            ServerPackets pak = new ServerPackets();

            pak.sendSystemChatMessage(Store.currentClient, "Ability ID is " + AbilityID.ToString() + " and the name is " + currentAbility.getAbilityName() + " and Target ViewId Is " + currentTargetViewId, "BROADCAST");

            // ToDo: do something with the entity (or queue a fx hit animation or something lol)
            this.processAbilityScript(this.currentAbility);
        }
Ejemplo n.º 25
0
        // Return all the values in an ArrayList, not just the decrypted packet
        public ArrayList decrypt(byte[] encryptedData, int length)
        {
            ArrayList response = new ArrayList();

            UInt16 pss  = 0;
            UInt16 cseq = 0;
            UInt16 sseq = 0;

            int decryptedSize = EnigmaLib.worldDecrypt(encryptedData, innerBuffer, length, ref pss, ref cseq, ref sseq);

            /*
             * If decrypted size is -1337 then it was a CRC in packet <> CRC of packet Exception
             * */

            if (decryptedSize == -1337)
            {
                Output.WriteLine("Oh oh, CRC didnt matched in this packet");
            }

            // This hexsize throws exceptions ...so we will use the decryptedSize - 10 (same value)
            byte[] hexSize = new byte[2];
            hexSize [0] = innerBuffer[4];
            hexSize [1] = innerBuffer[5];
            UInt16 size = NumericalUtils.ByteArrayToUint16(hexSize, 1);

            size -= 4;           // remove the 4 seq data bytes from size

            byte[] data = new byte[size];
            ArrayUtils.copy(innerBuffer, 14, data, 0, decryptedSize - 10);       // Should do a fast copy method for this, if not done already
            response.Add(data);
            response.Add(pss);
            response.Add(cseq);
            response.Add(sseq);

            return(response);
        }
Ejemplo n.º 26
0
        public void sendCastAbilityOnEntityId(UInt16 viewId, UInt32 animationId)
        {
            ClientView theView = Store.currentClient.viewMan.getViewById(viewId);

            byte[] updateCount = NumericalUtils.uint16ToByteArrayShort(Store.currentClient.playerData.assignSpawnIdCounter());

            Random rand         = new Random();
            ushort randomHealth = (ushort)rand.Next(3, 1800);
            // RSI Health FX "send 02 03 02 00 02 80 80 80 90 ed 00 30 22 0a 00 28 06 00 00;"
            PacketContent pak = new PacketContent();

            if (viewId == 0)
            {
                viewId = 2;
            }
            pak.addUint16(viewId, 1);

            UInt32 theGoID = 12;

            if (theView != null)
            {
                theGoID = theView.GoID;
            }

            switch (theGoID)
            {
            case 12:
                pak.addByte(0x02);
                pak.addByte(0x80);
                pak.addByte(0x80);
                pak.addByte(0x80);
                if (viewId == 2)
                {
                    pak.addByte(0x80);
                    pak.addByte(0xb0);
                }
                else
                {
                    pak.addByte(0x0c);
                }
                pak.addUint32(animationId, 1);
                pak.addByteArray(updateCount);
                break;

            case 599:
                pak.addByte(0x04);
                pak.addByte(0x80);
                pak.addByte(0x80);
                pak.addByte(0x80);
                pak.addByte(0xc0);
                pak.addUint16(randomHealth, 1);     // health
                pak.addByte(0xc0);
                pak.addUint32(animationId, 1);
                pak.addByteArray(updateCount);
                pak.addByte(0x05);
                pak.addByte(0x00);
                pak.addByte(0x00);
                string hexNPC = StringUtils.bytesToString(pak.returnFinalPacket());
                // Its more a demo - we "one hit" the mob currently so we must update this
                lock (WorldSocket.npcs.SyncRoot)
                {
                    for (int i = 0; i < WorldSocket.npcs.Count; i++)
                    {
                        npc thismob = (npc)WorldSocket.npcs[i];
                        if (thismob.getEntityId() == theView.entityId)
                        {
                            thismob.setIsDead(true);
                            thismob.setIsLootable(true);
                            WorldSocket.npcs[i] = thismob;
                            this.sendNPCDies(theView.ViewID, Store.currentClient, thismob);
                        }
                    }
                }
                break;

            default:
                pak.addByte(0x02);
                pak.addByte(0x80);
                pak.addByte(0x80);
                pak.addByte(0x80);
                if (viewId == 2)
                {
                    pak.addByte(0x80);
                    pak.addByte(0xb0);
                }
                else
                {
                    pak.addByte(0x0c);
                }
                pak.addUint32(animationId, 1);
                pak.addByteArray(updateCount);
                break;
            }

            string hex = StringUtils.bytesToString(pak.returnFinalPacket());

            Store.currentClient.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            Store.currentClient.flushQueue();
        }
Ejemplo n.º 27
0
        public void parseCommand(string data)
        {
            Output.WriteLine("[Chat Command helper] Chat command is: '" + data + "'");
            string[] commands = data.Split(' ');

            string command = commands[0].ToLower();

            try{
                if (command.Equals("?fix") && commands.Length > 1)
                {
                    int maxRPC = int.Parse(commands[1]);
                    for (int i = 0; i < maxRPC; i++)
                    {
                        Store.currentClient.playerData.setRPCCounter((UInt16)i);
                        Store.currentClient.messageQueue.addRpcMessage(PacketsUtils.createSystemMessage("Trying to fix! " + i, Store.currentClient));
                    }
                }

                if (command.Equals("?teleport") && commands.Length == 4)
                {
                    // parse the coord parameters parameters as int
                    Store.currentClient.messageQueue.addObjectMessage(new PlayerHelper().teleport(int.Parse(commands[1]), int.Parse(commands[2]), int.Parse(commands[3])), false);
                    Store.currentClient.messageQueue.addRpcMessage(PacketsUtils.createSystemMessage("Teleported!", Store.currentClient));
                }

                if (command.Equals("?rsi") && commands.Length == 3)
                {
                    //parse the rsi part and value
                    Store.currentClient.messageQueue.addObjectMessage(new PlayerHelper().changeRsi(commands[1], int.Parse(commands[2])), false);
                    Store.currentClient.messageQueue.addRpcMessage(PacketsUtils.createSystemMessage("Rsi changed!", Store.currentClient));
                }


                if (command.StartsWith("?message"))
                {
                    Output.WriteLine("[COMMAND HELPER]MESSAGE RECEIVED");
                    byte[] theMessage = PacketsUtils.createSystemMessageWithoutRPC(commands[1]);
                    Store.world.sendRPCToAllPlayers(theMessage);
                }

                if (command.Equals("?playanim"))
                {
                    string animId = commands[1];
                    if (animId.Length == 4)
                    {
                        ServerPackets pak = new ServerPackets();
                        pak.sendPlayerAnimation(Store.currentClient, animId);
                    }
                }

                if (command.StartsWith("?playfx"))
                {
                    string       fxHEDID = commands[1];
                    DynamicArray din     = new DynamicArray();


                    byte[] animationId = StringUtils.hexStringToBytes(fxHEDID);
                    byte[] viewID      = { 0x02, 0x00 };

                    Random rand = new Random();
                    ushort updateViewCounter = (ushort)rand.Next(3, 200);
                    byte[] updateCount       = NumericalUtils.uint16ToByteArrayShort(updateViewCounter);

                    Output.WriteLine("Check if its really one byte or two : " + StringUtils.bytesToString(updateCount));


                    din.append(viewID);
                    din.append(0x02);
                    din.append(0x80);
                    din.append(0x80);
                    din.append(0x80);
                    din.append(0x90);
                    din.append(0xed);
                    din.append(0x00);
                    din.append(0x30);
                    din.append(animationId);
                    din.append(updateCount);

                    Store.currentClient.messageQueue.addObjectMessage(din.getBytes(), false);
                }

                if (command.Contains("?send"))
                {
                    // Sends a packet from a file
                    string     filename   = "packet.txt";
                    TextReader tr         = new StreamReader(filename);
                    string     hexContent = tr.ReadToEnd();
                    hexContent = hexContent.Replace(" ", string.Empty);
                    hexContent = hexContent.Replace(" ", Environment.NewLine);
                    tr.Close();

                    if (hexContent.Length > 0)
                    {
                        Store.currentClient.messageQueue.addObjectMessage(StringUtils.hexStringToBytes(hexContent), false);
                        Output.writeToLogForConsole("[SENDPACK FROM FILE] Content : " + hexContent);
                    }
                }

                if (command.Contains("?combat"))
                {
                    byte[]          dummypak = new byte[4];
                    TestUnitHandler test     = new TestUnitHandler();
                    test.testCloseCombat(ref dummypak);
                }

                if (command.Contains("?mob"))
                {
                    UInt32[] rsiIDs = new UInt32[10];
                    rsiIDs[0] = 0xB7010058;
                    rsiIDs[1] = 0x89090058;
                    rsiIDs[2] = 0xB5010058;
                    rsiIDs[3] = 0x3A030008;
                    rsiIDs[4] = 0x32030008;
                    rsiIDs[5] = 0xD0010058;
                    rsiIDs[6] = 0xD4010058;
                    rsiIDs[7] = 0xB8040004; // Smith
                    rsiIDs[8] = 0x92010058; // Seraph
                    rsiIDs[9] = 0x56050004;
                    Random rand  = new Random();
                    int    index = rand.Next(0, 9);

                    double x = 0; double y = 0; double z = 0;
                    byte[] Ltvector3d = Store.currentClient.playerInstance.Position.getValue();
                    NumericalUtils.LtVector3dToDoubles(Ltvector3d, ref x, ref y, ref z);

                    byte[] xPos = NumericalUtils.floatToByteArray((float)x, 1);
                    byte[] yPos = NumericalUtils.floatToByteArray((float)y, 1);
                    byte[] zPos = NumericalUtils.floatToByteArray((float)z, 1);

                    UInt64 currentEntityId = WorldSocket.entityIdCounter;
                    WorldSocket.entityIdCounter++;
                    uint rotation = 0;

                    npc theMob = new npc();
                    theMob.setEntityId(currentEntityId);
                    theMob.setDistrict(Convert.ToUInt16(data[0].ToString()));
                    theMob.setDistrictName(Store.currentClient.playerData.getDistrict());
                    theMob.setName("HD Protector");
                    theMob.setLevel(255);
                    theMob.setHealthM(UInt16.Parse(data[4].ToString()));
                    theMob.setHealthC(UInt16.Parse(data[5].ToString()));
                    theMob.setMobId((ushort)rsiIDs[index]);
                    theMob.setRsiHex(StringUtils.bytesToString_NS(NumericalUtils.uint32ToByteArray(rsiIDs[index], 1)));
                    theMob.setXPos(x);
                    theMob.setYPos(y);
                    theMob.setZPos(z);
                    theMob.xBase = x;
                    theMob.yBase = y;
                    theMob.zBase = z;
                    theMob.setRotation(rotation);
                    theMob.setIsDead(false);
                    theMob.setIsLootable(false);
                    WorldSocket.npcs.Add(theMob);

                    // we use this for a test to see if we can spawn mobs and how we can handle them
                    // We refactor this
                }



                if (command.Contains("?sendrpc"))
                {
                    // sends a RPC Packet from a File
                    string     filename   = "rpcpacket.txt";
                    TextReader tr         = new StreamReader(filename);
                    string     hexContent = tr.ReadToEnd();
                    hexContent = hexContent.Replace(" ", string.Empty);
                    hexContent = hexContent.Replace(" ", Environment.NewLine);
                    Output.Write("SEND RPC COMMAND : CONTENT : " + hexContent);
                    tr.Close();

                    if (hexContent.Length > 0)
                    {
                        Store.currentClient.messageQueue.addRpcMessage(StringUtils.hexStringToBytes(hexContent));
                        Output.writeToLogForConsole("[SENDRPC FROM FILE] Content : " + hexContent);
                    }
                }

                if (command.Contains("?checkrpc"))
                {
                    DynamicArray din = new DynamicArray();
                    din.append(StringUtils.hexStringToBytes("2E1000FF7D020024000000310000000000000000000000000000000000000000000000000B0053796E61707A65373737001D004F6E2079656168204920646F2072656D656D62657220796F75203A2900"));
                    Store.currentClient.messageQueue.addRpcMessage(din.getBytes());
                }

                if (command.Contains("?testrpc"))
                {
                    UInt16 maxRPC = 33279;
                    // Just to reference
                    if (Store.currentClient.playerData.currentTestRPC <= maxRPC)
                    {
                        // Only if it is below we send it - we test with a 5 size packet
                        DynamicArray din = new DynamicArray();
                        if (Store.currentClient.playerData.currentTestRPC < 127)
                        {
                            din.append(NumericalUtils.uint16ToByteArrayShort(Store.currentClient.playerData.currentTestRPC));
                        }
                        else
                        {
                            din.append(NumericalUtils.uint16ToByteArray(Store.currentClient.playerData.currentTestRPC, 0));
                        }

                        din.append(0x00);
                        din.append(0x00);
                        din.append(0x00);

                        Store.currentClient.messageQueue.addRpcMessage(din.getBytes());

                        ServerPackets pak = new ServerPackets();
                        pak.sendSystemChatMessage(Store.currentClient, "Test RPC Header : " + Store.currentClient.playerData.currentTestRPC.ToString(), "MODAL");

                        Store.currentClient.playerData.currentTestRPC++;
                    }
                }

                if (command.Equals("?save"))
                {
                    new PlayerHelper().savePlayerInfo(Store.currentClient);

                    ServerPackets pak = new ServerPackets();
                    pak.sendSaveCharDataMessage(Store.currentClient, StringUtils.charBytesToString_NZ(Store.currentClient.playerInstance.CharacterName.getValue()));
                }
            }
            catch (Exception e) {
                Store.currentClient.messageQueue.addRpcMessage(PacketsUtils.createSystemMessage("Error parsing command!", Store.currentClient));
                Output.WriteLine("[CHAT COMMAND PARSER] Error parsing request: " + data);
                Output.WriteLine("[CHAT COMMAND PARSER] DEBUG: " + e.Message + "\n" + e.StackTrace);
            }
        }
Ejemplo n.º 28
0
        public byte[] encrypt(byte[] packet)
        {
            // Get timestamp
            byte[] timestamp = TimeUtils.getUnixTime();


            // get size
            int psize = packet.Length;

            byte[] size = NumericalUtils.uint16ToByteArray((UInt16)psize, 1);

            //showPacket(size, " Size ");

            // final Packet

            DynamicArray temp = new DynamicArray();

            temp.append(size);
            temp.append(timestamp);
            temp.append(packet);


            // compute CRC32
            byte[] crc32pax = crc32.checksumB(temp.getBytes(), 1);


            // Padding
            int totalLength = temp.getSize() + 4;
            int padding     = 16 - (totalLength % 16);

            byte[] paddingBytes = new byte[padding];

            for (int i = 0; i < padding; i++)
            {
                paddingBytes[i] = (byte)padding;
            }

            temp.append(paddingBytes);
            tf.setIV(IV);
            tf.setKey(TF_Key);

            // We init with 2 more than needed, so no memory reservation is done on dyn array
            DynamicArray finalPlainData = new DynamicArray();

            finalPlainData.append(crc32pax);
            finalPlainData.append(temp.getBytes());

            temp = null;             // Cleaning the house


            byte[] encryptedData = new byte[finalPlainData.getSize()];
            tf.encrypt(finalPlainData.getBytes(), encryptedData);


            finalPlainData = null;             // Cleaning the house (2)

            // add IV before the results

            DynamicArray response = new DynamicArray();

            response.append(IV);
            response.append(encryptedData);

            // Display HEX Values after Encryption
            return(response.getBytes());
        }
Ejemplo n.º 29
0
        public void processHyperJump(ref byte[] packet)
        {
            byte[]       destXBytes = new byte[8];
            byte[]       destYBytes = new byte[8];
            byte[]       destZBytes = new byte[8];
            byte[]       maxHeight  = new byte[4];
            byte[]       theLast4   = new byte[4]; // we dont know what this is lol
            DynamicArray restBytes  = new DynamicArray();

            ArrayUtils.copy(packet, 0, destXBytes, 0, 8);
            ArrayUtils.copy(packet, 8, destYBytes, 0, 8);
            ArrayUtils.copy(packet, 16, destZBytes, 0, 8);
            ArrayUtils.copy(packet, 30, maxHeight, 0, 4);
            ArrayUtils.copy(packet, packet.Length - 4, theLast4, 0, 4);

            // Players current X Z Y
            double x = 0; double y = 0; double z = 0;

            byte[] Ltvector3d = Store.currentClient.playerInstance.Position.getValue();
            NumericalUtils.LtVector3dToDoubles(Ltvector3d, ref x, ref y, ref z);
            int   rotation = (int)Store.currentClient.playerInstance.YawInterval.getValue()[0];
            float xPos     = (float)x;
            float yPos     = (float)y;
            float zPos     = (float)z;

            float xDestFloat = (float)NumericalUtils.byteArrayToDouble(destXBytes, 1);
            float yDestFloat = (float)NumericalUtils.byteArrayToDouble(destYBytes, 1);
            float zDestFloat = (float)NumericalUtils.byteArrayToDouble(destZBytes, 1);

            float  distance = getDistance(xPos, yPos, zPos, xDestFloat, yDestFloat, zDestFloat);
            UInt16 duration = (UInt16)(distance * 1.5);
            //UInt32 startTime = TimeUtils.getUnixTimeUint32() - 100000;
            //UInt32 endTime = startTime + duration;

            UInt32        startTime = TimeUtils.getUnixTimeUint32();
            UInt32        endTime   = startTime + duration;
            PacketContent pak       = new PacketContent();

            pak.addByte(0x02);
            pak.addByte(0x00);
            pak.addByte(0x03);
            pak.addByte(0x09);
            pak.addByte(0x08);
            pak.addByte(0x00);
            pak.addFloatLtVector3f(xPos, yPos, zPos);
            pak.addUint32(startTime, 1);
            pak.addByte(0x80);
            pak.addByte(0x80);
            pak.addByte(0xb8);
            pak.addByte(0x14); // if 0xb8
            pak.addByte(0x00); // if 0xb8
            pak.addUint32(endTime, 1);
            pak.addByteArray(destXBytes);
            pak.addByteArray(destYBytes);
            pak.addByteArray(destZBytes);
            pak.addByteArray(new byte[] { 0x10, 0xff, 0xff });
            pak.addByte(0x00);
            pak.addByte(0x00);
            pak.addByte(0x00);
            Store.currentClient.messageQueue.addObjectMessage(pak.returnFinalPacket(), true);
        }
Ejemplo n.º 30
0
        public StaticWorldObject getObjectValues(UInt32 objectId)
        {
            Output.WriteLine("REQUEST OBJECT WITH ID :" + StringUtils.bytesToString_NS(NumericalUtils.uint32ToByteArray(objectId, 0)));
            StaticWorldObject worldObject = null;

            worldObject = WorldObjectsDB.Find(delegate(StaticWorldObject temp) { return(temp.mxoId == objectId); });
            if (worldObject == null)
            {
                worldObject = new StaticWorldObject();
            }

            return(worldObject);
        }
Ejemplo n.º 31
0
        private static void ParseContent(ref byte[] packetData)
        {
            buffer = null;
            buffer = packetData;
            offset = 0;             //initialize to initial byte

            byte temp;

            temp = BufferHandler.readByte(ref packetData, ref offset);

            // Convert to Ack Flags
            BitArray AckFlags = NumericalUtils.byteToBitArray(temp);

            /* Flag Field
             * 1 - unknown / nothing
             * 2 - isAck (should always be )
             * 3 - unknown currently
             * 4 - unknown currently
             * 5 - SERVERFLAGS_RESETRCC
             * 6 - CLIENTFLAGS_RESETDONE (so its done)
             * 7 - SERVERFLAG_SIMTIME (aka 0x82, 0xc2)
             */

            if (AckFlags.Get(1) == false)
            {
                Output.WriteDebugLog("[WARNING] Packet has acked not set and is encrypted");
            }

            if (AckFlags.Get(7) == true)
            {
                byte[] simTime = BufferHandler.readBytes(ref packetData, ref offset, 4);
                Store.currentClient.playerData.setClientSimTime(NumericalUtils.byteArrayToFloat(simTime, 1));
            }


            if (AckFlags.Get(6) == true)
            {
                Output.WriteDebugLog("[CLIENT]CLIENTFLAGS_RESETDONE found - we can init new RCC Comm ");
                // Reset comm
                Store.currentClient.playerData.setCseq(0);
                Store.currentClient.playerData.setSseq(0);
                Store.currentClient.playerData.setPss(0x00);
                Store.currentClient.playerData.setOnWorld(false);
                Store.currentClient.playerData.setRPCShutDown(false);
                Store.currentClient.playerData.setRPCCounter(0);
                PlayerHandler handler = new PlayerHandler();
                handler.processAttributes();
                handler.processPlayerSetup();
            }


            if (packetData.Length > 1 && AckFlags.Get(1) == true) //Not just ACK nor Resetting

            {
                if (packetData[offset] == 0x05)
                {
                    offset = offset + 4;
                    Output.writeToLogForConsole("Its a 05 Packet");
                    Store.currentClient.messageQueue.ackOnlyCount = Store.currentClient.messageQueue.ackOnlyCount + 1;
                    Store.currentClient.flushQueue();
                    // We dont need a handler for 05 Packets (as there is only one as i see lol)
                }

                if (packetData[offset] == 0x03)                // Is a 03 packet
                {
                    offset++;
                    offset = man03.parse(offset, ref buffer);
                }


                if (offset < packetData.Length)                 // There is no more info if we'r out of offset

                {
                    if (packetData[offset] == 0x04)                    // Is a 04 packet
                    {
                        offset++;
                        offset = man04.parse(offset, ref buffer);
                    }
                }

                if (Store.currentClient.messageQueue.ObjectMessagesQueue.Count == 0 && Store.currentClient.messageQueue.RPCMessagesQueue.Count == 0)
                {
                    // nothing to send ? we should really ack something then
                    Store.currentClient.messageQueue.ackOnlyCount = Store.currentClient.messageQueue.ackOnlyCount + 1;
                    Store.currentClient.flushQueue();
                }
            }
        }