• 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!

Lua House Premium reduced cost

Apoccalypse

New Member
Joined
Apr 15, 2017
Messages
114
Solutions
2
Reaction score
4
Is is possible to make people who have active Premium account to pay half of a total rent for the house?
I mean , the total rent of the haouse is 100cc for a week. If player has active Premium account the game takes only half of this amount from his depot.

Thanks for anserw :)
I use the forgottenserver, tfs 0.3.6 ,tibia 8.6
 
Solution
OTSL/house.cpp at master · Zawodowiec1532/OTSL · GitHub
Replace house.cpp line 810-817:
C++:
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);

With:
C++:
uint32_t rent = house->getRent();
if (player->isPremium()) rent = (rent / 2);

uint32_t amount = rent + 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...
You cannot do it in Lua, but you can do it in C++ if you recompile the server.

Could you link me the source code of your server?

For now im gonna assume you use the old svn source on the otland github repository.

This line in house.cpp:
tfs-old-svn/house.cpp at master · otland/tfs-old-svn · GitHub

Change:
C++:
player->setBankBalance(player->getBankBalance() - house->getRent());

With this:
C++:
if (player->isPremium()) {
    player->setBankBalance(player->getBankBalance() - house->getRent() / 2);
} else {
    player->setBankBalance(player->getBankBalance() - house->getRent());
}
 
Last edited:
This is my source : GitHub - Zawodowiec1532/OTSL: OTS based on real Tibia by Leon Zawodowiec. (8.6)

I can place here my whole house.cpp if you wish so. I think that I use another version of source than you mentioned since there is no such line as you posted.

I think that I has to change something here :

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

BUMP
 
Last edited by a moderator:
OTSL/house.cpp at master · Zawodowiec1532/OTSL · GitHub
Replace house.cpp line 810-817:
C++:
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);

With:
C++:
uint32_t rent = house->getRent();
if (player->isPremium()) rent = (rent / 2);

uint32_t amount = rent + 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);
 
Solution
I will ask in other way.
1.Is it possible to compile this source by me at computer with windows 10 without having any advanced C++ skills?
2.If for first question anserw is yes,then wheter I find at this forum a tutorial to do it?
 
I will ask in other way.
1.Is it possible to compile this source by me at computer with windows 10 without having any advanced C++ skills?
2.If for first question anserw is yes,then wheter I find at this forum a tutorial to do it?
compiling is really simple if you just follow the instructions
you don't even need skill in c++ to compile tfs, here's a tutorial:
Compiling · otland/forgottenserver Wiki · GitHub
 
I will ask in other way.
1.Is it possible to compile this source by me at computer with windows 10 without having any advanced C++ skills?
2.If for first question anserw is yes,then wheter I find at this forum a tutorial to do it?

1. Yes
2. The distribution is maintained by the user Leon Zawodowiec. You should ask him which compiling tutorial is appropriate to use.
It seem to be based on some svn rev of 0.4, so you could try these:
[Compiling] Simple OTServ MSVC 2010/Linux : Compiling the Source
[Compiling]MSVC - Compiling TFS under Windows - EASY WAY!
 
Back
Top