-
-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Protocol Bytes] - Support to client 12.85.11525 (#167)
Added the bytes for the item classification upgrade (item tier)
- Loading branch information
1 parent
a1997c8
commit e9c85a5
Showing
28 changed files
with
20,552 additions
and
17,946 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
local itemTierClassifications = { | ||
-- Upgrade classification 1 | ||
[1] = { | ||
-- Update tier 0 | ||
[0] = {price = 25000} | ||
}, | ||
-- Upgrade classification 2 | ||
[2] = { | ||
-- Update tier 0 | ||
[0] = {price = 750000}, | ||
-- Update tier 1 | ||
[1] = {price = 5000000} | ||
}, | ||
-- Upgrade classification 3 | ||
[3] = { | ||
[0] = {price = 4000000}, | ||
[1] = {price = 10000000}, | ||
[2] = {price = 20000000} | ||
}, | ||
-- Upgrade classification 4 | ||
[4] = { | ||
[0] = {price = 8000000}, | ||
[1] = {price = 20000000}, | ||
[2] = {price = 40000000}, | ||
[3] = {price = 65000000}, | ||
[4] = {price = 100000000}, | ||
[5] = {price = 250000000}, | ||
[6] = {price = 750000000}, | ||
[7] = {price = 2500000000}, | ||
[8] = {price = 8000000000}, | ||
[9] = {price = 15000000000} | ||
} | ||
} | ||
|
||
for classificationId, classificationTable in ipairs(itemTierClassifications) do | ||
local itemClassification = Game.createItemClassification(classificationId) | ||
local classification = {} | ||
|
||
-- Registers table for register_item_tier.lua interface | ||
classification.Upgrades = {} | ||
for tierId, tierTable in ipairs(classificationTable) do | ||
if tierId then | ||
classification.Upgrades.TierId = tierId | ||
end | ||
if tierTable.price then | ||
classification.Upgrades.Price = tierTable.price | ||
end | ||
end | ||
-- Create item classification and register classification table | ||
itemClassification:register(classification) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
registerItemClassification = {} | ||
setmetatable(registerItemClassification, | ||
{ | ||
__call = | ||
function(self, itemClass, mask) | ||
for _,parse in pairs(self) do | ||
parse(itemClass, mask) | ||
end | ||
end | ||
}) | ||
|
||
ItemClassification.register = function(self, mask) | ||
return registerItemClassification(self, mask) | ||
end | ||
|
||
registerItemClassification.Upgrades = function(itemClassification, mask) | ||
if mask.Upgrades then | ||
for _, value in ipairs(mask.Upgrades) do | ||
if value.TierId and value.Price then | ||
itemClassification:addTier(value.TierId, value.Price) | ||
else | ||
Spdlog.warn("[registerItemClassification.Upgrades] - Item classification failed on adquire TierID or Price attribute.") | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Canary - A free and open-source MMORPG server emulator | ||
* Copyright (C) 2021 OpenTibiaBR <opentibiabr@outlook.com> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
#ifndef SRC_ITEMS_ITEMS_CLASSIFICATION_HPP_ | ||
#define SRC_ITEMS_ITEMS_CLASSIFICATION_HPP_ | ||
|
||
// Classification class for forging system and market. | ||
class ItemClassification | ||
{ | ||
public: | ||
ItemClassification() = default; | ||
explicit ItemClassification(uint8_t id) : | ||
id(id) {} | ||
virtual ~ItemClassification() = default; | ||
|
||
void addTier(uint8_t id, uint64_t price) | ||
{ | ||
for (std::pair<uint8_t, uint64_t> tier : tiers) { | ||
if (tier.first == id) { | ||
tier.second = price; | ||
return; | ||
} | ||
} | ||
|
||
tiers.push_back(std::pair<uint8_t, uint64_t>({ id, price })); | ||
} | ||
|
||
uint8_t id; | ||
std::vector<std::pair<uint8_t, uint64_t>> tiers; | ||
}; | ||
|
||
#endif // SRC_ITEMS_ITEMS_CLASSIFICATION_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.