mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-21 21:17:25 +00:00
Added enum for coin sources
Added an enum for coin sources as to avoid leaving a random number in the code.
This commit is contained in:
parent
c575294587
commit
97f8e9e9fc
@ -469,6 +469,31 @@ enum eRebuildState : uint32_t {
|
||||
REBUILD_INCOMPLETE
|
||||
};
|
||||
|
||||
enum eCoinSourceType : int32_t {
|
||||
COIN_SOURCE_NONE = 0,
|
||||
COIN_SOURCE_CHEST,
|
||||
COIN_SOURCE_MISSION,
|
||||
COIN_SOURCE_MAIL,
|
||||
COIN_SOURCE_CURRENCY,
|
||||
COIN_SOURCE_ACHIEVEMENT,
|
||||
COIN_SOURCE_TRADE,
|
||||
COIN_SOURCE_QUICKBUILD,
|
||||
COIN_SOURCE_DELETION,
|
||||
COIN_SOURCE_VENDOR,
|
||||
COIN_SOURCE_ACTIVITY,
|
||||
COIN_SOURCE_PICKUP,
|
||||
COIN_SOURCE_BRICK,
|
||||
COIN_SOURCE_PROPERTY,
|
||||
COIN_SOURCE_MODERATION,
|
||||
COIN_SOURCE_EXHIBIT,
|
||||
COIN_SOURCE_INVENTORY,
|
||||
COIN_SOURCE_CLAIMCODE,
|
||||
COIN_SOURCE_CONSUMPTION,
|
||||
COIN_SOURCE_CRAFTING,
|
||||
COIN_SOURCE_LEVELREWARD,
|
||||
COIN_SOURCE_RELOCATE
|
||||
};
|
||||
|
||||
enum eGameActivities : uint32_t {
|
||||
ACTIVITY_NONE,
|
||||
ACTIVITY_QUICKBUILDING,
|
||||
|
@ -527,7 +527,7 @@ void Character::OnZoneLoad()
|
||||
*/
|
||||
if (HasPermission(PermissionMap::Old)) {
|
||||
if (GetCoins() > 1000000) {
|
||||
SetCoins(1000000, 0);
|
||||
SetCoins(1000000, COIN_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, 6);
|
||||
characterB->SetCoins(characterB->GetCoins() - m_CoinsB + m_CoinsA, 6);
|
||||
characterA->SetCoins(characterA->GetCoins() - m_CoinsA + m_CoinsB, COIN_SOURCE_TRADE);
|
||||
characterB->SetCoins(characterB->GetCoins() - m_CoinsB + m_CoinsA, COIN_SOURCE_TRADE);
|
||||
|
||||
for (const auto& tradeItem : m_ItemsA)
|
||||
{
|
||||
|
@ -818,7 +818,7 @@ void DestroyableComponent::Smash(const LWOOBJID source, const eKillType killType
|
||||
LootGenerator::Instance().DropLoot(m_Parent, m_Parent, -1, coinsToLoose, coinsToLoose);
|
||||
}
|
||||
|
||||
character->SetCoins(coinsTotal, 11);
|
||||
character->SetCoins(coinsTotal, COIN_SOURCE_PICKUP);
|
||||
|
||||
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) {
|
||||
|
@ -4684,7 +4684,7 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
|
||||
inv->RemoveItem(itemComp.currencyLOT, altCurrencyCost);
|
||||
}
|
||||
|
||||
character->SetCoins(character->GetCoins() - (coinCost), 9);
|
||||
character->SetCoins(character->GetCoins() - (coinCost), COIN_SOURCE_VENDOR);
|
||||
inv->AddItem(item, count);
|
||||
}
|
||||
|
||||
@ -4733,7 +4733,7 @@ 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)), 9);
|
||||
character->SetCoins(std::floor(character->GetCoins() + ((itemComp.baseValue * sellScalar)*count)), COIN_SOURCE_VENDOR);
|
||||
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates
|
||||
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
||||
}
|
||||
@ -4795,7 +4795,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, 9);
|
||||
character->SetCoins(character->GetCoins() - cost, COIN_SOURCE_VENDOR);
|
||||
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates
|
||||
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
||||
}
|
||||
@ -5239,7 +5239,7 @@ void GameMessages::HandlePickupCurrency(RakNet::BitStream* inStream, Entity* ent
|
||||
|
||||
auto* ch = entity->GetCharacter();
|
||||
if (entity->CanPickupCoins(currency)) {
|
||||
ch->SetCoins(ch->GetCoins() + currency, 11);
|
||||
ch->SetCoins(ch->GetCoins() + currency, COIN_SOURCE_PICKUP);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,7 +453,7 @@ void Mission::YieldRewards() {
|
||||
}
|
||||
|
||||
if (info->reward_currency_repeatable > 0) {
|
||||
character->SetCoins(character->GetCoins() + info->reward_currency_repeatable, 2);
|
||||
character->SetCoins(character->GetCoins() + info->reward_currency_repeatable, COIN_SOURCE_MISSION);
|
||||
}
|
||||
|
||||
return;
|
||||
@ -482,9 +482,9 @@ void Mission::YieldRewards() {
|
||||
}
|
||||
|
||||
if (info->reward_currency > 0 && info->isMission) {
|
||||
character->SetCoins(character->GetCoins() + info->reward_currency, 2);
|
||||
character->SetCoins(character->GetCoins() + info->reward_currency, COIN_SOURCE_MISSION);
|
||||
} else if (info->reward_currency && !info->isMission) {
|
||||
character->SetCoins(character->GetCoins() + info->reward_currency, 5);
|
||||
character->SetCoins(character->GetCoins() + info->reward_currency, COIN_SOURCE_ACHIEVEMENT);
|
||||
}
|
||||
|
||||
if (info->reward_maxinventory > 0) {
|
||||
|
@ -316,7 +316,7 @@ void LootGenerator::GiveActivityLoot(Entity* player, Entity* source, uint32_t ac
|
||||
|
||||
auto* character = player->GetCharacter();
|
||||
|
||||
character->SetCoins(character->GetCoins() + coins, 10);
|
||||
character->SetCoins(character->GetCoins() + coins, COIN_SOURCE_ACTIVITY);
|
||||
}
|
||||
|
||||
void LootGenerator::DropLoot(Entity* player, Entity* killedObject, uint32_t matrixIndex, uint32_t minCoins, uint32_t maxCoins) {
|
||||
|
@ -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, 3);
|
||||
entity->GetCharacter()->SetCoins(entity->GetCharacter()->GetCoins() - mailCost, COIN_SOURCE_MAIL);
|
||||
|
||||
Game::logger->Log("Mail", "Seeing if we need to remove item with ID/count/LOT: %i %i %i\n", itemID, attachmentCount, itemLOT);
|
||||
|
||||
|
@ -1326,7 +1326,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
auto* ch = entity->GetCharacter();
|
||||
ch->SetCoins(ch->GetCoins() + money, 14);
|
||||
ch->SetCoins(ch->GetCoins() + money, COIN_SOURCE_MODERATION);
|
||||
}
|
||||
|
||||
if ((chatCommand == "setcurrency") && args.size() == 1 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
||||
@ -1339,7 +1339,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
}
|
||||
|
||||
auto* ch = entity->GetCharacter();
|
||||
ch->SetCoins(money, 14);
|
||||
ch->SetCoins(money, COIN_SOURCE_MODERATION);
|
||||
}
|
||||
|
||||
// Allow for this on even while not a GM, as it sometimes toggles incorrrectly.
|
||||
|
Loading…
Reference in New Issue
Block a user