Guild halls support#2467
Conversation
|
I think that you missed the in-game part, should has a condition in House::setOwner that if the house is a guildHall and who is purchasing is a guild leader then should set was a guild house to the Guild. It may be good for thoses servers how uses !buyhouse command. |
|
need replace line 275 on iomapserialize.cpp thanks for advance! |
DSpeichert
left a comment
There was a problem hiding this comment.
Also read other comments, as in-game purchasing part is missing (it should not be deferred to AAC as the only method)
| `highest_bidder` int(11) NOT NULL DEFAULT '0', | ||
| `size` int(11) NOT NULL DEFAULT '0', | ||
| `beds` int(11) NOT NULL DEFAULT '0', | ||
| `guildid` int(11) NOT NULL, |
| `ownerid` int(11) NOT NULL, | ||
| `creationdata` int(11) NOT NULL, | ||
| `motd` varchar(255) NOT NULL DEFAULT '', | ||
| `residence` int(11) NOT NULL, |
| void setMotd(const std::string& motd) { | ||
| this->motd = motd; | ||
| } | ||
| uint32_t getResidenceId() const { |
There was a problem hiding this comment.
Instead of "residence" use "house", it's an actual entity in DB and really it's a house.
|
@vankk there was a reason why I didnt touch that. Currently tfs is only loading guilds from database (these guilds are created by AAC), we are not saving the guild from tfs in any scenario. So when we set the house id attribute to guild in tfs source, it won't get saved. I can write additional function that would be called after setting house id to guild, but I don't know if this is right approach. |
| `ownerid` int(11) NOT NULL, | ||
| `creationdata` int(11) NOT NULL, | ||
| `motd` varchar(255) NOT NULL DEFAULT '', | ||
| `house_id` int(11) NOT NULL, |
There was a problem hiding this comment.
You can't update schema.sql
It must be a migration.
| `highest_bidder` int(11) NOT NULL DEFAULT '0', | ||
| `size` int(11) NOT NULL DEFAULT '0', | ||
| `beds` int(11) NOT NULL DEFAULT '0', | ||
| `guild_id` int(11) NOT NULL, |
There was a problem hiding this comment.
There's also this one here that should be a migration instead.
|
LGTM |
|
Sorry, this got hidden in my backlog. Gonna take a proper look at it tonight/tomorrow. Sorry for the delay. |
|
This vs #2214
@nekiro Have you looked at my request, do you think you could give the c++ code a go there? How do I get the guildid <-> houseid reference without the reference? I go through the player id. (owner) Sample: 1: SELECT
`h`.`id`,
`h`.`owner`,
`g`.`id` AS `guild_id`
FROM `houses` AS `h`
LEFT JOIN `guilds` AS `g`
ON `h`.`owner` = `g`.`ownerid`
AND `h`.`type` = 1
WHERE `h`.`type` = 1 Sample 2: SELECT
`g`.`id`,
`g`.`ownerid`,
`h`.`id` AS `house_id`
FROM `guilds` AS `g`
LEFT JOIN `houses` AS `h`
ON `g`.`ownerid` = `h`.`owner`
AND `h`.`type` = 1If you need help with SQL code, I'm more than happy to provide more sample codes. Imported houses where type is not specified should default to 0 for backwards compatibility. (So the SQL migration should be |
There was a problem hiding this comment.
Talked to Nekiro in the staff discord channel;
Turns out I was wrong when I said it was impossible to distinguish houses and guildhalls from each other in-game, this is a problem in the database, as the sources load this information from XML.
There should be a way for an AAC with only database access to determine if a house is a guildhall, so house->setGuildHall(houseNode.attribute("guildhall") should be synced to db. Instead of some sort of bool is_guildhall, I recommend a tinyint type column as suggested in the code review.
This is to accomodate house groups and flexibility further down the line, and to give AAC makers a chance to distinguish different house categories by querying the database.
I suggest that regular houses to be set for type 0, while guildhalls be set as type 1.
With this type column, at least from the perspective of SQL querying, guild_id and house_id references is uneccesary. But I understand the desire to keep it in for simplicity in the sources.
In this pull request I'm trying to add missing guild halls support.
What does this pr add?
Probably forgot about something as always, so let me know if anything is missing, btw. I didn't test this code.
New enums:
HOUSE_TYPE_NORMAL
HOUSE_TYPE_GUILDHALL
New lua methods: