Jump to content

Totem Bar


darkstalker
 Share

Recommended Posts

I'm looking into implementing the totem bar functionality of spells 66842 (Call of the Elements), 66843 (Call of the Ancestors), and 66844 (Call of the Spirits). All of them should place all 4 totems selected on actions bars at once. Anyone knows something about this? Never seen this working on retail so don't have an idea on how to properly implement it.

What i've found so far: when changing a totem into the bar, this event occurs

WORLD: Received CMSG_SET_ACTION_BUTTON
BUTTON: 132 ACTION: 58704 TYPE: 0
MISC: Added Spell 58704 into button 132
Player '1' Added Action '58704' (type 0) to Button '132'

The action bar swap seems to be handled by the client.

Edit: collected all the action button ids

Elements -> Fire: 132, Earth: 133, Water: 134, Air: 135

Ancestors -> Fire: 136, Earth: 137, Water: 138, Air: 139

Spirits -> Fire: 140, Earth: 141, Water: 142, Air: 143

Link to comment
Share on other sites

    &Spell::EffectCastButtons,                              // 97 SPELL_EFFECT_CAST_BUTTONS

void Spell::EffectCastButtons(uint32 i)
{
   if (m_caster->GetTypeId() != TYPEID_PLAYER)
       return;

   Player *pl=(Player*)m_caster;

   for(int button = (132+m_spellInfo->EffectMiscValue[i]); button < (132+m_spellInfo->EffectMiscValue[i]+4); ++button)
   {
       uint32 spellId = pl->GetActionSpell(button);
       // Cast Totem in this slot
       if (spellId)
       {
           SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);

           if(!spellInfo)
               continue;

           if (pl->HasSpellCooldown(spellId))
               continue;

           uint32 cost = CalculatePowerCost(spellInfo, m_caster, GetSpellSchoolMask(spellInfo));

           if (m_caster->GetPower(Powers(spellInfo->powerType)) < cost)
               break;

           m_caster->CastSpell(m_caster, spellId, true);
           m_caster->ModifyPower(Powers(spellInfo->powerType), -(int32)cost);
           pl->AddSpellAndCategoryCooldowns(spellInfo, 0);
       }
   }
}

Dunno if it is compatibile with mangos, and you should be able to add definition to a header, right?

Link to comment
Share on other sites

The three spells have:

Effect: 97 (unknown in mangos, wowhead labeled it as "summon critter")

EffectMiscValue: 0 - 4 - 8 (the offset in the totem bar buttons)

EffectMiscValueB: 4 (numer of totems to cast?)

EffectSpellClassMaskA: 2 (meaningless)

the only spell who have effect 97 as of 3.2.2 are this ones

edit: the effect doesnt trigger because EffectImplicitTargetA[0] == 0, duno if its dbc or mangos fault.

Link to comment
Share on other sites

i have problems with this (implemented the function myself)

uint32 GetActionButtonSpell(uint8 button) const
       {
           ActionButtonList::const_iterator ab = m_actionButtons.find(button);
           return ab != m_actionButtons.end() && ab->second.uState != ACTIONBUTTON_DELETED && ab->second.GetType() == ACTION_BUTTON_SPELL ? ab->second.GetAction() : 0;
       }

got trouble getting the button after it has been "deleted" (select no totem), maybe the state change is incorrect

Link to comment
Share on other sites

my implementation:

void Spell::EffectCastButtons(uint32 i)
{
   if (!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER)
       return;

   Player *p_caster = (Player*)m_caster;
   uint32 button_id = m_spellInfo->EffectMiscValue[i] + 132;
   uint32 n_buttons = m_spellInfo->EffectMiscValueB[i];

   for (; n_buttons; n_buttons--, button_id++)
   {
       uint32 spell_id = p_caster->GetActionButtonSpell(button_id);
       if (!spell_id)
           continue;
       p_caster->CastSpell(unitTarget, spell_id, true);
   }
}

didnt have problems with cooldown or mana costs so omitted that part

the sql for the trainer spells:

-- Call of the Elements/Ancestors/Spirits trainer entries
CREATE TEMPORARY TABLE new_spells (
   spell mediumint(8) unsigned NOT NULL,
   spellcost int(10) unsigned NOT NULL default 7000, /* 70 silver */
   reqskill smallint(5) unsigned NOT NULL default 0,
   reqskillvalue smallint(5) unsigned NOT NULL default 0,
   reqlevel tinyint(3) unsigned NOT NULL,
   PRIMARY KEY (spell)
);

INSERT INTO new_spells (spell, reqlevel) VALUES
(66842, 30), /* Call of the Elements */
(66843, 40), /* Call of the Ancestors */
(66844, 50); /* Call of the Spirits */

REPLACE INTO npc_trainer SELECT 986 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 3030 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 3031 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 3032 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 3066 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 3173 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 3344 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 3403 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 13417 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 17204 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 17212 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 17219 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 17519 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 17520 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 20407 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;
REPLACE INTO npc_trainer SELECT 23127 AS entry, spell, spellcost, reqskill, reqskillvalue, reqlevel FROM new_spells;

Link to comment
Share on other sites

  • 3 weeks later...
 Share

×
×
  • 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