addByte() public method

public addByte ( byte value ) : void
value byte
return void
Esempio n. 1
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());
                }
            }
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
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());
 }
Esempio n. 4
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());
        }
Esempio n. 5
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());
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
        public void sendPlayerMoveAnim(WorldClient client, byte animationId)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16(2, 1);
            pak.addByte(0x02);
            pak.addByteArray(new byte[] { 0x01, 0x02 });
            pak.addByte(animationId);
            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            client.FlushQueue();
        }
Esempio n. 8
0
        // Updates the Inner Strenght Value
        public void sendISCurrent(WorldClient client, UInt16 innerStrengthValue)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16(2, 1);
            pak.addByte(0x02);
            pak.addByteArray(new byte[] { 0x80, 0x80, 0x80 });
            pak.addByte(0x10);
            pak.addUint16(innerStrengthValue, 1);
            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            client.FlushQueue();
        }
Esempio n. 9
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());
        }
Esempio n. 10
0
        // ToDo: Move it to player Packets and make a ?moa command for it
        public void sendChangeChangeMoaRSI(WorldClient client, byte[] rsi)
        {
            // ToDo: proove to remove
            PacketContent pak = new PacketContent();

            pak.addUint16(2, 1);
            pak.addHexBytes("0281008080808004");
            pak.addByteArray(rsi);
            pak.addByte(0x41);
            pak.addByte(0x00);
            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
        }
Esempio n. 11
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();
        }
Esempio n. 12
0
        public void sendWhereami(WorldClient client, byte[] xPos, byte[] yPos, byte[] zPos)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16((UInt16)RPCResponseHeaders.SERVER_CHAT_WHEREAMI_RESPONSE, 0);
            pak.addByteArray(xPos);
            pak.addByteArray(yPos);
            pak.addByteArray(zPos);
            pak.addByte(0x07);
            pak.addByte(0x01);
            pak.addByte(0x00);
            Store.currentClient.messageQueue.addRpcMessage(pak.returnFinalPacket());
        }
Esempio n. 13
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());
        }
Esempio n. 14
0
        public void sendHardlineExit(WorldClient client)
        {
            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());
        }
Esempio n. 15
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();
        }
Esempio n. 16
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();
        }
Esempio n. 17
0
        public void updateAnimation(byte animationByte)
        {
            // Through Animation Packet here if you want to start / stop walking etc.
            // aka 0x0e
            var pak = new PacketContent();

            pak.addByte(0x02);
            pak.addByte(0x0e);
            pak.addByte(animationByte);
            pak.addByte((byte)rotation);
            pak.addFloatLtVector3f((float)getXPos(), (float)getYPos(), (float)getZPos());

            Store.world.SendViewUpdateToClientsWhoHasSpawnedView(pak, this);
        }
Esempio n. 18
0
        public void SendNpcUpdatePos(UInt16 viewId, WorldClient client, Mob theMob)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16(viewId, 1);
            pak.addByte(0x02);
            pak.addByte(0x0c);
            pak.addUintShort((UInt16)theMob.getRotation());
            pak.addFloatLtVector3f((float)theMob.getXPos(), (float)theMob.getYPos(), (float)theMob.getZPos());


            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            client.FlushQueue();
        }
Esempio n. 19
0
        public void sendNPCUpdateAnimation(UInt16 viewId, WorldClient client, npc theMob, byte animation)
        {
            PacketContent pak = new PacketContent();

            pak.addUint16(viewId, 1);
            pak.addByte(0x02);
            pak.addByte(0x0e);
            pak.addByte(animation);
            pak.addUintShort((UInt16)theMob.getRotation());
            pak.addFloatLtVector3f((float)theMob.getXPos(), (float)theMob.getYPos(), (float)theMob.getZPos());


            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            client.flushQueue();
        }
Esempio n. 20
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();
        }
Esempio n. 21
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());
        }
Esempio n. 22
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);
        }
Esempio n. 23
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());
        }
Esempio n. 24
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());
 }
Esempio n. 25
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());
        }
Esempio n. 26
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());
        }
Esempio n. 27
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();
        }
Esempio n. 28
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();
        }
Esempio n. 29
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();
        }
Esempio n. 30
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());
        }
Esempio n. 31
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());
 }
Esempio n. 32
0
        public void sendMoodChange(WorldClient client, byte moodByte)
        {
            // ToDo: should be more dynamic ? How to announce to another players ?
            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();
        }
Esempio n. 33
0
        public void spawnMobView(WorldClient client, npc thismob, ClientView mobView)
        {
            Object599     viewData = thismob.getCreationData();
            PacketContent pak      = new PacketContent();

            pak.addUint16(1, 1);
            pak.addByteArray(Store.world.objMan.GenerateCreationPacket(viewData, 0x0000, client.playerData.assignSpawnIdCounter()).getBytes());
            pak.addUint16(mobView.ViewID, 1);
            pak.addByte(0x00);

            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            client.flushQueue();
        }
Esempio n. 34
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());
        }
Esempio n. 35
0
        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();
        }
Esempio n. 36
0
        public void SpawnMobView(WorldClient client, Mob thismob, ClientView mobView)
        {
            Output.WriteDebugLog("Spawn MobView Data ( Entity ID : " + thismob.getEntityId() + " Name:" + thismob.getName() + " ID: " + thismob.getMobId() + " RSI HEX: " + thismob.getRsiHex());
            Object599     viewData = thismob.getCreationData();
            PacketContent pak      = new PacketContent();

            pak.addUint16(1, 1);
            pak.addByteArray(Store.world.objMan.GenerateCreationPacket(viewData, 0x0000, client.playerData.assignSpawnIdCounter()).getBytes());
            pak.addUint16(mobView.ViewID, 1);
            pak.addByte(0x00);

            client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
            client.FlushQueue();
        }
Esempio n. 37
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();
        }
Esempio n. 38
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();
        }
Esempio n. 39
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();
        }
Esempio n. 40
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();
            }
        }
Esempio n. 41
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();
        }
Esempio n. 42
0
File: npc.cs Progetto: hdneo/mxo-hd
 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();
 }
Esempio n. 43
0
 // Updates the Inner Strenght Value
 public void sendISCurrent(WorldClient client, UInt16 innerStrengthValue )
 {
     PacketContent pak = new PacketContent();
     pak.addUint16(2, 1);
     pak.addByte(0x02);
     pak.addByteArray(new byte[]{0x80,0x80,0x80});
     pak.addByte(0x10);
     pak.addUint16(innerStrengthValue,1);
     client.messageQueue.addObjectMessage(pak.returnFinalPacket(), false);
     client.flushQueue();
 }
Esempio n. 44
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());
 }
Esempio n. 45
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();
 }
Esempio n. 46
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();
 }
Esempio n. 47
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());
                }
            }
        }