aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/base/world_database.sql6
-rw-r--r--sql/updates/10078_world_spell_proc_event.sql5
-rw-r--r--src/server/game/Entities/Player/Player.cpp87
-rw-r--r--src/server/game/Entities/Player/Player.h4
-rw-r--r--src/server/game/Server/Protocol/Handlers/MiscHandler.cpp2
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.cpp3
-rw-r--r--src/server/shared/Database/Implementation/CharacterDatabase.h1
7 files changed, 57 insertions, 51 deletions
diff --git a/sql/base/world_database.sql b/sql/base/world_database.sql
index 7dce5407797..ca6d7181161 100644
--- a/sql/base/world_database.sql
+++ b/sql/base/world_database.sql
@@ -18412,12 +18412,12 @@ INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFam
( 15600, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 1, 0, 0), -- Hand of Justice
( 16086, 0x04, 11, 0x00000000, 0x00040000, 0x00000000, 0x00030000, 0x00000000, 0, 0, 0), -- Improved Fire Nova Totem (Rank 1)
( 16544, 0x04, 11, 0x00000000, 0x00040000, 0x00000000, 0x00030000, 0x00000000, 0, 0, 0), -- Improved Fire Nova Totem (Rank 2)
-( 16176, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Ancestral Healing (Rank 1)
+( 16176, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0, 0, 0), -- Ancestral Healing (Rank 1)
( 16180, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0, 100, 0), -- Improved Water Shield (Rank 1)
( 16196, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0, 100, 0), -- Improved Water Shield (Rank 2)
( 16198, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0, 100, 0), -- Improved Water Shield (Rank 3)
-( 16235, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Ancestral Healing (Rank 2)
-( 16240, 0x00, 11, 0x000001C0, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Ancestral Healing (Rank 3)
+( 16235, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0, 0, 0), -- Ancestral Healing (Rank 2)
+( 16240, 0x00, 11, 0x000001C0, 0x00000000, 0x00000010, 0x00000000, 0x00000002, 0, 0, 0), -- Ancestral Healing (Rank 3)
( 16256, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Flurry (Rank 1)
( 16257, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Flurry (Rank 1)
( 16277, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Flurry (Rank 2)
diff --git a/sql/updates/10078_world_spell_proc_event.sql b/sql/updates/10078_world_spell_proc_event.sql
new file mode 100644
index 00000000000..66127028836
--- /dev/null
+++ b/sql/updates/10078_world_spell_proc_event.sql
@@ -0,0 +1,5 @@
+DELETE FROM `spell_proc_event` WHERE `entry` IN (16176,16235,16240);
+INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFamilyMask0`,`SpellFamilyMask1`,`SpellFamilyMask2`,`procFlags`,`procEx`,`ppmRate`,`CustomChance`,`Cooldown`) VALUES
+(16176,0x00,11,0x000001C0,0x00000000,0x00000010,0x00000000,0x00000002,0,0,0), -- Ancestral Healing (Rank 1)
+(16235,0x00,11,0x000001C0,0x00000000,0x00000010,0x00000000,0x00000002,0,0,0), -- Ancestral Healing (Rank 2)
+(16240,0x00,11,0x000001C0,0x00000000,0x00000010,0x00000000,0x00000002,0,0,0); -- Ancestral Healing (Rank 3)
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 0b1f5d0c16d..c2c19266552 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -6237,8 +6237,8 @@ void Player::SendActionButtons(uint32 state) const
{
for (uint8 button = 0; button < MAX_ACTION_BUTTONS; ++button)
{
- ActionButtonList::const_iterator itr = m_actionButtons[m_activeSpec].find(button);
- if (itr != m_actionButtons[m_activeSpec].end() && itr->second.uState != ACTIONBUTTON_DELETED)
+ ActionButtonList::const_iterator itr = m_actionButtons.find(button);
+ if (itr != m_actionButtons.end() && itr->second.uState != ACTIONBUTTON_DELETED)
data << uint32(itr->second.packedData);
else
data << uint32(0);
@@ -6292,13 +6292,13 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
return true;
}
-ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type, uint8 spec /*= 0*/)
+ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type)
{
if (!IsActionButtonDataValid(button, action, type))
return NULL;
// it create new button (NEW state) if need or return existed
- ActionButton& ab = m_actionButtons[spec][button];
+ ActionButton& ab = m_actionButtons[button];
// set data and update to CHANGED if not NEW
ab.SetActionAndType(action,ActionButtonType(type));
@@ -6309,12 +6309,12 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type, u
void Player::removeActionButton(uint8 button)
{
- ActionButtonList::iterator buttonItr = m_actionButtons[m_activeSpec].find(button);
- if (buttonItr == m_actionButtons[m_activeSpec].end() || buttonItr->second.uState == ACTIONBUTTON_DELETED)
+ ActionButtonList::iterator buttonItr = m_actionButtons.find(button);
+ if (buttonItr == m_actionButtons.end() || buttonItr->second.uState == ACTIONBUTTON_DELETED)
return;
if (buttonItr->second.uState == ACTIONBUTTON_NEW)
- m_actionButtons[m_activeSpec].erase(buttonItr); // new and not saved
+ m_actionButtons.erase(buttonItr); // new and not saved
else
buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save
@@ -6323,8 +6323,8 @@ void Player::removeActionButton(uint8 button)
ActionButton const* Player::GetActionButton(uint8 button)
{
- ActionButtonList::iterator buttonItr = m_actionButtons[m_activeSpec].find(button);
- if (buttonItr == m_actionButtons[m_activeSpec].end() || buttonItr->second.uState == ACTIONBUTTON_DELETED)
+ ActionButtonList::iterator buttonItr = m_actionButtons.find(button);
+ if (buttonItr == m_actionButtons.end() || buttonItr->second.uState == ACTIONBUTTON_DELETED)
return NULL;
return &buttonItr->second;
@@ -16617,8 +16617,7 @@ bool Player::isAllowedToLoot(const Creature* creature)
void Player::_LoadActions(PreparedQueryResult result)
{
- m_actionButtons[0].clear();
- m_actionButtons[1].clear();
+ m_actionButtons.clear();
if (result)
{
@@ -16628,22 +16627,17 @@ void Player::_LoadActions(PreparedQueryResult result)
uint8 button = fields[0].GetUInt8();
uint32 action = fields[1].GetUInt32();
uint8 type = fields[2].GetUInt8();
- uint8 spec = fields[3].GetUInt8();
- if (spec >= MAX_TALENT_SPECS)
- continue;
-
- if (ActionButton* ab = addActionButton(button, action, type, spec))
+ if (ActionButton* ab = addActionButton(button, action, type))
ab->uState = ACTIONBUTTON_UNCHANGED;
else
{
sLog.outError(" ...at loading, and will deleted in DB also");
// Will deleted in DB at next save (it can create data until save but marked as deleted)
- m_actionButtons[spec][button].uState = ACTIONBUTTON_DELETED;
+ m_actionButtons[button].uState = ACTIONBUTTON_DELETED;
}
- }
- while (result->NextRow());
+ } while (result->NextRow());
}
}
@@ -17925,32 +17919,29 @@ void Player::SaveGoldToDB(SQLTransaction& trans)
void Player::_SaveActions(SQLTransaction& trans)
{
- for (uint8 i = 0; i < MAX_TALENT_SPECS; ++i)
+ for (ActionButtonList::iterator itr = m_actionButtons.begin(); itr != m_actionButtons.end();)
{
- for (ActionButtonList::iterator itr = m_actionButtons[i].begin(); itr != m_actionButtons[i].end();)
+ switch (itr->second.uState)
{
- switch (itr->second.uState)
- {
- case ACTIONBUTTON_NEW:
- trans->PAppend("INSERT INTO character_action (guid,spec,button,action,type) VALUES ('%u', '%u', '%u', '%u', '%u')",
- GetGUIDLow(), i, (uint32)itr->first, (uint32)itr->second.GetAction(), (uint32)itr->second.GetType());
- itr->second.uState = ACTIONBUTTON_UNCHANGED;
- ++itr;
- break;
- case ACTIONBUTTON_CHANGED:
- trans->PAppend("UPDATE character_action SET action = '%u', type = '%u' WHERE guid = '%u' AND button = '%u' AND spec = '%u'",
- (uint32)itr->second.GetAction(), (uint32)itr->second.GetType(), GetGUIDLow(), (uint32)itr->first, i);
- itr->second.uState = ACTIONBUTTON_UNCHANGED;
- ++itr;
- break;
- case ACTIONBUTTON_DELETED:
- trans->PAppend("DELETE FROM character_action WHERE guid = '%u' and button = '%u' and spec = '%u'", GetGUIDLow(), (uint32)itr->first, i);
- m_actionButtons[i].erase(itr++);
- break;
- default:
- ++itr;
- break;
- }
+ case ACTIONBUTTON_NEW:
+ trans->PAppend("INSERT INTO character_action (guid,spec,button,action,type) VALUES ('%u', '%u', '%u', '%u', '%u')",
+ GetGUIDLow(), m_activeSpec, (uint32)itr->first, (uint32)itr->second.GetAction(), (uint32)itr->second.GetType());
+ itr->second.uState = ACTIONBUTTON_UNCHANGED;
+ ++itr;
+ break;
+ case ACTIONBUTTON_CHANGED:
+ trans->PAppend("UPDATE character_action SET action = '%u', type = '%u' WHERE guid = '%u' AND button = '%u' AND spec = '%u'",
+ (uint32)itr->second.GetAction(), (uint32)itr->second.GetType(), GetGUIDLow(), (uint32)itr->first, m_activeSpec);
+ itr->second.uState = ACTIONBUTTON_UNCHANGED;
+ ++itr;
+ break;
+ case ACTIONBUTTON_DELETED:
+ trans->PAppend("DELETE FROM character_action WHERE guid = '%u' and button = '%u' and spec = '%u'", GetGUIDLow(), (uint32)itr->first, m_activeSpec);
+ m_actionButtons.erase(itr++);
+ break;
+ default:
+ ++itr;
+ break;
}
}
}
@@ -23937,7 +23928,7 @@ void Player::UpdateSpecCount(uint8 count)
if (count > curCount)
{
_SaveActions(trans); // make sure the button list is cleaned up
- for (ActionButtonList::iterator itr = m_actionButtons[m_activeSpec].begin(); itr != m_actionButtons[m_activeSpec].end(); ++itr)
+ for (ActionButtonList::iterator itr = m_actionButtons.begin(); itr != m_actionButtons.end(); ++itr)
trans->PAppend("INSERT INTO character_action (guid,button,action,type,spec) VALUES ('%u', '%u', '%u', '%u', '%u')",
GetGUIDLow(), uint32(itr->first), uint32(itr->second.GetAction()), uint32(itr->second.GetType()), 1);
@@ -24084,6 +24075,14 @@ void Player::ActivateSpec(uint8 spec)
m_usedTalentCount = spentTalents;
InitTalentForLevel();
+ {
+ PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_ACTIONS_SPEC);
+ stmt->setUInt32(0, GetGUIDLow());
+ stmt->setUInt8(1, m_activeSpec);
+ if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
+ _LoadActions(result);
+ }
+
ResummonPetTemporaryUnSummonedIfAny();
if (Pet* pPet = GetPet())
pPet->InitTalentForLevel(); // not processed with aura removal because pet was not active
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index cfb1d53bc1c..b85e31fdffc 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1668,7 +1668,7 @@ class Player : public Unit, public GridObject<Player>
m_cinematic = cine;
}
- ActionButton* addActionButton(uint8 button, uint32 action, uint8 type, uint8 spec = 0);
+ ActionButton* addActionButton(uint8 button, uint32 action, uint8 type);
void removeActionButton(uint8 button);
ActionButton const* GetActionButton(uint8 button);
void SendInitialActionButtons() const { SendActionButtons(1); }
@@ -2525,7 +2525,7 @@ class Player : public Unit, public GridObject<Player>
uint32 m_Glyphs[MAX_TALENT_SPECS][MAX_GLYPH_SLOT_INDEX];
- ActionButtonList m_actionButtons[MAX_TALENT_SPECS];
+ ActionButtonList m_actionButtons;
float m_auraBaseMod[BASEMOD_END][MOD_END];
int16 m_baseRatingValue[MAX_COMBAT_RATING];
diff --git a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp
index fd3485834cf..5e775631385 100644
--- a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp
+++ b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp
@@ -1071,7 +1071,7 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
sLog.outError("MISC: Unknown action button type %u for action %u into button %u", type, action, button);
return;
}
- GetPlayer()->addActionButton(button, action, type, uint8(GetPlayer()->GetActiveSpec()));
+ GetPlayer()->addActionButton(button, action, type);
}
}
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
index 2a721c04626..ee02f8ca2d8 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp
@@ -64,7 +64,8 @@ bool CharacterDatabaseConnection::Open(const std::string& infoString)
PrepareStatement(CHAR_LOAD_PLAYER_REPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = ?");
PrepareStatement(CHAR_LOAD_PLAYER_INVENTORY, "SELECT creatorGuid, giftCreatorGuid, count, duration, charges, flags, enchantments, randomPropertyId, durability, playedTime, text, bag, slot, "
"item, item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = ? ORDER BY bag, slot");
- PrepareStatement(CHAR_LOAD_PLAYER_ACTIONS, "SELECT a.button, a.action, a.type, a.spec FROM character_action as a WHERE a.guid = ? ORDER BY button");
+ PrepareStatement(CHAR_LOAD_PLAYER_ACTIONS, "SELECT a.button, a.action, a.type FROM character_action as a, characters as c WHERE a.guid = c.guid AND a.spec = c.activespec AND a.guid = ? ORDER BY button");
+ PrepareStatement(CHAR_LOAD_PLAYER_ACTIONS_SPEC, "SELECT button, action, type FROM character_action WHERE guid = ? AND spec = ? ORDER BY button");
PrepareStatement(CHAR_LOAD_PLAYER_MAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = ? AND (checked & 1) = 0 AND deliver_time <= ?");
PrepareStatement(CHAR_LOAD_PLAYER_MAILDATE, "SELECT MIN(deliver_time) FROM mail WHERE receiver = ? AND (checked & 1) = 0");
PrepareStatement(CHAR_LOAD_PLAYER_SOCIALLIST, "SELECT friend, flags, note FROM character_social JOIN characters ON characters.guid = character_social.friend WHERE character_social.guid = ? AND deleteinfos_name IS NULL LIMIT 255");
diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h
index c088a44ff9c..4628bfafb83 100644
--- a/src/server/shared/Database/Implementation/CharacterDatabase.h
+++ b/src/server/shared/Database/Implementation/CharacterDatabase.h
@@ -72,6 +72,7 @@ enum CharacterDatabaseStatements
CHAR_LOAD_PLAYER_REPUTATION,
CHAR_LOAD_PLAYER_INVENTORY,
CHAR_LOAD_PLAYER_ACTIONS,
+ CHAR_LOAD_PLAYER_ACTIONS_SPEC,
CHAR_LOAD_PLAYER_MAILCOUNT,
CHAR_LOAD_PLAYER_MAILDATE,
CHAR_LOAD_PLAYER_SOCIALLIST,