Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

Commit

Permalink
[Protocol Bytes] Support to client 12.72.11206 (#311)
Browse files Browse the repository at this point in the history
Client support 12.72.11206, download link: https://github.com/dudantas/tibia-client/tree/12.72.11206

Thanks to Rick (@FakeShinoda) for the help on market bytes.
Thanks to @hyresu for help with fix hireling offer

Added:
• Cyclopedia Character Stats - Bytes for cleave damage, reflect damage, perfect shot, magic shield capacity, concoctions potions
• Market -Bytes for cleave damage, reflect damage, perfect shot, magic shield capacity
• Missing creature icons

• Only protocol bytes
  • Loading branch information
marcosvf132 authored Dec 7, 2021
1 parent 7cea3b6 commit 20866ec
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,12 @@ TODO
## CUSTOM
# Files
config.lua
client_assertions.txt
# Extensions
*.ini
*.otb
*.exe
*.manifest
*.otbm
*.rar

Expand Down
4 changes: 2 additions & 2 deletions config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ maxItem = 2000
maxContainer = 100

-- Version
clientVersion = 1264
clientVersionStr = "12.64"
clientVersion = 1272
clientVersionStr = "12.72"

-- Depot Limit
freeDepotLimit = 2000
Expand Down
9 changes: 9 additions & 0 deletions data/XML/mounts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,13 @@
<mount id="179" clientid="1389" name="Void Watcher" speed="20" premium="no" type="store" />
<mount id="180" clientid="1390" name="Rune Watcher" speed="20" premium="no" type="store" />
<mount id="181" clientid="1391" name="Rift Watcher" speed="20" premium="no" type="store" />
<mount id="182" clientid="1417" name="Phant" speed="20" premium="yes" type="arena" />
<mount id="183" clientid="1430" name="Shellodon" speed="20" premium="yes" type="quest" />
<mount id="184" clientid="1431" name="Singeing Steed" speed="20" premium="yes" type="quest" />
<mount id="185" clientid="1439" name="Hyacinth" speed="20" premium="no" type="store" />
<mount id="186" clientid="1440" name="Peony" speed="20" premium="no" type="store" />
<mount id="187" clientid="1441" name="Dandelion" speed="20" premium="no" type="store" />
<mount id="188" clientid="1446" name="Rustwurm" speed="20" premium="no" type="store" />
<mount id="189" clientid="1447" name="Bogwurm" speed="20" premium="no" type="store" />
<mount id="190" clientid="1448" name="Gloomwurm" speed="20" premium="no" type="store" />
</mounts>
10 changes: 10 additions & 0 deletions data/XML/outfits.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@
<outfit type="0" looktype="1372" name="Rascoohan" premium="yes" unlocked="no" enabled="yes" from="quest" />
<outfit type="0" looktype="1383" name="Merry Garb" premium="no" unlocked="no" enabled="yes" from="store" />
<outfit type="0" looktype="1385" name="Rune Master" premium="no" unlocked="no" enabled="yes" from="store" />
<outfit type="0" looktype="1387" name="Citizen of Issavi" premium="yes" unlocked="no" enabled="yes" from="quest" />
<outfit type="0" looktype="1416" name="Forest Warden" premium="no" unlocked="no" enabled="yes" from="store" />
<outfit type="0" looktype="1437" name="Royal Bounacean Advisor" premium="yes" unlocked="no" enabled="yes" from="quest" />
<outfit type="0" looktype="1445" name="Dragon Knight" premium="no" unlocked="no" enabled="yes" from="store" />
<outfit type="0" looktype="1450" name="Arbalester" premium="no" unlocked="no" enabled="yes" from="store" />

<!-- Male outfits -->
<outfit type="1" looktype="128" name="Citizen" premium="no" unlocked="yes" enabled="yes" />
Expand Down Expand Up @@ -197,4 +202,9 @@
<outfit type="1" looktype="1371" name="Rascoohan" premium="yes" unlocked="no" enabled="yes" from="quest" />
<outfit type="1" looktype="1382" name="Merry Garb" premium="no" unlocked="no" enabled="yes" from="store" />
<outfit type="1" looktype="1384" name="Rune Master" premium="no" unlocked="no" enabled="yes" from="store" />
<outfit type="1" looktype="1386" name="Citizen of Issavi" premium="yes" unlocked="no" enabled="yes" from="quest" />
<outfit type="1" looktype="1415" name="Forest Warden" premium="no" unlocked="no" enabled="yes" from="store" />
<outfit type="1" looktype="1436" name="Royal Bounacean Advisor" premium="yes" unlocked="no" enabled="yes" from="quest" />
<outfit type="1" looktype="1444" name="Dragon Knight" premium="no" unlocked="no" enabled="yes" from="store" />
<outfit type="1" looktype="1449" name="Arbalester" premium="no" unlocked="no" enabled="yes" from="store" />
</outfits>
Binary file modified data/items/items.otb
Binary file not shown.
2 changes: 1 addition & 1 deletion data/modules/scripts/gamestore/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ end
GameStore.ClientOfferTypes = {
CLIENT_STORE_OFFER_OTHER = 0,
CLIENT_STORE_OFFER_NAMECHANGE = 1,
CLIENT_STORE_OFFER_HIRELING = 10,
CLIENT_STORE_OFFER_HIRELING = 3,
}

GameStore.HistoryTypes = {
Expand Down
4 changes: 2 additions & 2 deletions src/config/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ bool ConfigManager::load()
string[MYSQL_PASS] = getGlobalString(L, "mysqlPass", "");
string[MYSQL_DB] = getGlobalString(L, "mysqlDatabase", "otservbr-global");
string[MYSQL_SOCK] = getGlobalString(L, "mysqlSock", "");
string[CLIENT_VERSION_STR] = getGlobalString(L, "clientVersionStr", "12.64");
string[CLIENT_VERSION_STR] = getGlobalString(L, "clientVersionStr", "12.72");

integer[SQL_PORT] = getGlobalNumber(L, "mysqlPort", 3306);
integer[GAME_PORT] = getGlobalNumber(L, "gameProtocolPort", 7172);
Expand All @@ -140,7 +140,7 @@ bool ConfigManager::load()

integer[MARKET_OFFER_DURATION] = getGlobalNumber(L, "marketOfferDuration", 30 * 24 * 60 * 60);

integer[CLIENT_VERSION] = getGlobalNumber(L, "clientVersion", 1264);
integer[CLIENT_VERSION] = getGlobalNumber(L, "clientVersion", 1272);
integer[FREE_DEPOT_LIMIT] = getGlobalNumber(L, "freeDepotLimit", 2000);
integer[PREMIUM_DEPOT_LIMIT] = getGlobalNumber(L, "premiumDepotLimit", 8000);
integer[DEPOT_BOXES] = getGlobalNumber(L, "depotBoxes", 19);
Expand Down
72 changes: 58 additions & 14 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2707,18 +2707,25 @@ void ProtocolGame::sendCreatureLight(const Creature *creature)
void ProtocolGame::sendCreatureIcon(const Creature* creature)
{
if (!creature)
return;
CreatureIcon_t icon = creature->getIcon();
NetworkMessage msg;
msg.addByte(0x8B);
msg.add<uint32_t>(creature->getID());
msg.addByte(14); // type 14 for this
msg.addByte(icon != CREATUREICON_NONE); // 0 = no icon, 1 = we'll send an icon
if (icon != CREATUREICON_NONE) {
msg.addByte(icon);
msg.addByte(1); // ???
msg.add<uint16_t>(0); // used for the life in the new quest
}
{
return;
}

CreatureIcon_t icon = creature->getIcon();
NetworkMessage msg;
msg.addByte(0x8B);
msg.add<uint32_t>(creature->getID());
// Type 14 for this
msg.addByte(14);
// 0 = no icon, 1 = we'll send an icon
msg.addByte(icon != CREATUREICON_NONE);
if (icon != CREATUREICON_NONE) {
msg.addByte(icon);
// Creature update
msg.addByte(1);
// Used for the life in the new quest
msg.add<uint16_t>(0);
}
writeToOutputBuffer(msg);
}

Expand Down Expand Up @@ -2912,17 +2919,21 @@ void ProtocolGame::sendCyclopediaCharacterGeneralStats()
// loyalty bonus
msg.add<uint16_t>(player->getBaseMagicLevel());
msg.add<uint16_t>(player->getMagicLevelPercent() * 100);

for (uint8_t i = SKILL_FIRST; i < SKILL_CRITICAL_HIT_CHANCE; ++i)
{
// check if all clients have the same hardcoded skill ids
static const uint8_t HardcodedSkillIds[] = {11, 9, 8, 10, 7, 6, 13};
static const uint8_t HardcodedSkillIds[] = { 11, 9, 8, 10, 7, 6, 13 };
msg.addByte(HardcodedSkillIds[i]);
msg.add<uint16_t>(std::min<int32_t>(player->getSkillLevel(i), std::numeric_limits<uint16_t>::max()));
msg.add<uint16_t>(player->getBaseSkill(i));
// loyalty bonus
msg.add<uint16_t>(player->getBaseSkill(i));
msg.add<uint16_t>(player->getSkillPercent(i) * 100);
}

// Version 12.70
msg.addByte(0x00);

writeToOutputBuffer(msg);
}

Expand All @@ -2937,6 +2948,22 @@ void ProtocolGame::sendCyclopediaCharacterCombatStats()
msg.add<uint16_t>(std::min<int32_t>(player->getSkillLevel(i), std::numeric_limits<uint16_t>::max()));
msg.add<uint16_t>(0);
}

// Cleave (12.70)
msg.add<uint16_t>(0);
// Magic shield capacity (12.70)
msg.add<uint16_t>(0); // Direct bonus
msg.add<uint16_t>(0); // Percentage bonus

// Perfect shot range (12.70)
for (uint16_t i = 1; i <= 5; i++)
{
msg.add<uint16_t>(0x00);
}

// Damage reflection
msg.add<uint16_t>(0);

uint8_t haveBlesses = 0;
uint8_t blessings = 8;
for (uint8_t i = 1; i < blessings; ++i)
Expand All @@ -2946,8 +2973,10 @@ void ProtocolGame::sendCyclopediaCharacterCombatStats()
++haveBlesses;
}
}

msg.addByte(haveBlesses);
msg.addByte(blessings);

const Item *weapon = player->getWeapon();
if (weapon)
{
Expand Down Expand Up @@ -3027,6 +3056,7 @@ void ProtocolGame::sendCyclopediaCharacterCombatStats()
msg.addByte(0);
msg.addByte(CIPBIA_ELEMENTAL_UNDEFINED);
}

msg.add<uint16_t>(player->getArmor());
msg.add<uint16_t>(player->getDefense());

Expand Down Expand Up @@ -3090,6 +3120,9 @@ void ProtocolGame::sendCyclopediaCharacterCombatStats()
}
}

// Concoctions potions (12.70)
msg.addByte(0x00);

msg.setBufferPosition(startCombats);
msg.addByte(combats);

Expand Down Expand Up @@ -4491,12 +4524,22 @@ void ProtocolGame::sendMarketDetail(uint16_t itemId)
msg.add<uint16_t>(0x00);
}

// Magic shield capacity modifier (12.70)
msg.add<uint16_t>(0x00);
// Cleave modifier (12.70)
msg.add<uint16_t>(0x00);
// Damage reflection modifier (12.70)
msg.add<uint16_t>(0x00);
// Perfect shot modifier (12.70)
msg.add<uint16_t>(0x00);

MarketStatistics *statistics = IOMarket::getInstance().getPurchaseStatistics(itemId);
if (statistics)
{
msg.addByte(0x01);
msg.add<uint32_t>(statistics->numTransactions);
msg.add<uint32_t>(std::min<uint64_t>(std::numeric_limits<uint32_t>::max(), statistics->totalPrice));
msg.add<uint32_t>(0);
msg.add<uint32_t>(statistics->highestPrice);
msg.add<uint32_t>(statistics->lowestPrice);
}
Expand All @@ -4511,6 +4554,7 @@ void ProtocolGame::sendMarketDetail(uint16_t itemId)
msg.addByte(0x01);
msg.add<uint32_t>(statistics->numTransactions);
msg.add<uint32_t>(std::min<uint64_t>(std::numeric_limits<uint32_t>::max(), statistics->totalPrice));
msg.add<uint32_t>(0);
msg.add<uint32_t>(statistics->highestPrice);
msg.add<uint32_t>(statistics->lowestPrice);
}
Expand Down
26 changes: 22 additions & 4 deletions src/utils/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,28 @@ enum Icons_t {
};

enum CreatureIcon_t {
CREATUREICON_NONE = 0,
CREATUREICON_HIGHERRECEIVEDDAMAGE = 1,
CREATUREICON_LOWERDEALTDAMAGE = 2,
CREATUREICON_TURNEDMELEE = 3,
CREATUREICON_NONE = 0,
CREATUREICON_HIGHERRECEIVEDDAMAGE = 1,
CREATUREICON_LOWERDEALTDAMAGE = 2,
CREATUREICON_TURNEDMELEE = 3,
CREATUREICON_GREENBALL = 4,
CREATUREICON_REDBALL = 5,
CREATUREICON_GREENSHIELD = 6,
CREATUREICON_YELLOWSHIELD = 7,
CREATUREICON_BLUESHIELD = 8,
CREATUREICON_PURPLESHIELD = 9,
CREATUREICON_REDSHIELD = 10,
CREATUREICON_PIGEON = 11,
CREATUREICON_PURPLESTAR = 12,
CREATUREICON_POISONDROP = 13,
CREATUREICON_WATERDROP = 14,
CREATUREICON_FIREDROP = 15,
CREATUREICON_ICEFLOWER = 16,
CREATUREICON_ARROWUP = 17,
CREATUREICON_ARROWDOWN = 18,
CREATUREICON_EXCLAMATIONMARK = 19,
CREATUREICON_QUESTIONMARK = 20,
CREATUREICON_CANCELMARK = 21,
};

enum WeaponType_t : uint8_t {
Expand Down

0 comments on commit 20866ec

Please sign in to comment.