• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Change of payment for the house.

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

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?
 
Well I think you should change what this does
C++:
g_game.removeMoney

Maybe generating another function like g_game.removePoints instead?
I haven't read the source code but I can only give you this idea by now.

Regards!
 
C:
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);

Change this for a sql select for value and a sql update to remove points, try using chatgpt
 
Back
Top