addUint32() public method

public addUint32 ( UInt32 value, int reversed ) : void
value System.UInt32
reversed int
return void
コード例 #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);
        }
コード例 #2
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());
        }
コード例 #3
0
ファイル: ChatCommandPackets.cs プロジェクト: vitalyo7/mxo-hd
        public void sendLootWindowTest(WorldClient client, UInt32 objectId)
        {
            // This is just for reversing the missing model IDs
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_LOOT_WINDOW_RESPONSE, 0);
            pak.addHexBytes("000000001000");
            pak.addUint32(99999, 1);
            pak.addHexBytes("00000000010000000008");
            if (objectId > 0)
            {
                pak.addUint32(objectId, 1);
            }
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
            client.FlushQueue();
        }
コード例 #4
0
        public void SendLootWindow(UInt32 infoAmount, WorldClient client, UInt32[] objectIds)
        {
            // ToDo: figure the real object packet out (with more than one object) and show it up
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_LOOT_WINDOW_RESPONSE, 0);
            pak.addHexBytes("000000001000");
            pak.addUint32(infoAmount, 1);
            pak.addHexBytes("00000000010000000008");
            if (objectIds.Length > 0)
            {
                pak.addUint32(objectIds[0], 1);
            }
            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
            client.FlushQueue();
        }
コード例 #5
0
ファイル: Mob.cs プロジェクト: vitalyo7/mxo-hd
        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);
        }
コード例 #6
0
ファイル: DataNodePackets.cs プロジェクト: vitalyo7/mxo-hd
        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();
        }
コード例 #7
0
ファイル: TestUnitHelper.cs プロジェクト: hdneo/mxo-hd
        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);
        }
コード例 #8
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());
        }
コード例 #9
0
        private void sendMarginCharData(byte[] data, byte opcode, NetworkStream client, UInt16 shortAfterId, bool isLast)
        {
            // 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
            numCharacterReplies++;

            PacketContent pak = new PacketContent();

            pak.addByte(0x10);
            pak.addUint32(0, 1);
            pak.addUint32(newCharID, 1);
            pak.addUint16(shortAfterId, 1);
            pak.addUintShort(numCharacterReplies);
            if (isLast)
            {
                pak.addUintShort(1);
            }
            else
            {
                pak.addUintShort(0);
            }
            pak.addUintShort(opcode);
            if (data.Length > 0)
            {
                pak.addByteArray(new byte[] { 0x10, 0x00 });
                pak.addUint16((UInt16)data.Length, 1);
                pak.addByteArray(data);
            }
            else
            {
                pak.addByteArray(new byte[] { 0x00, 0x00 });
            }

            Output.WriteDebugLog("[MARGIN SERVER RESPONSE] for OPCODE " + opcode + " : " + StringUtils.bytesToString(pak.returnFinalPacket()));
            byte[] encryptedResponse = marginEncr.encrypt(pak.returnFinalPacket());
            sendTCPVariableLenPacket(encryptedResponse, client);
            System.Threading.Thread.Sleep(50);
        }
コード例 #10
0
ファイル: PlayerPackets.cs プロジェクト: hdneo/mxo-hd
 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());
 }
コード例 #11
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());
        }
コード例 #12
0
ファイル: FCPackets.cs プロジェクト: hdneo/mxo-hd
 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());
 }
コード例 #13
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());
        }
コード例 #14
0
ファイル: FCPackets.cs プロジェクト: vitalyo7/mxo-hd
        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());
        }
コード例 #15
0
ファイル: ChatPackets.cs プロジェクト: hdneo/mxo-hd
        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());
        }
コード例 #16
0
ファイル: MissionPackets.cs プロジェクト: neowhoru/mxo-hd
        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());
        }
コード例 #17
0
ファイル: InventoryPackets.cs プロジェクト: hdneo/mxo-hd
 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());
 }
コード例 #18
0
        public void sendAbilitySelfAnimation(UInt16 viewId, UInt16 abilityId, UInt32 animId)
        {
            ClientView theView = Store.currentClient.viewMan.getViewById(viewId);

            PacketContent pak = new PacketContent();

            pak.addUint16(viewId, 1);
            pak.addByteArray(new byte[] { 0x02, 0x80, 0x80, 0x80, 0x90, 0xed, 0x00, 0x30 });
            pak.addUint32(animId, 0);
            pak.addUintShort(Store.currentClient.playerData.assignSpawnIdCounter());
            Store.currentClient.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
        }
コード例 #19
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());
        }
コード例 #20
0
ファイル: AbilityPackets.cs プロジェクト: thomasholter/mxo-hd
        public void SendHyperJumpStepUpdate(LtVector3f currentPos, double xDestPos, double yDestPos, double zDestPos,
                                            float jumpHeight, uint endtime, ushort stepJumpId, uint maybeTimeBasedValue, bool isLastStep = false)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16(2, 1);
            pak.addByte(0x03);
            pak.addByte(0x0d);
            pak.addByte(0x08);
            pak.addByte(0x00);
            pak.addUintShort(Store.currentClient.playerData.getJumpID());
            pak.addFloatLtVector3f(currentPos.x, currentPos.y, currentPos.z);
            pak.addUintShort(stepJumpId);
            pak.addUint32(maybeTimeBasedValue, 1);
            // ToDo: Insert 2 missing bytes (or 4 as the next 2 bytes MAYBE wrong)
            pak.addByte(0x8a);
            pak.addByte(0x04);
            pak.addByte(0x80);
            pak.addByte(0x88);
            pak.addByteArray(new byte[] { 0x00, 0x00, 0x00, 0x00, 0xbc });
            pak.addFloat(jumpHeight, 1);
            pak.addUint16(4, 1);
            pak.addUint32(endtime, 1);
            pak.addDoubleLtVector3d(xDestPos, yDestPos, zDestPos);
            pak.addByteArray(new byte[] { 0x80, 0x81, 0x00, 0x02 });
            if (isLastStep)
            {
                pak.addByte(0x00);
                Store.currentClient.playerData.isJumping = false;
            }
            else
            {
                pak.addByte(0x01);
            }

            Store.currentClient.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            Store.currentClient.FlushQueue();
        }
コード例 #21
0
        public void SendServerSettingUInt(WorldClient client, string key, UInt32 value)
        {
            PacketContent pak = new PacketContent();

            pak.addUintShort((ushort)RPCResponseHeaders.SERVER_FEATURE_EVENT);
            int fullLen = key.Length + 2 + 4;

            pak.addInt16((short)fullLen, 1);
            pak.addSizedString(key);
            pak.addUint16(4, 1);
            pak.addUint32(value, 1);

            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
コード例 #22
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());

            PacketContent pakAnimation = new PacketContent();

            pakAnimation.addUint16((UInt16)RPCResponseHeaders.SERVER_PLAYER_EXP_ANIM, 0);
            pakAnimation.addUint32(exp, 1);
            pakAnimation.addByte(0x01); // Gain Type
            pakAnimation.addHexBytes("000000");
            client.messageQueue.addRpcMessage(pakAnimation.returnFinalPacket());
        }
コード例 #23
0
        public void sendVendorWindow(WorldClient client, Vendor vendor)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_VENDOR_OPEN, 0);
            pak.addByteArray(new byte[] { 0x7c, 0xad, 0xd9, 0x43 });
            // ToDo: Research what position should be here - Vendor or Player and why ?
            pak.addByteArray(Store.currentClient.playerInstance.Position.getValue());
            pak.addByteArray(new byte[] { 0x20, 0x00 }); // Always 20 00 (i think its an offset)

            pak.addUint16((UInt16)vendor.items.Length, 1);
            foreach (UInt32 item in vendor.items)
            {
                pak.addUint32(item, 1);
            }
            //pak.addHexBytes("7cadd94300000000a0b7f6c000000000003c9440000000000051c8c020000a0000140080002000800018008000040080002c008000f41180009806800090078000c4068000640680");

            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
コード例 #24
0
        public void sendWorldCMD(WorldClient client, uint districtId, string enviromentOptions)
        {
            // Prepare the dict
            Dictionary <uint, string> locs = new Dictionary <uint, string>();

            locs.Add((uint)MxOLocations.TUTORIAL, "resource/worlds/final_world/tutorial_v2/tutorial_v2.metr");
            locs.Add((uint)MxOLocations.SLUMS, "resource/worlds/final_world/slums_barrens_full.metr");
            locs.Add((uint)MxOLocations.DOWNTOWN, "resource/worlds/final_world/downtown/dt_world.metr");
            locs.Add((uint)MxOLocations.INTERNATIONAL, "resource/worlds/final_world/international/it.metr");
            locs.Add((uint)MxOLocations.ARCHIVE01, "resource/worlds/final_world/constructs/archive/archive01/archive01.metr");
            locs.Add((uint)MxOLocations.ARCHIVE02, "resource/worlds/final_world/constructs/archive/archive02/archive02.metr");
            locs.Add((uint)MxOLocations.ASHENCOURT, "resource/worlds/final_world/constructs/archive/archive_ashencourte/archive_ashencourte.metr");
            locs.Add((uint)MxOLocations.DATAMINE, "resource/worlds/final_world/constructs/archive/archive_datamine/datamine.metr");
            locs.Add((uint)MxOLocations.SAKURA, "resource/worlds/final_world/constructs/archive/archive_sakura/archive_sakura.metr");
            locs.Add((uint)MxOLocations.SATI, "resource/worlds/final_world/constructs/archive/archive_sati/sati.metr");
            locs.Add((uint)MxOLocations.WIDOWSMOOR, "resource/worlds/final_world/constructs/archive/archive_widowsmoor/archive_widowsmoor.metr");
            locs.Add((uint)MxOLocations.YUKI, "resource/worlds/final_world/constructs/archive/archive_yuki/archive_yuki.metr");
            locs.Add((uint)MxOLocations.LARGE01, "resource/worlds/final_world/constructs/large/large01/large01.metr");
            locs.Add((uint)MxOLocations.LARGE02, "resource/worlds/final_world/constructs/large/large02/large02.metr");
            locs.Add((uint)MxOLocations.MEDIUM01, "resource/worlds/final_world/constructs/medium/medium01/medium01.metr");
            locs.Add((uint)MxOLocations.MEDIUM02, "resource/worlds/final_world/constructs/medium/medium02/medium02.metr");
            locs.Add((uint)MxOLocations.MEDIUM03, "resource/worlds/final_world/constructs/medium/medium03/medium03.metr");
            locs.Add((uint)MxOLocations.SMALL03, "resource/worlds/final_world/constructs/small/small03/small03.metr");
            locs.Add((uint)MxOLocations.CAVES, "resource/worlds/final_world/zion_caves.metr");

            string path = locs[districtId];
            UInt16 offsetWeatherEvent = (UInt16)(path.Length + 17);

            PacketContent pak = new PacketContent();

            pak.addUintShort((ushort)RPCResponseHeaders.SERVER_LOAD_WORLD_CMD);
            pak.addUintShort(0x0e);       // dunno if header or not - just part of this
            pak.addUintShort(0);
            pak.addUint32(districtId, 1); // Atlas Byte
            pak.addByteArray(TimeUtils.getCurrentSimTime());
            pak.addByte(0x01);            // SimeTime + 01
            pak.addUint16(offsetWeatherEvent, 1);
            pak.addSizedTerminatedString(path);
            pak.addSizedTerminatedString(enviromentOptions);

            client.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
コード例 #25
0
        public void SendHyperJumpStepUpdate(LtVector3f currentPos, double xDestPos, double yDestPos, double zDestPos, float jumpHeight, UInt32 endtime)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16(2, 1);
            pak.addByte(0x03);
            pak.addByte(0x0d);
            pak.addByte(0x08);
            pak.addByte(0x00);
            pak.addFloatLtVector3f(currentPos.x, currentPos.y, currentPos.z);
            pak.addByte(0x8a);
            pak.addByte(0x04);
            pak.addByte(0x80);
            pak.addByte(0x88);
            pak.addByteArray(new byte[] { 0x00, 0x00, 0x00, 0x00, 0xbc });
            pak.addFloat(jumpHeight, 1);
            pak.addUint16(4, 1);
            pak.addUint32(endtime, 1);
            pak.addDoubleLtVector3d(xDestPos, yDestPos, zDestPos);
            pak.addByteArray(new byte[] { 0x80, 0x81, 0x00, 0x02, 0x01, 0x00 });
            Store.currentClient.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            Store.currentClient.FlushQueue();
        }
コード例 #26
0
ファイル: AbilityPackets.cs プロジェクト: neowhoru/mxo-hd
        public void sendCastAbilityOnEntityId(UInt16 viewId, UInt32 animationId)
        {
            ClientView theView = Store.currentClient.viewMan.getViewById(viewId);

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

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

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

            UInt32 theGoID = 12;

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

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

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

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

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

            Store.currentClient.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            Store.currentClient.flushQueue();
        }
コード例 #27
0
        public void processHyperJump(ref byte[] packet)
        {
            byte[]       destXBytes = new byte[8];
            byte[]       destYBytes = new byte[8];
            byte[]       destZBytes = new byte[8];
            byte[]       maxHeight  = new byte[4];
            byte[]       theLast4   = new byte[4]; // we dont know what this is lol
            DynamicArray restBytes  = new DynamicArray();

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

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

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

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

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

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

            pak.addByte(0x02);
            pak.addByte(0x00);
            pak.addByte(0x03);
            pak.addByte(0x09);
            pak.addByte(0x08);
            pak.addByte(0x00);
            pak.addFloatLtVector3f(xPos, yPos, zPos);
            pak.addUint32(startTime, 1);
            pak.addByte(0x80);
            pak.addByte(0x80);
            pak.addByte(0xb8);
            pak.addByte(0x14); // if 0xb8
            pak.addByte(0x00); // if 0xb8
            pak.addUint32(endTime, 1);
            pak.addByteArray(destXBytes);
            pak.addByteArray(destYBytes);
            pak.addByteArray(destZBytes);
            pak.addByteArray(new byte[] { 0x10, 0xff, 0xff });
            pak.addByte(0x00);
            pak.addByte(0x00);
            pak.addByte(0x00);
            Store.currentClient.messageQueue.addObjectMessage(pak.returnFinalPacket(), true);
        }
コード例 #28
0
ファイル: MissionPackets.cs プロジェクト: hdneo/mxo-hd
        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());
        }
コード例 #29
0
        public void sendCastAbilityOnEntityId(UInt16 viewId, UInt32 animationId, UInt16 value)
        {
            ClientView theView = Store.currentClient.viewMan.getViewById(viewId);

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

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

            UInt32 theGoID = 12;

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

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

            case 599:

                // Its more a demo - we "one hit" the mob currently so we must update this
                lock (WorldSocket.npcs.SyncRoot)
                {
                    for (int i = 0; i < WorldSocket.npcs.Count; i++)
                    {
                        Mob thismob = (Mob)WorldSocket.npcs[i];
                        if (theView != null && thismob.getEntityId() == theView.entityId)
                        {
                            thismob.HitEnemyWithDamage(value, animationId);

                            if (thismob.getHealthC() <= 0)
                            {
                                thismob.setIsDead(true);
                                this.SendNpcDies(theView.ViewID, Store.currentClient, thismob);

                                // We got some Exp for it - currently we just make a simple trick to calculate some exp
                                // Just take currentLevel * modifier
                                Random rand = new Random();

                                UInt32 expModifier = (UInt32)rand.Next(100, 500);
                                UInt32 expGained   = thismob.getLevel() * expModifier;
                                // Update EXP
                                new PlayerHandler().IncrementPlayerExp(expGained);
                                thismob.setIsLootable(true);
                            }
                            WorldSocket.npcs[i] = thismob;
                        }
                    }
                }
                break;

            default:
                pak.addByte(0x02);
                pak.addByte(0x80);
                pak.addByte(0x80);
                pak.addByte(0x80);
                if (viewId == 2)
                {
                    pak.addByte(0x80);
                    pak.addByte(0xb0);
                }
                else
                {
                    pak.addByte(0x0c);
                }
                pak.addUint32(animationId, 1);
                pak.addUintShort(Store.currentClient.playerData.assignSpawnIdCounter());
                break;
            }

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

            Store.currentClient.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            Store.currentClient.FlushQueue();
        }