public byte[] getFinalData(ClientData playerData) { // TODO: Sim Time with Client (not real time) on every 4 Local SSEQ we send playerData.IncrementSseq(); this.neededAckSSeq = playerData.getSseq(); if ((NumericalUtils.ByteArrayToUint32(TimeUtils.getCurrentSimTime(), 1) - playerData.lastSimTimeUpdate) > 3) { timed = true; playerData.lastSimTimeUpdate = NumericalUtils.ByteArrayToUint32(TimeUtils.getCurrentSimTime(), 1); } playerData.getRPCShutDown(); if (timed) { if (playerData.waitForRPCShutDown == true) { content.append((byte)0xc2); } else { content.append((byte)0x82); } content.append(TimeUtils.getCurrentSimTime()); } else { if (playerData.waitForRPCShutDown == true) { content.append((byte)0x42); } else { content.append((byte)0x02); } } // Merge all Message together and generate the Final Packet Header generateObjectMessageData(); generateRpcMessageData(); Output.WriteDebugLog("PACKET DATA (getFinalData):" + StringUtils.bytesToString(content.getBytes())); return(content.getBytes()); }
public byte[] getFinalData(ClientData playerData) { // TODO: Sim Time with Client (not real time) on every 4 Local SSEQ we send playerData.IncrementSseq(); this.neededAckSSeq = playerData.getSseq(); if ((playerData.getSseq() - playerData.lastSimTimeSEQ) >= 4) { timed = true; } playerData.getRPCShutDown(); if (timed) { if (playerData.waitForRPCShutDown == true) { content.append((byte)0xc2); } else { content.append((byte)0x82); } content.append(TimeUtils.getCurrentSimTime(2000)); } else { if (playerData.waitForRPCShutDown == true) { content.append((byte)0x42); } else { content.append((byte)0x02); } } // Merge all Message together and generate the Final Packet Header generateObjectMessageData(); generateRpcMessageData(); return(content.getBytes()); }
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()); }