summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2020-07-30 01:36:24 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2020-07-30 01:36:24 +0200
commit70c32d288fa2134c63c70964611da646fcdfe4e9 (patch)
tree5b70da559bace9384a2fe4a0262c3493213129fc
parentImplemented async connection to server (diff)
downloadAltCraft-70c32d288fa2134c63c70964611da646fcdfe4e9.tar
AltCraft-70c32d288fa2134c63c70964611da646fcdfe4e9.tar.gz
AltCraft-70c32d288fa2134c63c70964611da646fcdfe4e9.tar.bz2
AltCraft-70c32d288fa2134c63c70964611da646fcdfe4e9.tar.lz
AltCraft-70c32d288fa2134c63c70964611da646fcdfe4e9.tar.xz
AltCraft-70c32d288fa2134c63c70964611da646fcdfe4e9.tar.zst
AltCraft-70c32d288fa2134c63c70964611da646fcdfe4e9.zip
Diffstat (limited to '')
-rw-r--r--src/GameState.cpp10
-rw-r--r--src/Packet.hpp61
2 files changed, 71 insertions, 0 deletions
diff --git a/src/GameState.cpp b/src/GameState.cpp
index fdb453f..03b13ae 100644
--- a/src/GameState.cpp
+++ b/src/GameState.cpp
@@ -268,6 +268,16 @@ void GameState::UpdatePacket(std::shared_ptr<Packet> ptr) {
LOG(INFO) << "Gamemode is " << gameStatus.gamemode << ", Difficulty is " << (int)gameStatus.difficulty
<< ", Level Type is " << gameStatus.levelType;
PUSH_EVENT("PlayerConnected", 0);
+
+ auto packetSettings = std::make_shared<PacketClientSettings>("en_us", 0x14, 0, true, 0x7F, 1);
+ PUSH_EVENT("SendPacket", std::static_pointer_cast<Packet>(packetSettings));
+
+ std::string brandStr("\x08""AltCraft");
+ std::vector<unsigned char> brandData;
+ std::copy(brandStr.begin(), brandStr.end(), std::back_inserter(brandData));
+ auto packetPluginBrand = std::make_shared<PacketPluginMessageSB>("MC|Brand", brandData);
+ PUSH_EVENT("SendPacket", std::static_pointer_cast<Packet>(packetPluginBrand));
+
break;
}
diff --git a/src/Packet.hpp b/src/Packet.hpp
index cca01ec..ccc486f 100644
--- a/src/Packet.hpp
+++ b/src/Packet.hpp
@@ -1169,3 +1169,64 @@ struct PacketRespawn : Packet {
unsigned char Gamemode;
std::string LevelType;
};
+
+struct PacketPluginMessageSB : Packet {
+ void ToStream(StreamOutput* stream) override {
+ stream->WriteString(Channel);
+ stream->WriteByteArray(Data);
+ }
+
+ void FromStream(StreamInput* stream) override {
+
+ }
+
+ int GetPacketId() override {
+ return PacketNamePlaySB::PluginMessageSB;
+ }
+
+ PacketPluginMessageSB(const std::string& channel, const std::vector<unsigned char> data) : Channel(channel), Data(data) {}
+
+ std::string Channel;
+ std::vector<unsigned char> Data;
+};
+
+struct PacketClientSettings : Packet {
+ void ToStream(StreamOutput* stream) override {
+ stream->WriteString(Locale);
+ stream->WriteByte(ViewDistance);
+ stream->WriteVarInt(ChatMode);
+ stream->WriteBool(ChatColors);
+ stream->WriteUByte(DisplayedSkinParts);
+ stream->WriteVarInt(MainHand);
+ }
+
+ void FromStream(StreamInput* stream) override {
+
+ }
+
+ int GetPacketId() override {
+ return PacketNamePlaySB::ClientSettings;
+ }
+
+ PacketClientSettings(
+ const std::string locale,
+ unsigned char viewDistance,
+ int chatMode,
+ bool chatColors,
+ unsigned char displayedSkinParts,
+ int mainHand) :
+ Locale(locale),
+ ViewDistance(viewDistance),
+ ChatMode(chatMode),
+ ChatColors(chatColors),
+ DisplayedSkinParts(displayedSkinParts),
+ MainHand(mainHand) {}
+
+ std::string Locale;
+ unsigned char ViewDistance;
+ int ChatMode;
+ bool ChatColors;
+ unsigned char DisplayedSkinParts;
+ int MainHand;
+};
+