mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 13:37:22 +00:00
Specified enum
the LOOT_SOURCE enum is now attached to all loot sources.
This commit is contained in:
parent
8e10f090fd
commit
ceab229a63
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ void InventoryComponent::AddItem(
|
||||
|
||||
auto stack = static_cast<uint32_t>(info.stackSize);
|
||||
|
||||
if (inventoryType == BRICKS)
|
||||
if (inventoryType == eInventoryType::BRICKS)
|
||||
{
|
||||
stack = 999;
|
||||
}
|
||||
|
@ -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<InventoryComponent*>(entity->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||
auto inv = entity->GetComponent<InventoryComponent>();
|
||||
if (!inv) return;
|
||||
|
||||
auto* item = inv->FindItemById(objectID);
|
||||
@ -5523,7 +5523,7 @@ void GameMessages::HandleMoveItemBetweenInventoryTypes(RakNet::BitStream* inStre
|
||||
}
|
||||
}
|
||||
|
||||
inv->MoveItemToInventory(item, static_cast<eInventoryType>(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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -1293,7 +1293,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
CharacterComponent* character = entity->GetComponent<CharacterComponent>();
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user