mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 06:57:28 +00:00
loot source for item drops
Added support for Items to have a loot source attached to them when dropped or rolled. This fixes the issue where achievements would give the item before it appeared in the achievement window.
This commit is contained in:
parent
ceab229a63
commit
7a051afd97
@ -1637,7 +1637,7 @@ void Entity::PickupItem(const LWOOBJID& objectID) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
inv->AddItem(p.second.lot, p.second.count, INVALID, {}, LWOOBJID_EMPTY, true, false, LWOOBJID_EMPTY, INVALID, 1, false, -1, eLootSourceType::LOOT_SOURCE_PICKUP);
|
||||
inv->AddItem(p.second.lot, p.second.count, eLootSourceType::LOOT_SOURCE_PICKUP, eInventoryType::INVALID, {}, LWOOBJID_EMPTY, true, false, LWOOBJID_EMPTY, eInventoryType::INVALID, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -170,12 +170,12 @@ void Trade::Complete()
|
||||
|
||||
for (const auto& tradeItem : m_ItemsA)
|
||||
{
|
||||
inventoryB->AddItem(tradeItem.itemLot, tradeItem.itemCount, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_TRADE);
|
||||
inventoryB->AddItem(tradeItem.itemLot, tradeItem.itemCount, eLootSourceType::LOOT_SOURCE_TRADE);
|
||||
}
|
||||
|
||||
for (const auto& tradeItem : m_ItemsB)
|
||||
{
|
||||
inventoryA->AddItem(tradeItem.itemLot, tradeItem.itemCount, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_TRADE);
|
||||
inventoryA->AddItem(tradeItem.itemLot, tradeItem.itemCount, eLootSourceType::LOOT_SOURCE_TRADE);
|
||||
}
|
||||
|
||||
TradingManager::Instance()->CancelTrade(m_TradeId);
|
||||
|
@ -217,7 +217,7 @@ void CharacterComponent::HandleLevelUp()
|
||||
switch (reward->rewardType)
|
||||
{
|
||||
case 0:
|
||||
inventoryComponent->AddItem(reward->value, reward->count, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_LEVEL_REWARD);
|
||||
inventoryComponent->AddItem(reward->value, reward->count, eLootSourceType::LOOT_SOURCE_LEVEL_REWARD);
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
|
@ -141,6 +141,7 @@ const EquipmentMap& InventoryComponent::GetEquippedItems() const
|
||||
void InventoryComponent::AddItem(
|
||||
const LOT lot,
|
||||
const uint32_t count,
|
||||
eLootSourceType lootSourceType,
|
||||
eInventoryType inventoryType,
|
||||
const std::vector<LDFBaseData*>& config,
|
||||
const LWOOBJID parent,
|
||||
@ -150,8 +151,7 @@ void InventoryComponent::AddItem(
|
||||
const eInventoryType inventorySourceType,
|
||||
const int32_t sourceType,
|
||||
const bool bound,
|
||||
int32_t preferredSlot,
|
||||
eLootSourceType lootSourceType)
|
||||
int32_t preferredSlot)
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
@ -181,7 +181,7 @@ void InventoryComponent::AddItem(
|
||||
|
||||
if (!config.empty() || bound)
|
||||
{
|
||||
const auto slot = inventory->FindEmptySlot();
|
||||
const auto slot = preferredSlot != -1 && inventory->IsSlotEmpty(preferredSlot) ? preferredSlot : inventory->FindEmptySlot();
|
||||
|
||||
if (slot == -1)
|
||||
{
|
||||
@ -224,7 +224,7 @@ void InventoryComponent::AddItem(
|
||||
|
||||
left -= delta;
|
||||
|
||||
existing->SetCount(existing->GetCount() + delta, false, true, showFlyingLoot);
|
||||
existing->SetCount(existing->GetCount() + delta, false, true, showFlyingLoot, lootSourceType);
|
||||
|
||||
if (isModMoveAndEquip)
|
||||
{
|
||||
@ -255,9 +255,6 @@ void InventoryComponent::AddItem(
|
||||
|
||||
if (slot == -1)
|
||||
{
|
||||
// if (inventoryType == eInventoryType::VAULT_ITEMS || inventoryType == eInventoryType::VAULT_MODELS) {
|
||||
|
||||
// }
|
||||
auto* player = dynamic_cast<Player*>(GetParent());
|
||||
|
||||
if (player == nullptr)
|
||||
@ -372,7 +369,7 @@ void InventoryComponent::MoveItemToInventory(Item* item, const eInventoryType in
|
||||
|
||||
left -= delta;
|
||||
|
||||
AddItem(lot, delta, inventory, {}, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, false, preferredSlot, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
AddItem(lot, delta, eLootSourceType::LOOT_SOURCE_NONE, inventory, {}, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, false, preferredSlot);
|
||||
|
||||
item->SetCount(item->GetCount() - delta, false, false);
|
||||
|
||||
@ -390,7 +387,7 @@ void InventoryComponent::MoveItemToInventory(Item* item, const eInventoryType in
|
||||
|
||||
const auto delta = std::min<uint32_t>(item->GetCount(), count);
|
||||
|
||||
AddItem(lot, delta, inventory, config, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, item->GetBound(), preferredSlot, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
AddItem(lot, delta, eLootSourceType::LOOT_SOURCE_NONE, inventory, config, LWOOBJID_EMPTY, showFlyingLot, isModMoveAndEquip, LWOOBJID_EMPTY, origin->GetType(), 0, item->GetBound(), preferredSlot);
|
||||
|
||||
item->SetCount(item->GetCount() - delta, false, false);
|
||||
}
|
||||
|
@ -87,10 +87,12 @@ public:
|
||||
* @param sourceType the source of the item, used to determine if the item is dropped or mailed if the inventory is full
|
||||
* @param bound whether this item is bound
|
||||
* @param preferredSlot the preferred slot to store this item
|
||||
* @param lootSourceType The source of the loot. Defaults to none.
|
||||
*/
|
||||
void AddItem(
|
||||
LOT lot,
|
||||
uint32_t count,
|
||||
eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE,
|
||||
eInventoryType inventoryType = INVALID,
|
||||
const std::vector<LDFBaseData*>& config = {},
|
||||
LWOOBJID parent = LWOOBJID_EMPTY,
|
||||
@ -100,8 +102,7 @@ public:
|
||||
eInventoryType inventorySourceType = INVALID,
|
||||
int32_t sourceType = 0,
|
||||
bool bound = false,
|
||||
int32_t preferredSlot = -1,
|
||||
eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE
|
||||
int32_t preferredSlot = -1
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -615,7 +615,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position)
|
||||
|
||||
GameMessages::SendRegisterPetDBID(m_Tamer, petSubKey, tamer->GetSystemAddress());
|
||||
|
||||
inventoryComponent->AddItem(m_Parent->GetLOT(), 1, MODELS, {}, LWOOBJID_EMPTY, true, false, petSubKey, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
inventoryComponent->AddItem(m_Parent->GetLOT(), 1, eLootSourceType::LOOT_SOURCE_ACTIVITY, eInventoryType::MODELS, {}, LWOOBJID_EMPTY, true, false, petSubKey);
|
||||
auto* item = inventoryComponent->FindItemBySubKey(petSubKey, MODELS);
|
||||
|
||||
if (item == nullptr)
|
||||
|
@ -491,7 +491,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
|
||||
settings.push_back(propertyObjectID);
|
||||
settings.push_back(modelType);
|
||||
|
||||
inventoryComponent->AddItem(6662, 1, HIDDEN, settings, LWOOBJID_EMPTY, false, false, spawnerId, INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_DELETION);
|
||||
inventoryComponent->AddItem(6662, 1, eLootSourceType::LOOT_SOURCE_DELETION, eInventoryType::HIDDEN, settings, LWOOBJID_EMPTY, false, false, spawnerId);
|
||||
auto* item = inventoryComponent->FindItemBySubKey(spawnerId);
|
||||
|
||||
if (item == nullptr) {
|
||||
@ -526,7 +526,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet
|
||||
return;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(model->GetLOT(), 1, INVALID, {}, LWOOBJID_EMPTY, false, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_DELETION);
|
||||
inventoryComponent->AddItem(model->GetLOT(), 1, eLootSourceType::LOOT_SOURCE_DELETION, INVALID, {}, LWOOBJID_EMPTY, false);
|
||||
|
||||
auto* item = inventoryComponent->FindItemByLot(model->GetLOT());
|
||||
|
||||
|
@ -4700,7 +4700,7 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
|
||||
|
||||
inv->RemoveItem(tokenId, altCurrencyCost);
|
||||
|
||||
inv->AddItem(item, count, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||
inv->AddItem(item, count, eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4725,8 +4725,8 @@ void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* enti
|
||||
inv->RemoveItem(itemComp.currencyLOT, altCurrencyCost);
|
||||
}
|
||||
|
||||
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);
|
||||
inv->AddItem(item, count, eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||
}
|
||||
|
||||
GameMessages::SendVendorTransactionResult(entity, sysAddr);
|
||||
@ -4769,7 +4769,7 @@ void GameMessages::HandleSellToVendor(RakNet::BitStream* inStream, Entity* entit
|
||||
if (Inventory::IsValidItem(itemComp.currencyLOT))
|
||||
{
|
||||
const auto altCurrency = (itemComp.altCurrencyCost * sellScalar) * count;
|
||||
inv->AddItem(itemComp.currencyLOT, std::floor(altCurrency), eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_VENDOR); // Return alt currencies like faction tokens.
|
||||
inv->AddItem(itemComp.currencyLOT, std::floor(altCurrency), eLootSourceType::LOOT_SOURCE_VENDOR); // Return alt currencies like faction tokens.
|
||||
}
|
||||
|
||||
//inv->RemoveItem(count, -1, iObjID);
|
||||
@ -5103,7 +5103,7 @@ void GameMessages::HandleModularBuildConvertModel(RakNet::BitStream* inStream, E
|
||||
|
||||
item->Disassemble(TEMP_MODELS);
|
||||
|
||||
item->SetCount(item->GetCount() - 1, false, false);
|
||||
item->SetCount(item->GetCount() - 1, false, false, true, eLootSourceType::LOOT_SOURCE_QUICKBUILD);
|
||||
}
|
||||
|
||||
void GameMessages::HandleSetFlag(RakNet::BitStream* inStream, Entity* entity) {
|
||||
@ -5590,11 +5590,11 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
|
||||
|
||||
if (count == 3)
|
||||
{
|
||||
inv->AddItem(6416, 1, eInventoryType::MODELS, config, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_QUICKBUILD);
|
||||
inv->AddItem(6416, 1, eLootSourceType::LOOT_SOURCE_QUICKBUILD, eInventoryType::MODELS, config);
|
||||
}
|
||||
else if (count == 7)
|
||||
{
|
||||
inv->AddItem(8092, 1, eInventoryType::MODELS, config, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_QUICKBUILD);
|
||||
inv->AddItem(8092, 1, eLootSourceType::LOOT_SOURCE_QUICKBUILD, eInventoryType::MODELS, config);
|
||||
}
|
||||
|
||||
auto* missionComponent = character->GetComponent<MissionComponent>();
|
||||
|
@ -149,7 +149,7 @@ PreconditionExpression* Item::GetPreconditionExpression() const
|
||||
return preconditions;
|
||||
}
|
||||
|
||||
void Item::SetCount(const uint32_t value, const bool silent, const bool disassemble, const bool showFlyingLoot)
|
||||
void Item::SetCount(const uint32_t value, const bool silent, const bool disassemble, const bool showFlyingLoot, eLootSourceType lootSourceType)
|
||||
{
|
||||
if (value == count)
|
||||
{
|
||||
@ -177,7 +177,7 @@ void Item::SetCount(const uint32_t value, const bool silent, const bool disassem
|
||||
|
||||
if (value > count)
|
||||
{
|
||||
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, delta, 0LL);
|
||||
GameMessages::SendAddItemToInventoryClientSync(entity, entity->GetSystemAddress(), this, id, showFlyingLoot, delta, LWOOBJID_EMPTY, lootSourceType);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -341,7 +341,7 @@ bool Item::UseNonEquip()
|
||||
return false;
|
||||
}
|
||||
|
||||
LootGenerator::Instance().GiveLoot(inventory->GetComponent()->GetParent(), result);
|
||||
LootGenerator::Instance().GiveLoot(inventory->GetComponent()->GetParent(), result, eLootSourceType::LOOT_SOURCE_CONSUMPTION);
|
||||
}
|
||||
|
||||
inventory->GetComponent()->RemoveItem(lot, 1);
|
||||
@ -375,7 +375,7 @@ void Item::Disassemble(const eInventoryType inventoryType)
|
||||
|
||||
for (const auto mod : modArray)
|
||||
{
|
||||
inventory->GetComponent()->AddItem(mod, 1, inventoryType, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_DELETION);
|
||||
inventory->GetComponent()->AddItem(mod, 1, eLootSourceType::LOOT_SOURCE_DELETION, inventoryType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -473,7 +473,7 @@ void Item::DisassembleModel()
|
||||
continue;
|
||||
}
|
||||
|
||||
GetInventory()->GetComponent()->AddItem(brickID[0].NDObjectID, 1, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_DELETION);
|
||||
GetInventory()->GetComponent()->AddItem(brickID[0].NDObjectID, 1, eLootSourceType::LOOT_SOURCE_DELETION);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
* @param disassemble if items were removed, this returns all the sub parts of the item individually if it had assembly part lots
|
||||
* @param showFlyingLoot shows flying loot to the client, if not silent
|
||||
*/
|
||||
void SetCount(uint32_t value, bool silent = false, bool disassemble = true, bool showFlyingLoot = true);
|
||||
void SetCount(uint32_t value, bool silent = false, bool disassemble = true, bool showFlyingLoot = true, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE);
|
||||
|
||||
/**
|
||||
* Returns the number of items this item represents (e.g. for stacks)
|
||||
|
@ -463,7 +463,7 @@ void Mission::YieldRewards() {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(pair.first, count, eInventoryType::INVALID, {}, 0LL, IsMission(), false, 0LL, eInventoryType::INVALID, 0, false, -1, IsMission() ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT);
|
||||
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT);
|
||||
}
|
||||
|
||||
if (info->reward_currency_repeatable > 0 || coinsToSend > 0) {
|
||||
@ -496,7 +496,7 @@ void Mission::YieldRewards() {
|
||||
count = 0;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(pair.first, count, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, IsMission() ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT);
|
||||
inventoryComponent->AddItem(pair.first, count, IsMission() ? eLootSourceType::LOOT_SOURCE_MISSION : eLootSourceType::LOOT_SOURCE_ACHIEVEMENT);
|
||||
}
|
||||
|
||||
if (info->reward_currency > 0 || coinsToSend > 0) {
|
||||
|
@ -268,15 +268,15 @@ std::unordered_map<LOT, int32_t> LootGenerator::RollLootMatrix(uint32_t matrixIn
|
||||
return drops;
|
||||
}
|
||||
|
||||
void LootGenerator::GiveLoot(Entity* player, uint32_t matrixIndex) {
|
||||
void LootGenerator::GiveLoot(Entity* player, uint32_t matrixIndex, eLootSourceType lootSourceType) {
|
||||
player = player->GetOwner(); // If the owner is overwritten, we collect that here
|
||||
|
||||
std::unordered_map<LOT, int32_t> result = RollLootMatrix(player, matrixIndex);
|
||||
|
||||
GiveLoot(player, result);
|
||||
GiveLoot(player, result, lootSourceType);
|
||||
}
|
||||
|
||||
void LootGenerator::GiveLoot(Entity* player, std::unordered_map<LOT, int32_t>& result) {
|
||||
void LootGenerator::GiveLoot(Entity* player, std::unordered_map<LOT, int32_t>& result, eLootSourceType lootSourceType) {
|
||||
player = player->GetOwner(); // if the owner is overwritten, we collect that here
|
||||
|
||||
auto* inventoryComponent = player->GetComponent<InventoryComponent>();
|
||||
@ -285,7 +285,7 @@ void LootGenerator::GiveLoot(Entity* player, std::unordered_map<LOT, int32_t>& r
|
||||
return;
|
||||
|
||||
for (const auto& pair : result) {
|
||||
inventoryComponent->AddItem(pair.first, pair.second, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
inventoryComponent->AddItem(pair.first, pair.second, lootSourceType);
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,13 +314,13 @@ void LootGenerator::GiveActivityLoot(Entity* player, Entity* source, uint32_t ac
|
||||
maxCoins = currencyTable[0].maxvalue;
|
||||
}
|
||||
|
||||
GiveLoot(player, selectedReward->LootMatrixIndex);
|
||||
GiveLoot(player, selectedReward->LootMatrixIndex, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
|
||||
uint32_t coins = (int)(minCoins + GeneralUtils::GenerateRandomNumber<float>(0, 1) * (maxCoins - minCoins));
|
||||
|
||||
auto* character = player->GetCharacter();
|
||||
|
||||
character->SetCoins(character->GetCoins() + coins, LOOT_SOURCE_ACTIVITY);
|
||||
character->SetCoins(character->GetCoins() + coins, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
}
|
||||
|
||||
void LootGenerator::DropLoot(Entity* player, Entity* killedObject, uint32_t matrixIndex, uint32_t minCoins, uint32_t maxCoins) {
|
||||
|
@ -47,8 +47,8 @@ class LootGenerator : public Singleton<LootGenerator> {
|
||||
|
||||
std::unordered_map<LOT, int32_t> RollLootMatrix(Entity* player, uint32_t matrixIndex);
|
||||
std::unordered_map<LOT, int32_t> RollLootMatrix(uint32_t matrixIndex);
|
||||
void GiveLoot(Entity* player, uint32_t matrixIndex);
|
||||
void GiveLoot(Entity* player, std::unordered_map<LOT, int32_t>& result);
|
||||
void GiveLoot(Entity* player, uint32_t matrixIndex, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE);
|
||||
void GiveLoot(Entity* player, std::unordered_map<LOT, int32_t>& result, eLootSourceType lootSourceType = eLootSourceType::LOOT_SOURCE_NONE);
|
||||
void GiveActivityLoot(Entity* player, Entity* source, uint32_t activityID, int32_t rating = 0);
|
||||
void DropLoot(Entity* player, Entity* killedObject, uint32_t matrixIndex, uint32_t minCoins, uint32_t maxCoins);
|
||||
void DropLoot(Entity* player, Entity* killedObject, std::unordered_map<LOT, int32_t>& result, uint32_t minCoins, uint32_t maxCoins);
|
||||
|
@ -363,7 +363,7 @@ void Mail::HandleAttachmentCollect(RakNet::BitStream* packet, const SystemAddres
|
||||
auto inv = static_cast<InventoryComponent*>(player->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||
if (!inv) return;
|
||||
|
||||
inv->AddItem(attachmentLOT, attachmentCount, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_MAIL);
|
||||
inv->AddItem(attachmentLOT, attachmentCount, eLootSourceType::LOOT_SOURCE_MAIL);
|
||||
|
||||
Mail::SendAttachmentRemoveConfirm(sysAddr, mailID);
|
||||
|
||||
|
@ -794,7 +794,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
|
||||
InventoryComponent * inventory = static_cast<InventoryComponent*>(entity->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||
|
||||
inventory->AddItem(itemLOT, 1, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||
inventory->AddItem(itemLOT, 1, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||
} else if(args.size() == 2) {
|
||||
uint32_t itemLOT;
|
||||
|
||||
@ -814,7 +814,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
|
||||
InventoryComponent* inventory = static_cast<InventoryComponent*>(entity->GetComponent(COMPONENT_TYPE_INVENTORY));
|
||||
|
||||
inventory->AddItem(itemLOT, count, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||
inventory->AddItem(itemLOT, count, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||
}
|
||||
else {
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"Correct usage: /gmadditem <lot>");
|
||||
@ -1626,7 +1626,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
std::vector<LDFBaseData*> data {};
|
||||
data.push_back(new LDFData<int32_t>(u"reforgedLOT", reforgedItem));
|
||||
|
||||
inventoryComponent->AddItem(baseItem, 1, eInventoryType::INVALID, data, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||
inventoryComponent->AddItem(baseItem, 1, eLootSourceType::LOOT_SOURCE_MODERATION);
|
||||
}
|
||||
|
||||
if (chatCommand == "crash" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_OPERATOR)
|
||||
|
@ -32,7 +32,7 @@ void AmDropshipComputer::OnUse(Entity* self, Entity* user)
|
||||
return;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(12323, 1, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
inventoryComponent->AddItem(12323, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
}
|
||||
|
||||
void AmDropshipComputer::OnDie(Entity* self, Entity* killer)
|
||||
|
@ -11,7 +11,7 @@ void NPCAddRemoveItem::OnMissionDialogueOK(Entity *self, Entity *target, int mis
|
||||
for (const auto& itemSetting : missionSetting.second) {
|
||||
for (const auto& lot : itemSetting.items) {
|
||||
if (itemSetting.add && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)) {
|
||||
inventory->AddItem(lot, 1, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
inventory->AddItem(lot, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
} else if (itemSetting.remove && (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE)) {
|
||||
inventory->RemoveItem(lot, 1);
|
||||
}
|
||||
|
@ -54,6 +54,6 @@ void NjColeNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID,
|
||||
return;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(16644, 1, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||
inventoryComponent->AddItem(16644, 1, eLootSourceType::LOOT_SOURCE_VENDOR);
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,6 @@ void NjScrollChestServer::OnUse(Entity *self, Entity *user) {
|
||||
playerInventory->RemoveItem(keyLOT, 1);
|
||||
|
||||
// Reward the player with the item set
|
||||
playerInventory->AddItem(rewardItemLOT, 1, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
playerInventory->AddItem(rewardItemLOT, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int miss
|
||||
{
|
||||
if (inventoryComponent->GetLotCount(14378) == 0)
|
||||
{
|
||||
inventoryComponent->AddItem(14378, 1, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
inventoryComponent->AddItem(14378, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
}
|
||||
}
|
||||
else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE)
|
||||
|
@ -9,7 +9,7 @@ void NpcPirateServer::OnMissionDialogueOK(Entity *self, Entity *target, int miss
|
||||
// Add or remove the lucky shovel based on whether the mission was completed or started
|
||||
if ((missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)
|
||||
&& luckyShovel == nullptr) {
|
||||
inventory->AddItem(14591, 1, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
inventory->AddItem(14591, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
||||
inventory->RemoveItem(14591, 1);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missio
|
||||
// For the daily we add the maelstrom vacuum if the player doesn't have it yet
|
||||
if (missionID == 1883 && (missionState == MissionState::MISSION_STATE_AVAILABLE || missionState == MissionState::MISSION_STATE_COMPLETE_AVAILABLE)
|
||||
&& maelstromVacuum == nullptr) {
|
||||
inventory->AddItem(maelstromVacuumLot, 1, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
inventory->AddItem(maelstromVacuumLot, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
} else if (missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE || missionState == MissionState::MISSION_STATE_COMPLETE_READY_TO_COMPLETE) {
|
||||
inventory->RemoveItem(maelstromVacuumLot, 1);
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ void NsConcertInstrument::EquipInstruments(Entity *self, Entity *player) {
|
||||
// Equip the left hand instrument
|
||||
const auto leftInstrumentLot = instrumentLotLeft.find(GetInstrumentLot(self))->second;
|
||||
if (leftInstrumentLot != LOT_NULL) {
|
||||
inventory->AddItem(leftInstrumentLot, 1, TEMP_ITEMS, {}, LWOOBJID_EMPTY, false, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
inventory->AddItem(leftInstrumentLot, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
auto* leftInstrument = inventory->FindItemByLot(leftInstrumentLot, TEMP_ITEMS);
|
||||
leftInstrument->Equip();
|
||||
}
|
||||
@ -203,7 +203,7 @@ void NsConcertInstrument::EquipInstruments(Entity *self, Entity *player) {
|
||||
// Equip the right hand instrument
|
||||
const auto rightInstrumentLot = instrumentLotRight.find(GetInstrumentLot(self))->second;
|
||||
if (rightInstrumentLot != LOT_NULL) {
|
||||
inventory->AddItem(rightInstrumentLot, 1, TEMP_ITEMS, {}, LWOOBJID_EMPTY, false, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
inventory->AddItem(rightInstrumentLot, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
auto* rightInstrument = inventory->FindItemByLot(rightInstrumentLot, TEMP_ITEMS);
|
||||
rightInstrument->Equip();
|
||||
}
|
||||
|
@ -47,24 +47,29 @@ void NsTokenConsoleServer::OnUse(Entity* self, Entity* user)
|
||||
{
|
||||
GameMessages::SendPlayNDAudioEmitter(self, UNASSIGNED_SYSTEM_ADDRESS, useSound);
|
||||
}
|
||||
|
||||
// Player must be in faction to interact with this entity.
|
||||
LOT tokenLOT = 0;
|
||||
|
||||
if (character->GetPlayerFlag(46))
|
||||
{
|
||||
inventoryComponent->AddItem(8321, 5, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
tokenLOT = 8321;
|
||||
}
|
||||
else if (character->GetPlayerFlag(47))
|
||||
{
|
||||
inventoryComponent->AddItem(8318, 5, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
tokenLOT = 8318;
|
||||
}
|
||||
else if (character->GetPlayerFlag(48))
|
||||
{
|
||||
inventoryComponent->AddItem(8320, 5, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
tokenLOT = 8320;
|
||||
}
|
||||
else if (character->GetPlayerFlag(49))
|
||||
{
|
||||
inventoryComponent->AddItem(8319, 5, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
tokenLOT = 8319;
|
||||
}
|
||||
|
||||
inventoryComponent->AddItem(tokenLOT, 5, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
|
||||
missionComponent->ForceProgressTaskType(863, 1, 1, false);
|
||||
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), FROM_INTERACTION, self->GetObjectID());
|
||||
|
@ -29,7 +29,7 @@ void NtDukeServer::OnMissionDialogueOK(Entity *self, Entity *target, int mission
|
||||
auto lotCount = inventoryComponent->GetLotCount(m_SwordLot);
|
||||
|
||||
if ((state == MissionState::MISSION_STATE_AVAILABLE || state == MissionState::MISSION_STATE_ACTIVE) && lotCount < 1) {
|
||||
inventoryComponent->AddItem(m_SwordLot, 1, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
inventoryComponent->AddItem(m_SwordLot, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
} else if (state == MissionState::MISSION_STATE_READY_TO_COMPLETE) {
|
||||
inventoryComponent->RemoveItem(m_SwordLot, lotCount);
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ void SGCannon::StopGame(Entity *self, bool cancel) {
|
||||
auto* inventory = player->GetComponent<InventoryComponent>();
|
||||
if (inventory != nullptr) {
|
||||
for (const auto rewardLot : self->GetVar<std::vector<LOT>>(RewardsVariable)) {
|
||||
inventory->AddItem(rewardLot, 1, eInventoryType::MODELS, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
inventory->AddItem(rewardLot, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY, eInventoryType::MODELS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ void TokenConsoleServer::OnUse(Entity* self, Entity* user) {
|
||||
tokenLOT = 8320;
|
||||
else if (character->GetPlayerFlag(ePlayerFlags::SENTINEL_FACTION)) //sentinel
|
||||
tokenLOT = 8319;
|
||||
inv->AddItem(tokenLOT, tokensToGive, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
inv->AddItem(tokenLOT, tokensToGive, eLootSourceType::LOOT_SOURCE_NONE);
|
||||
}
|
||||
|
||||
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
|
||||
|
@ -10,7 +10,7 @@ void VeBricksampleServer::OnUse(Entity *self, Entity *user) {
|
||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
|
||||
if (loot && inventoryComponent != nullptr && inventoryComponent->GetLotCount(loot) == 0) {
|
||||
inventoryComponent->AddItem(loot, 1, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
inventoryComponent->AddItem(loot, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY);
|
||||
|
||||
for (auto* brickEntity : EntityManager::Instance()->GetEntitiesInGroup("Bricks")) {
|
||||
GameMessages::SendNotifyClientObject(brickEntity->GetObjectID(), u"Pickedup");
|
||||
|
@ -8,7 +8,7 @@ void VeMissionConsole::OnUse(Entity *self, Entity *user) {
|
||||
|
||||
auto* inventoryComponent = user->GetComponent<InventoryComponent>();
|
||||
if (inventoryComponent != nullptr) {
|
||||
inventoryComponent->AddItem(12547, 1, eInventoryType::INVALID, {}, 0LL, true, false, 0LL, eInventoryType::INVALID, 0, false, -1, eLootSourceType::LOOT_SOURCE_ACTIVITY); // Add the panel required for pickup
|
||||
inventoryComponent->AddItem(12547, 1, eLootSourceType::LOOT_SOURCE_ACTIVITY); // Add the panel required for pickup
|
||||
}
|
||||
|
||||
// The flag to set is 101<number>
|
||||
|
Loading…
Reference in New Issue
Block a user