- Joined
- Dec 11, 2007
- Messages
- 3,667
- Solutions
- 1
- Reaction score
- 129
- Location
- Warsaw, Poland
- GitHub
- tayandenga
- Twitch
- tayandenga
As I heard (slawkens told so KaczooH) - if premium ends, player still has his house.
I wrote a little modification, which instead of taking cash, will remove non-premium player from his house while taking rent for it (of course it sends items to depo!).
Morever, I did it configurable from config.lua - exactly: does the player need premium to own and buy a house (Thanks KaczooH for request)
1. Open house.cpp, and find (about line 844):
Replace it with:
Still, in house.cpp find (about line 911):
Add above it:
Save and close the file.
2. Open commands.cpp, and find (line 853):
Replace it with:
Still, in commands.cpp find (about line 938 in Commands::buyHouse):
Replace it with:
Save and close the file.
3. Open configmanager.cpp, and find (line 132):
Add after it:
Save and close the file.
4. Open configmanager.h, and find (line 83):
Add after it:
Save and close the file.
Now compile the server.
EDIT: Few pro coders may say its useless, 'Cause as far as I ... think so
'kick from a house if player doesn't have premium' may be done in iologindata.cpp, while player does login on the server - BUT
I wanted to make it more realistic, not comparing to Tibian system (where cipsoft counts their cash from premium and so
).
Example:
Rent period is set to week, and which buys a house has 8 days of premium.
After a week, he pays for the house, and next day losses premium priviligages.
#
If I would make it as in Tibia, player would just lose his gold - here, he has the house untill he paid for it (6 days more in the example).
Conclusion: Its more player friendly
I wrote a little modification, which instead of taking cash, will remove non-premium player from his house while taking rent for it (of course it sends items to depo!).
Morever, I did it configurable from config.lua - exactly: does the player need premium to own and buy a house (Thanks KaczooH for request)
1. Open house.cpp, and find (about line 844):
Code:
Depot* depot = player->getDepot(town->getTownID(), true);
bool savePlayerHere = true;
Code:
bool savePlayerHere = true;
// [START] Manual
bool playerHasPremium = true;
if (g_config.getString(ConfigManager::HOUSE_NEED_PREMIUM) == "yes" && !player->isPremium())
playerHasPremium = false;
if (playerHasPremium)
{
// [PAUSE] Manual
Depot* depot = player->getDepot(town->getTownID(), true); //Moved
Code:
if(!player->isOnline())
{
if(savePlayerHere)
IOLoginData.savePlayer(player, true);
delete player;
}
Code:
// [CONTINUE] Manual
}
else
{
house->setHouseOwner(0);
savePlayerHere = false;
}
// [END] Manual
2. Open commands.cpp, and find (line 853):
Code:
if(!tradePartner->isPremium())
Code:
if(g_config.getString(ConfigManager::HOUSE_NEED_PREMIUM) == "yes" && !tradePartner->isPremium()) //Changed manually
Code:
if(player->isPremium())
Code:
if(g_config.getString(ConfigManager::HOUSE_NEED_PREMIUM) != "yes" || player->isPremium()) //Changed manually
3. Open configmanager.cpp, and find (line 132):
Code:
m_confString[GENERATE_ACCOUNT_NUMBER] = getGlobalString(L, "generateAccountNumber", "yes");
Code:
m_confString[HOUSE_NEED_PREMIUM] = getGlobalString(L, "premiumToOwnHouse", "yes"); //Added by Elf
4. Open configmanager.h, and find (line 83):
Code:
GENERATE_ACCOUNT_NUMBER,
Code:
HOUSE_NEED_PREMIUM, //Added manually
Now compile the server.
EDIT: Few pro coders may say its useless, 'Cause as far as I ... think so
I wanted to make it more realistic, not comparing to Tibian system (where cipsoft counts their cash from premium and so
Example:
Rent period is set to week, and which buys a house has 8 days of premium.
After a week, he pays for the house, and next day losses premium priviligages.
#
If I would make it as in Tibia, player would just lose his gold - here, he has the house untill he paid for it (6 days more in the example).
Conclusion: Its more player friendly
Last edited: