Rename Vendor.Xpp -> Vendors.Xpp

This commit is contained in:
gsemaj 2021-04-16 13:28:59 -04:00
parent 588e941d3c
commit fa7c88e214
6 changed files with 15 additions and 15 deletions

View File

@ -71,7 +71,7 @@ CXXSRC=\
src/Buddies.cpp\ src/Buddies.cpp\
src/Groups.cpp\ src/Groups.cpp\
src/Racing.cpp\ src/Racing.cpp\
src/Vendor.cpp\ src/Vendors.cpp\
src/Trading.cpp\ src/Trading.cpp\
# headers (for timestamp purposes) # headers (for timestamp purposes)
@ -115,7 +115,7 @@ CXXHDR=\
src/Buddies.hpp\ src/Buddies.hpp\
src/Groups.hpp\ src/Groups.hpp\
src/Racing.hpp\ src/Racing.hpp\
src/Vendor.hpp\ src/Vendors.hpp\
src/Trading.hpp\ src/Trading.hpp\
COBJ=$(CSRC:.c=.o) COBJ=$(CSRC:.c=.o)

View File

@ -8,7 +8,7 @@
#include "TableData.hpp" #include "TableData.hpp"
#include "Groups.hpp" #include "Groups.hpp"
#include "Racing.hpp" #include "Racing.hpp"
#include "Vendor.hpp" #include "Vendors.hpp"
#include "Abilities.hpp" #include "Abilities.hpp"
#include <cmath> #include <cmath>

View File

@ -7,7 +7,7 @@
#include "Chunking.hpp" #include "Chunking.hpp"
#include "Nanos.hpp" #include "Nanos.hpp"
#include "Racing.hpp" #include "Racing.hpp"
#include "Vendor.hpp" #include "Vendors.hpp"
#include "Abilities.hpp" #include "Abilities.hpp"
#include "Eggs.hpp" #include "Eggs.hpp"
@ -708,10 +708,10 @@ void TableData::init() {
for (nlohmann::json::iterator _lst = listings.begin(); _lst != listings.end(); _lst++) { for (nlohmann::json::iterator _lst = listings.begin(); _lst != listings.end(); _lst++) {
auto lst = _lst.value(); auto lst = _lst.value();
VendorListing vListing = { lst["m_iSortNumber"], lst["m_iItemType"], lst["m_iitemID"] }; VendorListing vListing = { lst["m_iSortNumber"], lst["m_iItemType"], lst["m_iitemID"] };
Vendor::VendorTables[lst["m_iNpcNumber"]].push_back(vListing); Vendors::VendorTables[lst["m_iNpcNumber"]].push_back(vListing);
} }
std::cout << "[INFO] Loaded " << Vendor::VendorTables.size() << " vendor tables" << std::endl; std::cout << "[INFO] Loaded " << Vendors::VendorTables.size() << " vendor tables" << std::endl;
// load crocpot entries // load crocpot entries
nlohmann::json crocs = xdtData["m_pCombiningTable"]["m_pCombiningData"]; nlohmann::json crocs = xdtData["m_pCombiningTable"]["m_pCombiningData"];

View File

@ -1,8 +1,8 @@
#include "Vendor.hpp" #include "Vendors.hpp"
using namespace Vendor; using namespace Vendors;
std::map<int32_t, std::vector<VendorListing>> Vendor::VendorTables; std::map<int32_t, std::vector<VendorListing>> Vendors::VendorTables;
static void vendorBuy(CNSocket* sock, CNPacketData* data) { static void vendorBuy(CNSocket* sock, CNPacketData* data) {
auto req = (sP_CL2FE_REQ_PC_VENDOR_ITEM_BUY*)data->buf; auto req = (sP_CL2FE_REQ_PC_VENDOR_ITEM_BUY*)data->buf;
@ -198,10 +198,10 @@ static void vendorBuyback(CNSocket* sock, CNPacketData* data) {
static void vendorTable(CNSocket* sock, CNPacketData* data) { static void vendorTable(CNSocket* sock, CNPacketData* data) {
auto req = (sP_CL2FE_REQ_PC_VENDOR_TABLE_UPDATE*)data->buf; auto req = (sP_CL2FE_REQ_PC_VENDOR_TABLE_UPDATE*)data->buf;
if (req->iVendorID != req->iNPC_ID || Vendor::VendorTables.find(req->iVendorID) == Vendor::VendorTables.end()) if (req->iVendorID != req->iNPC_ID || Vendors::VendorTables.find(req->iVendorID) == Vendors::VendorTables.end())
return; return;
std::vector<VendorListing> listings = Vendor::VendorTables[req->iVendorID]; std::vector<VendorListing> listings = Vendors::VendorTables[req->iVendorID];
INITSTRUCT(sP_FE2CL_REP_PC_VENDOR_TABLE_UPDATE_SUCC, resp); INITSTRUCT(sP_FE2CL_REP_PC_VENDOR_TABLE_UPDATE_SUCC, resp);
@ -360,7 +360,7 @@ static void vendorCombineItems(CNSocket* sock, CNPacketData* data) {
sock->sendPacket(resp, P_FE2CL_REP_PC_ITEM_COMBINATION_SUCC); sock->sendPacket(resp, P_FE2CL_REP_PC_ITEM_COMBINATION_SUCC);
} }
void Vendor::init() { void Vendors::init() {
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_VENDOR_START, vendorStart); REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_VENDOR_START, vendorStart);
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_VENDOR_TABLE_UPDATE, vendorTable); REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_VENDOR_TABLE_UPDATE, vendorTable);
REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_VENDOR_ITEM_BUY, vendorBuy); REGISTER_SHARD_PACKET(P_CL2FE_REQ_PC_VENDOR_ITEM_BUY, vendorBuy);

View File

@ -10,7 +10,7 @@ struct VendorListing {
int sort, type, iID; int sort, type, iID;
}; };
namespace Vendor { namespace Vendors {
extern std::map<int32_t, std::vector<VendorListing>> VendorTables; extern std::map<int32_t, std::vector<VendorListing>> VendorTables;
void init(); void init();

View File

@ -19,7 +19,7 @@
#include "Racing.hpp" #include "Racing.hpp"
#include "Trading.hpp" #include "Trading.hpp"
#include "Email.hpp" #include "Email.hpp"
#include "Vendor.hpp" #include "Vendors.hpp"
#include "Chat.hpp" #include "Chat.hpp"
#include "Eggs.hpp" #include "Eggs.hpp"
@ -111,7 +111,7 @@ int main() {
Missions::init(); Missions::init();
Nanos::init(); Nanos::init();
NPCManager::init(); NPCManager::init();
Vendor::init(); Vendors::init();
Transport::init(); Transport::init();
Buddies::init(); Buddies::init();
Email::init(); Email::init();