[9354] Add spell efffects for dual spec.

Actual dual spec still not implemented.

Credits to EnderGT for original patch.

Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
hunuza 2010-02-10 20:47:23 +01:00
parent 0bd88dd55a
commit 0f7f7c5ada
9 changed files with 62 additions and 15 deletions

View file

@ -21,7 +21,7 @@
DROP TABLE IF EXISTS `character_db_version`; DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` ( CREATE TABLE `character_db_version` (
`required_9349_01_characters_character_action` bit(1) default NULL `required_9354_01_characters_character_action` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
-- --
@ -341,7 +341,7 @@ CREATE TABLE `character_action` (
`button` tinyint(3) unsigned NOT NULL default '0', `button` tinyint(3) unsigned NOT NULL default '0',
`action` int(11) unsigned NOT NULL default '0', `action` int(11) unsigned NOT NULL default '0',
`type` tinyint(3) unsigned NOT NULL default '0', `type` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`guid`,`button`) PRIMARY KEY (`guid`,`spec`,`button`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System';
-- --

View file

@ -0,0 +1,3 @@
ALTER TABLE character_db_version CHANGE COLUMN required_9349_01_characters_character_action required_9354_01_characters_character_action bit;
ALTER TABLE `character_action` DROP PRIMARY KEY, ADD PRIMARY KEY(`guid`,`spec`,`button`);

View file

@ -64,6 +64,7 @@ pkgdata_DATA = \
9331_01_mangos_quest_template.sql \ 9331_01_mangos_quest_template.sql \
9339_01_characters_group.sql \ 9339_01_characters_group.sql \
9349_01_characters_character_action.sql \ 9349_01_characters_character_action.sql \
9354_01_characters_character_action.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -108,4 +109,5 @@ EXTRA_DIST = \
9331_01_mangos_quest_template.sql \ 9331_01_mangos_quest_template.sql \
9339_01_characters_group.sql \ 9339_01_characters_group.sql \
9349_01_characters_character_action.sql \ 9349_01_characters_character_action.sql \
9354_01_characters_character_action.sql \
README README

View file

@ -5634,7 +5634,7 @@ void Player::SendInitialActionButtons() const
sLog.outDetail( "Initializing Action Buttons for '%u'", GetGUIDLow() ); sLog.outDetail( "Initializing Action Buttons for '%u'", GetGUIDLow() );
WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4)); WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4));
data << uint8(0); // can be 0, 1, 2 (talent spec) data << uint8(1); // can be 0, 1, 2 (talent spec)
ActionButtonList const& currentActionButtonList = m_actionButtons[m_activeSpec]; ActionButtonList const& currentActionButtonList = m_actionButtons[m_activeSpec];
for(int button = 0; button < MAX_ACTION_BUTTONS; ++button) for(int button = 0; button < MAX_ACTION_BUTTONS; ++button)
{ {
@ -21315,12 +21315,34 @@ void Player::DeleteEquipmentSet(uint64 setGuid)
} }
} }
void Player::ActivateSpec(uint32 specNum) void Player::ActivateSpec(uint8 specNum)
{ {
if(GetActiveSpec() == specNum) if(GetActiveSpec() == specNum)
return; return;
resetTalents(true); resetTalents(true);
SetActiveSpec(specNum);
SendInitialActionButtons();
InitTalentForLevel();
}
void Player::UpdateSpecCount(uint8 count)
{
uint8 curCount = GetSpecsCount();
if(curCount == count)
return;
if(count > curCount)
{
//TODO: copy current action button set
}
SetSpecsCount(count);
SendTalentsInfoData(false);
} }
void Player::RemoveAtLoginFlag( AtLoginFlags f, bool in_db_also /*= false*/ ) void Player::RemoveAtLoginFlag( AtLoginFlags f, bool in_db_also /*= false*/ )

View file

@ -1532,11 +1532,12 @@ class MANGOS_DLL_SPEC Player : public Unit
uint32 CalculateTalentsPoints() const; uint32 CalculateTalentsPoints() const;
// Dual Spec // Dual Spec
uint32 GetActiveSpec() { return m_activeSpec; } uint8 GetActiveSpec() { return m_activeSpec; }
void SetActiveSpec(uint32 spec) { m_activeSpec = spec; } void SetActiveSpec(uint8 spec) { m_activeSpec = spec; }
uint32 GetSpecsCount() { return m_specsCount; } uint8 GetSpecsCount() { return m_specsCount; }
void SetSpecsCount(uint32 count) { m_specsCount = count; } void SetSpecsCount(uint8 count) { m_specsCount = count; }
void ActivateSpec(uint32 specNum); void ActivateSpec(uint8 specNum);
void UpdateSpecCount(uint8 count);
void InitGlyphsForLevel(); void InitGlyphsForLevel();
void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); } void SetGlyphSlot(uint8 slot, uint32 slottype) { SetUInt32Value(PLAYER_FIELD_GLYPH_SLOTS_1 + slot, slottype); }
@ -2357,8 +2358,8 @@ class MANGOS_DLL_SPEC Player : public Unit
SpellCooldowns m_spellCooldowns; SpellCooldowns m_spellCooldowns;
uint32 m_lastPotionId; // last used health/mana potion in combat, that block next potion use uint32 m_lastPotionId; // last used health/mana potion in combat, that block next potion use
uint32 m_activeSpec; uint8 m_activeSpec;
uint32 m_specsCount; uint8 m_specsCount;
ActionButtonList m_actionButtons[MAX_TALENT_SPEC_COUNT]; ActionButtonList m_actionButtons[MAX_TALENT_SPEC_COUNT];

View file

@ -328,6 +328,8 @@ class Spell
void EffectTitanGrip(uint32 i); void EffectTitanGrip(uint32 i);
void EffectEnchantItemPrismatic(uint32 i); void EffectEnchantItemPrismatic(uint32 i);
void EffectPlayMusic(uint32 i); void EffectPlayMusic(uint32 i);
void EffectSpecCount(uint32 i);
void EffectActivateSpec(uint32 i);
Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL ); Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL );
~Spell(); ~Spell();

View file

@ -218,8 +218,8 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectMilling, //158 SPELL_EFFECT_MILLING milling &Spell::EffectMilling, //158 SPELL_EFFECT_MILLING milling
&Spell::EffectRenamePet, //159 SPELL_EFFECT_ALLOW_RENAME_PET allow rename pet once again &Spell::EffectRenamePet, //159 SPELL_EFFECT_ALLOW_RENAME_PET allow rename pet once again
&Spell::EffectNULL, //160 SPELL_EFFECT_160 unused &Spell::EffectNULL, //160 SPELL_EFFECT_160 unused
&Spell::EffectNULL, //161 SPELL_EFFECT_TALENT_SPEC_COUNT second talent spec (learn/revert) &Spell::EffectSpecCount, //161 SPELL_EFFECT_TALENT_SPEC_COUNT second talent spec (learn/revert)
&Spell::EffectNULL, //162 SPELL_EFFECT_TALENT_SPEC_SELECT activate primary/secondary spec &Spell::EffectActivateSpec, //162 SPELL_EFFECT_TALENT_SPEC_SELECT activate primary/secondary spec
}; };
void Spell::EffectNULL(uint32 /*i*/) void Spell::EffectNULL(uint32 /*i*/)
@ -6996,3 +6996,20 @@ void Spell::EffectPlayMusic(uint32 i)
data << uint32(soundid); data << uint32(soundid);
((Player*)unitTarget)->GetSession()->SendPacket(&data); ((Player*)unitTarget)->GetSession()->SendPacket(&data);
} }
void Spell::EffectSpecCount(uint32 /*eff_idx*/)
{
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
((Player*)unitTarget)->UpdateSpecCount(damage);
}
void Spell::EffectActivateSpec(uint32 /*eff_idx*/)
{
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
// damage = spec + 1
((Player*)unitTarget)->ActivateSpec(damage-1);
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9353" #define REVISION_NR "9354"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__ #ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__ #define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_9349_01_characters_character_action" #define REVISION_DB_CHARACTERS "required_9354_01_characters_character_action"
#define REVISION_DB_MANGOS "required_9331_01_mangos_quest_template" #define REVISION_DB_MANGOS "required_9331_01_mangos_quest_template"
#define REVISION_DB_REALMD "required_9010_01_realmd_realmlist" #define REVISION_DB_REALMD "required_9010_01_realmd_realmlist"
#endif // __REVISION_SQL_H__ #endif // __REVISION_SQL_H__