Dynamically scale mob HP/AP/SP

Hi there,

I’m fairly new to C++ but not to development languages – the syntax is easy to pick up but the difficulty for me is figuring out where in the TC structure to plop things so it all works as intended. (Side note, is there documentation for understanding the architecture?)

Anyway, what I’d like to do is dynamically scale the HP, Attack Power, and Spell Power of Elite mobs in dungeons/raids based on the average item level of the party. I feel comfortable modifying [FONT=‘courier new’]Creature::_GetHealthMod, [/FONT][FONT=‘courier new’]Creature::_GetDamageMod,[/FONT][FONT=arial] and [/FONT][FONT=‘courier new’]Creature::_GetSpellDamageMod[/FONT] in [FONT=‘courier new’]Creature.cpp[/FONT] to support this, but I haven’t the slightest idea of where to start for gathering the data to submit to the function. Looks like [FONT=‘courier new’]Player::GetAverageItemLevel()[/FONT] is a thing in [FONT=‘courier new’]Player.cpp[/FONT] – I expect I would implement this somewhere in [FONT=‘courier new’]LFGHandler.cpp[/FONT], but I lack the knowledge to iterate over the group members and stash the average result into a variable properly scoped to be accessible by [FONT=‘courier new’]Creature.cpp[/FONT].

Any assistance provided would be greatly appreciated. Hopefully this is a simple change?

Thanks in advance!

This might help:

for (GroupReference* itr = group->GetFirstMember(); itr; itr = itr->next())
Player* member = itr->GetSource();
if (!member || !member->GetSession())
}Notice that you need to access this in a thread safe manner.

Hmm, I see that the LFG queue is completely made with guids.

Maybe take a look at the teleporting at LFGMgr.cpp LFGMgr::MakeNewGroup

Thanks for your reply! I was actually looking at LFGMgr::MakeNewGroup right after I posted this thread.

So would I just do something like this?

[SIZE=12px]void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
LfgGuidList players;
LfgGuidList playersToTeleport;

// custom variable declarations
int size = 0;
int sum = 0;
int avg = 0;

// stock stuff here
// snip
        if (dungeon->type == LFG_TYPE_RANDOM)
        player->CastSpell(player, LFG_SPELL_DUNGEON_COOLDOWN, false);

// custom stuff begins

for (LfgGuidList::const_iterator it = players.begin(); it != players.end(); ++it)
	playercount += it;

// array declaration down here because i don't know how to do this better 
char ilevel[playercount];

for (LfgGuidList::const_iterator it = players.begin(); it != players.end(); ++it)
	ilevel[it] = player->GetAverageItemLevel();

for (int i = 0; i < size; i++)
	sum += ilevel[I];

[/I] }[I]

[/I]avg = sum / size;

// totally arbitrary numbers here
case < 100:
    rate_values[RATE_CREATE_ELITE_ELITE_HP] = 1;
    rate_values[RATE_CREATE_ELITE_ELITE_AP] = 1;
    rate_values[RATE_CREATE_ELITE_ELITE_SP] = 1;
case < 200:
    rate_values[RATE_CREATE_ELITE_ELITE_HP] = 2;
    rate_values[RATE_CREATE_ELITE_ELITE_AP] = 2;
    rate_values[RATE_CREATE_ELITE_ELITE_SP] = 2;
    rate_values[RATE_CREATE_ELITE_ELITE_HP] = 1;
    rate_values[RATE_CREATE_ELITE_ELITE_AP] = 1;
    rate_values[RATE_CREATE_ELITE_ELITE_SP] = 1;

// stock stuff here
// etc


Only question remains is whether that’s enough to override how those rate values are set in Creature.cpp?

You should probably try what you have there and see.
I would also check the parts where creature base stats are set. Try see usages of ObjectMgr::GetCreatureBaseStats

This might also be of interest:

I’m just a lowly user (no programming experience/skill), but I would be so, so, so interested in adopting this for the very small server I’ve set up for family and friends!

​If/when I ever get it working I’ll share the code. /emoticons/default_smile.png

Thanks, I’m rooting for you!