Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ActionBar packets (sendEquipItem) + Tier in actionbar #1073

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kokekanon
Copy link
Collaborator

@kokekanon kokekanon commented Jan 24, 2025

Description

The function sendEquipItem (which only affects game_actionbar) was sending 2 packets:
according OTCR
u16 the itemId
u8 or u16 countOrSubType
But this is incorrect.
According to Canary, the 2 packets to send are:

u16 the itemId
u8 tier.
This error manifests when trying to equip an item with a tier through the action bar.
The client sends the itemId and count (1).
For example, attempting to equip an Helmet tier +5.
The server interprets itemId and tier = 1(count), failing to find the item.
As a result, it doesn't work.

Canary 13.40

2 packets:
U16 item ID
u8 Tier

https://github.com/opentibiabr/canary/blob/5781de718e5d22ce9e7f136151d8b4032c85843d/src/server/network/protocol/protocolgame.cpp#L1392-L1400

image

Tfs 10.98 blacktek

only packet U16 Item ID ( no have this feature GameThingUpgradeClassification)
https://github.com/Black-Tek/BlackTek-Server/blob/7130b41899fcb643b582e78a52ff27e891110d54/src/protocolgame.cpp#L983-L989

image

tfs forgottenserver-optimized SaiyansKing

only packet U16 Item ID ( no have this feature GameThingUpgradeClassification)

https://github.com/mehah/forgottenserver-optimized/blob/148baaa48c8ca159b16d0b632bd813749399b013/src/protocolgame.cpp#L1256-L1262

image

tfs 8.6

does not have this function

tfs 13.10

13.10 does not have many features, this is one of them

https://github.com/otland/forgottenserver/blob/b227678ab3584b8349913abfe4529292678a3fdf/src/protocolgame.cpp#L1300-L1308
image

Behavior

Actual

cvcaca

Expected

avavaaxc

Fixes

usser in discord

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested

  • login
  • logout
  • item with and without tier
  • clear item
  • 13.40 , 8.6 , 13.10, 10.98

Test Configuration:

  • Server Version: 13.40 , 8.6 , 13.10, 10.98
  • Client: this pr
  • Operating System: win 11

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • tier :

image

image

@kokekanon kokekanon changed the title fix: action bar packets sendEquipItem fix: ActionBar packets (sendEquipItem) + Tier in actionbar Jan 24, 2025
@Zbizu
Copy link
Contributor

Zbizu commented Jan 24, 2025

As far as I'm aware, this feature was introduced together with the exaltation forge so it can be enabled since 12.80 (or generally be a part of "forge packets" feature)

13.20 private repo

void ProtocolGame::parseEquipObject(NetworkMessage& msg)
{
	// action bar/hotkey equip
	uint16_t clientId = msg.get<uint16_t>();
	const ItemType& it = g_items.legacyGetItemTypeByClientId(clientId);
	if (it.id == 0) {
		return;
	}

	uint8_t tier = 0;
	if (it.classification > 0) {
		tier = msg.getByte();
	}

	g_gameThread.addTask(createTask((DISPATCHER_TASK_EXPIRATION, [=, playerID = player->getID(), isTiered = it.classification > 0]() { g_game.playerEquipItem(playerID, clientId, isTiered, tier); })));
}

@kokekanon kokekanon marked this pull request as draft January 24, 2025 05:13
@kokekanon kokekanon marked this pull request as ready for review January 24, 2025 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants