Lua How to show how many tiles there is in the house on look the door

maikons

Member
Joined
Aug 1, 2015
Messages
192
Best answers
0
Reaction score
13
How to show how many tiles there is in the house on look the door, just like in this img:



With some help from people from this forum i changed:
Code:
void House::updateDoorDescription(std::string _name/* = ""*/)
From:
Fir3element/3777 (https://github.com/Fir3element/3777/blob/master/src/house.cpp)

To:
Code:
void House::updateDoorDescription(std::string _name/* = ""*/)
{
    int32_t house_tiles = (price / g_config.getNumber(ConfigManager::HOUSE_PRICE));
    std::string tmp = "house";
    if(isGuild())
        tmp = "hall";

    char houseDescription[200];
    if(owner)
    {
        if(isGuild())
            IOGuild::getInstance()->getGuildById(_name, owner);
        else if(_name.empty())
            IOLoginData::getInstance()->getNameByGuid(owner, _name);

        sprintf(houseDescription, "It belongs to %s '%s'. %s owns this %s. It has %d tiles.", tmp.c_str(), name.c_str(), _name.c_str(), tmp.c_str(), house_tiles);
    }
    else
        sprintf(houseDescription, "It belongs to %s '%s'. Nobody owns this %s. It costs %d gold coins. It has %d tiles.", tmp.c_str(), name.c_str(), tmp.c_str(), price, house_tiles);

    for(HouseDoorList::iterator it = doorList.begin(); it != doorList.end(); ++it)
        (*it)->setSpecialDescription(houseDescription);
}
But it's not working 100%


its only working with houses who had iteract with players
if some player had !buyhouse, !leavehouse, !sellhouse, it is showing right:
Code:
It belongs to house 'Unnamed House #1'. Maikao owns this house. It has 39 tiles.
Code:
It belongs to house 'Unnamed House #1'. Nobody owns this house. It costs 3900000 gold coins. It has 39 tiles.




But houses who players never had buy or sell, never interact, it's not showing how many tiles the house have (if a player buy the house it starts to shows)
Code:
It belongs to house 'Unnamed House #3'. Nobody owns this house. It costs 2500000 gold coins.


how to fix it?
 

Okke

Voidcore 7.4
Joined
Jul 19, 2015
Messages
911
Best answers
17
Reaction score
423
Location
germany
Hello there,

as you can see the name of the function is updateDoorDescription, which is called only after someone interacts with them, in order to fix this problem you could call the function as soon as the server starts.

Best Wishes,
Okke
 
OP
M

maikons

Member
Joined
Aug 1, 2015
Messages
192
Best answers
0
Reaction score
13
Hello there,

as you can see the name of the function is updateDoorDescription, which is called only after someone interacts with them, in order to fix this problem you could call the function as soon as the server starts.

Best Wishes,
Okke
I don't find another function to deal with this in no where

And looks like be the only one cause, always when add a house should update the door desc:
Code:
void House::addDoor(Door* door)
{
    door->addRef();
    doorList.push_back(door);

    door->setHouse(this);
    updateDoorDescription();
}
Where did u found the other function, the start one?
 

namco

Alienbutserious
Joined
Sep 5, 2010
Messages
124
Best answers
2
Reaction score
32
Maybe the addDoor function was only called when you first ran the house into the server and it was saved?
Can you try calling updateDoorDescription function everytime the server starts?
Idk where or how you can do it, I'm c++ noob.
 

Znote

<?php echo $title; ?>
Staff member
Global Moderator
Premium User
Joined
Feb 14, 2008
Messages
6,532
Best answers
172
Reaction score
1,227
Location
Norway, Oslo
Clean the house database is it?

You have to clean the house_auctions table before you remove the houses. Would be weird to auction away houses that theoretically don't exist anymore. :p
 
OP
M

maikons

Member
Joined
Aug 1, 2015
Messages
192
Best answers
0
Reaction score
13
You have to clean the house_auctions table before you remove the houses. Would be weird to auction away houses that theoretically don't exist anymore. :p
I'm already tried
I can't even delete it


 
Top