Skip to content

Commit 5867513

Browse files
authored
Merge pull request #1 from Kgamer77/main
Fixed setoutfit command
2 parents 6aa7273 + 8eff980 commit 5867513

4 files changed

Lines changed: 40 additions & 0 deletions

File tree

include/packets/ChangeCostume.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#pragma once
2+
3+
#include "Packet.h"
4+
5+
struct PACKED ChangeCostume : Packet {
6+
ChangeCostume() : Packet() {
7+
this->mType = PacketType::CHANGECOSTUME;
8+
mPacketSize = sizeof(ChangeCostume) - sizeof(Packet);
9+
};
10+
ChangeCostume(const char* body, const char* cap) : Packet() {
11+
this->mType = PacketType::CHANGECOSTUME;
12+
mPacketSize = sizeof(ChangeCostume) - sizeof(Packet);
13+
strcpy(bodyModel, body);
14+
strcpy(capModel, cap);
15+
}
16+
char bodyModel[COSTUMEBUFSIZE] = {};
17+
char capModel[COSTUMEBUFSIZE] = {};
18+
};

include/packets/Packet.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ enum PacketType : short {
2828
CMD, // = 12
2929
EXTRA, // = 15
3030
HEALTH_COINS, // = 16
31+
MODS, // = 17
32+
CHANGECOSTUME, // = 18
3133
End // end of enum for bounds checking
3234
};
3335

include/server/Client.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
#include "packets/PlayerInfPacket.h"
7676
#include "packets/ShineCollect.h"
7777
#include "packets/Extras.hpp"
78+
#include "packets/ChangeCostume.h"
7879

7980

8081
#include "puppets/PuppetInfo.h"
@@ -239,6 +240,7 @@ class Client {
239240
void updateHackCapInfo(HackCapInf *packet);
240241
void updateGameInfo(GameInf *packet);
241242
void updateCostumeInfo(CostumeInf *packet);
243+
void changeCostume(ChangeCostume* packet);
242244
void updateShineInfo(ShineCollect *packet);
243245
void updatePlayerConnect(PlayerConnect *packet);
244246
void updateCaptureInfo(CaptureInf* packet);

source/server/Client.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ void Client::readFunc() {
409409
case PacketType::COSTUMEINF:
410410
updateCostumeInfo((CostumeInf*)curPacket);
411411
break;
412+
case PacketType::CHANGECOSTUME:
413+
changeCostume((ChangeCostume*)curPacket);
414+
break;
412415
case PacketType::SHINECOLL:
413416
updateShineInfo((ShineCollect*)curPacket);
414417
break;
@@ -850,6 +853,21 @@ void Client::updateCostumeInfo(CostumeInf *packet) {
850853
strcpy(curInfo->costumeHead, packet->capModel);
851854
}
852855

856+
/**
857+
* @brief
858+
*
859+
* @param packet
860+
*/
861+
void Client::changeCostume(ChangeCostume* packet) {
862+
863+
// Set outfit when costume info is received
864+
if (sInstance) {
865+
GameDataFunction::wearCostume(sInstance->mHolder, packet->bodyModel);
866+
GameDataFunction::wearCap(sInstance->mHolder, packet->capModel);
867+
Logger::log("Set outfit from costume packet: Body=%s, Cap=%s\n", packet->bodyModel, packet->capModel);
868+
}
869+
}
870+
853871
/**
854872
* @brief
855873
*

0 commit comments

Comments
 (0)