diff --git a/data-otservbr-global/npc/obi.lua b/data-otservbr-global/npc/obi.lua index d63995619da..8694accfa0c 100644 --- a/data-otservbr-global/npc/obi.lua +++ b/data-otservbr-global/npc/obi.lua @@ -141,7 +141,7 @@ npcConfig.shop = { { itemName = "hatchet", clientId = 3276, sell = 25 }, { itemName = "katana", clientId = 3300, sell = 35 }, { itemName = "mace", clientId = 3286, sell = 30 }, - { itemName = "machete", clientId = 3308, sell = 30 }, + { itemName = "machete", clientId = 3308, sell = 6 }, { itemName = "rapier", clientId = 3272, buy = 15, sell = 5 }, { itemName = "sabre", clientId = 3273, buy = 25, sell = 12 }, { itemName = "scythe", clientId = 3453, buy = 12, sell = 3 }, diff --git a/data-otservbr-global/npc/ramina.lua b/data-otservbr-global/npc/ramina.lua index b115ca4b6f9..78972d2a78f 100644 --- a/data-otservbr-global/npc/ramina.lua +++ b/data-otservbr-global/npc/ramina.lua @@ -65,7 +65,7 @@ npcConfig.shop = { { itemName = "orange", clientId = 3586, buy = 12 }, { itemName = "peas", clientId = 11683, buy = 5 }, { itemName = "vial of fruit juice", clientId = 2874, buy = 10, count = 14 }, - { itemName = "vial of water", clientId = 2874, buy = 2, count = 1 }, + { itemName = "vial of water", clientId = 2874, buy = 6, count = 1 }, } -- On buy npc shop message npcType.onBuyItem = function(npc, player, itemId, subType, amount, ignore, inBackpacks, totalCost) diff --git a/data-otservbr-global/npc/sessek.lua b/data-otservbr-global/npc/sessek.lua index ee7f56a2536..8a8d24ca532 100644 --- a/data-otservbr-global/npc/sessek.lua +++ b/data-otservbr-global/npc/sessek.lua @@ -55,11 +55,11 @@ npcConfig.shop = { { itemName = "peas", clientId = 11683, buy = 3 }, { itemName = "pineapple", clientId = 11459, buy = 14 }, { itemName = "roll", clientId = 3601, buy = 2 }, - { itemName = "vial of coconut milk", clientId = 2874, buy = 2, count = 15 }, + { itemName = "vial of coconut milk", clientId = 2874, buy = 6, count = 15 }, { itemName = "vial of fruit juice", clientId = 2874, buy = 6, count = 14 }, - { itemName = "vial of tea", clientId = 2874, buy = 3, count = 17 }, - { itemName = "vial of water", clientId = 2874, buy = 2, count = 1 }, - { itemName = "vial of wine", clientId = 2874, buy = 3, count = 2 }, + { itemName = "vial of tea", clientId = 2874, buy = 6, count = 17 }, + { itemName = "vial of water", clientId = 2874, buy = 6, count = 1 }, + { itemName = "vial of wine", clientId = 2874, buy = 6, count = 2 }, } -- On buy npc shop message npcType.onBuyItem = function(npc, player, itemId, subType, amount, ignore, inBackpacks, totalCost) diff --git a/src/creatures/players/wheel/player_wheel.cpp b/src/creatures/players/wheel/player_wheel.cpp index 4c7a3dc52e0..2a3e1366430 100644 --- a/src/creatures/players/wheel/player_wheel.cpp +++ b/src/creatures/players/wheel/player_wheel.cpp @@ -1031,7 +1031,7 @@ void PlayerWheel::sendOpenWheelWindow(NetworkMessage &msg, uint32_t ownerId) con // TODO: read items from inventory auto voc = m_player.getVocation(); m_player.client->sendResourceBalance(RESOURCE_BANK, m_player.getBankBalance()); - m_player.client->sendResourceBalance(RESOURCE_INVENTORY, m_player.getMoney()); + m_player.client->sendResourceBalance(RESOURCE_INVENTORY_MONEY, m_player.getMoney()); m_player.client->sendResourceBalance(RESOURCE_LESSER_GEMS, m_player.getItemTypeCount(voc->getWheelGemId(WheelGemQuality_t::Lesser))); m_player.client->sendResourceBalance(RESOURCE_REGULAR_GEMS, m_player.getItemTypeCount(voc->getWheelGemId(WheelGemQuality_t::Regular))); m_player.client->sendResourceBalance(RESOURCE_GREATER_GEMS, m_player.getItemTypeCount(voc->getWheelGemId(WheelGemQuality_t::Greater))); diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index cf274ce58a9..c67cee710a8 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -4804,7 +4804,7 @@ void ProtocolGame::sendGameNews() { void ProtocolGame::sendResourcesBalance(uint64_t money /*= 0*/, uint64_t bank /*= 0*/, uint64_t preyCards /*= 0*/, uint64_t taskHunting /*= 0*/, uint64_t forgeDust /*= 0*/, uint64_t forgeSliver /*= 0*/, uint64_t forgeCores /*= 0*/) { sendResourceBalance(RESOURCE_BANK, bank); - sendResourceBalance(RESOURCE_INVENTORY, money); + sendResourceBalance(RESOURCE_INVENTORY_MONEY, money); sendResourceBalance(RESOURCE_PREY_CARDS, preyCards); sendResourceBalance(RESOURCE_TASK_HUNTING, taskHunting); sendResourceBalance(RESOURCE_FORGE_DUST, forgeDust); @@ -4825,40 +4825,35 @@ void ProtocolGame::sendResourceBalance(Resource_t resourceType, uint64_t value) } void ProtocolGame::sendSaleItemList(const std::vector &shopVector, const std::map &inventoryMap) { - // Since we already have full inventory map we shouldn't call getMoney here - it is simply wasting cpu power - uint64_t playerMoney = 0; - auto it = inventoryMap.find(ITEM_CRYSTAL_COIN); - if (it != inventoryMap.end()) { - playerMoney += static_cast(it->second) * 10000; - } - it = inventoryMap.find(ITEM_PLATINUM_COIN); - if (it != inventoryMap.end()) { - playerMoney += static_cast(it->second) * 100; - } - it = inventoryMap.find(ITEM_GOLD_COIN); - if (it != inventoryMap.end()) { - playerMoney += static_cast(it->second); - } + sendResourceBalance(RESOURCE_BANK, player->getBankBalance()); - NetworkMessage msg; - msg.addByte(0xEE); - msg.addByte(0x00); - msg.add(player->getBankBalance()); uint16_t currency = player->getShopOwner() ? player->getShopOwner()->getCurrency() : static_cast(ITEM_GOLD_COIN); - msg.addByte(0xEE); if (currency == ITEM_GOLD_COIN) { - msg.addByte(0x01); - msg.add(playerMoney); + // Since we already have full inventory map we shouldn't call getMoney here - it is simply wasting cpu power + uint64_t playerMoney = 0; + auto it = inventoryMap.find(ITEM_CRYSTAL_COIN); + if (it != inventoryMap.end()) { + playerMoney += static_cast(it->second) * 10000; + } + it = inventoryMap.find(ITEM_PLATINUM_COIN); + if (it != inventoryMap.end()) { + playerMoney += static_cast(it->second) * 100; + } + it = inventoryMap.find(ITEM_GOLD_COIN); + if (it != inventoryMap.end()) { + playerMoney += static_cast(it->second); + } + sendResourceBalance(RESOURCE_INVENTORY_MONEY, playerMoney); } else { - msg.addByte(oldProtocol ? 0x01 : 0x02); - uint64_t newCurrency = 0; + uint64_t customCurrencyValue = 0; auto search = inventoryMap.find(currency); if (search != inventoryMap.end()) { - newCurrency += static_cast(search->second); + customCurrencyValue += static_cast(search->second); } - msg.add(newCurrency); + sendResourceBalance(oldProtocol ? RESOURCE_INVENTORY_MONEY : RESOURCE_INVENTORY_CURRENCY_CUSTOM, customCurrencyValue); } + NetworkMessage msg; msg.addByte(0x7B); if (oldProtocol) { @@ -4874,7 +4869,7 @@ void ProtocolGame::sendSaleItemList(const std::vector &shopVector, co continue; } - it = inventoryMap.find(shopBlock.itemId); + auto it = inventoryMap.find(shopBlock.itemId); if (it != inventoryMap.end()) { msg.add(shopBlock.itemId); if (oldProtocol) { diff --git a/src/server/server_definitions.hpp b/src/server/server_definitions.hpp index 1d5ed5b628e..b957292b579 100644 --- a/src/server/server_definitions.hpp +++ b/src/server/server_definitions.hpp @@ -55,7 +55,8 @@ enum SessionEndInformations : uint8_t { enum Resource_t : uint8_t { RESOURCE_BANK = 0x00, - RESOURCE_INVENTORY = 0x01, + RESOURCE_INVENTORY_MONEY = 0x01, + RESOURCE_INVENTORY_CURRENCY_CUSTOM = 0x02, RESOURCE_PREY_CARDS = 0x0A, RESOURCE_TASK_HUNTING = 0x32, RESOURCE_FORGE_DUST = 0x46,