diff options
| author | joschiwald <joschiwald.trinity@gmail.com> | 2014-08-14 16:09:14 +0200 |
|---|---|---|
| committer | joschiwald <joschiwald.trinity@gmail.com> | 2014-08-14 16:09:14 +0200 |
| commit | ccfa82e7d516c9d280fc7214fcf3672397c741ff (patch) | |
| tree | 2a6e1ed1efefae63f0ec5c0d88363023355f0c79 /src/server/game/Miscellaneous | |
| parent | 1b65cda9480bd8207b658beca82d8c54085d0c9c (diff) | |
Core/Creature: update creature_template and some other small things
http://www.trinitycore.org/f/topic/9572-creature-damage/
Diffstat (limited to 'src/server/game/Miscellaneous')
| -rw-r--r-- | src/server/game/Miscellaneous/Formulas.h | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h index 8d0e97dc765..e6ff1a0b40f 100644 --- a/src/server/game/Miscellaneous/Formulas.h +++ b/src/server/game/Miscellaneous/Formulas.h @@ -160,27 +160,32 @@ namespace Trinity inline uint32 Gain(Player* player, Unit* u) { - uint32 gain; + Creature* creature = u->ToCreature(); + uint32 gain = 0; - if (u->GetTypeId() == TYPEID_UNIT && - (((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() || - (((Creature*)u)->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) || - ((Creature*)u)->GetCreatureTemplate()->type == CREATURE_TYPE_CRITTER)) - gain = 0; - else + if (!creature || (!creature->IsTotem() && !creature->IsPet() && !creature->IsCritter() && + !(creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL))) { + float xpMod = 1.0f; + gain = BaseGain(player->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId())); - if (gain != 0 && u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isElite()) + if (gain && creature) { - // Elites in instances have a 2.75x XP bonus instead of the regular 2x world bonus. - if (u->GetMap() && u->GetMap()->IsDungeon()) - gain = uint32(gain * 2.75); - else - gain *= 2; + if (creature->isElite()) + { + // Elites in instances have a 2.75x XP bonus instead of the regular 2x world bonus. + if (u->GetMap() && u->GetMap()->IsDungeon()) + xpMod *= 2.75f; + else + xpMod *= 2.0f; + } + + xpMod *= creature->GetCreatureTemplate()->ModExperience; } - gain = uint32(gain * sWorld->getRate(RATE_XP_KILL)); + xpMod *= sWorld->getRate(RATE_XP_KILL); + gain = uint32(gain * xpMod); } sScriptMgr->OnGainCalculation(gain, player, u); |
