Hello folks.
I've been recieving alot of help from you guys lately and I appreciate it alot so I'm trying my luck here again!
I'm using tfs 1.2 8.0 (This one)
And for some reason players are not getting any rent warning letters in their depot and also after 7 days of warnings being added on to the database (but no warning letter) they get kicked from the house like it should but their items get sent to oblivion.
If players have money in bank it does take it and renew the lease.
I've checked the database to try to see if the players items ends up in some unknown dp location after losing their house but no it literally disappears!
There is no such issue when player uses !leavehouse command. Only when rent warning has passed 7 days and player loses house.
Any one got any idea what the issue could be? Or if anyone got a fix for this I would appreciate it alot!
I tried searching alot for this issue but have not found anything unfortunatly.
EDIT: Is there anyway to make these functions lua script based instead?
edit:
This is from my house.cpp
Thanks in advance!
I've been recieving alot of help from you guys lately and I appreciate it alot so I'm trying my luck here again!
I'm using tfs 1.2 8.0 (This one)
And for some reason players are not getting any rent warning letters in their depot and also after 7 days of warnings being added on to the database (but no warning letter) they get kicked from the house like it should but their items get sent to oblivion.
If players have money in bank it does take it and renew the lease.
I've checked the database to try to see if the players items ends up in some unknown dp location after losing their house but no it literally disappears!
There is no such issue when player uses !leavehouse command. Only when rent warning has passed 7 days and player loses house.
Any one got any idea what the issue could be? Or if anyone got a fix for this I would appreciate it alot!
I tried searching alot for this issue but have not found anything unfortunatly.
EDIT: Is there anyway to make these functions lua script based instead?
edit:
This is from my house.cpp
C++:
void Houses::payHouses(RentPeriod_t rentPeriod) const
{
if (rentPeriod == RENTPERIOD_NEVER) {
return;
}
time_t currentTime = time(nullptr);
for (const auto& it : houseMap) {
House* house = it.second;
if (house->getOwner() == 0) {
continue;
}
const uint32_t rent = house->getRent();
if (rent == 0 || house->getPaidUntil() > currentTime) {
continue;
}
const uint32_t ownerId = house->getOwner();
Town* town = g_game.map.towns.getTown(house->getTownId());
if (!town) {
continue;
}
Player player(nullptr);
if (!IOLoginData::loadPlayerById(&player, ownerId)) {
// Player doesn't exist, reset house owner
house->setOwner(0);
continue;
}
if (player.getBankBalance() >= rent) {
player.setBankBalance(player.getBankBalance() - rent);
time_t paidUntil = currentTime;
switch (rentPeriod) {
case RENTPERIOD_DAILY:
paidUntil += 24 * 60 * 60;
break;
case RENTPERIOD_WEEKLY:
paidUntil += 24 * 60 * 60 * 7;
break;
case RENTPERIOD_MONTHLY:
paidUntil += 24 * 60 * 60 * 30;
break;
case RENTPERIOD_YEARLY:
paidUntil += 24 * 60 * 60 * 365;
break;
default:
break;
}
house->setPaidUntil(paidUntil);
} else {
if (house->getPayRentWarnings() < 7) {
int32_t daysLeft = 7 - house->getPayRentWarnings();
Item* letter = Item::CreateItem(ITEM_LETTER_STAMPED);
std::string period;
switch (rentPeriod) {
case RENTPERIOD_DAILY:
period = "daily";
break;
case RENTPERIOD_WEEKLY:
period = "weekly";
break;
case RENTPERIOD_MONTHLY:
period = "monthly";
break;
case RENTPERIOD_YEARLY:
period = "annual";
break;
default:
break;
}
std::ostringstream ss;
ss << "Warning! \nThe " << period << " rent of " << house->getRent() << " gold for your house \"" << house->getName() << "\" is payable. Have it within " << daysLeft << " days or you will lose this house.";
letter->setText(ss.str());
DepotLocker* depotLocker = player.getDepotLocker(town->getID());
if (depotLocker) {
g_game.internalAddItem(depotLocker, letter, INDEX_WHEREEVER, FLAG_NOLIMIT);
}
house->setPayRentWarnings(house->getPayRentWarnings() + 1);
} else {
house->setOwner(0, true, &player);
}
}
IOLoginData::savePlayer(&player);
}
}
Thanks in advance!
Last edited: