Jump to content

[patch] Store creature power type in DB


Recommended Posts

Posted

This patch allows to specify creature power type (mana, energy, etc.) via field in creature_template. Uses same values as Powers enum.

Some remarks:

unk17 in creature cache is actually power_mod. For example http://www.wowhead.com/npc=33109 has power_mod = 0.5 in WDB.

max energy (100) * power_mod (0.5) = 50 pyrite max, that's right.

http://www.wowhead.com/npc=29859 has power_mod = 1 -> 100 energy as usual.

So I decided to use power_mod for calculating max energy.

Examples of creatures that have energy bar:

http://www.wowhead.com/npc=29840

http://www.wowhead.com/npc=37813

http://www.wowhead.com/npc=34472

http://www.wowhead.com/npc=34454

http://www.wowhead.com/npc=38200

Patch: http://paste2.org/p/1010938

SQL:

ALTER TABLE creature_template
 ADD COLUMN `PowerType` tinyint(3) unsigned NOT NULL default '0' AFTER `MaxHealth`,
 CHANGE COLUMN `unk16` `health_mod` float NOT NULL default '1',
 CHANGE COLUMN `unk17` `power_mod` float NOT NULL default '1';

  • 4 weeks later...
  • 1 month later...
  • 2 weeks later...
Posted

You got qsa's support, you can die in peace!

More seriously, patch is nicely done. I will test it in a few minutes

Little question however :

Regenerate(getPowerType());

This Regenerate method is never, and will (probably?) never be called with another argument than the current power type of the creature.

Since Regenerate does not override Unit::Regenerate method, we could replace it with :

RegenerateCurrentPower();

void Creature::RegenerateCurrentPower()
{
   uint32 power = getPowerType();
   ...

And btw, would be nice to actually move Regenerate from Creature and Player to Unit, no?

Edit : tested, works fine.

  • 2 weeks later...
  • 2 weeks later...
Posted
powertype can by extracted from UNIT_FIELD_BYTES_0.

Powers getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); }.

not need to store it..

At first we need somehow set it to correct value.

Posted
powertype can by extracted from UNIT_FIELD_BYTES_0.

Powers getPowerType() const { return Powers(GetByteValue(UNIT_FIELD_BYTES_0, 3)); }.

not need to store it..

At first we need somehow set it to correct value.

sniffer ;)

  • 5 months later...
  • 2 weeks later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use