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()); }
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()); }
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()); }
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()); }
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()); }
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()); }
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(); }
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); }
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); }
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()); }
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()); }
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); }
public void SendServerSettingString(WorldClient client, string key, string value) { PacketContent pak = new PacketContent(); pak.addUintShort((ushort)RPCResponseHeaders.SERVER_FEATURE_EVENT); int fullLen = key.Length + value.Length; pak.addInt16((short)fullLen, 1); pak.addSizedString(key); pak.addSizedString(value); client.messageQueue.addRpcMessage(pak.returnFinalPacket()); }
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(); }
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(); }
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(); }
public static byte[] createSystemMessageWithoutRPC(string message) { byte[] messageBytes = StringUtils.stringToBytes(message + "\x00"); UInt16 messageSize = (UInt16)(message.Length + 1); PacketContent packet = new PacketContent(); packet.addUintShort((UInt16)RPCResponseHeaders.SERVER_CHAT_MESSAGE_RESPONSE); packet.addHexBytes("0700000000000000000024000000000000000000000000000000000000000000000000"); packet.addUint16(messageSize, 1); packet.addByteArray(messageBytes); return(packet.returnFinalPacket()); }
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(); }
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()); }
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(); }
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(); }