@@ -3287,79 +3287,22 @@ void ObjectMgr::LoadItemTemplates()
32873287 }
32883288 }
32893289
3290- // special format
3291- if ((itemTemplate.Spells [0 ].SpellId == 483 ) || (itemTemplate.Spells [0 ].SpellId == 55884 ))
3290+ for (uint8 j = 0 ; j < MAX_ITEM_PROTO_SPELLS; ++j)
32923291 {
3293- // spell_1
3294- if (itemTemplate.Spells [0 ].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
3292+ if (itemTemplate.Spells [j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER)
32953293 {
3296- TC_LOG_ERROR (" sql.sql" , " Item (Entry: {}) has wrong item spell trigger value in spelltrigger_{} ({}) for special learning format" , entry, 0 +1 , itemTemplate.Spells [0 ].SpellTrigger );
3297- itemTemplate.Spells [0 ].SpellId = 0 ;
3298- itemTemplate.Spells [0 ].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
3299- itemTemplate.Spells [1 ].SpellId = 0 ;
3300- itemTemplate.Spells [1 ].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
3294+ TC_LOG_ERROR (" sql.sql" , " Item (Entry: {}) has wrong item spell trigger value in spelltrigger_{} ({})" , entry, j+1 , itemTemplate.Spells [j].SpellTrigger );
3295+ itemTemplate.Spells [j].SpellId = 0 ;
3296+ itemTemplate.Spells [j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
33013297 }
33023298
3303- // spell_2 have learning spell
3304- if (itemTemplate.Spells [1 ].SpellTrigger != ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
3299+ if (itemTemplate.Spells [j].SpellId > 0 )
33053300 {
3306- TC_LOG_ERROR (" sql.sql" , " Item (Entry: {}) has wrong item spell trigger value in spelltrigger_{} ({}) for special learning format." , entry, 1 +1 , itemTemplate.Spells [1 ].SpellTrigger );
3307- itemTemplate.Spells [0 ].SpellId = 0 ;
3308- itemTemplate.Spells [1 ].SpellId = 0 ;
3309- itemTemplate.Spells [1 ].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
3310- }
3311- else if (!itemTemplate.Spells [1 ].SpellId )
3312- {
3313- TC_LOG_ERROR (" sql.sql" , " Item (Entry: {}) does not have an expected spell in spellid_{} in special learning format." , entry, 1 +1 );
3314- itemTemplate.Spells [0 ].SpellId = 0 ;
3315- itemTemplate.Spells [1 ].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
3316- }
3317- else if (itemTemplate.Spells [1 ].SpellId != -1 )
3318- {
3319- SpellInfo const * spellInfo = sSpellMgr ->GetSpellInfo (itemTemplate.Spells [1 ].SpellId );
3320- if (!spellInfo && !DisableMgr::IsDisabledFor (DISABLE_TYPE_SPELL, itemTemplate.Spells [1 ].SpellId , nullptr ))
3321- {
3322- TC_LOG_ERROR (" sql.sql" , " Item (Entry: {}) has wrong (not existing) spell in spellid_{} ({})" , entry, 1 +1 , itemTemplate.Spells [1 ].SpellId );
3323- itemTemplate.Spells [0 ].SpellId = 0 ;
3324- itemTemplate.Spells [1 ].SpellId = 0 ;
3325- itemTemplate.Spells [1 ].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
3326- }
3327- // allowed only in special format
3328- else if ((itemTemplate.Spells [1 ].SpellId == 483 ) || (itemTemplate.Spells [1 ].SpellId == 55884 ))
3329- {
3330- TC_LOG_ERROR (" sql.sql" , " Item (Entry: {}) has broken spell in spellid_{} ({})" , entry, 1 +1 , itemTemplate.Spells [1 ].SpellId );
3331- itemTemplate.Spells [0 ].SpellId = 0 ;
3332- itemTemplate.Spells [1 ].SpellId = 0 ;
3333- itemTemplate.Spells [1 ].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
3334- }
3335- }
3336- }
3337- // normal spell list
3338- else
3339- {
3340- for (uint8 j = 0 ; j < MAX_ITEM_PROTO_SPELLS; ++j)
3341- {
3342- if (itemTemplate.Spells [j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER || itemTemplate.Spells [j].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
3301+ SpellInfo const * spellInfo = sSpellMgr ->GetSpellInfo (itemTemplate.Spells [j].SpellId );
3302+ if (!spellInfo && !DisableMgr::IsDisabledFor (DISABLE_TYPE_SPELL, itemTemplate.Spells [j].SpellId , nullptr ))
33433303 {
3344- TC_LOG_ERROR (" sql.sql" , " Item (Entry: {}) has wrong item spell trigger value in spelltrigger_ {} ({})" , entry, j+1 , itemTemplate.Spells [j].SpellTrigger );
3304+ TC_LOG_ERROR (" sql.sql" , " Item (Entry: {}) has wrong (not existing) spell in spellid_ {} ({})" , entry, j+1 , itemTemplate.Spells [j].SpellId );
33453305 itemTemplate.Spells [j].SpellId = 0 ;
3346- itemTemplate.Spells [j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE;
3347- }
3348-
3349- if (itemTemplate.Spells [j].SpellId && itemTemplate.Spells [j].SpellId != -1 )
3350- {
3351- SpellInfo const * spellInfo = sSpellMgr ->GetSpellInfo (itemTemplate.Spells [j].SpellId );
3352- if (!spellInfo && !DisableMgr::IsDisabledFor (DISABLE_TYPE_SPELL, itemTemplate.Spells [j].SpellId , nullptr ))
3353- {
3354- TC_LOG_ERROR (" sql.sql" , " Item (Entry: {}) has wrong (not existing) spell in spellid_{} ({})" , entry, j+1 , itemTemplate.Spells [j].SpellId );
3355- itemTemplate.Spells [j].SpellId = 0 ;
3356- }
3357- // allowed only in special format
3358- else if ((itemTemplate.Spells [j].SpellId == 483 ) || (itemTemplate.Spells [j].SpellId == 55884 ))
3359- {
3360- TC_LOG_ERROR (" sql.sql" , " Item (Entry: {}) has broken spell in spellid_{} ({})" , entry, j+1 , itemTemplate.Spells [j].SpellId );
3361- itemTemplate.Spells [j].SpellId = 0 ;
3362- }
33633306 }
33643307 }
33653308 }
0 commit comments