Skip to content

Commit 89f3447

Browse files
jprzimbagabrielew
andcommitted
fix: add proficiency inspection type to item inspection
Introduces INSPECT_PROFICIENCY as a new inspection type in server_definitions.hpp and updates related methods to use an inspectionType uint8_t instead of a cyclopedia boolean. This allows item inspection to support proficiency and other future types, improving flexibility in inspection handling. Co-Authored-By: Gabriel Alcântara Bernardes <[email protected]>
1 parent 0c0c0d9 commit 89f3447

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

src/creatures/players/player.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8377,9 +8377,9 @@ void Player::sendAddMarker(const Position &pos, uint8_t markType, const std::str
83778377
}
83788378
}
83798379

8380-
void Player::sendItemInspection(uint16_t itemId, uint8_t itemCount, const std::shared_ptr<Item> &item, bool cyclopedia) const {
8380+
void Player::sendItemInspection(uint16_t itemId, uint8_t itemCount, const std::shared_ptr<Item> &item, uint8_t inspectionType) const {
83818381
if (client) {
8382-
client->sendItemInspection(itemId, itemCount, item, cyclopedia);
8382+
client->sendItemInspection(itemId, itemCount, item, inspectionType);
83838383
}
83848384
}
83858385

src/creatures/players/player.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ class Player final : public Creature, public Cylinder, public Bankable {
10731073
void sendChannel(uint16_t channelId, const std::string &channelName, const UsersMap* channelUsers, const InvitedMap* invitedUsers) const;
10741074
void sendTutorial(uint8_t tutorialId) const;
10751075
void sendAddMarker(const Position &pos, uint8_t markType, const std::string &desc) const;
1076-
void sendItemInspection(uint16_t itemId, uint8_t itemCount, const std::shared_ptr<Item> &item, bool cyclopedia) const;
1076+
void sendItemInspection(uint16_t itemId, uint8_t itemCount, const std::shared_ptr<Item> &item, uint8_t inspectionType) const;
10771077
void sendCyclopediaCharacterNoData(CyclopediaCharacterInfoType_t characterInfoType, uint8_t errorCode) const;
10781078
void sendCyclopediaCharacterBaseInformation() const;
10791079
void sendCyclopediaCharacterGeneralStats() const;

src/server/network/protocol/protocolgame.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,10 +2265,10 @@ void ProtocolGame::parseInspectionObject(NetworkMessage &msg) {
22652265
if (inspectionType == INSPECT_NORMALOBJECT) {
22662266
Position pos = msg.getPosition();
22672267
g_game().playerInspectItem(player, pos);
2268-
} else if (inspectionType == INSPECT_NPCTRADE || inspectionType == INSPECT_CYCLOPEDIA) {
2268+
} else if (inspectionType == INSPECT_NPCTRADE || inspectionType == INSPECT_CYCLOPEDIA || inspectionType == INSPECT_PROFICIENCY) {
22692269
auto itemId = msg.get<uint16_t>();
22702270
uint16_t itemCount = msg.getByte();
2271-
g_game().playerInspectItem(player, itemId, static_cast<int8_t>(itemCount), (inspectionType == INSPECT_CYCLOPEDIA));
2271+
g_game().playerInspectItem(player, itemId, static_cast<int8_t>(itemCount), inspectionType);
22722272
}
22732273
}
22742274

@@ -2282,15 +2282,21 @@ void ProtocolGame::sendSessionEndInformation(SessionEndInformations information)
22822282
disconnect();
22832283
}
22842284

2285-
void ProtocolGame::sendItemInspection(uint16_t itemId, uint8_t itemCount, const std::shared_ptr<Item> &item, bool cyclopedia) {
2285+
void ProtocolGame::sendItemInspection(uint16_t itemId, uint8_t itemCount, const std::shared_ptr<Item> &item, uint8_t inspectionType) {
22862286
if (oldProtocol) {
22872287
return;
22882288
}
22892289

22902290
NetworkMessage msg;
22912291
msg.addByte(0x76);
22922292
msg.addByte(0x00);
2293-
msg.addByte(cyclopedia ? 0x01 : 0x00);
2293+
if (inspectionType == INSPECT_CYCLOPEDIA) {
2294+
msg.addByte(0x01);
2295+
} else if (inspectionType == INSPECT_PROFICIENCY) {
2296+
msg.addByte(0x02);
2297+
} else {
2298+
msg.addByte(0x00);
2299+
}
22942300
msg.add<uint32_t>(player->getID()); // 13.00 Creature ID
22952301
msg.addByte(0x01);
22962302

src/server/network/protocol/protocolgame.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class ProtocolGame final : public Protocol {
174174

175175
void sendSessionEndInformation(SessionEndInformations information);
176176

177-
void sendItemInspection(uint16_t itemId, uint8_t itemCount, const std::shared_ptr<Item> &item, bool cyclopedia);
177+
void sendItemInspection(uint16_t itemId, uint8_t itemCount, const std::shared_ptr<Item> &item, uint8_t inspectionType);
178178
void parseInspectionObject(NetworkMessage &msg);
179179

180180
void parseFriendSystemAction(NetworkMessage &msg);

src/server/server_definitions.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ enum InspectObjectTypes : uint8_t {
9191
INSPECT_NORMALOBJECT = 0,
9292
INSPECT_NPCTRADE = 1,
9393
INSPECT_PLAYERTRADE = 2,
94-
INSPECT_CYCLOPEDIA = 3
94+
INSPECT_CYCLOPEDIA = 3,
95+
INSPECT_PROFICIENCY = 4,
9596
};
9697

9798
enum CyclopediaCharacterInfo_OutfitType_t : uint8_t {

0 commit comments

Comments
 (0)