Skip to content

Commit

Permalink
Update to game protocol 13.10 (#4591)
Browse files Browse the repository at this point in the history
  • Loading branch information
omarcopires authored Dec 13, 2023
1 parent 70fab9c commit ab1d313
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 30 deletions.
4 changes: 4 additions & 0 deletions data/XML/mounts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,8 @@
<mount id="203" clientid="1578" name="Parade Horse" speed="20" premium="no" />
<mount id="204" clientid="1579" name="Jousting Horse" speed="20" premium="no" />
<mount id="205" clientid="1580" name="Tourney Horse" speed="20" premium="no" />
<mount id="206" clientid="1599" name="Mutated Abomination" speed="20" premium="yes" />
<mount id="207" clientid="1608" name="Tangerine Flecked Koi" speed="20" premium="no" />
<mount id="208" clientid="1609" name="Brass Speckled Koi" speed="20" premium="no" />
<mount id="209" clientid="1610" name="Ink Spotted Koi" speed="20" premium="no" />
</mounts>
4 changes: 4 additions & 0 deletions data/XML/outfits.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
<outfit type="0" looktype="1501" name="Nordic Chieftain" premium="no" unlocked="no" enabled="yes" />
<outfit type="0" looktype="1569" name="Fire-Fighter" premium="yes" unlocked="no" enabled="yes" />
<outfit type="0" looktype="1576" name="Fencer" premium="no" unlocked="no" enabled="yes" />
<outfit type="0" looktype="1582" name="Shadowlotus Disciple" premium="no" unlocked="no" enabled="yes" />
<outfit type="0" looktype="1598" name="Ancient Aucar" premium="yes" unlocked="no" enabled="yes" />

<!-- Male outfits -->
<outfit type="1" looktype="128" name="Citizen" premium="no" unlocked="yes" enabled="yes" />
Expand Down Expand Up @@ -219,4 +221,6 @@
<outfit type="1" looktype="1500" name="Nordic Chieftain" premium="no" unlocked="no" enabled="yes" />
<outfit type="1" looktype="1568" name="Fire-Fighter" premium="yes" unlocked="no" enabled="yes" />
<outfit type="1" looktype="1575" name="Fencer" premium="no" unlocked="no" enabled="yes" />
<outfit type="1" looktype="1581" name="Shadowlotus Disciple" premium="no" unlocked="no" enabled="yes" />
<outfit type="1" looktype="1597" name="Ancient Aucar" premium="yes" unlocked="no" enabled="yes" />
</outfits>
1 change: 1 addition & 0 deletions data/creaturescripts/scripts/login.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function onLogin(player)
-- Update client stats
player:updateClientExpDisplay()
player:sendHotkeyPreset()
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.
5 changes: 5 additions & 0 deletions data/lib/core/achievements.lua
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,11 @@ achievements = {
[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."},

-- 13.10
[510] = {clientId = 542, name = "Mutagenius", grade = 1, points = 2, description = "You accomplished the impossible and created 16 mutagens of corresponding colours."},
[511] = {clientId = 543, name = "Strangest Thing", grade = 1, points = 3, description = "Only its rider can love this abomination of a mount."},
[512] = {clientId = 541, name = "Warrior of the Iks", grade = 1, points = 2, description = "Combining unabating courage in combat and respect for the traditions and culture of the ancient Iks earned you the honours of true Aucar."},
}

ACHIEVEMENT_FIRST = 1
Expand Down
11 changes: 11 additions & 0 deletions data/lib/core/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -726,3 +726,14 @@ function Player.sendHotkeyPreset(self)
msg:sendToPlayer(self)
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())
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
46 changes: 24 additions & 22 deletions src/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1779,14 +1779,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 @@ -3361,7 +3363,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 @@ -3524,8 +3526,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>(static_cast<uint32_t>(player->getHealth()));
msg.add<uint32_t>(static_cast<uint32_t>(player->getMaxHealth()));

msg.add<uint32_t>(player->hasFlag(PlayerFlag_HasInfiniteCapacity) ? 1000000 : player->getFreeCapacity());
msg.add<uint64_t>(player->getExperience());
Expand All @@ -3538,8 +3540,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>(static_cast<uint32_t>(player->getMana()));
msg.add<uint32_t>(static_cast<uint32_t>(player->getMaxMana()));

msg.addByte(player->getSoul());
msg.add<uint16_t>(player->getStaminaMinutes());
Expand All @@ -3555,11 +3557,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 @@ -3583,21 +3585,21 @@ 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); // element magic level
// structure:
// u8 client element id
// u16 bonus element ml

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();
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

0 comments on commit ab1d313

Please sign in to comment.