diff --git a/dGame/Character.cpp b/dGame/Character.cpp index d396382c..ce61ae70 100644 --- a/dGame/Character.cpp +++ b/dGame/Character.cpp @@ -534,7 +534,7 @@ void Character::OnZoneLoad() */ if (HasPermission(PermissionMap::Old)) { if (GetCoins() > 1000000) { - SetCoins(1000000, LOOT_SOURCE_NONE); + SetCoins(1000000, eLootSourceType::LOOT_SOURCE_NONE); } } diff --git a/dGame/TradingManager.cpp b/dGame/TradingManager.cpp index e178d130..c489c47b 100644 --- a/dGame/TradingManager.cpp +++ b/dGame/TradingManager.cpp @@ -151,8 +151,8 @@ void Trade::Complete() if (inventoryA == nullptr || inventoryB == nullptr || characterA == nullptr || characterB == nullptr || missionsA == nullptr || missionsB == nullptr) return; - characterA->SetCoins(characterA->GetCoins() - m_CoinsA + m_CoinsB, LOOT_SOURCE_TRADE); - characterB->SetCoins(characterB->GetCoins() - m_CoinsB + m_CoinsA, LOOT_SOURCE_TRADE); + characterA->SetCoins(characterA->GetCoins() - m_CoinsA + m_CoinsB, eLootSourceType::LOOT_SOURCE_TRADE); + characterB->SetCoins(characterB->GetCoins() - m_CoinsB + m_CoinsA, eLootSourceType::LOOT_SOURCE_TRADE); for (const auto& tradeItem : m_ItemsA) { diff --git a/dGame/dComponents/CharacterComponent.cpp b/dGame/dComponents/CharacterComponent.cpp index 67b820c2..8c4b0962 100644 --- a/dGame/dComponents/CharacterComponent.cpp +++ b/dGame/dComponents/CharacterComponent.cpp @@ -221,7 +221,7 @@ void CharacterComponent::HandleLevelUp() break; case 4: { - auto* items = inventoryComponent->GetInventory(ITEMS); + auto* items = inventoryComponent->GetInventory(eInventoryType::ITEMS); items->SetSize(items->GetSize() + reward->value); } break; diff --git a/dGame/dComponents/DestroyableComponent.cpp b/dGame/dComponents/DestroyableComponent.cpp index 31b3af19..8a99c069 100644 --- a/dGame/dComponents/DestroyableComponent.cpp +++ b/dGame/dComponents/DestroyableComponent.cpp @@ -821,7 +821,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType coinsTotal -= coinsToLoose; LootGenerator::Instance().DropLoot(m_Parent, m_Parent, -1, coinsToLoose, coinsToLoose); - character->SetCoins(coinsTotal, LOOT_SOURCE_PICKUP); + character->SetCoins(coinsTotal, eLootSourceType::LOOT_SOURCE_PICKUP); } } diff --git a/dGame/dComponents/InventoryComponent.cpp b/dGame/dComponents/InventoryComponent.cpp index d7a059a0..85d58065 100644 --- a/dGame/dComponents/InventoryComponent.cpp +++ b/dGame/dComponents/InventoryComponent.cpp @@ -207,7 +207,7 @@ void InventoryComponent::AddItem( auto stack = static_cast(info.stackSize); - if (inventoryType == BRICKS) + if (inventoryType == eInventoryType::BRICKS) { stack = 999; } diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index d363f437..b051ad45 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -566,8 +566,8 @@ void GameMessages::SendModifyLEGOScore(Entity* entity, const SystemAddress& sysA bitStream.Write((uint16_t)GAME_MSG_MODIFY_LEGO_SCORE); bitStream.Write(score); - bitStream.Write(sourceType != LOOT_SOURCE_NONE); - if (sourceType != LOOT_SOURCE_NONE) bitStream.Write(sourceType); + bitStream.Write(sourceType != eLootSourceType::LOOT_SOURCE_NONE); + if (sourceType != eLootSourceType::LOOT_SOURCE_NONE) bitStream.Write(sourceType); SEND_PACKET } @@ -4725,8 +4725,8 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti inv->RemoveItem(itemComp.currencyLOT, altCurrencyCost); } - character->SetCoins(character->GetCoins() - (coinCost), LOOT_SOURCE_VENDOR); inv->AddItem(item, count, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_VENDOR); + character->SetCoins(character->GetCoins() - (coinCost), eLootSourceType::LOOT_SOURCE_VENDOR); } GameMessages::SendVendorTransactionResult(entity, sysAddr); @@ -4773,8 +4773,8 @@ void GameMessages::HandleSellToVendor(RakNet::BitStream* inStream, Entity* entit } //inv->RemoveItem(count, -1, iObjID); - inv->MoveItemToInventory(item, VENDOR_BUYBACK, count, true, false, true); - character->SetCoins(std::floor(character->GetCoins() + ((itemComp.baseValue * sellScalar)*count)), LOOT_SOURCE_VENDOR); + inv->MoveItemToInventory(item, eInventoryType::VENDOR_BUYBACK, count, true, false, true); + character->SetCoins(std::floor(character->GetCoins() + ((itemComp.baseValue * sellScalar)*count)), eLootSourceType::LOOT_SOURCE_VENDOR); //EntityManager::Instance()->SerializeEntity(player); // so inventory updates GameMessages::SendVendorTransactionResult(entity, sysAddr); } @@ -4836,7 +4836,7 @@ void GameMessages::HandleBuybackFromVendor(RakNet::BitStream* inStream, Entity* //inv->RemoveItem(count, -1, iObjID); inv->MoveItemToInventory(item, Inventory::FindInventoryTypeForLot(item->GetLot()), count, true, false); - character->SetCoins(character->GetCoins() - cost, LOOT_SOURCE_VENDOR); + character->SetCoins(character->GetCoins() - cost, eLootSourceType::LOOT_SOURCE_VENDOR); //EntityManager::Instance()->SerializeEntity(player); // so inventory updates GameMessages::SendVendorTransactionResult(entity, sysAddr); } @@ -5269,7 +5269,7 @@ void GameMessages::HandlePickupCurrency(RakNet::BitStream* inStream, Entity* ent auto* ch = entity->GetCharacter(); if (entity->CanPickupCoins(currency)) { - ch->SetCoins(ch->GetCoins() + currency, LOOT_SOURCE_PICKUP); + ch->SetCoins(ch->GetCoins() + currency, eLootSourceType::LOOT_SOURCE_PICKUP); } } @@ -5484,8 +5484,8 @@ void GameMessages::HandleMoveItemInInventory(RakNet::BitStream* inStream, Entity } void GameMessages::HandleMoveItemBetweenInventoryTypes(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { - int inventoryTypeA; - int inventoryTypeB; + eInventoryType inventoryTypeA; + eInventoryType inventoryTypeB; LWOOBJID objectID; bool showFlyingLoot = true; bool stackCountIsDefault = false; @@ -5502,7 +5502,7 @@ void GameMessages::HandleMoveItemBetweenInventoryTypes(RakNet::BitStream* inStre inStream->Read(templateIDIsDefault); if (templateIDIsDefault) inStream->Read(templateID); - InventoryComponent* inv = static_cast(entity->GetComponent(COMPONENT_TYPE_INVENTORY)); + auto inv = entity->GetComponent(); if (!inv) return; auto* item = inv->FindItemById(objectID); @@ -5523,7 +5523,7 @@ void GameMessages::HandleMoveItemBetweenInventoryTypes(RakNet::BitStream* inStre } } - inv->MoveItemToInventory(item, static_cast(inventoryTypeB), stackCount, showFlyingLoot, false); + inv->MoveItemToInventory(item, inventoryTypeB, stackCount, showFlyingLoot); EntityManager::Instance()->SerializeEntity(entity); } @@ -5624,7 +5624,7 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity* for (auto* item : items) { - inv->MoveItemToInventory(item, MODELS, item->GetCount(), false); + inv->MoveItemToInventory(item, eInventoryType::MODELS, item->GetCount(), false); } } @@ -5739,7 +5739,7 @@ void GameMessages::HandleDoneArrangingWithItem(RakNet::BitStream* inStream, Enti for (auto* item : items) { - inv->MoveItemToInventory(item, MODELS, item->GetCount(), false, false); + inv->MoveItemToInventory(item, eInventoryType::MODELS, item->GetCount(), false, false); } } @@ -5765,7 +5765,7 @@ void GameMessages::HandleModularBuildMoveAndEquip(RakNet::BitStream* inStream, E return; } - inv->MoveItemToInventory(item, MODELS, 1, false, true); + inv->MoveItemToInventory(item, eInventoryType::MODELS, 1, false, true); } void GameMessages::HandlePickupItem(RakNet::BitStream* inStream, Entity* entity) { diff --git a/dGame/dMission/Mission.cpp b/dGame/dMission/Mission.cpp index 93a60ae9..9732bb5b 100644 --- a/dGame/dMission/Mission.cpp +++ b/dGame/dMission/Mission.cpp @@ -430,7 +430,7 @@ void Mission::YieldRewards() { int32_t coinsToSend = 0; if (info->LegoScore > 0) { - eLootSourceType lootSource = info->isMission ? LOOT_SOURCE_MISSION : LOOT_SOURCE_ACHIEVEMENT; + eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT; if(characterComponent->GetLevel() >= dZoneManager::Instance()->GetMaxLevel()) { // Since the character is at the level cap we reward them with coins instead of UScore. coinsToSend += info->LegoScore * dZoneManager::Instance()->GetLevelCapCurrencyConversion(); @@ -467,7 +467,7 @@ void Mission::YieldRewards() { } if (info->reward_currency_repeatable > 0 || coinsToSend > 0) { - eLootSourceType lootSource = info->isMission ? LOOT_SOURCE_MISSION : LOOT_SOURCE_ACHIEVEMENT; + eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT; character->SetCoins(character->GetCoins() + info->reward_currency_repeatable + coinsToSend, lootSource); } @@ -500,7 +500,7 @@ void Mission::YieldRewards() { } if (info->reward_currency > 0 || coinsToSend > 0) { - eLootSourceType lootSource = info->isMission ? LOOT_SOURCE_MISSION : LOOT_SOURCE_ACHIEVEMENT; + eLootSourceType lootSource = info->isMission ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT; character->SetCoins(character->GetCoins() + info->reward_currency + coinsToSend, lootSource); } diff --git a/dGame/dUtilities/Mail.cpp b/dGame/dUtilities/Mail.cpp index d0718f4c..89cc0fff 100644 --- a/dGame/dUtilities/Mail.cpp +++ b/dGame/dUtilities/Mail.cpp @@ -262,7 +262,7 @@ void Mail::HandleSendMail(RakNet::BitStream* packet, const SystemAddress& sysAdd } Mail::SendSendResponse(sysAddr, Mail::MailSendResponse::Success); - entity->GetCharacter()->SetCoins(entity->GetCharacter()->GetCoins() - mailCost, LOOT_SOURCE_MAIL); + entity->GetCharacter()->SetCoins(entity->GetCharacter()->GetCoins() - mailCost, eLootSourceType::LOOT_SOURCE_MAIL); Game::logger->Log("Mail", "Seeing if we need to remove item with ID/count/LOT: %i %i %i\n", itemID, attachmentCount, itemLOT); diff --git a/dGame/dUtilities/SlashCommandHandler.cpp b/dGame/dUtilities/SlashCommandHandler.cpp index 69ee60b0..d94c8d47 100644 --- a/dGame/dUtilities/SlashCommandHandler.cpp +++ b/dGame/dUtilities/SlashCommandHandler.cpp @@ -1293,7 +1293,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit CharacterComponent* character = entity->GetComponent(); if (character) character->SetUScore(character->GetUScore() + uscore); // LOOT_SOURCE_MODERATION should work but it doesn't. Relog to see uscore changes - GameMessages::SendModifyLEGOScore(entity, entity->GetSystemAddress(), uscore, LOOT_SOURCE_MODERATION); + GameMessages::SendModifyLEGOScore(entity, entity->GetSystemAddress(), uscore, eLootSourceType::LOOT_SOURCE_MODERATION); } if (chatCommand == "pos" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) { @@ -1337,7 +1337,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } auto* ch = entity->GetCharacter(); - ch->SetCoins(ch->GetCoins() + money, LOOT_SOURCE_MODERATION); + ch->SetCoins(ch->GetCoins() + money, eLootSourceType::LOOT_SOURCE_MODERATION); } if ((chatCommand == "setcurrency") && args.size() == 1 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) { @@ -1350,7 +1350,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit } auto* ch = entity->GetCharacter(); - ch->SetCoins(money, LOOT_SOURCE_MODERATION); + ch->SetCoins(money, eLootSourceType::LOOT_SOURCE_MODERATION); } // Allow for this on even while not a GM, as it sometimes toggles incorrrectly.