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

Update to game protocol 12.91 #4568

Merged
8 commits merged into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions data/XML/mounts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,6 @@
<mount id="198" clientid="1526" name="Poppy Ibex" speed="20" premium="no" />
<mount id="199" clientid="1527" name="Mint Ibex" speed="20" premium="no" />
<mount id="200" clientid="1528" name="Cinnamon Ibex" speed="20" premium="no" />
<mount id="201" clientid="1536" name="Giant Beaver" speed="20" premium="yes" />
<mount id="202" clientid="1577" name="Ripptor" speed="20" premium="yes" />
</mounts>
4 changes: 4 additions & 0 deletions data/XML/outfits.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
<outfit type="0" looktype="1461" name="Formal Dress" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="1490" name="Ghost Blade" premium="no" unlocked="no" enabled="yes" />
<outfit type="0" looktype="1501" name="Nordic Chieftain" premium="no" unlocked="no" enabled="yes" />
<outfit type="0" looktype="1568" name="Fire-Fighter" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="1576" name="Fencer" premium="no" unlocked="no" enabled="yes" />

<!-- Male outfits -->
<outfit type="1" looktype="128" name="Citizen" premium="no" unlocked="yes" enabled="yes" />
Expand Down Expand Up @@ -215,4 +217,6 @@
<outfit type="1" looktype="1460" name="Formal Dress" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="1489" name="Ghost Blade" premium="no" unlocked="no" enabled="yes" />
<outfit type="1" looktype="1500" name="Nordic Chieftain" premium="no" unlocked="no" enabled="yes" />
<outfit type="1" looktype="1569" name="Fire-Fighter" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="1575" name="Fencer" premium="no" unlocked="no" enabled="yes" />
</outfits>
Binary file modified data/items/items.otb
Binary file not shown.
8 changes: 7 additions & 1 deletion data/items/items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4420,7 +4420,7 @@
<attribute key="type" value="mailbox" />
</item>
<item id="2594" article="a" name="depot chest">
<attribute key="containerSize" value="18" />
<attribute key="containerSize" value="20" />
</item>
<item id="2595" article="a" name="parcel">
<attribute key="type" value="container" />
Expand Down Expand Up @@ -42934,4 +42934,10 @@
<item id="42854" article="a" name="box full of ballons" />
<item id="42855" article="a" name="Pan Amphora" />
<item id="42858" article="a" name="big reward box" />
<item id="44714" name="depot box XIX">
<attribute key="containerSize" value="32" />
</item>
<item id="44715" name="depot box XX">
<attribute key="containerSize" value="32" />
</item>
</items>
10 changes: 10 additions & 0 deletions data/lib/core/achievements.lua
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,16 @@ achievements = {
[494] = {clientId = 528, name = "Shell we take a Ride", grade = 1, points = 3, description = "Equipped with the shell of a tortoise and claws of a lobster this insect like companion will help you through every hardship."},
[495] = {clientId = 530, name = "Some Like It Hot", grade = 1, points = 2, description = "You have braved the searing heat in the tunnels deep below Kazordoon and vanquished the Brainstealer. The voices inside your head are finally silenced."},
[496] = {clientId = 427, name = "Woodcarver", grade = 1, points = 3, secret = true, description = "You defeated Megasylvan Yselda in the wake of the sleeping carnisylvan menace deep under Bounac."},

-- 12.90
[502] = {clientId = 534, name = "Friendly Fire", grade = 1, points = 1, description = "You mastered the fire and tamed a supervulcano!"},
[503] = {clientId = 535, name = "Wedding Planner", grade = 1, points = 3, description = "Alas! What could be more beautiful and satisfying than bringing two loving hearts together? So romantic!"},
[504] = {clientId = 536, name = "Beaver Away", grade = 1, points = 1, description = "You really were as busy as a beaver in order to help the nagas. Enjoy some eager company!"},
[505] = {clientId = 537, name = "Snake Pit", grade = 1, points = 1, description = "Mysterious nagas, a vibrant jungle and a sinking island - you really know every corner of Marapur now."},
[506] = {clientId = 538, name = "Royalty of Hazard", grade = 1, points = 1, description = "For some it can't be hazardous enough."},
[507] = {clientId = 539, name = "Measuring the World", grade = 1, points = 3, description = "Step by step you discovered many of the secrets hidden in the world, thus gaining the right to wear the Discoverer outfit and hat. Made-to-measure for a brave traveller of the wilds."},
[508] = {clientId = 540, name = "Ripp-Ripp Hooray!", grade = 1, points = 3, description = "Don't get carried away by your success. Get carried away by your ripptor."},
[509] = {clientId = 531, name = "First Achievement", grade = 1, points = 1, secret = true, description = "Congratulations to your very first achievement! ... Well, not really. But imagine, it is. Because at this point during your journey into the past, achievements have been introduced."},
}

ACHIEVEMENT_FIRST = 1
Expand Down
8 changes: 8 additions & 0 deletions data/scripts/actions/others/taming.lua
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,14 @@ local config = {
{sound = "GRRRRRRRRR", text = "The noble lion majestically rejects your amulet."}
},
success = {sound = "Grrr", text = "The noble lion will now accompany you as a friend and ally."}
},
[44579] = { -- colourful water lily
name = "giant beaver",
id = 201,
type = TYPE_MONSTER,
achievement = "Beaver Away",
chance = 100,
success = {sound = "Grrr!", text = "You tamed the giant beaver."}
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ enum MagicEffectClasses : uint8_t
CONST_ME_HORESTIS = 238,
CONST_ME_DEVOVORGA = 239,
CONST_ME_FERUMBRAS_2 = 240,
CONST_ME_FOAM = 241,
};

enum ShootType_t : uint8_t
Expand Down Expand Up @@ -581,6 +582,8 @@ enum item_t : uint16_t
ITEM_DEPOT_BOX_XVI = 25468,
ITEM_DEPOT_BOX_XVII = 25469,
ITEM_DEPOT_BOX_XVIII = 34571,
ITEM_DEPOT_BOX_XIX = 44714,
ITEM_DEPOT_BOX_XX = 44715,

ITEM_MALE_CORPSE = 3058,
ITEM_FEMALE_CORPSE = 3065,
Expand Down
6 changes: 3 additions & 3 deletions src/definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ static constexpr auto STATUS_SERVER_NAME = "The Forgotten Server";
static constexpr auto STATUS_SERVER_VERSION = "1.5";
static constexpr auto STATUS_SERVER_DEVELOPERS = "The Forgotten Server Team";

static constexpr auto CLIENT_VERSION_MIN = 1280;
static constexpr auto CLIENT_VERSION_MAX = 1288;
static constexpr auto CLIENT_VERSION_STR = "12.87";
static constexpr auto CLIENT_VERSION_MIN = 1290;
static constexpr auto CLIENT_VERSION_MAX = 1291;
static constexpr auto CLIENT_VERSION_STR = "12.90";

static constexpr auto AUTHENTICATOR_DIGITS = 6U;
static constexpr auto AUTHENTICATOR_PERIOD = 30U;
Expand Down
4 changes: 2 additions & 2 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3045,7 +3045,7 @@ void Game::internalCloseTrade(Player* player, bool sendCancel /* = true*/)
}
}

void Game::playerPurchaseItem(uint32_t playerId, uint16_t spriteId, uint8_t count, uint8_t amount,
void Game::playerPurchaseItem(uint32_t playerId, uint16_t spriteId, uint8_t count, uint16_t amount,
bool ignoreCap /* = false*/, bool inBackpacks /* = false*/)
{
if (amount == 0 || amount > ITEM_STACK_SIZE) {
Expand Down Expand Up @@ -3083,7 +3083,7 @@ void Game::playerPurchaseItem(uint32_t playerId, uint16_t spriteId, uint8_t coun
merchant->onPlayerTrade(player, onBuy, it.id, subType, amount, ignoreCap, inBackpacks);
}

void Game::playerSellItem(uint32_t playerId, uint16_t spriteId, uint8_t count, uint8_t amount, bool ignoreEquipped)
void Game::playerSellItem(uint32_t playerId, uint16_t spriteId, uint8_t count, uint16_t amount, bool ignoreEquipped)
{
if (amount == 0 || amount > ITEM_STACK_SIZE) {
return;
Expand Down
6 changes: 3 additions & 3 deletions src/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ class Game
uint16_t spriteId);
void playerAcceptTrade(uint32_t playerId);
void playerLookInTrade(uint32_t playerId, bool lookAtCounterOffer, uint8_t index);
void playerPurchaseItem(uint32_t playerId, uint16_t spriteId, uint8_t count, uint8_t amount, bool ignoreCap = false,
bool inBackpacks = false);
void playerSellItem(uint32_t playerId, uint16_t spriteId, uint8_t count, uint8_t amount,
void playerPurchaseItem(uint32_t playerId, uint16_t spriteId, uint8_t count, uint16_t amount,
bool ignoreCap = false, bool inBackpacks = false);
void playerSellItem(uint32_t playerId, uint16_t spriteId, uint8_t count, uint16_t amount,
bool ignoreEquipped = false);
void playerCloseShop(uint32_t playerId);
void playerLookInShop(uint32_t playerId, uint16_t spriteId, uint8_t count);
Expand Down
7 changes: 4 additions & 3 deletions src/itemloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ enum clientVersion_t
CLIENT_VERSION_1285 = 61,
CLIENT_VERSION_1286 = 62,
CLIENT_VERSION_1287 = 63,
CLIENT_VERSION_1290 = 64,

CLIENT_VERSION_LAST = CLIENT_VERSION_1287
CLIENT_VERSION_LAST = CLIENT_VERSION_1290
};

enum rootattrib_
Expand Down Expand Up @@ -169,8 +170,8 @@ enum itemflags_t
FLAG_HORIZONTAL = 1 << 18,
FLAG_CANNOTDECAY = 1 << 19, // unused
FLAG_ALLOWDISTREAD = 1 << 20,
FLAG_UNUSED = 1 << 21, // unused
FLAG_CLIENTCHARGES = 1 << 22, /* deprecated */
FLAG_CLIENTDURATION = 1 << 21,
FLAG_CLIENTCHARGES = 1 << 22,
FLAG_LOOKTHROUGH = 1 << 23,
FLAG_ANIMATION = 1 << 24,
FLAG_FULLTILE = 1 << 25, // unused
Expand Down
2 changes: 2 additions & 0 deletions src/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,8 @@ bool Items::loadFromOtb(const std::string& file)
iType.isAnimation = hasBitSet(FLAG_ANIMATION, flags);
// iType.walkStack = !hasBitSet(FLAG_FULLTILE, flags);
iType.forceUse = hasBitSet(FLAG_FORCEUSE, flags);
iType.showClientCharges = hasBitSet(FLAG_CLIENTCHARGES, flags);
iType.showClientDuration = hasBitSet(FLAG_CLIENTDURATION, flags);

iType.id = serverId;
iType.clientId = clientId;
Expand Down
2 changes: 2 additions & 0 deletions src/items.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ class ItemType
bool stopTime = false;
bool showCount = true;
bool supply = false;
bool showClientCharges = false;
bool showClientDuration = false;
};

class Items
Expand Down
1 change: 1 addition & 0 deletions src/luascript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1465,6 +1465,7 @@ void LuaScriptInterface::registerFunctions()
registerEnum(CONST_ME_HORESTIS);
registerEnum(CONST_ME_DEVOVORGA);
registerEnum(CONST_ME_FERUMBRAS_2);
registerEnum(CONST_ME_FOAM);

registerEnum(CONST_ANI_NONE);
registerEnum(CONST_ANI_SPEAR);
Expand Down
14 changes: 14 additions & 0 deletions src/networkmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ void NetworkMessage::addItem(uint16_t id, uint8_t count)
addByte(0x00); // quiver ammo count
} else if (it.classification > 0) {
addByte(0x00); // item tier (0-10)
} else if (it.showClientCharges) {
add<uint32_t>(it.charges);
addByte(0x00); // boolean (is brand new)
} else if (it.showClientDuration) {
add<uint32_t>(it.decayTime);
addByte(0x00); // boolean (is brand new)
}

if (it.isPodium()) {
Expand All @@ -119,6 +125,14 @@ void NetworkMessage::addItem(const Item* item)
addByte(0x00); // item tier (0-10)
}

if (it.showClientCharges) {
add<uint32_t>(item->getCharges());
addByte(0); // boolean (is brand new)
} else if (it.showClientDuration) {
add<uint32_t>(item->getDuration() / 1000);
addByte(0); // boolean (is brand new)
}

if (it.isContainer()) {
addByte(0x00); // assigned loot container icon
// quiver ammo count
Expand Down
4 changes: 2 additions & 2 deletions src/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ void Npc::doSayToPlayer(Player* player, const std::string& text)
}
}

void Npc::onPlayerTrade(Player* player, int32_t callback, uint16_t itemId, uint8_t count, uint8_t amount,
void Npc::onPlayerTrade(Player* player, int32_t callback, uint16_t itemId, uint8_t count, uint16_t amount,
bool ignore /* = false*/, bool inBackpacks /* = false*/)
{
if (npcEventHandler) {
Expand Down Expand Up @@ -1176,7 +1176,7 @@ void NpcEventsHandler::onCreatureSay(Creature* creature, SpeakClasses type, cons
scriptInterface->callFunction(3);
}

void NpcEventsHandler::onPlayerTrade(Player* player, int32_t callback, uint16_t itemId, uint8_t count, uint8_t amount,
void NpcEventsHandler::onPlayerTrade(Player* player, int32_t callback, uint16_t itemId, uint8_t count, uint16_t amount,
bool ignore, bool inBackpacks)
{
if (callback == -1) {
Expand Down
4 changes: 2 additions & 2 deletions src/npc.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class NpcEventsHandler
void onCreatureDisappear(Creature* creature);
void onCreatureMove(Creature* creature, const Position& oldPos, const Position& newPos);
void onCreatureSay(Creature* creature, SpeakClasses, const std::string& text);
void onPlayerTrade(Player* player, int32_t callback, uint16_t itemId, uint8_t count, uint8_t amount,
void onPlayerTrade(Player* player, int32_t callback, uint16_t itemId, uint8_t count, uint16_t amount,
bool ignore = false, bool inBackpacks = false);
void onPlayerCloseChannel(Player* player);
void onPlayerEndTrade(Player* player);
Expand Down Expand Up @@ -143,7 +143,7 @@ class Npc final : public Creature
}

void onPlayerCloseChannel(Player* player);
void onPlayerTrade(Player* player, int32_t callback, uint16_t itemId, uint8_t count, uint8_t amount,
void onPlayerTrade(Player* player, int32_t callback, uint16_t itemId, uint8_t count, uint16_t amount,
bool ignore = false, bool inBackpacks = false);
void onPlayerEndTrade(Player* player, int32_t buyCallback, int32_t sellCallback);

Expand Down
7 changes: 3 additions & 4 deletions src/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ void ProtocolGame::parsePlayerPurchase(NetworkMessage& msg)
{
uint16_t id = msg.get<uint16_t>();
uint8_t count = msg.getByte();
uint8_t amount = msg.getByte();
uint16_t amount = msg.get<uint16_t>();
bool ignoreCap = msg.getByte() != 0;
bool inBackpacks = msg.getByte() != 0;
g_dispatcher.addTask(DISPATCHER_TASK_EXPIRATION, [=, playerID = player->getID()]() {
Expand All @@ -1382,7 +1382,7 @@ void ProtocolGame::parsePlayerSale(NetworkMessage& msg)
{
uint16_t id = msg.get<uint16_t>();
uint8_t count = msg.getByte();
uint8_t amount = msg.getByte();
uint16_t amount = msg.get<uint16_t>();
bool ignoreEquipped = msg.getByte() != 0;
g_dispatcher.addTask(DISPATCHER_TASK_EXPIRATION, [=, playerID = player->getID()]() {
g_game.playerSellItem(playerID, id, count, amount, ignoreEquipped);
Expand Down Expand Up @@ -2022,7 +2022,6 @@ void ProtocolGame::sendSaleItemList(const std::list<ShopInfo>& shop)

NetworkMessage msg;
msg.addByte(0x7B);
msg.add<uint64_t>(playerBank + playerMoney); // deprecated and ignored by QT client. OTClient still uses it.

std::map<uint16_t, uint32_t> saleMap;

Expand Down Expand Up @@ -2092,7 +2091,7 @@ void ProtocolGame::sendSaleItemList(const std::list<ShopInfo>& shop)
uint8_t i = 0;
for (std::map<uint16_t, uint32_t>::const_iterator it = saleMap.begin(); i < itemsToSend; ++it, ++i) {
msg.addItemId(it->first);
msg.addByte(std::min<uint32_t>(it->second, std::numeric_limits<uint8_t>::max()));
msg.add<uint16_t>(std::min<uint16_t>(it->second, std::numeric_limits<uint16_t>::max()));
}

writeToOutputBuffer(msg);
Expand Down
12 changes: 7 additions & 5 deletions src/tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ MagicEffectNames magicEffectNames = {
{"horestis", CONST_ME_HORESTIS},
{"devovorga", CONST_ME_DEVOVORGA},
{"ferumbras2", CONST_ME_FERUMBRAS_2},
{"foam", CONST_ME_FOAM},
};

ShootTypeNames shootTypeNames = {
Expand Down Expand Up @@ -656,11 +657,12 @@ SkullNames skullNames = {
{"red", SKULL_RED}, {"black", SKULL_BLACK}, {"orange", SKULL_ORANGE},
};

std::vector<uint16_t> depotBoxes = {ITEM_DEPOT_BOX_I, ITEM_DEPOT_BOX_II, ITEM_DEPOT_BOX_III, ITEM_DEPOT_BOX_IV,
ITEM_DEPOT_BOX_V, ITEM_DEPOT_BOX_VI, ITEM_DEPOT_BOX_VII, ITEM_DEPOT_BOX_VIII,
ITEM_DEPOT_BOX_IX, ITEM_DEPOT_BOX_X, ITEM_DEPOT_BOX_XI, ITEM_DEPOT_BOX_XII,
ITEM_DEPOT_BOX_XIII, ITEM_DEPOT_BOX_XIV, ITEM_DEPOT_BOX_XV, ITEM_DEPOT_BOX_XVI,
ITEM_DEPOT_BOX_XVII, ITEM_DEPOT_BOX_XVIII};
std::vector<uint16_t> depotBoxes = {
ITEM_DEPOT_BOX_I, ITEM_DEPOT_BOX_II, ITEM_DEPOT_BOX_III, ITEM_DEPOT_BOX_IV, ITEM_DEPOT_BOX_V,
ITEM_DEPOT_BOX_VI, ITEM_DEPOT_BOX_VII, ITEM_DEPOT_BOX_VIII, ITEM_DEPOT_BOX_IX, ITEM_DEPOT_BOX_X,
ITEM_DEPOT_BOX_XI, ITEM_DEPOT_BOX_XII, ITEM_DEPOT_BOX_XIII, ITEM_DEPOT_BOX_XIV, ITEM_DEPOT_BOX_XV,
ITEM_DEPOT_BOX_XVI, ITEM_DEPOT_BOX_XVII, ITEM_DEPOT_BOX_XVIII, ITEM_DEPOT_BOX_XIX, ITEM_DEPOT_BOX_XX,
};

uint16_t getDepotBoxId(uint16_t index)
{
Expand Down
Loading