All pastes #987835 Raw Edit

Unnamed

public text v1 · immutable
#987835 ·published 2008-04-17 00:32 UTC
rendered paste body
Index: sql/updates_4x/characters_characters.sql
===================================================================
--- sql/updates_4x/characters_characters.sql	(revision 0)
+++ sql/updates_4x/characters_characters.sql	(revision 0)
@@ -0,0 +1,19 @@
+UPDATE characters.characters
+SET data = CONCAT(
+  SUBSTRING_INDEX(data,' ',225+1),
+  ' 1 0 ',
+  SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',315+1),' ',225-315),
+  ' 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ',
+  SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',621+1),' ',315-621),
+  ' 0 ',
+  SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',822+1),' ',621-822),
+  ' 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ',
+  SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',1319+1),' ',822-1319),
+  ' 0 ',
+  SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',1351+1),' ',1319-1351),
+  ' 0 ',
+  SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',1447+1),' ',1351-1447),
+  ' 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ',
+  SUBSTRING_INDEX(data,' ',-1449+1447+1)
+)
+WHERE SUBSTRING_INDEX(data,' ',1448)=data;
Index: sql/updates_4x/characters_characters.sql
===================================================================
--- sql/updates_4x/characters_characters.sql	(revision 0)
+++ sql/updates_4x/characters_characters.sql	(revision 0)
@@ -0,0 +1,19 @@
+UPDATE characters.characters
+SET data = CONCAT(
+  SUBSTRING_INDEX(data,' ',225+1),
+  ' 1 0 ',
+  SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',315+1),' ',225-315),
+  ' 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ',
+  SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',621+1),' ',315-621),
+  ' 0 ',
+  SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',822+1),' ',621-822),
+  ' 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ',
+  SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',1319+1),' ',822-1319),
+  ' 0 ',
+  SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',1351+1),' ',1319-1351),
+  ' 0 ',
+  SUBSTRING_INDEX(SUBSTRING_INDEX(data,' ',1447+1),' ',1351-1447),
+  ' 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ',
+  SUBSTRING_INDEX(data,' ',-1449+1447+1)
+)
+WHERE SUBSTRING_INDEX(data,' ',1448)=data;
Index: src/game/Player.cpp
===================================================================
--- src/game/Player.cpp	(revision 5641)
+++ src/game/Player.cpp	(working copy)
@@ -13619,17 +13444,19 @@
                 {
                     uint32 state = 0;
                     if(questStatusData.m_status == QUEST_STATUS_COMPLETE)
-                        state |= 1 << 24;
+                        state |= 1 << 0;
 
+                    uint32 stateCounter = 0;
                     for(uint8 idx = 0; idx < QUEST_OBJECTIVES_COUNT; ++idx)
                     {
                         if(questStatusData.m_creatureOrGOcount[idx])
-                            state += (questStatusData.m_creatureOrGOcount[idx] << ( 6 * idx ));
+                            stateCounter += (questStatusData.m_creatureOrGOcount[idx] << ( 8 * idx ));
                     }
 
-                    SetUInt32Value(PLAYER_QUEST_LOG_1_1 + 3*slot+0,quest_id);
-                    SetUInt32Value(PLAYER_QUEST_LOG_1_1 + 3*slot+1,state);
-                    SetUInt32Value(PLAYER_QUEST_LOG_1_1 + 3*slot+2,quest_time);
+                    SetUInt32Value(PLAYER_QUEST_LOG_1_1 + 4*slot+0,quest_id);
+                    SetUInt32Value(PLAYER_QUEST_LOG_1_1 + 4*slot+1,state);
+                    SetUInt32Value(PLAYER_QUEST_LOG_1_1 + 4*slot+2,stateCounter);
+                    SetUInt32Value(PLAYER_QUEST_LOG_1_1 + 4*slot+3,quest_time);
 
                     ++slot;
                 }
Index: src/game/SpellAuras.cpp
===================================================================
--- src/game/SpellAuras.cpp	(revision 5641)
+++ src/game/SpellAuras.cpp	(working copy)
@@ -2582,8 +2585,11 @@
             if(BattleGround *bg = ((Player*)m_target)->GetBattleGround())
                 bg->HandleDropFlag((Player*)m_target);
 
-        m_target->SetFlag(UNIT_FIELD_BYTES_1, PLAYER_STATE_FLAG_CREEP);
+        m_target->SetByteValue(UNIT_FIELD_BYTES_1, 2, 0x02);
 
+        if(m_target->GetTypeId()==TYPEID_PLAYER)
+            m_target->SetByteValue(PLAYER_FIELD_BYTES2, 1, 0x20);
+
         // only at real aura add
         if(Real)
         {
@@ -2605,8 +2611,11 @@
     }
     else
     {
-        m_target->RemoveFlag(UNIT_FIELD_BYTES_1, PLAYER_STATE_FLAG_CREEP);
+        m_target->SetByteValue(UNIT_FIELD_BYTES_1, 2, 0x00);
 
+        if(m_target->GetTypeId()==TYPEID_PLAYER)
+            m_target->SetByteValue(PLAYER_FIELD_BYTES2, 1, 0x00);
+
         // only at real aura remove
         if(Real)
         {
Index: src/game/ObjectMgr.cpp
===================================================================
--- src/game/ObjectMgr.cpp	(revision 5641)
+++ src/game/ObjectMgr.cpp	(working copy)
@@ -1271,26 +1271,92 @@
             }
         }
 
-        for (int j = 0; j < 5; j++)
+        // special format
+        if(proto->Spells[0].SpellId == SPELL_GENERIC_LEARN)
         {
-            if(proto->Spells[j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER)
+            // spell_1
+            if(proto->Spells[0].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
             {
-                sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)",i,j+1,proto->Spells[j].SpellTrigger);
-                const_cast<ItemPrototype*>(proto)->Spells[j].SpellId = 0;
-                const_cast<ItemPrototype*>(proto)->Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
+                sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format",i,0+1,proto->Spells[0].SpellTrigger);
+                const_cast<ItemPrototype*>(proto)->Spells[0].SpellId = 0;
+                const_cast<ItemPrototype*>(proto)->Spells[0].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
+                const_cast<ItemPrototype*>(proto)->Spells[1].SpellId = 0;
+                const_cast<ItemPrototype*>(proto)->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
             }
-            else if(proto->Spells[j].SpellId)
+
+            // spell_2 have learning spell
+            if(proto->Spells[1].SpellTrigger != ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
             {
-                SpellEntry const* spellInfo = sSpellStore.LookupEntry(proto->Spells[j].SpellId);
+                sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.",i,1+1,proto->Spells[1].SpellTrigger);
+                const_cast<ItemPrototype*>(proto)->Spells[0].SpellId = 0;
+                const_cast<ItemPrototype*>(proto)->Spells[1].SpellId = 0;
+                const_cast<ItemPrototype*>(proto)->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
+            }
+            else if(!proto->Spells[1].SpellId)
+            {
+                sLog.outErrorDb("Item (Entry: %u) not has expected spell in spellid_%d in special learning format.",i,1+1);
+                const_cast<ItemPrototype*>(proto)->Spells[0].SpellId = 0;
+                const_cast<ItemPrototype*>(proto)->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
+            }
+            else
+            {
+                SpellEntry const* spellInfo = sSpellStore.LookupEntry(proto->Spells[1].SpellId);
                 if(!spellInfo)
                 {
-                    sLog.outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%u)",i,j+1,proto->Spells[j].SpellId);
+                    sLog.outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%u)",i,1+1,proto->Spells[1].SpellId);
+                    const_cast<ItemPrototype*>(proto)->Spells[0].SpellId = 0;
+                    const_cast<ItemPrototype*>(proto)->Spells[1].SpellId = 0;
+                    const_cast<ItemPrototype*>(proto)->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
+                }
+                // allowed only in special format
+                else if(proto->Spells[1].SpellId==SPELL_GENERIC_LEARN)
+                {
+                    sLog.outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%u)",i,1+1,proto->Spells[1].SpellId);
+                    const_cast<ItemPrototype*>(proto)->Spells[0].SpellId = 0;
+                    const_cast<ItemPrototype*>(proto)->Spells[1].SpellId = 0;
+                    const_cast<ItemPrototype*>(proto)->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
+                }
+            }
+
+            // spell_3*,spell_4*,spell_5* is empty
+            for (int j = 2; j < 5; j++)
+            {
+                if(proto->Spells[j].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
+                {
+                    sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)",i,j+1,proto->Spells[j].SpellTrigger);
                     const_cast<ItemPrototype*>(proto)->Spells[j].SpellId = 0;
+                    const_cast<ItemPrototype*>(proto)->Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
                 }
-                else
+                else if(proto->Spells[j].SpellId != 0)
                 {
-                    if(!SpellMgr::IsSpellValid(spellInfo))
+                    sLog.outErrorDb("Item (Entry: %u) has wrong spell in spellid_%d (%u) for learning special format",i,j+1,proto->Spells[j].SpellId);
+                    const_cast<ItemPrototype*>(proto)->Spells[j].SpellId = 0;
+                }
+            }
+        }
+        // normal spell list
+        else
+        {
+            for (int j = 0; j < 5; j++)
+            {
+                if(proto->Spells[j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER || proto->Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
+                {
+                    sLog.outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)",i,j+1,proto->Spells[j].SpellTrigger);
+                    const_cast<ItemPrototype*>(proto)->Spells[j].SpellId = 0;
+                    const_cast<ItemPrototype*>(proto)->Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
+                }
+
+                if(proto->Spells[j].SpellId)
+                {
+                    SpellEntry const* spellInfo = sSpellStore.LookupEntry(proto->Spells[j].SpellId);
+                    if(!spellInfo)
                     {
+                        sLog.outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%u)",i,j+1,proto->Spells[j].SpellId);
+                        const_cast<ItemPrototype*>(proto)->Spells[j].SpellId = 0;
+                    }
+                    // allowed only in special format
+                    else if(proto->Spells[j].SpellId==SPELL_GENERIC_LEARN)
+                    {
                         sLog.outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%u)",i,j+1,proto->Spells[j].SpellId);
                         const_cast<ItemPrototype*>(proto)->Spells[j].SpellId = 0;
                     }