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

feat: features OTCR natively in canary #3061

Draft
wants to merge 44 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4c54d85
1/6 feature: Creature : AttachedEffect, Shader
kokekanon Nov 4, 2024
745b7b8
2/7 feature: Map Shader
kokekanon Nov 4, 2024
ee26730
3/7 feature: TypingIcon
kokekanon Nov 5, 2024
23e166a
review: mehah
kokekanon Nov 5, 2024
eae4112
4/7 feature: Item Shader
kokekanon Nov 5, 2024
74ea55f
5/7 send disableFeature / enableFeature
kokekanon Nov 5, 2024
b09547e
review: dudantas
kokekanon Nov 5, 2024
9484492
fix sonarcloud bot
kokekanon Nov 5, 2024
f490ce4
fix sonarcloud bot 2
kokekanon Nov 5, 2024
1437b7e
fix: wrong review
dudantas Nov 5, 2024
67777a9
Code format - (Clang-format)
github-actions[bot] Nov 5, 2024
6766389
fix: itemShader old protocol otcr
kokekanon Nov 5, 2024
7c45b97
clean variable
kokekanon Nov 6, 2024
bd1854c
fix return get shader
kokekanon Nov 6, 2024
0ff915e
missing content player:getAttachedEffects
kokekanon Nov 6, 2024
f538950
simple test Talkations. delete when finished
kokekanon Nov 6, 2024
0217e80
Lua code format - (Stylua)
github-actions[bot] Nov 6, 2024
4b5fbad
Merge remote-tracking branch 'upstream/main' into kokekanon/all-featu…
kokekanon Nov 6, 2024
9fe26c5
format
kokekanon Nov 6, 2024
7956f08
Merge remote-tracking branch 'upstream/main' into kokekanon/all-featu…
kokekanon Nov 6, 2024
8d6961d
improve: variable name
kokekanon Nov 6, 2024
558b212
Merge branch 'kokekanon/all-feature-redemption' of https://github.com…
kokekanon Nov 6, 2024
3744f16
game_outfit functional version, not cleaned or optimized
kokekanon Nov 6, 2024
789354a
this requires review canary team .no break v8 and cipsoft
kokekanon Nov 7, 2024
6a23e40
Lua code format - (Stylua)
github-actions[bot] Nov 7, 2024
36da43e
fix: review sonarcloud ?
kokekanon Nov 7, 2024
8e939e5
Code format - (Clang-format)
github-actions[bot] Nov 7, 2024
c551152
Merge remote-tracking branch 'upstream/main' into kokekanon/all-featu…
kokekanon Nov 7, 2024
5b5dc84
Merge branch 'kokekanon/all-feature-redemption' of https://github.com…
kokekanon Nov 7, 2024
9e763f7
simple test
kokekanon Nov 7, 2024
300f92c
Lua code format - (Stylua)
github-actions[bot] Nov 7, 2024
3bb868b
Merge remote-tracking branch 'upstream/main' into kokekanon/all-featu…
kokekanon Nov 8, 2024
ef754d0
Merge branch 'kokekanon/all-feature-redemption' of https://github.com…
kokekanon Nov 8, 2024
6b27bb9
Merge remote-tracking branch 'upstream/main' into kokekanon/all-featu…
kokekanon Nov 10, 2024
6097de3
Merge remote-tracking branch 'upstream/main' into kokekanon/all-featu…
kokekanon Nov 10, 2024
ec0bd43
murge
kokekanon Nov 10, 2024
e30fd35
fix: compilation windows
kokekanon Nov 10, 2024
29919ed
Code format - (Clang-format)
github-actions[bot] Nov 10, 2024
6ed239c
Merge remote-tracking branch 'upstream/main' into kokekanon/all-featu…
kokekanon Nov 13, 2024
2c46d0a
Merge remote-tracking branch 'upstream/main' into kokekanon/all-featu…
kokekanon Nov 16, 2024
687d0b2
Merge remote-tracking branch 'upstream/main' into kokekanon/all-featu…
kokekanon Nov 18, 2024
dce1886
Merge remote-tracking branch 'upstream/main' into kokekanon/all-featu…
kokekanon Nov 25, 2024
f44bf10
Merge remote-tracking branch 'upstream/main' into kokekanon/all-featu…
kokekanon Nov 29, 2024
8350458
Merge remote-tracking branch 'upstream/main' into kokekanon/all-featu…
kokekanon Dec 12, 2024
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
6 changes: 6 additions & 0 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9613,6 +9613,12 @@ void Player::sendMapShader(const std::string &shaderName) const {
}
}

void Player::sendPlayerTyping(const std::shared_ptr<Creature> &creature, uint8_t typing) const {
if (client) {
kokekanon marked this conversation as resolved.
Show resolved Hide resolved
client->sendPlayerTyping(creature, typing);
}
}

void Player::sendSingleSoundEffect(const Position &pos, SoundEffect_t id, SourceEffect_t source) const {
if (client) {
client->sendSingleSoundEffect(pos, id, source);
Expand Down
1 change: 1 addition & 0 deletions src/creatures/players/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,7 @@ class Player final : public Creature, public Cylinder, public Bankable {
void setMapShader(const std::string &shaderName) {
this->mapShader = shaderName;
}
void sendPlayerTyping(const std::shared_ptr<Creature> &creature, uint8_t typing) const;

private:
friend class PlayerLock;
Expand Down
22 changes: 19 additions & 3 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10857,7 +10857,7 @@ void Game::sendAttachedEffect(const std::shared_ptr<Creature> &creature, uint16_
auto spectators = Spectators().find<Creature>(creature->getPosition(), true);
kokekanon marked this conversation as resolved.
Show resolved Hide resolved
for (const auto &spectator : spectators) {
auto player = spectator->getPlayer();
kokekanon marked this conversation as resolved.
Show resolved Hide resolved
if (player) { // Solo procede si player no es nullptr
if (player) {
player->sendAttachedEffect(creature, effectId);
}
}
Expand All @@ -10866,7 +10866,7 @@ void Game::sendDetachEffect(const std::shared_ptr<Creature> &creature, uint16_t
auto spectators = Spectators().find<Creature>(creature->getPosition(), true);
kokekanon marked this conversation as resolved.
Show resolved Hide resolved
for (const auto &spectator : spectators) {
auto player = spectator->getPlayer();
kokekanon marked this conversation as resolved.
Show resolved Hide resolved
if (player) { // Solo procede si player no es nullptr
if (player) {
player->sendDetachEffect(creature, effectId);
}
}
Expand All @@ -10875,8 +10875,24 @@ void Game::updateCreatureShader(const std::shared_ptr<Creature> &creature) {
auto spectators = Spectators().find<Creature>(creature->getPosition(), true);
kokekanon marked this conversation as resolved.
Show resolved Hide resolved
for (const auto &spectator : spectators) {
auto player = spectator->getPlayer();
kokekanon marked this conversation as resolved.
Show resolved Hide resolved
if (player) { // Solo procede si player no es nullptr
if (player) {
player->sendShader(creature, creature->getShader());
}
}
}

void Game::playerSetTyping(uint32_t playerId, uint8_t typing) {
const auto &player = getPlayerByID(playerId);
if (!player) {
return;
}
auto spectators = Spectators().find<Creature>(player->getPosition(), true);
auto playersSpectators = spectators.filter<Player>();
for (const auto &spectator : spectators) {
kokekanon marked this conversation as resolved.
Show resolved Hide resolved
if (const auto &tmpPlayer = spectator->getPlayer()) {
tmpPlayer->sendPlayerTyping(player, typing);
}
}
}


2 changes: 2 additions & 0 deletions src/game/game.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,8 @@ class Game {
void sendAttachedEffect(const std::shared_ptr<Creature> &creature, uint16_t effectId);
void sendDetachEffect(const std::shared_ptr<Creature> &creature, uint16_t effectId);
void updateCreatureShader(const std::shared_ptr<Creature> &creature);
void playerSetTyping(uint32_t playerId, uint8_t typing);


private:
std::map<uint16_t, Achievement> m_achievements;
Expand Down
19 changes: 19 additions & 0 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,9 @@ void ProtocolGame::parsePacketFromDispatcher(NetworkMessage &msg, uint8_t recvby
case 0x32:
parseExtendedOpcode(msg);
break; // otclient extended opcode
case 0x38:
parsePlayerTyping(msg); // player are typing or not
break;
case 0x60:
parseInventoryImbuements(msg);
break;
Expand Down Expand Up @@ -2512,6 +2515,11 @@ void ProtocolGame::parseCyclopediaMonsterTracker(NetworkMessage &msg) {
}
}

void ProtocolGame::parsePlayerTyping(NetworkMessage &msg) {
uint8_t typing = msg.getByte();
g_dispatcher().addEvent([self = getThis(), playerID = player->getID(), typing] { g_game().playerSetTyping(playerID, typing); }, __FUNCTION__);
}

void ProtocolGame::sendTeamFinderList() {
if (!player || oldProtocol) {
return;
Expand Down Expand Up @@ -9319,3 +9327,14 @@ void ProtocolGame::sendMapShader(const std::string &shaderName) {
msg.addString(shaderName);
writeToOutputBuffer(msg);
}

void ProtocolGame::sendPlayerTyping(const std::shared_ptr<Creature> &creature, uint8_t typing) {
if (!isOTC || player->getOperatingSystem() >= CLIENTOS_OTCLIENTV8_LINUX) {
return;
}
NetworkMessage msg;
msg.addByte(0x38);
msg.add<uint32_t>(creature->getID());
msg.addByte(typing);
writeToOutputBuffer(msg);
}
11 changes: 7 additions & 4 deletions src/server/network/protocol/protocolgame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,13 @@ class ProtocolGame final : public Protocol {

// OTCv8
void sendFeatures();
// OTCR
void sendAttachedEffect(const std::shared_ptr<Creature> &creature, uint16_t effectId);
void sendDetachEffect(const std::shared_ptr<Creature> &creature, uint16_t effectId);
void sendShader(const std::shared_ptr<Creature> &creature, const std::string &shaderName);
void sendMapShader(const std::string &shaderName);
void sendPlayerTyping(const std::shared_ptr<Creature> &creature, uint8_t typing);
void parsePlayerTyping(NetworkMessage &msg);

void parseInventoryImbuements(NetworkMessage &msg);
void sendInventoryImbuements(const std::map<Slots_t, std::shared_ptr<Item>> &items);
Expand Down Expand Up @@ -542,10 +549,6 @@ class ProtocolGame final : public Protocol {
void sendHotkeyPreset();
void sendTakeScreenshot(Screenshot_t screenshotType);
void sendDisableLoginMusic();
void sendAttachedEffect(const std::shared_ptr<Creature> &creature, uint16_t effectId);
void sendDetachEffect(const std::shared_ptr<Creature> &creature, uint16_t effectId);
void sendShader(const std::shared_ptr<Creature> &creature, const std::string &shaderName);
void sendMapShader( const std::string &shaderName);

uint8_t m_playerDeathTime = 0;

Expand Down
Loading