mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 21:47:24 +00:00
Merge pull request #592 Added item precondition checks
Added item precondition checks
This commit is contained in:
commit
5f34b7150a
@ -311,7 +311,9 @@ bool Item::UseNonEquip()
|
|||||||
|
|
||||||
const auto success = !packages.empty();
|
const auto success = !packages.empty();
|
||||||
|
|
||||||
Game::logger->Log("Item", "Used (%i) with (%d)\n", lot, success);
|
auto inventoryComponent = inventory->GetComponent();
|
||||||
|
|
||||||
|
auto playerEntity = inventoryComponent->GetParent();
|
||||||
|
|
||||||
if (subKey != LWOOBJID_EMPTY)
|
if (subKey != LWOOBJID_EMPTY)
|
||||||
{
|
{
|
||||||
@ -324,8 +326,7 @@ bool Item::UseNonEquip()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (success && (playerEntity->GetGMLevel() >= eGameMasterLevel::GAME_MASTER_LEVEL_JUNIOR_DEVELOPER || this->GetPreconditionExpression()->Check(playerEntity)))
|
||||||
if (success)
|
|
||||||
{
|
{
|
||||||
auto* entityParent = inventory->GetComponent()->GetParent();
|
auto* entityParent = inventory->GetComponent()->GetParent();
|
||||||
|
|
||||||
@ -342,7 +343,7 @@ bool Item::UseNonEquip()
|
|||||||
|
|
||||||
LootGenerator::Instance().GiveLoot(inventory->GetComponent()->GetParent(), result, eLootSourceType::LOOT_SOURCE_CONSUMPTION);
|
LootGenerator::Instance().GiveLoot(inventory->GetComponent()->GetParent(), result, eLootSourceType::LOOT_SOURCE_CONSUMPTION);
|
||||||
}
|
}
|
||||||
|
Game::logger->Log("Item", "Used (%i)\n", lot);
|
||||||
inventory->GetComponent()->RemoveItem(lot, 1);
|
inventory->GetComponent()->RemoveItem(lot, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user