Modcraft - The community dedicated to quality WoW modding!

Wrath of the Lich King Modding => Serverside Modding => Topic started by: spiderwaseem on July 04, 2016, 05:18:19 pm

Title: [TrinityCore 335] How To Make A Class Heroic?
Post by: spiderwaseem on July 04, 2016, 05:18:19 pm
Hello everyone!

I've created a new class and I was wondering, how is it possible to set the class as a heroic class?
I'd like to do this for 2 reasons:

1) The class is supposed to be a Heroic Class, special.
2) I need to set a level limitation to be able to play the class.

My main goal is somehow to make this heroic class (Class ID: 12) different from the DK heroic because DK requires a level 55, while my new class will require another level 90 character in order to play or create the class.

Is this a client-side or server-side, or maybe even both?
I'm running on TrinityCore 3.3.5a. If anyone has any ideas, it's appreciated.

Thanks,
Deathorous.
Title: Re: [TrinityCore 335] How To Make A Class Heroic?
Post by: Ascathos on July 04, 2016, 10:16:47 pm
Heroic classes are basically handled server side with client being told you shall not play. So server is your first way to go. Basically copy paste everything that dk does.
Title: Re: [TrinityCore 335] How To Make A Class Heroic?
Post by: schlumpf on July 04, 2016, 11:48:51 pm
Client knows about stuff though to forbid creation etc.
Title: Re: [TrinityCore 335] How To Make A Class Heroic?
Post by: Ascathos on July 05, 2016, 12:56:21 am
A ChrClasses flag iirc, ye
Title: Re: [TrinityCore 335] How To Make A Class Heroic?
Post by: spiderwaseem on July 05, 2016, 04:15:30 am
Alright, that makes it easier to determine what to do in a way.
However, any ideas where I should be looking into the core in specific?

The only file I could think of is player.cpp.
Doing a quick search to "Heroic", I found some interesting results such as the following:
Code: [Select]
   // set starting level
    uint32 start_level = getClass() != CLASS_DEATH_KNIGHT
        ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
        : sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);

    if (m_session->HasPermission(rbac::RBAC_PERM_USE_START_GM_LEVEL))
    {
        uint32 gm_level = sWorld->getIntConfig(CONFIG_START_GM_LEVEL);
        if (gm_level > start_level)
            start_level = gm_level;
    }

    SetUInt32Value(UNIT_FIELD_LEVEL, start_level);

    InitRunes();

    SetUInt32Value(PLAYER_FIELD_COINAGE, sWorld->getIntConfig(CONFIG_START_PLAYER_MONEY));
    SetHonorPoints(sWorld->getIntConfig(CONFIG_START_HONOR_POINTS));
    SetArenaPoints(sWorld->getIntConfig(CONFIG_START_ARENA_POINTS));

There's a lot more but this would be very long.
Anyhow, looking into the code above it also specifies something about Death Knights in resemblance to it being a heroic class on a starting level.
I'm not exactly sure how to do this yet, but I feel like I could be getting somewhere.

Any other files beside player.cpp you believe I should be looking into?

Thanks for the responses! :)
Title: Re: [TrinityCore 335] How To Make A Class Heroic?
Post by: Kaev on July 05, 2016, 07:20:18 am
https://github.com/TrinityCore/TrinityC ... r.cpp#L479 (https://github.com/TrinityCore/TrinityCore/blob/8396dabdad65fbe86c525584e38ccfacde85f9f1/src/server/game/Handlers/CharacterHandler.cpp#L479" onclick="window.open(this.href);return false;)
Title: Re: [TrinityCore 335] How To Make A Class Heroic?
Post by: spiderwaseem on July 05, 2016, 04:42:26 pm
Quote from: "Kaev"
https://github.com/TrinityCore/TrinityCore/blob/8396dabdad65fbe86c525584e38ccfacde85f9f1/src/server/game/Handlers/CharacterHandler.cpp#L479

Thank you so much! :)
Title: Re: [TrinityCore 335] How To Make A Class Heroic?
Post by: spiderwaseem on July 06, 2016, 03:01:24 am
I'm getting really close to getting what I need done.
However, for the following code (c++):

Code: [Select]
   // set starting level
uint32 start_level = getClass() != CLASS_DEATH_KNIGHT
        ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
        : sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);

I could do it this way, however, I need both classes starting at different levels so I created my own configs for it, so I can't do it this way or else the other class (CLASS_DEMONHUNTER) would be using the same configs as CLASS_DEATHKNIGHT, DKs:

Code: [Select]
   // set starting level
uint32 start_level = (getClass() != CLASS_DEATH_KNIGHT && getClass() != CLASS_DEMONHUNTER)
        ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
        : sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);

So I thought of copying the same code but changing the class to DH instead of DK and changing the configs it's directed to. So like this:

(http://puu.sh/pRIi2/5f82b3ef59.png)

However, I receive the following compiling error:
(http://puu.sh/pRIxB/e5e79ef543.jpg)



So, how should I be writing the code in this case?
My objective is to set DK to the following configs in code (defaults):
Code: [Select]
uint32 start_level = getClass() != CLASS_DEATH_KNIGHT
        ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
        : sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);

And then to have the Demon Hunter class (CLASS_DEMONHUNTER) with these custom configs in code:
Code: [Select]
uint32 start_level = getClass() != CLASS_DEMONHUNTER
        ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
        : sWorld->getIntConfig(CONFIG_START_ULTRAHEROIC_PLAYER_LEVEL);

"CONFIG_START_PLAYER_LEVEL" those stay the same for CLASS_DEMONHUNTER.
"CONFIG_START_HEROIC_PLAYER_LEVEL" need to become "CONFIG_START_ULTRAHEROIC_PLAYER_LEVEL" for CLASS_DEMONHUNTER.


Thanks!
Any help is appreciated and I appreciate the help I got so far. :)

-- Quick Update:
I have a broad understanding of the error "redefinition; muliple initialization". From what I know, the error is telling me I have repeated code. Which I technically do, but how I should write the code is what I don't understand to achieve what I wrote above.
Title: Re: [TrinityCore 335] How To Make A Class Heroic?
Post by: spiderwaseem on July 06, 2016, 03:42:44 am
FIXED THE ERROR BEFORE
Turns out it was a really simple fix.

I'll post more if I run into anything else but I believe I'm almost done. :)
Title: Re: [TrinityCore 335] How To Make A Class Heroic?
Post by: spiderwaseem on July 06, 2016, 10:53:51 pm
Thanks for all the help everyone.
I've gotten what I need. :)