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 13.10 #4591

Merged
merged 7 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion data/creaturescripts/scripts/login.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ function onLogin(player)
player:setVocation(vocation:getDemotion())
end

-- Update client exp display
-- Update client stats
player:updateClientExpDisplay()
player:disableLoginMusic()

-- achievements points for highscores
if not player:getStorageValue(PlayerStorageKeys.achievementsTotal) then
Expand Down
Binary file modified data/items/items.otb
Binary file not shown.
11 changes: 11 additions & 0 deletions data/lib/core/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -718,3 +718,14 @@ function Player.sendWorldTime(self, time)
msg:delete()
return true
end

function Player.disableLoginMusic(self)
local msg = NetworkMessage()
msg:addByte(0x85)
msg:addByte(0x01)
msg:addByte(0x00)
msg:addByte(0x00)
msg:sendToPlayer(self)
msg:delete()
return true
end
1 change: 1 addition & 0 deletions data/scripts/network/bestiary_info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function handler.onReceive(player, msg)
response:addU32(monsterType:getExperience())
response:addU16(monsterType:getBaseSpeed())
response:addU16(monsterType:getArmor())
response:addDouble(0) -- damage mitigation
end

if progress > 2 then
Expand Down
10 changes: 6 additions & 4 deletions data/scripts/network/cyclopedia_character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ local function sendCombatStats(self, msg)
msg:addU16(self:getTotalArmor())
msg:addU16(self:getTotalDefense())

msg:addDouble(0) -- damage mitigation (in %)

-- element resistances count
msg:addByte(0)
-- structure:
Expand Down Expand Up @@ -98,10 +100,10 @@ local function sendGeneralStats(self, msg)
msg:addU16(0) -- exp boost remaining time
msg:addByte(0) -- enable exp boost store button

msg:addU16(self:getHealth())
msg:addU16(self:getMaxHealth())
msg:addU16(self:getMana())
msg:addU16(self:getMaxMana())
msg:addU32(self:getHealth())
msg:addU32(self:getMaxHealth())
msg:addU32(self:getMana())
msg:addU32(self:getMaxMana())
EPuncker marked this conversation as resolved.
Show resolved Hide resolved
msg:addByte(self:getSoul())
msg:addU16(self:getStamina())

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 = 1290;
static constexpr auto CLIENT_VERSION_MAX = 1291;
static constexpr auto CLIENT_VERSION_STR = "12.90";
static constexpr auto CLIENT_VERSION_MIN = 1310;
static constexpr auto CLIENT_VERSION_MAX = 1311;
static constexpr auto CLIENT_VERSION_STR = "13.10";

static constexpr auto AUTHENTICATOR_DIGITS = 6U;
static constexpr auto AUTHENTICATOR_PERIOD = 30U;
Expand Down
3 changes: 2 additions & 1 deletion src/itemloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ enum clientVersion_t
CLIENT_VERSION_1286 = 62,
CLIENT_VERSION_1287 = 63,
CLIENT_VERSION_1290 = 64,
CLIENT_VERSION_1310 = 65,

CLIENT_VERSION_LAST = CLIENT_VERSION_1290
CLIENT_VERSION_LAST = CLIENT_VERSION_1310
};

enum rootattrib_
Expand Down
43 changes: 21 additions & 22 deletions src/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1789,14 +1789,16 @@ void ProtocolGame::sendBasicData()
msg.addByte(0);
msg.add<uint32_t>(0);
}

msg.addByte(player->getVocation()->getClientId());
msg.addByte(0x00); // is prey system enabled (bool)

// unlock spells on action bar
msg.add<uint16_t>(0xFF);
for (uint8_t spellId = 0x00; spellId < 0xFF; spellId++) {
msg.addByte(spellId);
msg.add<uint16_t>(spellId);
}

msg.addByte(player->getVocation()->getMagicShield()); // is magic shield active (bool)
writeToOutputBuffer(msg);
}
Expand Down Expand Up @@ -3371,7 +3373,7 @@ void ProtocolGame::sendSpellCooldown(uint8_t spellId, uint32_t time)
{
NetworkMessage msg;
msg.addByte(0xA4);
msg.addByte(spellId);
msg.add<uint16_t>(static_cast<uint16_t>(spellId));
msg.add<uint32_t>(time);
writeToOutputBuffer(msg);
}
Expand Down Expand Up @@ -3534,8 +3536,8 @@ void ProtocolGame::AddPlayerStats(NetworkMessage& msg)
{
msg.addByte(0xA0);

msg.add<uint16_t>(std::min<int32_t>(player->getHealth(), std::numeric_limits<uint16_t>::max()));
msg.add<uint16_t>(std::min<int32_t>(player->getMaxHealth(), std::numeric_limits<uint16_t>::max()));
msg.add<uint32_t>(std::min<int32_t>(player->getHealth(), std::numeric_limits<int32_t>::max()));
msg.add<uint32_t>(std::min<int32_t>(player->getMaxHealth(), std::numeric_limits<int32_t>::max()));
omarcopires marked this conversation as resolved.
Show resolved Hide resolved

msg.add<uint32_t>(player->hasFlag(PlayerFlag_HasInfiniteCapacity) ? 1000000 : player->getFreeCapacity());
msg.add<uint64_t>(player->getExperience());
Expand All @@ -3548,8 +3550,8 @@ void ProtocolGame::AddPlayerStats(NetworkMessage& msg)
msg.add<uint16_t>(0); // store exp bonus
msg.add<uint16_t>(player->getClientStaminaBonusDisplay());

msg.add<uint16_t>(std::min<int32_t>(player->getMana(), std::numeric_limits<uint16_t>::max()));
msg.add<uint16_t>(std::min<int32_t>(player->getMaxMana(), std::numeric_limits<uint16_t>::max()));
msg.add<uint32_t>(std::min<int32_t>(player->getMana(), std::numeric_limits<int32_t>::max()));
msg.add<uint32_t>(std::min<int32_t>(player->getMaxMana(), std::numeric_limits<int32_t>::max()));
omarcopires marked this conversation as resolved.
Show resolved Hide resolved

msg.addByte(player->getSoul());
msg.add<uint16_t>(player->getStaminaMinutes());
Expand All @@ -3565,11 +3567,11 @@ void ProtocolGame::AddPlayerStats(NetworkMessage& msg)

if (ConditionManaShield* conditionManaShield =
dynamic_cast<ConditionManaShield*>(player->getCondition(CONDITION_MANASHIELD_BREAKABLE))) {
msg.add<uint16_t>(conditionManaShield->getManaShield()); // remaining mana shield
msg.add<uint16_t>(conditionManaShield->getMaxManaShield()); // total mana shield
msg.add<uint32_t>(conditionManaShield->getManaShield());
msg.add<uint32_t>(conditionManaShield->getMaxManaShield());
} else {
msg.add<uint16_t>(0); // remaining mana shield
msg.add<uint16_t>(0); // total mana shield
msg.add<uint32_t>(0); // remaining mana shield
msg.add<uint32_t>(0); // total mana shield
}
}

Expand All @@ -3593,21 +3595,18 @@ void ProtocolGame::AddPlayerSkills(NetworkMessage& msg)
msg.add<uint16_t>(0); // base special skill
}

// fatal, dodge, momentum
msg.add<uint16_t>(0);
msg.add<uint16_t>(0);

msg.add<uint16_t>(0);
msg.add<uint16_t>(0);
msg.addByte(0); // mitigation(?)
omarcopires marked this conversation as resolved.
Show resolved Hide resolved

msg.add<uint16_t>(0);
msg.add<uint16_t>(0);
// fatal, dodge, momentum
for (int i = 0; i < 3; ++i) {
msg.add<uint16_t>(0);
msg.add<uint16_t>(0);
}

// to do: bonus cap
msg.add<uint32_t>(player->hasFlag(PlayerFlag_HasInfiniteCapacity) ? 1000000
: player->getCapacity()); // base + bonus capacity
msg.add<uint32_t>(player->hasFlag(PlayerFlag_HasInfiniteCapacity) ? 1000000
: player->getCapacity()); // base capacity
uint32_t capacityValue = player->hasFlag(PlayerFlag_HasInfiniteCapacity) ? 1000000 : player->getCapacity();
EPuncker marked this conversation as resolved.
Show resolved Hide resolved
msg.add<uint32_t>(capacityValue); // base + bonus capacity
msg.add<uint32_t>(capacityValue); // base capacity
}

void ProtocolGame::AddOutfit(NetworkMessage& msg, const Outfit_t& outfit)
Expand Down
Loading