Rafael Hamdan
OT Developer
Hello!
These are cool features made for TFS or OpenTibia (if you know how to adapt it )
I won't explain EXACTLY where you should put codes, so if you don't know anything about c++, leave :thumbup:
1. Death System (small change)
Remove deaths as Tibia: they're stored in database for X days, then they're removed. (in tibia, x value is 30)
In configmanager.cpp, add:
in configmanager.h, in number_config_t enum, add:
in iologindata.cpp, add this function:
in iologindata.h add this:
and, in the end of Game::saveGameState() execute the function clearDeaths():
Then add in config.lua the "clearDeathsFrequence = 30"
2. House Paying System
We could make the system smarter, instead of puting "rentAsPrice", "priceAsRent", and all those things, we could just keep using houseSqmPrice (dunnow if it's the right name) and use + 1 string:
houseRentTilePrice
We would just remove the old system (keeping houseSqmPrice) and then:
PS: if player wants to use rent price set in map editor, he should set as 0 in config.lua
Replace this:
for this:
in configmanager.cpp:
and in configmanager.h (enum of integers):
Now you add "houseRentTilePrice = X" in config.lua
BE SURE YOU REMOVED THE OLD SYSTEM BUT KEPT THE houseSqmPrice
This is not the finish, still editing the topic
These are cool features made for TFS or OpenTibia (if you know how to adapt it )
I won't explain EXACTLY where you should put codes, so if you don't know anything about c++, leave :thumbup:
1. Death System (small change)
Remove deaths as Tibia: they're stored in database for X days, then they're removed. (in tibia, x value is 30)
In configmanager.cpp, add:
Code:
m_confInteger[CLEAR_DEATHS_FREQUENCE] = getGlobalNumber(L, "clearDeathsFrequence", 30);
in configmanager.h, in number_config_t enum, add:
Code:
CLEAR_DEATHS_FREQUENCE,
in iologindata.cpp, add this function:
Code:
bool IOLoginData::clearDeaths()
{
Database* db = Database::getInstance();
DBQuery query;
uint32_t time = (time(NULL) - (g_config.getNumber(ConfigManager::CLEAR_DEATHS_FREQUENCE) * 86400));
query << "DELETE FROM `player_deaths` WHERE `time` <= " << time;
return db->executeQuery(query.str());
}
in iologindata.h add this:
Code:
bool clearDeaths();
and, in the end of Game::saveGameState() execute the function clearDeaths():
Code:
IOLoginData::getInstance()->clearDeaths();
Then add in config.lua the "clearDeathsFrequence = 30"
2. House Paying System
We could make the system smarter, instead of puting "rentAsPrice", "priceAsRent", and all those things, we could just keep using houseSqmPrice (dunnow if it's the right name) and use + 1 string:
houseRentTilePrice
We would just remove the old system (keeping houseSqmPrice) and then:
PS: if player wants to use rent price set in map editor, he should set as 0 in config.lua
Replace this:
Code:
if(readXMLInteger(houseNode, "rent", intValue))
house->setRent(intValue);
for this:
Code:
uint32_t rentPrice = house->getHouseTileSize() * g_config.getNumber(ConfigManager::HOUSE_RENT_TILE);
if(rentPrice > 0)
house->setRent(rentPrice);
else if(readXMLInteger(houseNode, "rent", intValue))
house->setRent(intValue);
in configmanager.cpp:
Code:
m_confInteger[HOUSE_RENT_TILE] = getGlobalNumber(L, "houseRentTilePrice", 0);
and in configmanager.h (enum of integers):
Code:
HOUSE_RENT_TILE,
Now you add "houseRentTilePrice = X" in config.lua
BE SURE YOU REMOVED THE OLD SYSTEM BUT KEPT THE houseSqmPrice
This is not the finish, still editing the topic