Kownikuzyt
Member
- Joined
- Feb 11, 2020
- Messages
- 171
- Solutions
- 1
- Reaction score
- 8
Hello, this may be absurd but I would like to ask for help or a hint.
I would like to change the payment system for the house I purchased.
Code -> house.cpp
By default, monthly payments are set in config.lua.
How to change the code so that payment for the house is made with points from the ItemShop and not with in-game currency?
I would like to change the payment system for the house I purchased.
Code -> house.cpp
C++:
bool Houses::payRent(Player* player, House* house, uint32_t bid, time_t _time/* = 0*/)
{
if(rentPeriod == RENTPERIOD_NEVER || !house->getOwner() ||
house->getPaidUntil() > _time || !house->getRent() ||
player->hasCustomFlag(PlayerCustomFlag_IgnoreHouseRent))
return true;
Town* town = Towns::getInstance()->getTown(house->getTownId());
if(!town)
return false;
bool paid = false;
uint32_t amount = house->getRent() + bid;
if(g_config.getBool(ConfigManager::BANK_SYSTEM) && player->balance >= amount)
{
player->balance -= amount;
paid = true;
}
else if(Depot* depot = player->getDepot(town->getID(), true))
paid = g_game.removeMoney(depot, amount, FLAG_NOLIMIT);
if(!paid)
return false;
if(!_time)
_time = time(NULL);
uint32_t paidUntil = _time;
switch(rentPeriod)
{
case RENTPERIOD_DAILY:
paidUntil += 86400;
break;
case RENTPERIOD_WEEKLY:
paidUntil += 7 * 86400;
break;
case RENTPERIOD_MONTHLY:
paidUntil += 30 * 86400;
break;
case RENTPERIOD_YEARLY:
paidUntil += 365 * 86400;
break;
default:
break;
}
house->setLastWarning(0);
house->setRentWarnings(0);
house->setPaidUntil(paidUntil);
return true;
}
By default, monthly payments are set in config.lua.
How to change the code so that payment for the house is made with points from the ItemShop and not with in-game currency?