mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 13:37:22 +00:00
Implemented sourceType for SendSetCurrency
Implemented sourceType for the function SendSetCurrency.
This commit is contained in:
parent
0531365cb5
commit
23e269940b
@ -527,7 +527,7 @@ void Character::OnZoneLoad()
|
|||||||
*/
|
*/
|
||||||
if (HasPermission(PermissionMap::Old)) {
|
if (HasPermission(PermissionMap::Old)) {
|
||||||
if (GetCoins() > 1000000) {
|
if (GetCoins() > 1000000) {
|
||||||
SetCoins(1000000);
|
SetCoins(1000000, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,7 +567,7 @@ const NiPoint3& Character::GetRespawnPoint(LWOMAPID map) const
|
|||||||
return pair->second;
|
return pair->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Character::SetCoins(int64_t newCoins, const bool message) {
|
void Character::SetCoins(int64_t newCoins, int lootType) {
|
||||||
if (newCoins < 0)
|
if (newCoins < 0)
|
||||||
{
|
{
|
||||||
newCoins = 0;
|
newCoins = 0;
|
||||||
@ -575,10 +575,7 @@ void Character::SetCoins(int64_t newCoins, const bool message) {
|
|||||||
|
|
||||||
m_Coins = newCoins;
|
m_Coins = newCoins;
|
||||||
|
|
||||||
if (message)
|
GameMessages::SendSetCurrency(EntityManager::Instance()->GetEntity(m_ObjectID), m_Coins, 0, 0, 0, 0, true, lootType);
|
||||||
{
|
|
||||||
GameMessages::SendSetCurrency(EntityManager::Instance()->GetEntity(m_ObjectID), m_Coins, 0, 0, 0, 0, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Character::HasBeenToWorld(LWOMAPID mapID) const
|
bool Character::HasBeenToWorld(LWOMAPID mapID) const
|
||||||
|
@ -314,7 +314,7 @@ public:
|
|||||||
* @param newCoins the amount of coins to update by
|
* @param newCoins the amount of coins to update by
|
||||||
* @param message whether to notify the client of the change
|
* @param message whether to notify the client of the change
|
||||||
*/
|
*/
|
||||||
void SetCoins(int64_t newCoins, bool message = true);
|
void SetCoins(int64_t newCoins, int lootType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the entity this character belongs to
|
* Get the entity this character belongs to
|
||||||
|
@ -151,8 +151,8 @@ void Trade::Complete()
|
|||||||
|
|
||||||
if (inventoryA == nullptr || inventoryB == nullptr || characterA == nullptr || characterB == nullptr || missionsA == nullptr || missionsB == nullptr) return;
|
if (inventoryA == nullptr || inventoryB == nullptr || characterA == nullptr || characterB == nullptr || missionsA == nullptr || missionsB == nullptr) return;
|
||||||
|
|
||||||
characterA->SetCoins(characterA->GetCoins() - m_CoinsA + m_CoinsB);
|
characterA->SetCoins(characterA->GetCoins() - m_CoinsA + m_CoinsB, 6);
|
||||||
characterB->SetCoins(characterB->GetCoins() - m_CoinsB + m_CoinsA);
|
characterB->SetCoins(characterB->GetCoins() - m_CoinsB + m_CoinsA, 6);
|
||||||
|
|
||||||
for (const auto& tradeItem : m_ItemsA)
|
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);
|
LootGenerator::Instance().DropLoot(m_Parent, m_Parent, -1, coinsToLoose, coinsToLoose);
|
||||||
}
|
}
|
||||||
|
|
||||||
character->SetCoins(coinsTotal);
|
character->SetCoins(coinsTotal, 11);
|
||||||
|
|
||||||
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
|
Entity* zoneControl = EntityManager::Instance()->GetZoneControlEntity();
|
||||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) {
|
for (CppScripts::Script* script : CppScripts::GetEntityScripts(zoneControl)) {
|
||||||
|
@ -706,7 +706,7 @@ void GameMessages::SendBroadcastTextToChatbox(Entity* entity, const SystemAddres
|
|||||||
SEND_PACKET_BROADCAST
|
SEND_PACKET_BROADCAST
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameMessages::SendSetCurrency(Entity* entity, int64_t currency, int lootType, const LWOOBJID& sourceID, const LOT& sourceLOT, int sourceTradeID, bool overrideCurrent) {
|
void GameMessages::SendSetCurrency(Entity* entity, int64_t currency, int lootType, const LWOOBJID& sourceID, const LOT& sourceLOT, int sourceTradeID, bool overrideCurrent, int sourceType) {
|
||||||
CBITSTREAM
|
CBITSTREAM
|
||||||
CMSGHEADER
|
CMSGHEADER
|
||||||
|
|
||||||
@ -729,7 +729,6 @@ void GameMessages::SendSetCurrency(Entity* entity, int64_t currency, int lootTyp
|
|||||||
bitStream.Write(sourceTradeID != LWOOBJID_EMPTY);
|
bitStream.Write(sourceTradeID != LWOOBJID_EMPTY);
|
||||||
if (sourceTradeID != LWOOBJID_EMPTY) bitStream.Write(sourceTradeID);
|
if (sourceTradeID != LWOOBJID_EMPTY) bitStream.Write(sourceTradeID);
|
||||||
|
|
||||||
int sourceType = 0; //For now.
|
|
||||||
bitStream.Write(sourceType != LOOTTYPE_NONE);
|
bitStream.Write(sourceType != LOOTTYPE_NONE);
|
||||||
if (sourceType != LOOTTYPE_NONE) bitStream.Write(sourceType);
|
if (sourceType != LOOTTYPE_NONE) bitStream.Write(sourceType);
|
||||||
|
|
||||||
@ -4685,7 +4684,7 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
|
|||||||
inv->RemoveItem(itemComp.currencyLOT, altCurrencyCost);
|
inv->RemoveItem(itemComp.currencyLOT, altCurrencyCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
character->SetCoins(character->GetCoins() - (coinCost));
|
character->SetCoins(character->GetCoins() - (coinCost), 9);
|
||||||
inv->AddItem(item, count);
|
inv->AddItem(item, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4734,7 +4733,7 @@ void GameMessages::HandleSellToVendor(RakNet::BitStream* inStream, Entity* entit
|
|||||||
|
|
||||||
//inv->RemoveItem(count, -1, iObjID);
|
//inv->RemoveItem(count, -1, iObjID);
|
||||||
inv->MoveItemToInventory(item, VENDOR_BUYBACK, count, true, false, true);
|
inv->MoveItemToInventory(item, VENDOR_BUYBACK, count, true, false, true);
|
||||||
character->SetCoins(std::floor(character->GetCoins() + ((itemComp.baseValue * sellScalar)*count)));
|
character->SetCoins(std::floor(character->GetCoins() + ((itemComp.baseValue * sellScalar)*count)), 9);
|
||||||
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates
|
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates
|
||||||
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
||||||
}
|
}
|
||||||
@ -4796,7 +4795,7 @@ void GameMessages::HandleBuybackFromVendor(RakNet::BitStream* inStream, Entity*
|
|||||||
|
|
||||||
//inv->RemoveItem(count, -1, iObjID);
|
//inv->RemoveItem(count, -1, iObjID);
|
||||||
inv->MoveItemToInventory(item, Inventory::FindInventoryTypeForLot(item->GetLot()), count, true, false);
|
inv->MoveItemToInventory(item, Inventory::FindInventoryTypeForLot(item->GetLot()), count, true, false);
|
||||||
character->SetCoins(character->GetCoins() - cost);
|
character->SetCoins(character->GetCoins() - cost, 9);
|
||||||
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates
|
//EntityManager::Instance()->SerializeEntity(player); // so inventory updates
|
||||||
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
||||||
}
|
}
|
||||||
@ -5240,7 +5239,7 @@ void GameMessages::HandlePickupCurrency(RakNet::BitStream* inStream, Entity* ent
|
|||||||
|
|
||||||
auto* ch = entity->GetCharacter();
|
auto* ch = entity->GetCharacter();
|
||||||
if (entity->CanPickupCoins(currency)) {
|
if (entity->CanPickupCoins(currency)) {
|
||||||
ch->SetCoins(ch->GetCoins() + currency);
|
ch->SetCoins(ch->GetCoins() + currency, 11);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ namespace GameMessages {
|
|||||||
void SendPlayFXEffect(const LWOOBJID& entity, int32_t effectID, const std::u16string& effectType, const std::string& name, LWOOBJID secondary = LWOOBJID_EMPTY, float priority = 1, float scale = 1, bool serialize = true);
|
void SendPlayFXEffect(const LWOOBJID& entity, int32_t effectID, const std::u16string& effectType, const std::string& name, LWOOBJID secondary = LWOOBJID_EMPTY, float priority = 1, float scale = 1, bool serialize = true);
|
||||||
void SendStopFXEffect(Entity* entity, bool killImmediate, std::string name);
|
void SendStopFXEffect(Entity* entity, bool killImmediate, std::string name);
|
||||||
void SendBroadcastTextToChatbox(Entity* entity, const SystemAddress& sysAddr, const std::u16string& attrs, const std::u16string& wsText);
|
void SendBroadcastTextToChatbox(Entity* entity, const SystemAddress& sysAddr, const std::u16string& attrs, const std::u16string& wsText);
|
||||||
void SendSetCurrency(Entity* entity, int64_t currency, int lootType, const LWOOBJID& sourceID, const LOT& sourceLOT, int sourceTradeID, bool overrideCurrent);
|
void SendSetCurrency(Entity* entity, int64_t currency, int lootType, const LWOOBJID& sourceID, const LOT& sourceLOT, int sourceTradeID, bool overrideCurrent, int sourceType);
|
||||||
|
|
||||||
void SendRebuildNotifyState(Entity* entity, int prevState, int state, const LWOOBJID& playerID);
|
void SendRebuildNotifyState(Entity* entity, int prevState, int state, const LWOOBJID& playerID);
|
||||||
void SendEnableRebuild(Entity* entity, bool enable, bool fail, bool success, int failReason, float duration, const LWOOBJID& playerID);
|
void SendEnableRebuild(Entity* entity, bool enable, bool fail, bool success, int failReason, float duration, const LWOOBJID& playerID);
|
||||||
|
@ -444,7 +444,7 @@ void Mission::YieldRewards() {
|
|||||||
|
|
||||||
auto count = pair.second > 0 ? pair.second : 1;
|
auto count = pair.second > 0 ? pair.second : 1;
|
||||||
|
|
||||||
// Sanitfy check, 6 is the max any mission yields
|
// Sanity check, 6 is the max any mission yields
|
||||||
if (count > 6) {
|
if (count > 6) {
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
@ -453,7 +453,7 @@ void Mission::YieldRewards() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (info->reward_currency_repeatable > 0) {
|
if (info->reward_currency_repeatable > 0) {
|
||||||
character->SetCoins(character->GetCoins() + info->reward_currency_repeatable);
|
character->SetCoins(character->GetCoins() + info->reward_currency_repeatable, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -481,8 +481,10 @@ void Mission::YieldRewards() {
|
|||||||
inventoryComponent->AddItem(pair.first, count);
|
inventoryComponent->AddItem(pair.first, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->reward_currency > 0) {
|
if (info->reward_currency > 0 && info->isMission) {
|
||||||
character->SetCoins(character->GetCoins() + info->reward_currency, info->isMission);
|
character->SetCoins(character->GetCoins() + info->reward_currency, 2);
|
||||||
|
} else if (info->reward_currency && !info->isMission) {
|
||||||
|
character->SetCoins(character->GetCoins() + info->reward_currency, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->reward_maxinventory > 0) {
|
if (info->reward_maxinventory > 0) {
|
||||||
|
@ -316,7 +316,7 @@ void LootGenerator::GiveActivityLoot(Entity* player, Entity* source, uint32_t ac
|
|||||||
|
|
||||||
auto* character = player->GetCharacter();
|
auto* character = player->GetCharacter();
|
||||||
|
|
||||||
character->SetCoins(character->GetCoins() + coins);
|
character->SetCoins(character->GetCoins() + coins, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LootGenerator::DropLoot(Entity* player, Entity* killedObject, uint32_t matrixIndex, uint32_t minCoins, uint32_t maxCoins) {
|
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);
|
Mail::SendSendResponse(sysAddr, Mail::MailSendResponse::Success);
|
||||||
entity->GetCharacter()->SetCoins(entity->GetCharacter()->GetCoins() - mailCost);
|
entity->GetCharacter()->SetCoins(entity->GetCharacter()->GetCoins() - mailCost, 3);
|
||||||
|
|
||||||
Game::logger->Log("Mail", "Seeing if we need to remove item with ID/count/LOT: %i %i %i\n", itemID, attachmentCount, itemLOT);
|
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();
|
auto* ch = entity->GetCharacter();
|
||||||
ch->SetCoins(ch->GetCoins() + money);
|
ch->SetCoins(ch->GetCoins() + money, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((chatCommand == "setcurrency") && args.size() == 1 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
|
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();
|
auto* ch = entity->GetCharacter();
|
||||||
ch->SetCoins(money);
|
ch->SetCoins(money, 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow for this on even while not a GM, as it sometimes toggles incorrrectly.
|
// Allow for this on even while not a GM, as it sometimes toggles incorrrectly.
|
||||||
|
Loading…
Reference in New Issue
Block a user