Exemple #1
0
        public void SendHyperJumpUpdate(float xFromPos, float yFromPos, float zFromPos, float xDestPos, float yDestPos,
                                        float zDestPos, UInt32 startTime, UInt32 endTime)
        {
            // ToDo: make real repsonse
            PacketContent pak = new PacketContent();

            pak.addByte(0x02);
            pak.addByte(0x00);
            pak.addByte(0x03);
            pak.addByte(0x09);
            pak.addByte(0x08);
            pak.addByte(0x00);
            pak.addFloatLtVector3f(xFromPos, yFromPos, zFromPos);
            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.addDoubleLtVector3d((double)xDestPos, (double)yDestPos, (double)zDestPos);
            pak.addByteArray(new byte[] { 0x10, 0xff, 0xff });
            pak.addByte(0x00);
            pak.addByte(0x00);
            pak.addByte(0x00);
            Store.currentClient.messageQueue.addObjectMessage(pak.returnFinalPacket(), true);
        }
Exemple #2
0
        public void spawnDataNodeView(WorldClient client)
        {
            // ToDo: implement it in our Object Attribute Generation System
            // #VALUES FOR GOID: 47080, DataNodeContainer
            // #USING 305, Binary-Present: YES
            // 276,Position,LTVector3d,24
            // 140,HalfExtents,LTVector3f,12
            // 194,MissionKey,MissionKey,4
            // 304,UseCount,uint8,1
            // 108,CurrentState,EventID,4
            // 112,CurrentTimerState,EventID,4
            // 260,Orientation,LTQuaternion,16
            WorldSocket.entityIdCounter++;
            ClientView view = client.viewMan.getViewForEntityAndGo(WorldSocket.entityIdCounter, 47080);

            PacketContent pak = new PacketContent();

            pak.addUint16(1, 1);
            pak.addHexBytes("0ce8b7f5cdab0329");
            pak.addByteArray(client.playerInstance.Position.getValue());
            pak.addUintShort(1);    // UseCount
            pak.addUint32(4001, 1); // 112,CurrentTimerState,EventID,4
            pak.addUint16(view.ViewID, 1);
            pak.addByte(0x00);
            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            client.FlushQueue();
        }
Exemple #3
0
        public void HitEnemyWithDamage(ushort hitValue, uint hitFxId)
        {
            // Change to combat so that he isnt moving anymore
            currentState = (int)statusList.COMBAT;
            if (healthC - hitValue <= 0)
            {
                healthC = 0;
            }
            else
            {
                healthC -= hitValue;
            }
            hitCounter++;

            // Format 04 80 80 80 80 c0 <uint16 health> c0 <uint32 fxid> 01(but unknown for what it is) <uint8 random>
            // Example Full: send 02 03 <viewID> 04 80 80 80 c0 02 00 c0 c1 01 00 28 01 01 00 00;
            var hitPacket = new PacketContent();

            hitPacket.addByte(0x04);
            hitPacket.addByte(0x80);
            hitPacket.addByte(0x80);
            hitPacket.addByte(0x80);
            hitPacket.addByte(0xc0);
            hitPacket.addUint16(healthC, 1);
            hitPacket.addByte(0xc0);
            hitPacket.addUint32(hitFxId, 1);    // FX ID
            hitPacket.addByte(0x01);
            hitPacket.addUintShort(hitCounter); // Animation Count or something - must be an another as before
            Store.world.SendViewUpdateToClientsWhoHasSpawnedView(hitPacket, this);
        }
Exemple #4
0
        public void sendPlayerFriendList(WorldClient client)
        {
            ArrayList friends = Store.dbManager.WorldDbHandler.fetchFriendList(Store.currentClient.playerData.getCharID());

            if (friends.Count > 0)
            {
                foreach (Hashtable friend in friends)
                {
                    PacketContent pak = new PacketContent();
                    pak.addUint16((UInt16)RPCResponseHeaders.SERVER_FRIENDLIST_STATUS, 0);
                    pak.addHexBytes("0800");
                    if ((Int16)friend["online"] == 1)
                    {
                        pak.addByte(0x3c);
                    }
                    else
                    {
                        pak.addByte(0x3b);
                    }

                    pak.addHexBytes("0000");
                    pak.addByte(0x8e); // Another unknown flag ...mxosource made it wrong lol
                    pak.addSizedTerminatedString("SOE+MXO+" + friend["handle"]);
                    client.messageQueue.addRpcMessage(pak.returnFinalPacket());
                }
            }
        }
        public void SendWhoCMD(WorldClient client)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_CHAT_WHO_RESPONSE, 0);
            pak.addUint16(5, 1); // Alsways there
            pak.addByte(0x00);   // We are not sure why but as its just 3 bytes for the nums we need "space" bytes
            pak.addUint16((UInt16)WorldSocket.Clients.Count, 1);
            pak.addByte(0x00);   // Again there is space
            foreach (string clientKey in WorldSocket.Clients.Keys)
            {
                WorldClient theClient = WorldSocket.Clients[clientKey] as WorldClient;
                // ToDo: this is not complete implemented - the first is maybe an offset- needs more research firstex
                pak.addHexBytes("3c014801"); // This is just from logs
                pak.addByte(0xef);           // profession
                pak.addHexBytes("010000");
                pak.addByteArray(theClient.playerInstance.Level.getValue());
                pak.addByte(0x01);
                pak.addByte(0x00);
            }

            foreach (string clientKey in WorldSocket.Clients.Keys)
            {
                WorldClient theClient = WorldSocket.Clients[clientKey] as WorldClient;
                // ToDo: this is really dirty hacky
                string charname = StringUtils.charBytesToString_NZ(theClient.playerInstance.CharacterName.getValue());
                pak.addSizedTerminatedString(charname);
            }
            Store.currentClient.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #6
0
 public void sendMissionAbort(WorldClient client)
 {
     PacketContent pak = new PacketContent();
     pak.addHexBytes("80a20800000000b4658db5000000000000000000000000000000");
     client.messageQueue.addRpcMessage(pak.returnFinalPacket());
     client.flushQueue();
 }
Exemple #7
0
        public void sendMarketPlaceList(WorldClient client)
        {
            // ToDo: make it dynamic with database later (but the "handler" should give the items as arguments for this method
            // List Marketplace Items

            byte[] headerSeperator = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

            // Should foreach this later on "Real Server"
            DynamicArray listItems = new DynamicArray();
            listItems.append(StringUtils.hexStringToBytes("8703000000000034bdcf1200401f00000310db6a4a")); // Foot Wear
            listItems.append(0x00); // Seperate each item

            listItems.append(StringUtils.hexStringToBytes("2e00000003a04a000bd012000000FFFF01aedc6a4a")); // Google
            listItems.append(0x00); // Seperate each item

            listItems.append(StringUtils.hexStringToBytes("721a000003a04a000bd012000000FFFF01aedc6a4a")); // Item Data
            listItems.append(0x00); // Seperate each item

            listItems.append(StringUtils.hexStringToBytes("2e00000003a04a000bd01200000000FF01aedc6a4a")); // Item Data
            listItems.append(0x00); // Seperate each item

            // get data size
            byte[] itemSize = NumericalUtils.uint16ToByteArray((UInt16)listItems.getBytes().Length, 1);

            PacketContent pak = new PacketContent();
            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_LOAD_MARKERPLACE, 0);
            pak.addUintShort(9); // list offset
            pak.addByteArray(headerSeperator);
            pak.addUint16((UInt16)listItems.getBytes().Length,1);
            pak.addByteArray(listItems.getBytes());
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #8
0
        public void SendNpcDies(UInt16 viewId, WorldClient client, Mob theMob)
        {
            // Falls to ground like dead lol

            //activate loot+f
            PacketContent pak = new PacketContent();

            pak.addUint16(viewId, 1);
            pak.addHexBytes("0501c20200808100000000e0010000c0830000de810303fd070000000000000000");
            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);

            PacketContent fallToGroundPak = new PacketContent();

            fallToGroundPak.addUint16(viewId, 1);
            fallToGroundPak.addHexBytes("02010d000000000000000000000000000000");
            client.messageQueue.addObjectMessage(fallToGroundPak.returnFinalPacket(), false);

            // lie on the ground
            PacketContent pak2 = new PacketContent();

            pak2.addUint16(viewId, 1);
            pak2.addHexBytes("02010d000000000000000000000000000000");
            client.messageQueue.addObjectMessage(pak2.returnFinalPacket(), false);

            client.FlushQueue();
        }
Exemple #9
0
        public void testCloseCombat(ref byte[] packet)
        {
            byte[] targetViewWithSpawnId = new byte[4];
            ArrayUtils.copy(packet, 0, targetViewWithSpawnId, 0, 4);
            string hexString    = StringUtils.bytesToString_NS(targetViewWithSpawnId);
            string hexStringPak = StringUtils.bytesToString_NS(packet);

            Store.currentClient.messageQueue.addObjectMessage(StringUtils.hexStringToBytes("020003010C00808400808080800100001000"), false); // Make me combat mode "on"

            // The 55 View Packet
            PacketContent ilCombatHandler = new PacketContent();

            ilCombatHandler.addHexBytes("01000C370036CDAB0205");
            ilCombatHandler.addByteArray(Store.currentClient.playerInstance.Position.getValue());
            ilCombatHandler.addHexBytes("cdec4023"); // Time starts i think
            ilCombatHandler.addHexBytes("fd0000");   // view ID fd00
            Store.currentClient.messageQueue.addObjectMessage(ilCombatHandler.returnFinalPacket(), false);
            Store.currentClient.flushQueue();
            // The other 03 Packet for combat
            PacketContent unknownCreatePak = new PacketContent();

            unknownCreatePak.addByteArray(StringUtils.hexStringToBytes("010002A700"));
            unknownCreatePak.addByteArray(StringUtils.hexStringToBytes("FD00")); // ViewID from Combat Object
            unknownCreatePak.addByteArray(StringUtils.hexStringToBytes("01"));
            unknownCreatePak.addByteArray(Store.currentClient.playerInstance.Position.getValue());
            unknownCreatePak.addByteArray(StringUtils.hexStringToBytes("0100000003000000"));
            unknownCreatePak.addByteArray(targetViewWithSpawnId);
            unknownCreatePak.addUint16(2, 1);
            unknownCreatePak.addUint16(Store.currentClient.playerData.selfSpawnIdCounter, 1);
            unknownCreatePak.addByteArray(StringUtils.hexStringToBytes("01010207030000200BF5C2000020C19420B9C300000000000020C100000000070001001201000007037608E00603145200008B0B0024145200008B0B0024882300008B0B00240000000000000000000000000000000064000000640000000010001010000000020000001000000002000000000000000000000000"));
            Store.currentClient.messageQueue.addObjectMessage(unknownCreatePak.returnFinalPacket(), false);
            Store.currentClient.flushQueue();
        }
        public void processVendorOpen(ref byte[] objectID)
        {
            PacketContent pak = new PacketContent();

            pak.addHexBytes("810D7CADD943000000A07EB1D1400000008000BEA940000000E0E74CA7402000140000140080002000800018008000040080002C008000F4118000540680004C088000BC06800000068000AC058000700D8000740D8000900D8000940D8000980D80009C0D8000240080003C0080001C0080");
            Store.currentClient.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #11
0
        public void sendMarketPlaceList(WorldClient client)
        {
            // ToDo: make it dynamic with database later (but the "handler" should give the items as arguments for this method
            // List Marketplace Items

            byte[] headerSeperator = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

            // Should foreach this later on "Real Server"
            DynamicArray listItems = new DynamicArray();

            listItems.append(StringUtils.hexStringToBytes("8703000000000034bdcf1200401f00000310db6a4a")); // Foot Wear
            listItems.append(0x00);                                                                       // Seperate each item

            listItems.append(StringUtils.hexStringToBytes("2e00000003a04a000bd012000000FFFF01aedc6a4a")); // Google
            listItems.append(0x00);                                                                       // Seperate each item

            listItems.append(StringUtils.hexStringToBytes("721a000003a04a000bd012000000FFFF01aedc6a4a")); // Item Data
            listItems.append(0x00);                                                                       // Seperate each item

            listItems.append(StringUtils.hexStringToBytes("2e00000003a04a000bd01200000000FF01aedc6a4a")); // Item Data
            listItems.append(0x00);                                                                       // Seperate each item

            // get data size
            byte[] itemSize = NumericalUtils.uint16ToByteArray((UInt16)listItems.getBytes().Length, 1);

            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_LOAD_MARKERPLACE, 0);
            pak.addUintShort(9); // list offset
            pak.addByteArray(headerSeperator);
            pak.addUint16((UInt16)listItems.getBytes().Length, 1);
            pak.addByteArray(listItems.getBytes());
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #12
0
        public void processLoadAbility(ref byte[] packet)
        {
            // read the values from the packet
            PacketReader reader         = new PacketReader(packet);
            UInt32       staticObjectID = reader.readUInt32(1);
            UInt16       unloadFlag     = reader.readUInt16(1);
            UInt16       loadFlag       = reader.readUInt16(1);
            UInt16       countAbilities = reader.readUInt16(1);

            int           pointer      = 11; // Start at index 11
            List <UInt16> abilitySlots = new List <UInt16>();

            for (int i = 1; i <= countAbilities; i++)
            {
                // This must be looped
                byte[] slotByteID = new byte[2];
                ArrayUtils.copyTo(packet, pointer, slotByteID, 0, 2);
                pointer = pointer + 2;

                byte[] abilityByteID = new byte[2];
                ArrayUtils.copyTo(packet, pointer, abilityByteID, 0, 2);
                pointer = pointer + 4;

                byte[] abilityByteLevel = new byte[2];
                ArrayUtils.copyTo(packet, pointer, abilityByteLevel, 0, 2);
                pointer = pointer + 3;


                UInt16 slotID       = NumericalUtils.ByteArrayToUint16(slotByteID, 1);
                UInt16 AbilityID    = NumericalUtils.ByteArrayToUint16(abilityByteID, 1);
                UInt16 AbilityLevel = NumericalUtils.ByteArrayToUint16(abilityByteLevel, 1);

                PacketContent pak = new PacketContent();
                if (unloadFlag > 0)
                {
                    pak.addUint16((UInt16)RPCResponseHeaders.SERVER_ABILITY_UNLOAD, 0);
                    pak.addByteArray(abilityByteID);
                }
                else
                {
                    pak.addUint16((UInt16)RPCResponseHeaders.SERVER_ABILITY_LOAD, 0);
                    pak.addByteArray(abilityByteID);
                    pak.addByteArray(abilityByteLevel);
                    pak.addByteArray(slotByteID);
                }
                abilitySlots.Add(slotID);
                Store.currentClient.messageQueue.addRpcMessage(pak.returnFinalPacket());
            }


            if (unloadFlag > 0)
            {
                Store.dbManager.WorldDbHandler.updateAbilityLoadOut(abilitySlots, 0);
            }
            else
            {
                Store.dbManager.WorldDbHandler.updateAbilityLoadOut(abilitySlots, 1);
            }
        }
Exemple #13
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, 0xe3, 0x00 });
            pak.addByte(0x00);
            pak.addByte(0x00);
            pak.addByte(0x00);
            Store.currentClient.messageQueue.addObjectMessage(pak.returnFinalPacket(), true);
        }
Exemple #14
0
        public void sendHyperJumpID(UInt32 possibleJumpID)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_HYPERJUMP_ID, 0);
            pak.addUint32(possibleJumpID, 1);
            Store.currentClient.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #15
0
 public void sendEXPCurrent(WorldClient client, UInt32 exp)
 {
     PacketContent pak = new PacketContent();
     pak.addUint16((UInt16)RPCResponseHeaders.SERVER_PLAYER_EXP, 0);
     pak.addUint32(exp, 1);
     pak.addHexBytes("00000000");
     client.messageQueue.addRpcMessage(pak.returnFinalPacket());
 }
Exemple #16
0
 public void sendTeamCreation(WorldClient client, string missionTeamName)
 {
     PacketContent pak = new PacketContent();
     pak.addUint16((UInt16)RPCResponseHeaders.SERVER_TEAM_CREATE, 0);
     pak.addHexBytes("2A0000020E00040000000000"); // Unknown mostly
     pak.addSizedTerminatedString(missionTeamName);
     client.messageQueue.addRpcMessage(pak.returnFinalPacket());
 }
Exemple #17
0
        public void SendLootAccepted(WorldClient client)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_LOOT_ACCEPTED_RESPONSE, 0);
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
            client.FlushQueue();
        }
Exemple #18
0
        public void sendVendorWindow()
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_VENDOR_OPEN, 0);
            pak.addHexBytes("7cadd94300000000a0b7f6c000000000003c9440000000000051c8c020000a0000140080002000800018008000040080002c008000f41180009806800090078000c4068000640680");
            Store.currentClient.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #19
0
        public void sendCrewAndFactionEnableWindow(WorldClient client)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_FACTION_ENABLED_WINDOW, 0);
            pak.addHexBytes("15A0070000000000000000000000000000000000000000210000000000230000000000");
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #20
0
        public void sendExitGame(WorldClient client)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_JACKOUT_FINISH, 0);
            pak.addHexBytes("000000000000");
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #21
0
        public void sendMissionAbort(WorldClient client)
        {
            PacketContent pak = new PacketContent();

            pak.addHexBytes("80a20800000000b4658db5000000000000000000000000000000");
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
            client.flushQueue();
        }
Exemple #22
0
        public void sendElevatorPanel(WorldClient client, StaticWorldObject objectValues)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_ELEVATOR_PANEL, 0);
            pak.addUint16(objectValues.sectorID, 1);
            pak.addHexBytes("2200");
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #23
0
        public void sendTeamCreation(WorldClient client, string missionTeamName)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_TEAM_CREATE, 0);
            pak.addHexBytes("2A0000020E00040000000000"); // Unknown mostly
            pak.addSizedTerminatedString(missionTeamName);
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #24
0
        private byte[] loadBackgroundInfo(int charID)
        {
            MarginCharacter marginCharacter = Store.dbManager.MarginDbHandler.getCharInfo(charID);


            PacketContent pak = new PacketContent();

            if (!isNewCreatedChar)
            {
                pak.addByteArray(StringUtils.hexStringToBytes("01000000640000007B0000006500000000000000000000006C000000000000002B010000"));
            }
            pak.addStringWithFixedSized(marginCharacter.firstname, 32);
            pak.addStringWithFixedSized(marginCharacter.lastname, 32);
            pak.addStringWithFixedSized(marginCharacter.background, 1024);


            // ToDo: Analyse it and (Rep zion => 82, Rep Machine 2, RepMero 81
            //pak.addHexBytes("000000000000000000178604E40008AF2F0175020000A39F714A81FF81FF81FF670067006700000003000301310000B402320000B403380000B4044E0000000200510000001600520000001900540000001300");
            pak.addUint32(marginCharacter.exp, 1);
            pak.addUint32(marginCharacter.cash, 1);
            pak.addUintShort(0x01); // Flag - always 1
            pak.addUint32(200, 1);  // CQ Points

            pak.addByteArray(TimeUtils.getCurrentTime());
            //pak.addByteArray(StringUtils.hexStringToBytes("875D714A")); // Last Changed Timestamp - current its static - needs to be dynamic

            // Rputation Bytes (int16[7])
            pak.addInt16(-116, 1);
            pak.addInt16(-117, 1);
            pak.addInt16(-20, 1);
            pak.addInt16(-59, 1);
            pak.addInt16(-58, 1);
            pak.addInt16(-57, 1);
            pak.addInt16(2, 1);
            pak.addByte(0x03);

            // 01 = onWorld , 00 = LA . In World you have to take care to not spawn the Character in LA State
            if (marginCharacter.districtId != 0)
            {
                pak.addByte(0x01);
            }
            else
            {
                pak.addByte(0x00);
            }

            pak.addHexBytes("0301310000b402320000b403380000b403510000000400520000000b00540000000100"); // The Last Part

                #if DEBUG
            if (isNewCreatedChar == true)
            {
                Output.WriteLine("Load Background Reply for Created Char:\n" + pak.returnFinalPacket());
            }
                        #endif

            return(pak.returnFinalPacket());
        }
Exemple #25
0
 public void sendFactionName(WorldClient client, UInt32 factionID, string factionName)
 {
     PacketContent pak = new PacketContent();
     pak.addUint16((UInt16)RPCResponseHeaders.SERVER_FACTION_NAME_RESPONSE, 0);
     pak.addUint32(factionID,1);
     // Add 42 Bytes long faction name
     pak.addStringWithFixedSized(factionName, 42);
     Store.currentClient.messageQueue.addRpcMessage(pak.returnFinalPacket());
 }
Exemple #26
0
 // Place Methods here for Inventory
 public void sendInventoryItemMove(UInt16 sourceSlot, UInt16 destSlot, WorldClient client)
 {
     PacketContent pak = new PacketContent();
     pak.addByte(0x65);
     pak.addUint16(sourceSlot,1);
     pak.addUint16(destSlot,1);
     pak.addByte(0x00);
     client.messageQueue.addRpcMessage(pak.returnFinalPacket());
 }
Exemple #27
0
        public void sendSaveCharDataMessage(WorldClient client, string handle)
        {
            PacketContent pak = new PacketContent();

            pak.addByte((byte)RPCResponseHeaders.SERVER_CHAT_MESSAGE_RESPONSE);
            pak.addHexBytes("0700000000000000000000006400002E00240000000000000000000000000000000000");
            pak.addSizedTerminatedString(handle);
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #28
0
 public void sendAttribute(WorldClient client, UInt16 attributeValue, byte type)
 {
     PacketContent pak = new PacketContent();
     pak.addUint16((UInt16)RPCResponseHeaders.SERVER_PLAYER_ATTRIBUTE, 0);
     pak.addByte(type);
     pak.addUint16(attributeValue, 0);
     pak.addHexBytes("000802");
     client.messageQueue.addRpcMessage(pak.returnFinalPacket());
 }
Exemple #29
0
        public void sendInfoCurrent(WorldClient client, UInt32 info)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_PLAYER_INFO, 0);
            pak.addUint32(info, 1);
            pak.addHexBytes("00000000");
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #30
0
 // ToDo: if other clients invite this player to a team
 public void sendTeamInvitation(WorldClient client, string inviterCharname, string missionTeamName)
 {
     PacketContent pak = new PacketContent();
     pak.addUint16((UInt16)RPCResponseHeaders.SERVER_TEAM_INVITE_MEMBER, 0);
     pak.addHexBytes("0C001C00000000000000"); // Unknown
     pak.addSizedTerminatedString(inviterCharname);
     pak.addSizedTerminatedString(missionTeamName);
     client.messageQueue.addRpcMessage(pak.returnFinalPacket());
 }
Exemple #31
0
        // ToDo: if other clients invite this player to a team
        public void sendTeamInvitation(WorldClient client, string inviterCharname, string missionTeamName)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_TEAM_INVITE_MEMBER, 0);
            pak.addHexBytes("0C001C00000000000000"); // Unknown
            pak.addSizedTerminatedString(inviterCharname);
            pak.addSizedTerminatedString(missionTeamName);
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #32
0
        public void sendAttribute(WorldClient client, UInt16 attributeValue, byte type)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_PLAYER_ATTRIBUTE, 0);
            pak.addByte(type);
            pak.addUint16(attributeValue, 0);
            pak.addHexBytes("000802");
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #33
0
        // Place Methods here for Inventory

        public void sendInventoryItemMove(UInt16 sourceSlot, UInt16 destSlot, WorldClient client)
        {
            PacketContent pak = new PacketContent();

            pak.addByte(0x65);
            pak.addUint16(sourceSlot, 1);
            pak.addUint16(destSlot, 1);
            pak.addByte(0x00);
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #34
0
        public void processTeleportReset(ref byte[] packet)
        {
            Store.currentClient.playerData.setRPCShutDown(true);

            // We want to reset
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_LOAD_WORLD, 0);
            Store.currentClient.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #35
0
        // Place Methods here for Skills
        public void sendCastAbilityBar(UInt16 abilityID, float timeProcessing)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_CAST_BAR_ABILITY, 0);
            pak.addUint16(abilityID, 1);
            pak.addHexBytes("00000000000000000000");
            pak.addFloat(timeProcessing, 1);
            Store.currentClient.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #36
0
        public void sendFactionName(WorldClient client, UInt32 factionID, string factionName)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_FACTION_NAME_RESPONSE, 0);
            pak.addUint32(factionID, 1);
            // Add 42 Bytes long faction name
            pak.addStringWithFixedSized(factionName, 42);
            Store.currentClient.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #37
0
        public void sendNPCUpdateData(UInt16 viewId, WorldClient client, byte[] updateData)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16(viewId, 1);
            pak.addByteArray(updateData);

            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            client.flushQueue();
        }
Exemple #38
0
        public void createFlashTraffic(WorldClient client, string url)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_FLASH_TRAFFIC, 0);
            pak.addHexBytes("0000070005");
            pak.addSizedString(url);
            pak.addByte(0);
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #39
0
        public void sendAppeareanceUpdate(WorldClient client, byte[] rsibytes)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16(2, 1);
            pak.addByteArray(new byte[] { 0x02, 0x80, 0x89 });
            pak.addByteArray(rsibytes);

            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            client.FlushQueue();
        }
Exemple #40
0
 public void sendMissionInfo(WorldClient client)
 {
     // Test a MissionList
     PacketContent pak = new PacketContent();
     pak.addUint16((UInt16)RPCResponseHeaders.SERVER_MISION_INFO_RESPONSE, 0);
     pak.addHexBytes("0000000000002f000100000002a29f7e46a29f7e46000000000000000000d0060000310000b4c00c0028");
     pak.addHexBytes("42000001000002000D001300020002030200FFFFFDFF");
     pak.addSizedTerminatedString("Eliminate Agent Smith");
     client.messageQueue.addRpcMessage(pak.returnFinalPacket());
     client.flushQueue();
 }
Exemple #41
0
        public void processHardlineExitRequest(ref byte[] packet)
        {
            PacketContent pak = new PacketContent();
            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_EXIT_HL, 0);
            pak.addByte(0x95);
            pak.addByte(0x00);
            pak.addByte(0x00);
            pak.addByte(0x00);
            pak.addByte(0x01);

            Store.currentClient.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Exemple #42
0
        public void sendDeleteViewPacket(WorldClient client, UInt16 viewIdToDelete)
        {
            PacketContent pak = new PacketContent();
            pak.addUint16(1, 1); // Master View
            pak.addByte(0x01);
            pak.addUint16(1,1); // Num Views to delete - current just this one (maybe later more)
            pak.addUint16(viewIdToDelete, 1);
            pak.addByte(0x00);

            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            client.flushQueue();
        }
Exemple #43
0
 public void sendInventoryItemAdd(UInt16 freeSlot, UInt32 itemId, ushort amount, UInt16 type, WorldClient client)
 {
     PacketContent pak = new PacketContent();
     pak.addByte(0x5e);
     pak.addUint16(freeSlot, 1);
     pak.addUint32(itemId, 1);
     pak.addUint16(0,1);
     pak.addUintShort(amount);
     pak.addUintShort(type);
     pak.addUintShort(1);
     client.messageQueue.addRpcMessage(pak.returnFinalPacket());
 }
Exemple #44
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();
            }
        }
Exemple #45
0
        public void sendPlayFXOnView(UInt16 viewId, WorldClient client, byte animation, UInt16 incrementCounter)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16(viewId, 1);
            // ToDo later : make a real Object Update
            pak.addByte(0x02);
            pak.addByte(0x80);
            pak.addByte(0x80);
            pak.addByte(0x80);
            pak.addByte(0x90);
            pak.addByte(0xed);
            pak.addByte(0x00);
            pak.addByte(0x30);
            pak.addByte(animation);
            pak.addUint16(incrementCounter, 1);

            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            client.flushQueue();
        }
Exemple #46
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());
        }
Exemple #47
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);

            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");

            // 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();
        }
Exemple #48
0
        public void sendSystemChatMessage(WorldClient client, string message, string type)
        {
            byte typeByte;
            switch (type)
            {

                case "SYSTEM":
                    typeByte = 0x07;
                    break;
                case "MODAL":
                    typeByte = 0x17;
                    break;
                case "FRAMEMODAL":
                    typeByte = 0xd7;
                    break;
                case "BROADCAST":
                    typeByte = 0xc7;
                    break;

                default:
                    typeByte = 0x07;
                    break;
            }

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

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

            PacketContent pak = new PacketContent();
            pak.addByte((byte)RPCResponseHeaders.SERVER_CHAT_MESSAGE_RESPONSE);
            pak.addByte(typeByte);
            pak.addByteArray(hexContents);
            pak.addSizedTerminatedString(message);

            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
            client.flushQueue();
        }
Exemple #49
0
        public void sendMissionAccept(WorldClient client, UInt16 contactId, ushort missionId)
        {
            // This is still a testing message mate

            PacketContent selfUpdate = new PacketContent();
            selfUpdate.addHexBytes("0200028040002a03020000");
            client.messageQueue.addObjectMessage(selfUpdate.returnFinalPacket(), false);

            PacketContent pak = new PacketContent();
            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_MISSION_SET_NAME, 0);
            pak.addHexBytes("00000000");
            pak.addUint16(contactId, 1);
            pak.addHexBytes("2B0001002F0002D0070000310000B4C00C002814000026700A00280100003E003B00000E00417373617373696E6174696F6E000100000300AA0600009C070000DC050000");

            PacketContent pak2 = new PacketContent();
            pak2.addHexBytes("80A33000030078001A000000030000003C000010EF4600007FC30020E4C50088DB4600007FC300E0ABC500000000000032015768696C65206F7665727420636F6E666C696374207365727665732069747320707572706F73652C20736F6D6574696D65732061206D6F726520737562746C6520617070726F6163682069732072657175697265642E20496E207468697320636173652C20616E20617373617373696E6174696F6E2E0D0A0D0A496E206F7264657220746F2072656163682042656E67742C20796F752077696C6C206669727374206E65656420746F206163717569726520612063657274696E2044617461204469736B207468617420686F6C64");

            // This tells the location
            PacketContent pak4 = new PacketContent();
            pak4.addHexBytes("809E00000000000026DB40000000008078C1400000000000F8B1C00100000022018007");

            PacketContent pak5 = new PacketContent();
            pak5.addHexBytes("80A0000600002500476574207468652044617461204469736B2066726F6D20746865206D61696E6672616D6500");

            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
            client.messageQueue.addRpcMessage(pak2.returnFinalPacket());
            client.messageQueue.addRpcMessage(pak4.returnFinalPacket());

            client.messageQueue.addRpcMessage(pak5.returnFinalPacket());
            /*
            PacketContent pakWayPoint = new PacketContent();
            pakWayPoint.addHexBytes("01000213001200020C9DE1B8D747F0BF2D443752BA450000");
            client.messageQueue.addObjectMessage(pakWayPoint.returnFinalPacket(),false);
            */
            client.flushQueue();
        }
Exemple #50
0
 public void updateAnimation(byte animationByte)
 {
     // Through Animation Packet here if you want to start / stop walking etc.
     // aka 0x0e
     PacketContent pak = new PacketContent();
     pak.addByte(0x02);
     pak.addByte(0x0e);
     pak.addByte(animationByte);
     pak.addByte((byte)this.rotation);
     pak.addFloatLtVector3f((float)this.getXPos(), (float)this.getYPos(), (float)this.getZPos());
     this.updateData = pak.returnFinalPacket();
 }
Exemple #51
0
        public void processLoadAbility(ref byte[] packet)
        {
            // read the values from the packet
            byte[] staticObjectByteID = new byte[4];
            ArrayUtils.copyTo(packet, 0, staticObjectByteID, 0, 4);

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

            byte[] loadFlagByte = new byte[2];
            ArrayUtils.copyTo(packet, 6, loadFlagByte, 0, 2);

            byte[] countAbilityBytes = new byte[2];
            ArrayUtils.copyTo(packet, 8, countAbilityBytes, 0, 2);
            UInt16 countAbilities = NumericalUtils.ByteArrayToUint16(countAbilityBytes, 1);

            // Get the Ability Related Header Data
            UInt32 staticObjectID = NumericalUtils.ByteArrayToUint32(staticObjectByteID, 1);
            UInt16 unloadFlag = NumericalUtils.ByteArrayToUint16(unloadFlagByte, 1);
            UInt16 loadFlag = NumericalUtils.ByteArrayToUint16(loadFlagByte, 1);

            int pointer = 11; // Start at index 11
            List<UInt16> abilitySlots = new List<UInt16>();

            for (int i = 1; i <= countAbilities; i++)
            {

                // This must be looped
                byte[] slotByteID = new byte[2];
                ArrayUtils.copyTo(packet, pointer, slotByteID, 0, 2);
                pointer = pointer + 2;

                byte[] abilityByteID = new byte[2];
                ArrayUtils.copyTo(packet, pointer, abilityByteID, 0, 2);
                pointer = pointer + 4;

                byte[] abilityByteLevel = new byte[2];
                ArrayUtils.copyTo(packet, pointer, abilityByteLevel, 0, 2);
                pointer = pointer + 3;

                UInt16 slotID = NumericalUtils.ByteArrayToUint16(slotByteID, 1);
                UInt16 AbilityID = NumericalUtils.ByteArrayToUint16(abilityByteID, 1);
                UInt16 AbilityLevel = NumericalUtils.ByteArrayToUint16(abilityByteLevel, 1);

                PacketContent pak = new PacketContent();
                if (unloadFlag > 0)
                {
                    pak.addUint16((UInt16)RPCResponseHeaders.SERVER_ABILITY_UNLOAD, 0);
                    pak.addByteArray(abilityByteID);

                }
                else
                {
                    pak.addUint16((UInt16)RPCResponseHeaders.SERVER_ABILITY_LOAD, 0);
                    pak.addByteArray(abilityByteID);
                    pak.addByteArray(abilityByteLevel);
                    pak.addByteArray(slotByteID);
                }
                abilitySlots.Add(slotID);
                Store.currentClient.messageQueue.addRpcMessage(pak.returnFinalPacket());

            }

            if (unloadFlag > 0)
            {
                Store.dbManager.WorldDbHandler.updateAbilityLoadOut(abilitySlots, 0);
            }
            else
            {
                Store.dbManager.WorldDbHandler.updateAbilityLoadOut(abilitySlots, 1);
            }
        }
Exemple #52
0
        public void testCloseCombat(ref byte[] packet)
        {
            byte[] targetViewWithSpawnId = new byte[4];
            ArrayUtils.copy(packet, 0, targetViewWithSpawnId, 0, 4);
            string hexString = StringUtils.bytesToString_NS(targetViewWithSpawnId);
            string hexStringPak = StringUtils.bytesToString_NS(packet);
            Store.currentClient.messageQueue.addObjectMessage(StringUtils.hexStringToBytes("020003010C00808400808080800100001000"), false); // Make me combat mode "on"

            // The 55 View Packet
            PacketContent ilCombatHandler = new PacketContent();
            ilCombatHandler.addHexBytes("01000C370036CDAB0205");
            ilCombatHandler.addByteArray(Store.currentClient.playerInstance.Position.getValue());
            ilCombatHandler.addHexBytes("cdec4023"); // Time starts i think
            ilCombatHandler.addHexBytes("fd0000"); // view ID fd00
            Store.currentClient.messageQueue.addObjectMessage(ilCombatHandler.returnFinalPacket(), false);
            Store.currentClient.flushQueue();
            // The other 03 Packet for combat
            PacketContent unknownCreatePak = new PacketContent();
            unknownCreatePak.addByteArray(StringUtils.hexStringToBytes("010002A700"));
            unknownCreatePak.addByteArray(StringUtils.hexStringToBytes("FD00")); // ViewID from Combat Object
            unknownCreatePak.addByteArray(StringUtils.hexStringToBytes("01"));
            unknownCreatePak.addByteArray(Store.currentClient.playerInstance.Position.getValue());
            unknownCreatePak.addByteArray(StringUtils.hexStringToBytes("0100000003000000"));
            unknownCreatePak.addByteArray(targetViewWithSpawnId);
            unknownCreatePak.addUint16(2, 1);
            unknownCreatePak.addUint16(Store.currentClient.playerData.selfSpawnIdCounter, 1);
            unknownCreatePak.addByteArray(StringUtils.hexStringToBytes("01010207030000200BF5C2000020C19420B9C300000000000020C100000000070001001201000007037608E00603145200008B0B0024145200008B0B0024882300008B0B00240000000000000000000000000000000064000000640000000010001010000000020000001000000002000000000000000000000000"));
            Store.currentClient.messageQueue.addObjectMessage(unknownCreatePak.returnFinalPacket(), false);
            Store.currentClient.flushQueue();
        }
Exemple #53
0
 public void sendSetMissionObjective(ushort id, ushort state, string missionObjective, WorldClient client)
 {
     //format : rpcsize+uint16header+ uint8(0) + uint16(0600), + uint8 state + sizedString (uint16 size + string + 00?)
     PacketContent pak = new PacketContent();
     pak.addUint16((UInt16)RPCResponseHeaders.SERVER_MISSION_SET_OBJECTIVE, 0);
     pak.addUintShort(id);
     pak.addUint16(6, 1);
     pak.addUintShort(state);
     pak.addSizedTerminatedString(missionObjective);
     Output.WriteRpcLog("MISSION PAK: " + StringUtils.bytesToString(pak.returnFinalPacket()));
     // Now send the message to the player queue
     client.messageQueue.addRpcMessage(pak.returnFinalPacket());
 }
Exemple #54
0
        private void sendMarginCharData(byte[] data, byte opcode, NetworkStream client)
        {
            // This Method will be used to send the real Data to the client

            // Format for general LoadCharacterReply Responses:
            // 10 00 00 00 <- everytime the same
            // 00 f9 76 04 <- uint32 Char ID
            // 00 00 00 09 <- uint32 number of Character Replys (just raise one up)
            // 00 05 <- viewData opcode (what data is inside) uint16
            // 10 00 <- if it has Data it is 10 00 if not is just 00 00 (and no Data can follow up and packet ends here)
            // e1 00 <- short / uint16 data size
            // DATA

            byte[] header = { 0x10, 0x00, 0x00, 0x00 };
            // Raise one up
            loadCharCounter++;

            // Add the counter
            byte[] counterByte = new byte[4];
            counterByte = NumericalUtils.uint32ToByteArray(loadCharCounter,1);

            // get the datasize for the packet
            byte[] dataSize = NumericalUtils.uint16ToByteArray((UInt16)data.Length,1);

            // charId
            byte[] charID = NumericalUtils.uint32ToByteArray(this.newCharID, 0);

            // viewData code
            byte[] responseCode = {0x00, opcode };

            string pakData = StringUtils.bytesToString_NS(header) +
                                StringUtils.bytesToString_NS(charID) +
                                StringUtils.bytesToString_NS(counterByte) +
                                StringUtils.bytesToString_NS(responseCode);

            string hasData;

            // this needs improvement...
            if (data.Length == 0 && opcode==0x01)
            {
                hasData = "0000";
            }
            else
            {
                hasData = "1000" + StringUtils.bytesToString_NS(dataSize) + StringUtils.bytesToString_NS(data);
            }

            pakData += hasData;
            PacketContent pak = new PacketContent();

            // Dump the Packet Data to see whats in
            //Console.WriteLine("Response Load Pak : " + pakData);

            // Do the viewData
            byte[] response = StringUtils.hexStringToBytes(pakData);
            Output.WritePacketLog(StringUtils.bytesToString(response), "MARGINSERVER", "0", "0", "0");
            Output.WriteDebugLog("[MARGIN SERVER RESPONSE] for OPCODE " + opcode + " : " + StringUtils.bytesToString(response));
            byte[] encryptedResponse = marginEncr.encrypt(response);
            sendTCPVariableLenPacket(encryptedResponse, client);
            System.Threading.Thread.Sleep(50);
        }
Exemple #55
0
 public void sendSaveCharDataMessage(WorldClient client, string handle)
 {
     PacketContent pak = new PacketContent();
     pak.addByte((byte)RPCResponseHeaders.SERVER_CHAT_MESSAGE_RESPONSE);
     pak.addHexBytes("0700000000000000000000006400002E00240000000000000000000000000000000000");
     pak.addSizedTerminatedString(handle);
     client.messageQueue.addRpcMessage(pak.returnFinalPacket());
 }
Exemple #56
0
 public void sendMoodChange(WorldClient client, byte moodByte)
 {
     byte[] moodPak = { 0x02, 0x00, 0x01, 0x01, 0x00, moodByte, 0x00, 0x00 };
     PacketContent pak = new PacketContent();
     pak.addUint16(2, 1);
     pak.addByte(0x02);
     pak.addByteArray(moodPak);
     client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
     client.flushQueue();
 }
Exemple #57
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();
        }
Exemple #58
0
        public void sendPlayerFriendList(WorldClient client)
        {
            ArrayList friends =  Store.dbManager.WorldDbHandler.fetchFriendList(Store.currentClient.playerData.getCharID());

            if (friends.Count > 0)
            {
                foreach (Hashtable friend in friends)
                {
                    PacketContent pak = new PacketContent();
                    pak.addUint16((UInt16)RPCResponseHeaders.SERVER_FRIENDLIST_STATUS, 0);
                    pak.addHexBytes("0800");
                    if ((Int16)friend["online"] ==1)
                    {
                        pak.addByte(0x3c);
                    }
                    else
                    {
                        pak.addByte(0x3b);
                    }

                    pak.addHexBytes("0000");
                    pak.addByte(0x8e); // Another unknown flag ...mxosource made it wrong lol
                    pak.addSizedTerminatedString("SOE+MXO+" + friend["handle"]);
                    client.messageQueue.addRpcMessage(pak.returnFinalPacket());
                }
            }
        }
Exemple #59
0
 public void sendPlayerSpawn(WorldClient receiverClient, WorldClient otherClient, UInt16 viewId)
 {
     PacketContent pak = new PacketContent();
     byte[] spawnPaket = new BootingHelperRsi().generatePlayerSpawnPacket(otherClient, receiverClient.playerData.assignSpawnIdCounter());
     pak.addByteArray(spawnPaket);
     pak.addUint16(viewId,1);
     pak.addByte(0x00);
     receiverClient.messageQueue.addObjectMessage(pak.returnFinalPacket(),false);
     receiverClient.flushQueue();
 }
Exemple #60
0
        public void sendMissionList(UInt16 contactId, uint orgID, WorldClient client)
        {
            /*
             * ToDo: check if mission team was created or not
             */

            /*
             * ToDo: Figure the "unknowns" out
             * Examples:
             * Neo: 18 80 95 00 00 00 00 06 00 07 00 00 01 d0 07 00 00 31 00 00 b4 c0 0c 00 28
             * Luz: 18 80 95 00 00 00 00 05 00 01 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00
             */
            PacketContent pak = new PacketContent();
            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_MISSION_RESPONSE_LIST,0);
            pak.addUint32(0, 0);
            pak.addUint16(contactId, 1);
            pak.addUint16(7,1); // Unknown - in neo it has 1
            pak.addUintShort(0);
            pak.addUintShort((ushort)orgID);
            pak.addHexBytes("000000000000000000000000"); // The big unknown part - maybe some informations about the contact
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());

            // ToDo: make it dynamic from a file or something
            ArrayList possibleMissions = new ArrayList();
            possibleMissions.Add("Assassination");
            possibleMissions.Add("Hack the Duality");
            possibleMissions.Add("Welcome to 2015");
            possibleMissions.Add("Party like '99");

            UInt16 i = 0;
            foreach (string mission in possibleMissions)
            {
                PacketContent missionListPak = new PacketContent();
                missionListPak.addUint16((UInt16)RPCResponseHeaders.SERVER_MISSION_RESPONSE_NAME, 0);
                missionListPak.addUint16(contactId, 1);
                missionListPak.addUint16(i, 1);
                missionListPak.addHexBytes("0f0001d00700000000"); // curently unknown
                missionListPak.addSizedTerminatedString(mission);
                client.messageQueue.addRpcMessage(missionListPak.returnFinalPacket());
                i++;
            }

            // And finally again a resposne
            PacketContent finalResponse = new PacketContent();
            finalResponse.addUint16((UInt16)RPCResponseHeaders.SERVER_MISSION_RESPONSE_UNKNOWN, 0);
            finalResponse.addUint16(contactId, 1);
            client.messageQueue.addRpcMessage(finalResponse.returnFinalPacket());
        }