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

[Feature] Mechanics from12.72 #143

Closed
wants to merge 37 commits into from
Closed

[Feature] Mechanics from12.72 #143

wants to merge 37 commits into from

Conversation

dudantas
Copy link
Contributor

@dudantas dudantas commented Oct 17, 2021

Description

Client support 12.72
Thanks to Rick (FakeShinoda) and Marcos for help with bytes

image

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Co-Authored-By: Rick <23365432+fakeshinoda@users.noreply.github.com>
Co-Authored-By: Marcos <66353315+marcosvf132@users.noreply.github.com>
dudantas and others added 2 commits October 17, 2021 16:26
Co-Authored-By: Rick <23365432+fakeshinoda@users.noreply.github.com>
Co-Authored-By: Rick <23365432+fakeshinoda@users.noreply.github.com>
@majestyotbr majestyotbr changed the title Add support for 12.72 tibia protocol Add support for protocol 12.72 Oct 17, 2021
dudantas and others added 3 commits October 18, 2021 11:53
Co-Authored-By: Marcos <66353315+marcosvf132@users.noreply.github.com>
@dudantas dudantas marked this pull request as draft October 23, 2021 01:01
@@ -5772,6 +5826,27 @@ bool Game::combatChangeHealth(Creature* attacker, Creature* target, CombatDamage
damage.primary.value = std::abs(damage.primary.value);
damage.secondary.value = std::abs(damage.secondary.value);

bool perfectShot = false;
if (attackerPlayer && damage.extension == false && damage.origin == ORIGIN_RANGED && target == attackerPlayer->getAttackedCreature()) {
const Position& targetPos = target->getPosition();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cppcheck] reported by reviewdog 🐶
Local variable 'targetPos' shadows outer variable

int16_t value = pugi::cast<int16_t>(valueAttribute.value());
Abilities & abilities = itemType.getAbilities();
for (auto & i: abilities.absorbPercent) {
i += value;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cppcheck] reported by reviewdog 🐶
Consider using std::transform algorithm instead of a raw loop.

} else if (stringValue == "reflectpercentall") {
int16_t value = pugi::cast<int16_t>(valueAttribute.value());
for (auto& i : abilities.reflectPercent) {
i += value;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cppcheck] reported by reviewdog 🐶
Consider using std::transform algorithm instead of a raw loop.

itemid = 35524,
type = "equip",
slot = "right-hand",
level = 150,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[luacheck] reported by reviewdog 🐶
line contains trailing whitespace

itemid = 35524,
type = "equip",
slot = "right-hand",
level = 150,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[luacheck] reported by reviewdog 🐶
line contains trailing whitespace

@@ -64,6 +64,24 @@ enum CreatureIcon_t {
CREATUREICON_HIGHERRECEIVEDDAMAGE = 1,
CREATUREICON_LOWERDEALTDAMAGE = 2,
CREATUREICON_TURNEDMELEE = 3,
CREATUREICON_GREENBALL = 4,
Copy link
Contributor

@Zbizu Zbizu Oct 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are 2 sets of these icons

First set is monster icons (1-3). It supports numbers but they're optional. These icons are displayed only for monsters (other creatures don't show them).
The other set is icons for all creatures (1-21). Numbers are always displayed here.

Second byte of the packet determines which set you're sending.
I've documented the packet structure in a gist.
See https://gist.github.com/Zbizu/476f86b647eb907495deacdfa8594906 for details.

Both groups have to be sent in same packet btw to avoid resetting them. Monsters can have 24 of these icons in total (3 monster, 21 creature), other creatures 21.

@dmarszk
Copy link

dmarszk commented Nov 3, 2021

Missing clientVersion update in config.lua.dist. Is this intended?

@dudantas
Copy link
Contributor Author

dudantas commented Nov 3, 2021

Missing clientVersion update in config.lua.dist. Is this intended?

Well remembered, thank you, I will change.

@Zbizu
Copy link
Contributor

Zbizu commented Nov 27, 2021

What does that dot do?

end
end,
[36725] = function(p)
p:setStamina(p:getStamina() + 60)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[luacheck] reported by reviewdog 🐶
line contains trailing whitespace

table.insert(potionConditions[id], condition)
end
end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[luacheck] reported by reviewdog 🐶
line contains only whitespace

end
end


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[luacheck] reported by reviewdog 🐶
line contains only whitespace

end



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[luacheck] reported by reviewdog 🐶
line contains only whitespace

player:getPosition():sendMagicEffect(CONST_ME_POFF)
return true
end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[luacheck] reported by reviewdog 🐶
line contains only whitespace

player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
player:setStorageValue(itemID, os.time() + 24 * 60 * 60)
item:remove(1)
local potionConditions = potionConditions[itemID]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[luacheck] reported by reviewdog 🐶
shadowing upvalue 'potionConditions' on line 22

continue;
}

const ItemType& it = Item::items[item->getID()];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[cppcheck] reported by reviewdog 🐶
Local variable 'it' shadows outer variable

src/server/network/protocol/protocolgame.cpp Show resolved Hide resolved
src/server/network/protocol/protocolgame.cpp Show resolved Hide resolved
src/server/network/protocol/protocolgame.cpp Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Dec 7, 2021

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 179 Code Smells

0.0% 0.0% Coverage
14.9% 14.9% Duplication

@dudantas
Copy link
Contributor Author

dudantas commented Dec 8, 2021

12.72 is now here: #170
@hyresu will open a new pull with the mechanics, so the protocol will be separated from the mechanics.

@dudantas dudantas closed this Dec 8, 2021
@dudantas dudantas deleted the protocol-12.72 branch December 8, 2021 19:31
@beats-dh beats-dh restored the protocol-12.72 branch July 2, 2022 02:31
@dudantas dudantas changed the title Add support for protocol 12.72 [Feature] Mechanics from12.72 Sep 22, 2022
@dudantas dudantas deleted the protocol-12.72 branch September 22, 2022 16:38
@dudantas dudantas restored the protocol-12.72 branch September 22, 2022 16:39
@dudantas dudantas deleted the protocol-12.72 branch September 22, 2022 16:40
@opentibiabr opentibiabr deleted a comment from Zbizu May 27, 2023
@opentibiabr opentibiabr deleted a comment from Zbizu May 27, 2023
@opentibiabr opentibiabr deleted a comment from Zbizu May 27, 2023
@dudantas dudantas restored the protocol-12.72 branch May 27, 2023 18:28
luan pushed a commit that referenced this pull request Jul 11, 2023
ItemParse has been refactored and decoupled in a own file to allow for better organization and avoid breakage in the compilation
Fixed some bugs, such as fields in items.xml
This commit is necessary for the pull request (12.72 protocol) to work correctly: #143

Co-authored-by @dudantas <eduardo.dantas@hotmail.com.br>
@dudantas dudantas deleted the protocol-12.72 branch August 26, 2023 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants