This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Semga

Pages: [1]
1
Miscellaneous / [SOLVED] [QUESTION:WotlK] Third faction problem
« on: October 25, 2015, 06:03:24 pm »
Hello. So, I wanted to exclude night elves from Alliance team and create a separate team for them.
Firstly, I added a team in FactionGroup.dbc, here is the result:
 

 
Secondly, I edited ChrRaces.dbc, changed teamID in 8th column to 2 for night elves. As far as I understand, this value will be later used on server in Player.cpp method uint32 Player::TeamForRace, but let’s talk about that later.
So ChrRaces.dbc here:

 
Then I edited Faction.dbc:  removed Alliance racemasks from night elves faction 69 Darnas and removed night elves racemask from all alliance factions like Stormwind, Alliance and etc. Edited hostile races masks and friendly racemasks. Set parentFactionId to 1161(my new faction category, it’s a copy of Alliance faction category except for changed name and friendly/enemy racemasks and changed reputationIndex(2th column)). There is no problem here. Just for example, faction 69 looks like:

1783 - racemask of all races without nelfs and 8 - night elves.
Next, FactionTemplate.dbc. Parsed it and added to Hostile factionGroup mask(6th column) my new factionGroup mask 16 for Kaldorei, where Alliance faction is presented as hostile. Then edited player factionTemplate with id 4 which goes for night elves players. Changed FightSupport(4th column) to 17(As far as I understand, it’s a mask from FactionGroup which means 1+16 where 1 - Player, 16 - Kaldorei. For example for Horde player(orc) we have 1+4 and for human 1+2). Friendly mask(5th column) edited to 16 and enemy hostile mask to 14(which is 2(Alliance)+4(Horde)+8(Monsters)).
 
Okay, a bit about the core.
Added new data to enums

Changed Player class method TeamForRace(added new case)
uint32 Player::TeamForRace(uint8 race)
{
    if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(race))
    {
        switch (rEntry->TeamID)
        {
            case 1: return HORDE;
            case 2: return NELF; // ADDED MY CASE HERE
            case 7: return ALLIANCE;
        }
        TC_LOG_ERROR("entities.player", "Race (%u) has wrong teamid (%u) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID);
    }
    else
        TC_LOG_ERROR("entities.player", "Race (%u) not found in DBC: wrong DBC files?", uint32(race));
 
    return ALLIANCE;
}
 
And ofc changed const method GetTeamId()
 
TeamId GetTeamId() const { return m_team == ALLIANCE ? TEAM_ALLIANCE : m_team == HORDE ? TEAM_HORDE : TEAM_NELF; }
 
So... Now my problem: everything works fine except that I can’t create a night elf character because client GlueXML does not create a button for night elves. Reason goes to CharacterCreate.lua file where lua function CharacterCreateEnumerateRaces() being called with lua funciton GetAvailableRaces() as params. So GetAvailableRaces() returns all needed races exept night elves. I see no reason why this is happening because if I try to create a night elf without a patched FactionTemplate.dbc on client and then set patched dbc back and try to play as night elf created before everything works as it should in every damn aspect.
After some research I came to conclusion that problem source is FightSupport(4th column) in FactionTemplate. As I told before, I set it to 17 as it should be for night elf player factiontemplate with id 4, as I described before too. But that’s also the reason it doesn’t work.

Pages: [1]