Ru-MaNGOS

Ru-MaNGOS (http://mangos.ytdb.ru/index.php)
-   Отвергнутые патчи (http://mangos.ytdb.ru/forumdisplay.php?f=50)
-   -   Introduced new method RemoveSpellIconIdCooldown (http://mangos.ytdb.ru/showthread.php?t=4385)

Den 11.05.2011 20:24

Introduced new method RemoveSpellIconIdCooldown
 
Код:

diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp
index 8bcb899..8751600 100644
--- a/src/game/DBCStores.cpp
+++ b/src/game/DBCStores.cpp
@@ -148,6 +148,7 @@ DBCStorage <SpellItemEnchantmentConditionEntry> sSpellItemEnchantmentConditionSt
 DBCStorage <SpellEntry> sSpellStore(SpellEntryfmt);
 SpellCategoryStore sSpellCategoryStore;
 PetFamilySpellsStore sPetFamilySpellsStore;
+SpellIconIdStore sSpellIconIdStore;
 
 DBCStorage <SpellCastTimesEntry> sSpellCastTimesStore(SpellCastTimefmt);
 DBCStorage <SpellDifficultyEntry> sSpellDifficultyStore(SpellDifficultyfmt);
@@ -485,6 +486,9 @@ void LoadDBCStores(const std::string& dataPath)
        if(spell && spell->Category)
            sSpellCategoryStore[spell->Category].insert(i);
 
+        if (spell && spell->SpellIconID)
+            sSpellIconIdStore[spell->SpellIconID].insert(i);
+
        // DBC not support uint64 fields but SpellEntry have SpellFamilyFlags mapped at 2 uint32 fields
        // uint32 field already converted to bigendian if need, but must be swapped for correct uint64 bigendian view
        #if MANGOS_ENDIAN == MANGOS_BIGENDIAN
diff --git a/src/game/DBCStores.h b/src/game/DBCStores.h
index acffa01..edec1ee 100644
--- a/src/game/DBCStores.h
+++ b/src/game/DBCStores.h
@@ -173,6 +173,7 @@ extern DBCStorage <WMOAreaTableEntry>            sWMOAreaTableStore;
 //extern DBCStorage <WorldMapAreaEntry>          sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates
 extern DBCStorage <WorldMapOverlayEntry>        sWorldMapOverlayStore;
 extern DBCStorage <WorldSafeLocsEntry>          sWorldSafeLocsStore;
+extern SpellIconIdStore                          sSpellIconIdStore;
 
 void LoadDBCStores(const std::string& dataPath);
 
diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
index 4f496e4..6d23516 100644
--- a/src/game/DBCStructure.h
+++ b/src/game/DBCStructure.h
@@ -2021,6 +2021,8 @@ typedef std::set<uint32> SpellCategorySet;
 typedef std::map<uint32,SpellCategorySet > SpellCategoryStore;
 typedef std::set<uint32> PetFamilySpellsSet;
 typedef std::map<uint32,PetFamilySpellsSet > PetFamilySpellsStore;
+typedef std::set<uint32>SpellIconIdSet;
+typedef std::map<uint32, SpellIconIdSet > SpellIconIdStore;
 
 // Structures not used for casting to loaded DBC data and not required then packing
 struct MapDifficulty
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index e6f1e3a..915d2ed 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -22781,3 +22781,21 @@ void Player::SetRestType( RestType n_r_type, uint32 areaTriggerId /*= 0*/)
            SetFFAPvP(false);
    }
 }
+
+void Player::RemoveSpellIconIdCooldown(uint32 spellIcon, bool update/*= false*/)
+{
+    SpellIconIdStore::const_iterator icon = sSpellIconIdStore.find(spellIcon);
+
+    if (icon == sSpellIconIdStore.end())
+        return;
+
+    const SpellIconIdSet& icon_set = icon->second;
+
+    for (SpellCooldowns::const_iterator i = m_spellCooldowns.begin(); i != m_spellCooldowns.end();)
+    {
+        if (icon_set.find(i->first) != icon_set.end())
+            RemoveSpellCooldown((i++)->first, update);
+        else
+            ++i;
+    }
+}
diff --git a/src/game/Player.h b/src/game/Player.h
index b2193e2..c322a54 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1657,6 +1657,7 @@ class MANGOS_DLL_SPEC Player : public Unit
        void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs );
        void RemoveSpellCooldown(uint32 spell_id, bool update = false);
        void RemoveSpellCategoryCooldown(uint32 cat, bool update = false);
+        void RemoveSpellIconIdCooldown(uint32 spellIcon, bool update = false);
        void SendClearCooldown( uint32 spell_id, Unit* target );
 
        GlobalCooldownMgr& GetGlobalCooldownMgr() { return m_GlobalCooldownMgr; }
diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp

Что-то я задумался... надо или ненадо...

zergtmn 11.05.2011 21:08

Для чего?

Vladimir 12.05.2011 00:01

Spellicon восновном хаки для выбора наборов спелов когда проверка по dbc spell family данным не помогает. Неуверен что требуется такой высокоуровневый вызов. Тем более что близы используют одинаковые иконки для совершенно разных спелов в разных классах, а уж в случае npc так вообще куча мала. А кулдауны вроде по собственным полям выбираются если не по школе магии там и т.д.?


Текущее время: 14:57. Часовой пояс GMT +3.

ru-mangos.ru - Русское сообщество MaNGOS