format codebase

This commit is contained in:
aronwk-aaron
2022-07-28 08:39:57 -05:00
parent 4f7aa11067
commit 19e77a38d8
881 changed files with 34700 additions and 38689 deletions

View File

@@ -13,9 +13,9 @@ VendorComponent::VendorComponent(Entity* parent) : Component(parent) {
VendorComponent::~VendorComponent() = default;
void VendorComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
outBitStream->Write1();
outBitStream->Write1();
outBitStream->Write1(); // Has standard items (Required for vendors with missions.)
outBitStream->Write(HasCraftingStation()); // Has multi use items
outBitStream->Write(HasCraftingStation()); // Has multi use items
}
void VendorComponent::OnUse(Entity* originator) {
@@ -52,10 +52,10 @@ void VendorComponent::RefreshInventory(bool isCreation) {
//Custom code for Max vanity NPC
if (m_Parent->GetLOT() == 9749 && Game::server->GetZoneID() == 1201) {
if (!isCreation) return;
m_Inventory.insert({11909, 0}); //Top hat w frog
m_Inventory.insert({7785, 0}); //Flash bulb
m_Inventory.insert({12764, 0}); //Big fountain soda
m_Inventory.insert({12241, 0}); //Hot cocoa (from fb)
m_Inventory.insert({ 11909, 0 }); //Top hat w frog
m_Inventory.insert({ 7785, 0 }); //Flash bulb
m_Inventory.insert({ 12764, 0 }); //Big fountain soda
m_Inventory.insert({ 12241, 0 }); //Hot cocoa (from fb)
return;
}
m_Inventory.clear();
@@ -72,7 +72,7 @@ void VendorComponent::RefreshInventory(bool isCreation) {
std::vector<CDLootTable> vendorItems = lootTableTable->Query([=](CDLootTable entry) { return (entry.LootTableIndex == lootTableID); });
if (lootMatrix.maxToDrop == 0 || lootMatrix.minToDrop == 0) {
for (CDLootTable item : vendorItems) {
m_Inventory.insert({item.itemid, item.sortPriority});
m_Inventory.insert({ item.itemid, item.sortPriority });
}
} else {
auto randomCount = GeneralUtils::GenerateRandomNumber<int32_t>(lootMatrix.minToDrop, lootMatrix.maxToDrop);
@@ -86,7 +86,7 @@ void VendorComponent::RefreshInventory(bool isCreation) {
vendorItems.erase(vendorItems.begin() + randomItemIndex);
m_Inventory.insert({randomItem.itemid, randomItem.sortPriority});
m_Inventory.insert({ randomItem.itemid, randomItem.sortPriority });
}
}
}
@@ -96,24 +96,24 @@ void VendorComponent::RefreshInventory(bool isCreation) {
auto randomCamera = GeneralUtils::GenerateRandomNumber<int32_t>(0, 2);
switch (randomCamera) {
case 0:
m_Inventory.insert({16253, 0}); //Grungagroid
break;
case 1:
m_Inventory.insert({16254, 0}); //Hipstabrick
break;
case 2:
m_Inventory.insert({16204, 0}); //Megabrixel snapshot
break;
default:
break;
case 0:
m_Inventory.insert({ 16253, 0 }); //Grungagroid
break;
case 1:
m_Inventory.insert({ 16254, 0 }); //Hipstabrick
break;
case 2:
m_Inventory.insert({ 16204, 0 }); //Megabrixel snapshot
break;
default:
break;
}
}
// Callback timer to refresh this inventory.
m_Parent->AddCallbackTimer(m_RefreshTimeSeconds, [this]() {
RefreshInventory();
});
});
GameMessages::SendVendorStatusUpdate(m_Parent, UNASSIGNED_SYSTEM_ADDRESS);
}
@@ -128,4 +128,4 @@ void VendorComponent::SetupConstants() {
m_SellScalar = vendorComps[0].sellScalar;
m_RefreshTimeSeconds = vendorComps[0].refreshTimeSeconds;
m_LootMatrixID = vendorComps[0].LootMatrixIndex;
}
}