patched coin exploit

This commit is contained in:
Jett
2021-12-11 13:21:00 +00:00
parent e31dc35733
commit b6453376e4
5 changed files with 45 additions and 1 deletions

View File

@@ -1644,6 +1644,24 @@ void Entity::PickupItem(const LWOOBJID& objectID) {
droppedLoot.erase(objectID);
}
bool Entity::PickupCoins(uint64_t count) { // bool because we are returning whether they can pick up the coins
if (!IsPlayer()) return false;
auto droppedcoins = static_cast<Player*>(this)->GetDroppedCoins();
if (count > droppedcoins) {
return false;
} else {
static_cast<Player*>(this)->SetDroppedCoins(droppedcoins - count);
return true;
}
}
void Entity::DropCoins(uint64_t count) {
if (!IsPlayer()) return;
auto droppedcoins = static_cast<Player*>(this)->GetDroppedCoins();
droppedcoins += count;
static_cast<Player*>(this)->SetDroppedCoins(droppedcoins);
}
void Entity::AddChild(Entity* child) {
m_ChildEntities.push_back(child);
}