azerothcore/mod-guildhouse

CreatureTemplate/GameObjectTemplate ID's are partially hardcoded

dedmen opened this issue · 0 comments

dedmen commented

First up, thank you for putting down this note
https://github.com/azerothcore/mod-guildhouse/blob/master/sql/world/creatures_objects.sql#L16C26-L16C26

I indeed would have a conflict in my database.
But while there is a note and its easy to fix the database ID's.
The ID's are still hardcoded on C++ side

if (player->GetTeamId() == TEAM_ALLIANCE)
{
// Portal to Stormwind
entry = 500000;
}
else
{
// Portal to Orgrimmar
entry = 500004;
}

uint32 entry = 500031;

AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Innkeeper", GOSSIP_SENDER_MAIN, 500032, "Add an Innkeeper?", GuildHouseInnKeeper, false);

if (player->GetTeamId() == TEAM_ALLIANCE)
{
// ALLIANCE players get these options
AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Ironforge", GOSSIP_SENDER_MAIN, 500003, "Add Ironforge Portal?", GuildHousePortal, false);
AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Darnassus", GOSSIP_SENDER_MAIN, 500001, "Add Darnassus Portal?", GuildHousePortal, false);
AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Exodar", GOSSIP_SENDER_MAIN, 500002, "Add Exodar Portal?", GuildHousePortal, false);
}
else
{
// HORDE players get these options
AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Undercity", GOSSIP_SENDER_MAIN, 500007, "Add Undercity Portal?", GuildHousePortal, false);
AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Thunderbluff", GOSSIP_SENDER_MAIN, 500006, "Add Thunderbuff Portal?", GuildHousePortal, false);
AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Silvermoon", GOSSIP_SENDER_MAIN, 500005, "Add Silvermoon Portal?", GuildHousePortal, false);
}
// These two portals work for either Team
AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Shattrath", GOSSIP_SENDER_MAIN, 500008, "Add Shattrath Portal?", GuildHousePortal, false);
AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Dalaran", GOSSIP_SENDER_MAIN, 500009, "Add Dalaran Portal?", GuildHousePortal, false);

case 500032: // Innkeeper

case 500001: // Darnassus Portal
case 500002: // Exodar Portal
case 500003: // Ironforge Portal
case 500005: // Silvermoon Portal
case 500006: // Thunder Bluff Portal
case 500007: // Undercity Portal
case 500008: // Shattrath Portal
case 500009: // Dalaran Portal

There should be a config option for the Base ID so when it needs to be changed, you don't need to make over a dozen small edits in multiple c++ files.
Or atleast a #define/constant in C++ so that only one place needs to be changed