Beispiel #1
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());
        }
Beispiel #2
0
 public void sendMissionAbort(WorldClient client)
 {
     PacketContent pak = new PacketContent();
     pak.addHexBytes("80a20800000000b4658db5000000000000000000000000000000");
     client.messageQueue.addRpcMessage(pak.returnFinalPacket());
     client.flushQueue();
 }
Beispiel #3
0
 public RPCPacket(WorldClient _client)
 {
     destClient = _client;
     din = new DynamicArray();
     this.addedMsgBlocks = 0;
     this.rpcInside = 0;
 }
Beispiel #4
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());
 }
Beispiel #5
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());
 }
Beispiel #6
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());
 }
Beispiel #7
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());
 }
Beispiel #8
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());
 }
Beispiel #9
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());
 }
Beispiel #10
0
        public byte[] generatePlayerSpawnPacket(WorldClient client, UInt16 spawnIdCounter)
        {
            DynamicArray rsiPacket;
            DynamicArray creationPacket;
            playerRSIPacket(out rsiPacket, out creationPacket, client, spawnIdCounter);

            // Same as generate Self without viewData
            rsiPacket.append(creationPacket.getBytes());
            return rsiPacket.getBytes();
        }
Beispiel #11
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();
 }
Beispiel #12
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();
        }
Beispiel #13
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());
 }
Beispiel #14
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());
        }
Beispiel #15
0
        // Checks and create a mission Team if you are not on a mission
        public void checkAndCreateMissionTeam(WorldClient client)
        {
            if (client.playerData.getMissionTeam() == null)
            {
                string missionTeamName = StringUtils.charBytesToString_NZ(client.playerInstance.CharacterName.getValue()) + "'s Mission Team";
                ServerPackets packets = new ServerPackets();
                packets.sendTeamCreation(client, missionTeamName);

                // Add the Team to our global Team List
                MissionTeam team = new MissionTeam(missionTeamName, StringUtils.charBytesToString_NZ(client.playerInstance.CharacterName.getValue()));
                lock (WorldSocket.missionTeams)
                {
                    WorldSocket.missionTeams.Add(team);
                }
            }
        }
Beispiel #16
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();
            }
        }
Beispiel #17
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();
        }
Beispiel #18
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());
        }
Beispiel #19
0
        public byte[] generateSelfSpawnPacket(WorldClient client)
        {
            DynamicArray rsiPacket;
            DynamicArray creationPacket;
            client.playerData.selfSpawnIdCounter = client.playerData.spawnViewUpdateCounter;
            playerRSIPacket(out rsiPacket, out creationPacket, client, client.playerData.assignSpawnIdCounter());

            // self
            byte[] selfViewID = {0x02, 0x00 };

            creationPacket.append(selfViewID);
            creationPacket.append(0x00);
            /*
             * Maybe we must remove the first too..needs testing
            creationPacket.append(0x00);
            creationPacket.append(0x00);
            */
            rsiPacket.append(creationPacket.getBytes());

            return rsiPacket.getBytes();
        }
Beispiel #20
0
        private static void playerRSIPacket(out DynamicArray rsiPacket, out DynamicArray creationPacket, WorldClient client, ushort spawnIdCounter)
        {
            //Create the packet for the player

            rsiPacket = new DynamicArray();
            byte[] rsi = PacketsUtils.getRSIBytes(client.playerData.getRsiValues());

            byte[] CurCombatExclusiveAbility = { 0x00, 0x10, 0x00, 0x00 };

            //TODO: fix this 03 01 00
            rsiPacket.append(new byte[] { 0x01, 0x00 });
            /////////////////////////////////////////////
            client.playerInstance.disableAllAttributes(); //Predisable to just send what we need to spawn

            client.playerInstance.RealFirstName.enable();
            client.playerInstance.RealLastName.enable();
            client.playerInstance.Health.enable();
            client.playerInstance.MaxHealth.enable();
            client.playerInstance.YawInterval.enable(); //ROTATION
            client.playerInstance.OrganizationID.enable();

            client.playerInstance.StealthAwareness.setValue((byte)0x01); // TODO: See what's stealth awareness
            client.playerInstance.InnerStrengthAvailable.enable();
            client.playerInstance.CharacterName.enable();

            client.playerInstance.TitleAbility.enable();
            client.playerInstance.CharacterID.enable(); // It was set when grabbing from database
            client.playerInstance.RSIDescription.setValue(rsi);
            client.playerInstance.InnerStrengthMax.enable();
            client.playerInstance.Position.enable();
            client.playerInstance.Level.enable();
            client.playerInstance.CombatantMode.setValue((byte)0x22); //TODO: see what's combatantmode

            client.playerInstance.CurExclusiveAbility.setValue(CurCombatExclusiveAbility); //TODO: see what's this

            // ok we set all our values - lets get the generated packet for us
            DynamicArray creationPacketWithoutView = Store.world.objMan.generateCreationPacket(client.playerInstance, 0x0000,(byte)spawnIdCounter);
            creationPacket = Store.world.objMan.generateCreationPacket(client.playerInstance, 0x0000,(byte)spawnIdCounter);
        }
Beispiel #21
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();
        }
Beispiel #22
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();
        }
Beispiel #23
0
 /// <summary>
 /// Helper Methods 
 /// </summary>
 public void savePlayerInfo(WorldClient client)
 {
     Store.dbManager.WorldDbHandler.savePlayer(client);
 }
Beispiel #24
0
 public void sendWorldSetup(WorldClient client)
 {
     // The Packet with PVP Flag etc.
 }
Beispiel #25
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();
        }
Beispiel #26
0
        public void sendPlayerAttributes(WorldClient client)
        {
            // ToDo: Load dynamic if we know what to load

            //client.messageQueue.addRpcMessage(StringUtils.hexStringToBytes("80bc15002f0000f70300000802000000000000000000"));
            //client.messageQueue.addRpcMessage(StringUtils.hexStringToBytes("80bc15002f0000f70300000802000000000000000000"));
            //client.messageQueue.addRpcMessage(StringUtils.hexStringToBytes("80bc1500300000f70300000702ecffffff0000000000"));
            //client.messageQueue.addRpcMessage(StringUtils.hexStringToBytes("80bc1500310000f70300005004000000000000000000"));
            //client.messageQueue.addRpcMessage(StringUtils.hexStringToBytes("80bc1500320000f7030000f403000000000000000000"));
            //client.messageQueue.addRpcMessage(StringUtils.hexStringToBytes("80bc1500330000f70300005104f6ffffff0000000000"));
            //client.messageQueue.addRpcMessage(StringUtils.hexStringToBytes("80bc56002a0000b3a900000904090000000100000000"));
            //client.messageQueue.addRpcMessage(StringUtils.hexStringToBytes("80b23a0400000802"));
            //client.messageQueue.addRpcMessage(StringUtils.hexStringToBytes("80b2110011000802"));

            //client.messageQueue.addRpcMessage(StringUtils.hexStringToBytes("81A500000700052300687474703A2F2F6D786F656D752E696E666F2F666F72756D2F696E6465782E70687000")); // Has forum url - but is not flash traffic - or ?
            client.messageQueue.addRpcMessage(StringUtils.hexStringToBytes("80bc55005100000b0000003702330000000000000000")); // this adds super jump points dude
            //client.messageQueue.addRpcMessage(StringUtils.hexStringToBytes("2E070000000000000000002400000000000000000000000000000000000000000000000011005768617427732075702062726F736B6900"));
            createFlashTraffic(client, "http://mxo.hardlinedreams.com");
        }
Beispiel #27
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());
                }
            }
        }
Beispiel #28
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();
 }
Beispiel #29
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());
 }
Beispiel #30
0
 /// <summary>
 /// Helper Methods
 /// </summary>
 public void savePlayerInfo(WorldClient client)
 {
     Store.dbManager.WorldDbHandler.savePlayer(client);
 }
Beispiel #31
0
 public void processTargetChange(ref byte[] rpcData, WorldClient currentClient)
 {
     UInt16 viewId = NumericalUtils.ByteArrayToUint16(new byte[] { rpcData[0], rpcData[1] }, 1);
     ushort spawnId = rpcData[2];
     // ToDo: add this to the ClientData
     currentClient.playerData.currentSelectedTargetViewId = viewId;
     currentClient.playerData.currentSelectedTargetSpawnId = spawnId;
     ServerPackets pak = new ServerPackets();
     pak.sendSystemChatMessage(Store.currentClient, "TARGET CHANGE For ViewID " + viewId.ToString() + " AND SPAWN ID : " + spawnId.ToString(), "MODAL");
 }
Beispiel #32
0
 public void sendSetWeather(WorldClient client)
 {
 }
Beispiel #33
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());
 }
Beispiel #34
0
        public void ViewVisibleThread()
        {
            Output.WriteLine("[WORLD SERVER]View Visible Thread started");
            while (true)
            {
                ArrayList deadPlayers    = new ArrayList();
                ArrayList removeEntities = new ArrayList();

                // Clean
                lock (WorldSocket.Clients.SyncRoot)
                {
                    foreach (string clientKey in WorldSocket.Clients.Keys)
                    {
                        // Collect dead players to arraylist
                        WorldClient thisclient = WorldSocket.Clients[clientKey] as WorldClient;

                        if (thisclient.Alive == false)
                        {
                            // Add dead Player to the List - we need later to clear them
                            deadPlayers.Add(clientKey);
                        }
                    }
                    cleanDeadPlayers(deadPlayers);
                }

                // Check for Player Views
                lock (WorldSocket.Clients.SyncRoot)
                {
                    foreach (string clientKey in WorldSocket.Clients.Keys)
                    {
                        // get Current client
                        WorldClient currentClient = WorldSocket.Clients[clientKey] as WorldClient;
                        // Loop all Clients and check if we need to create a view for it
                        foreach (string clientOtherKey in WorldSocket.Clients.Keys)
                        {
                            WorldClient otherClient = WorldSocket.Clients[clientOtherKey] as WorldClient;
                            if (otherClient != currentClient)
                            {
                                ClientView clientView = currentClient.viewMan.getViewForEntityAndGo(otherClient.playerData.getEntityId(), NumericalUtils.ByteArrayToUint16(otherClient.playerInstance.GetGoid(), 1));

                                // Create
                                Maths  math           = new Maths();
                                double currentPlayerX = 0;
                                double currentPlayerY = 0;
                                double currentPlayerZ = 0;

                                double otherPlayerX = 0;
                                double otherPlayerY = 0;
                                double otherPlayerZ = 0;

                                NumericalUtils.LtVector3dToDoubles(currentClient.playerInstance.Position.getValue(), ref currentPlayerX, ref currentPlayerY, ref currentPlayerZ);
                                NumericalUtils.LtVector3dToDoubles(currentClient.playerInstance.Position.getValue(), ref otherPlayerX, ref otherPlayerY, ref otherPlayerZ);
                                Maths mathUtils        = new Maths();
                                bool  playerIsInCircle = mathUtils.IsInCircle((float)currentPlayerX, (float)currentPlayerZ, (float)otherPlayerX, (float)otherPlayerZ, 5000);
                                if (clientView.viewCreated == false && currentClient.playerData.getDistrictId() == otherClient.playerData.getDistrictId() && otherClient.playerData.getOnWorld() && currentClient.playerData.getOnWorld() && playerIsInCircle)
                                {
                                    // Spawn player
                                    ServerPackets pak = new ServerPackets();
                                    pak.sendSystemChatMessage(currentClient, "Player " + otherClient.playerInstance.GetName() + " with new View ID " + clientView.ViewID + " jacked in", "BROADCAST");
                                    pak.sendPlayerSpawn(currentClient, otherClient, clientView.ViewID);
                                    clientView.spawnId     = currentClient.playerData.spawnViewUpdateCounter;
                                    clientView.viewCreated = true;
                                }


                                if (clientView.viewCreated && !playerIsInCircle)
                                {
                                    // ToDo: delete mob
                                    ServerPackets packets = new ServerPackets();
                                    packets.sendSystemChatMessage(currentClient, "Player " + otherClient.playerInstance.GetName() + " with View ID " + clientView.ViewID + " jacked out!", "MODAL");
                                    packets.sendDeleteViewPacket(currentClient, clientView.ViewID);
                                    currentClient.viewMan.removeViewByViewId(clientView.ViewID);
                                }
                            }
                        }
                    }
                }



                // Spawn/Update for mobs
                int npcCount = WorldSocket.npcs.Count;
                for (int i = 0; i < npcCount; i++)
                {
                    npc thismob = (npc)WorldSocket.npcs[i];

                    lock (WorldSocket.Clients.SyncRoot)
                    {
                        foreach (string clientKey in WorldSocket.Clients.Keys)
                        {
                            // Loop through all clients
                            WorldClient thisclient = WorldSocket.Clients[clientKey] as WorldClient;

                            if (thisclient.Alive == true)
                            {
                                // Check if

                                if (thisclient.playerData.getOnWorld() == true && thisclient.playerData.waitForRPCShutDown == false)
                                {
                                    Maths  math    = new Maths();
                                    double playerX = 0;
                                    double playerY = 0;
                                    double playerZ = 0;
                                    NumericalUtils.LtVector3dToDoubles(thisclient.playerInstance.Position.getValue(), ref playerX, ref playerY, ref playerZ);
                                    Maths mathUtils     = new Maths();
                                    bool  mobIsInCircle = mathUtils.IsInCircle((float)playerX, (float)playerZ, (float)thismob.getXPos(), (float)thismob.getZPos(), 5000);

                                    // ToDo: Check if mob is in circle of player (radian some value that is in a middle range for example 300m)
                                    // Create
                                    ClientView mobView = thisclient.viewMan.getViewForEntityAndGo(thismob.getEntityId(), NumericalUtils.ByteArrayToUint16(thismob.getGoId(), 1));
                                    if (mobView.viewCreated == false && thismob.getDistrict() == thisclient.playerData.getDistrictId() && thisclient.playerData.getOnWorld() && mobIsInCircle)
                                    {
                                        ServerPackets pak = new ServerPackets();
                                        pak.sendSystemChatMessage(thisclient, "Mob with Name " + thismob.getName() + " with new View ID " + mobView.ViewID + " spawned", "BROADCAST");
                                        ServerPackets mobPak = new ServerPackets();
                                        mobPak.spawnMobView(thisclient, thismob, mobView);
                                        mobView.spawnId     = thisclient.playerData.spawnViewUpdateCounter;
                                        mobView.viewCreated = true;
                                    }

                                    // Update Mob
                                    if (mobView.viewCreated == true && thismob.getDistrict() == thisclient.playerData.getDistrictId() && thisclient.playerData.getOnWorld())
                                    {
                                        // ToDo: We need to involve the Statuslist here and we need to move them finaly
                                        if (thismob.getIsDead() == false)
                                        {
                                            updateMob(thisclient, ref thismob, mobView);
                                        }
                                    }

                                    // Mob moves outside - should delete it
                                    if (mobView.viewCreated == true &&
                                        !mobIsInCircle &&
                                        thismob.getDistrict() == thisclient.playerData.getDistrictId())
                                    {
                                        // ToDo: delete mob
                                        ServerPackets packets = new ServerPackets();
                                        packets.sendDeleteViewPacket(thisclient, mobView.ViewID);
                                        packets.sendSystemChatMessage(thisclient, "MobView (" + thismob.getName() + " LVL: " + thismob.getLevel() + " ) with View ID " + mobView.ViewID + " is out of range and is deleted!", "MODAL");
                                        thisclient.viewMan.removeViewByViewId(mobView.ViewID);
                                    }
                                }
                            }
                        }
                    }
                    thismob.updateClient = false;
                }
                Thread.Sleep(500);
            }
        }
Beispiel #35
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());
        }