Load item tables + price implementation

This commit is contained in:
Gent
2020-09-14 00:25:14 -04:00
parent f55cc8f36d
commit c91022030c
4 changed files with 44 additions and 7 deletions

View File

@@ -3,8 +3,12 @@
#include "CNShardServer.hpp"
#include "Player.hpp"
struct Item {
bool tradeable, sellable;
int buyPrice, sellPrice, stackSize, level; // TODO: implement more as needed
};
struct VendorListing {
int sort, type, iID, price;
int sort, type, iID;
};
namespace ItemManager {
@@ -14,6 +18,7 @@ namespace ItemManager {
BANK = 3
};
// hopefully this is fine since it's never modified after load
extern std::map<std::pair<int32_t, int32_t>, Item> ItemData; // <id, type> -> data
extern std::map<int32_t, std::vector<VendorListing>> VendorTables;
void init();
@@ -36,4 +41,6 @@ namespace ItemManager {
void chestOpenHandler(CNSocket* sock, CNPacketData* data);
int findFreeSlot(Player *plr);
bool isItemRegistered(int32_t id, int32_t type);
Item getItemData(int32_t id, int32_t type);
}