From 6192fcbd0c2e56fb347d3df98495d8eace6906f2 Mon Sep 17 00:00:00 2001 From: AlexDereka Date: Wed, 29 Apr 2009 15:27:50 +0400 Subject: [PATCH 1/6] [7733] Fixed compile error on VC2005ee. --- src/game/Transports.cpp | 4 ++-- src/game/Unit.cpp | 2 +- src/game/WorldSocketMgr.cpp | 2 +- src/shared/revision_nr.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index 5c1cd3a1b..290a42b21 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -436,9 +436,9 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) SetMapId(newMapid); Relocate(x, y, z); - for(PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();) + for(PlayerSet::iterator itr = m_passengers.begin(); itr != m_passengers.end();) { - PlayerSet::const_iterator it2 = itr; + PlayerSet::iterator it2 = itr; ++itr; Player *plr = *it2; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 4ed56827c..a2928a43e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7284,7 +7284,7 @@ void Unit::RemoveAllAttackers() { while (!m_attackers.empty()) { - AttackerSet::const_iterator iter = m_attackers.begin(); + AttackerSet::iterator iter = m_attackers.begin(); if(!(*iter)->AttackStop()) { sLog.outError("WORLD: Unit has an attacker that isn't attacking it!"); diff --git a/src/game/WorldSocketMgr.cpp b/src/game/WorldSocketMgr.cpp index 876862937..b7a476123 100644 --- a/src/game/WorldSocketMgr.cpp +++ b/src/game/WorldSocketMgr.cpp @@ -156,7 +156,7 @@ class ReactorRunnable : protected ACE_Task_Base ACE_ASSERT (m_Reactor); - SocketSet::const_iterator i, t; + SocketSet::iterator i, t; while (!m_Reactor->reactor_event_loop_done ()) { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a3d72c6c2..77e54d89b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7732" + #define REVISION_NR "7733" #endif // __REVISION_NR_H__ From 30992d0ac3cca4130201091fde46331b98b7dd34 Mon Sep 17 00:00:00 2001 From: Fog Date: Wed, 29 Apr 2009 22:55:30 +0400 Subject: [PATCH 2/6] [7734] Implement spell 58204 and 58205 used in DK introduction quest. Signed-off-by: VladimirMangos --- src/game/SpellAuras.cpp | 126 ++++++++++++++++++++++++--------------- src/shared/revision_nr.h | 2 +- 2 files changed, 80 insertions(+), 48 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 3c3b6b555..8c4edda26 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2176,65 +2176,97 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { case SPELLFAMILY_GENERIC: { - // Unstable Power - if( GetId()==24658 ) + switch(GetId()) { - uint32 spellId = 24659; - if (apply && caster) + // Unstable Power + case 24658: { - const SpellEntry *spell = sSpellStore.LookupEntry(spellId); - if (!spell) - return; + uint32 spellId = 24659; + if (apply && caster) + { + const SpellEntry *spell = sSpellStore.LookupEntry(spellId); + if (!spell) + return; - for (int i=0; i < spell->StackAmount; ++i) - caster->CastSpell(m_target, spell->Id, true, NULL, NULL, GetCasterGUID()); + for (int i=0; i < spell->StackAmount; ++i) + caster->CastSpell(m_target, spell->Id, true, NULL, NULL, GetCasterGUID()); + return; + } + m_target->RemoveAurasDueToSpell(spellId); return; } - m_target->RemoveAurasDueToSpell(spellId); - return; - } - // Restless Strength - if( GetId()==24661 ) - { - uint32 spellId = 24662; - if (apply && caster) + // Restless Strength + case 24661: { - const SpellEntry *spell = sSpellStore.LookupEntry(spellId); - if (!spell) + uint32 spellId = 24662; + if (apply && caster) + { + const SpellEntry *spell = sSpellStore.LookupEntry(spellId); + if (!spell) + return; + for (int i=0; i < spell->StackAmount; ++i) + caster->CastSpell(m_target, spell->Id, true, NULL, NULL, GetCasterGUID()); return; - for (int i=0; i < spell->StackAmount; ++i) - caster->CastSpell(m_target, spell->Id, true, NULL, NULL, GetCasterGUID()); + } + m_target->RemoveAurasDueToSpell(spellId); return; } - m_target->RemoveAurasDueToSpell(spellId); - return; - } - //Summon Fire Elemental - if (GetId() == 40133 && caster) - { - Unit *owner = caster->GetOwner(); - if (owner && owner->GetTypeId() == TYPEID_PLAYER) + //Summon Fire Elemental + case 40133: { - if(apply) - owner->CastSpell(owner,8985,true); - else - ((Player*)owner)->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); - } - return; - } + if (!caster) + return; - //Summon Earth Elemental - if (GetId() == 40132 && caster) - { - Unit *owner = caster->GetOwner(); - if (owner && owner->GetTypeId() == TYPEID_PLAYER) - { - if(apply) - owner->CastSpell(owner,19704,true); - else - ((Player*)owner)->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); + Unit *owner = caster->GetOwner(); + if (owner && owner->GetTypeId() == TYPEID_PLAYER) + { + if(apply) + owner->CastSpell(owner,8985,true); + else + ((Player*)owner)->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); + } + return; } - return; + //Summon Earth Elemental + case 40132 : + { + if (!caster) + return; + + Unit *owner = caster->GetOwner(); + if (owner && owner->GetTypeId() == TYPEID_PLAYER) + { + if(apply) + owner->CastSpell(owner,19704,true); + else + ((Player*)owner)->RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); + } + return; + } + // LK Intro VO (1) + case 58204: + if(m_target->GetTypeId() == TYPEID_PLAYER) + { + // Play part 1 + if(apply) + m_target->PlayDirectSound(14970, (Player *)m_target); + // continue in 58205 + else + m_target->CastSpell(m_target, 58205, true); + } + return; + // LK Intro VO (2) + case 58205: + if(m_target->GetTypeId() == TYPEID_PLAYER) + { + // Play part 2 + if(apply) + m_target->PlayDirectSound(14971, (Player *)m_target); + // Play part 3 + else + m_target->PlayDirectSound(14972, (Player *)m_target); + } + return; } break; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 77e54d89b..20307b982 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7733" + #define REVISION_NR "7734" #endif // __REVISION_NR_H__ From 57fce910e008aab4d905338c66e1ed4c272dfb19 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Thu, 30 Apr 2009 00:36:58 +0400 Subject: [PATCH 3/6] [7735] Not apply enchant mods from broken item (but allow set it duration) Signed-off-by: DiSlord --- src/game/Player.cpp | 1 + src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index f4bd869a1..c8ee02338 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -11437,6 +11437,7 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a if(!ignore_condition && pEnchant->EnchantmentCondition && !((Player*)this)->EnchantmentFitsRequirements(pEnchant->EnchantmentCondition, -1)) return; + if (!item->IsBroken()) for (int s=0; s<3; s++) { uint32 enchant_display_type = pEnchant->type[s]; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 20307b982..6105c19b7 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7734" + #define REVISION_NR "7735" #endif // __REVISION_NR_H__ From b22b603c0e6bc909693ceaffd0bbe3a187fbbda6 Mon Sep 17 00:00:00 2001 From: freghar Date: Wed, 29 Apr 2009 22:14:14 +0200 Subject: [PATCH 4/6] [7736] Do not cast Deserter debuff at gamemaster Signed-off-by: freghar --- src/game/Player.cpp | 2 +- src/shared/revision_nr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index c8ee02338..da003ff80 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17515,7 +17515,7 @@ void Player::LeaveBattleground(bool teleportToEntryPoint) bg->RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true); // call after remove to be sure that player resurrected for correct cast - if( bg->isBattleGround() && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER) ) + if( bg->isBattleGround() && !isGameMaster() && sWorld.getConfig(CONFIG_BATTLEGROUND_CAST_DESERTER) ) { if( bg->GetStatus() == STATUS_IN_PROGRESS || bg->GetStatus() == STATUS_WAIT_JOIN ) CastSpell(this, 26013, true); // Deserter diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6105c19b7..9fa633605 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7735" + #define REVISION_NR "7736" #endif // __REVISION_NR_H__ From dba73b611dc208c739cd845549dd963a3c8b4dcd Mon Sep 17 00:00:00 2001 From: Trazom Date: Thu, 30 Apr 2009 03:00:59 +0400 Subject: [PATCH 5/6] [7737] Implement ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE. Zone dependent achievement criteria required DB support. Signed-off-by: VladimirMangos --- src/game/AchievementMgr.cpp | 48 ++++++++++++++++++++++++++++++------- src/game/LootHandler.cpp | 2 ++ src/game/LootMgr.h | 18 +++++++++++++- src/game/Player.cpp | 3 +++ src/game/Player.h | 13 ---------- src/shared/revision_nr.h | 2 +- 6 files changed, 62 insertions(+), 24 deletions(-) diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 363e8cbe7..912f9508d 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -78,8 +78,9 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria) switch(criteria->requiredType) { - case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: break; default: sLog.outErrorDb( "Table `achievement_criteria_data` have data for not supported criteria type (Entry: %u Type: %u), ignore.", criteria->ID, criteria->requiredType); @@ -861,6 +862,30 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if(GetPlayer()->HasSpell(achievementCriteria->learn_spell.spellID)) SetCriteriaProgress(achievementCriteria, 1); break; + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: + { + // miscvalue1=loot_type (note: 0 = LOOT_CORSPE and then it ignored) + // miscvalue2=count of item loot + if (!miscvalue1 || !miscvalue2) + continue; + if (miscvalue1 != achievementCriteria->loot_type.lootType) + continue; + + // zone specific + if(achievementCriteria->loot_type.lootTypeCount==1) + { + // those requirements couldn't be found in the dbc + AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria); + if(!data) + continue; + + if(!data->Meets(GetPlayer(),unit)) + continue; + } + + SetCriteriaProgress(achievementCriteria, miscvalue2, PROGRESS_ACCUMULATE); + break; + } case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM: // speedup for non-login case if(miscvalue1 && achievementCriteria->own_item.itemID != miscvalue1) @@ -1142,7 +1167,6 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui case ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED: case ACHIEVEMENT_CRITERIA_TYPE_QUEST_ABANDONED: case ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN: - case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: case ACHIEVEMENT_CRITERIA_TYPE_ACCEPTED_SUMMONINGS: case ACHIEVEMENT_CRITERIA_TYPE_TOTAL: break; // Not implemented yet :( @@ -1232,6 +1256,8 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve return progress->counter >= achievementCriteria->cast_spell.castCount; case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: return progress->counter >= 1; + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: + return progress->counter >= achievementCriteria->loot_type.lootTypeCount; case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM: return progress->counter >= achievementCriteria->own_item.itemCount; case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: @@ -1672,18 +1698,22 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() switch(criteria->requiredType) { - case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: - if(!GetCriteriaDataSet(criteria)) - sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for for criteria (Entry: %u Type: %u).", criteria->ID, criteria->requiredType); - break; case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: // need skip generic cases - if(criteria->do_emote.count && !GetCriteriaDataSet(criteria)) - sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for for criteria (Entry: %u Type: %u).", criteria->ID, criteria->requiredType); + if(criteria->do_emote.count==0) + continue; break; - default: // unexpected case processed in IsValid check + case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: // any cases break; + case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE: // need skip generic cases + if(criteria->loot_type.lootTypeCount!=1) + continue; + break; + default: // type not use DB data, ignore + continue; } + if(!GetCriteriaDataSet(criteria)) + sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for for criteria (Entry: %u Type: %u).", criteria->ID, criteria->requiredType); } sLog.outString(); diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index 69b9a1f1c..0dc2b5598 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -141,6 +141,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data ) player->SendNewItem(newitem, uint32(item->count), false, false, true); player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item->itemid, item->count); + player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item->count); } else player->SendEquipError( msg, NULL, NULL ); @@ -497,6 +498,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data ) Item * newitem = target->StoreNewItem( dest, item.itemid, true, item.randomPropertyId ); target->SendNewItem(newitem, uint32(item.count), false, false, true ); target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count); + target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, pLoot->loot_type, item.count); // mark as looted item.count=0; diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h index 40ea2303a..b67ef9a31 100644 --- a/src/game/LootMgr.h +++ b/src/game/LootMgr.h @@ -55,6 +55,21 @@ enum PermissionTypes NONE_PERMISSION = 3 }; +enum LootType +{ + LOOT_CORPSE = 1, + LOOT_PICKPOCKETING = 2, + LOOT_FISHING = 3, + LOOT_DISENCHANTING = 4, + // ignored always by client + LOOT_SKINNING = 6, + LOOT_PROSPECTING = 7, + LOOT_MILLING = 8, + + LOOT_FISHINGHOLE = 20, // unsupported by client, sending LOOT_FISHING instead + LOOT_INSIGNIA = 21 // unsupported by client, sending LOOT_CORPSE instead +}; + class Player; class LootStore; @@ -224,8 +239,9 @@ struct Loot std::vector items; uint32 gold; uint8 unlootedCount; + LootType loot_type; // required for achievement system - Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0) {} + Loot(uint32 _gold = 0) : gold(_gold), unlootedCount(0), loot_type(LOOT_CORPSE) {} ~Loot() { clear(); } // if loot becomes invalid this reference is used to inform the listener diff --git a/src/game/Player.cpp b/src/game/Player.cpp index da003ff80..8383aec49 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -7320,6 +7320,9 @@ void Player::SendLoot(uint64 guid, LootType loot_type) default: break; } + // need know merged fishing/corpse loot type for achievements + loot->loot_type = loot_type; + WorldPacket data(SMSG_LOOT_RESPONSE, (9+50)); // we guess size data << uint64(guid); diff --git a/src/game/Player.h b/src/game/Player.h index 87768cc38..4eabfb5d5 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -457,20 +457,7 @@ enum ActivateTaxiReplies ERR_TAXINOTSTANDING = 12 }; -enum LootType -{ - LOOT_CORPSE = 1, - LOOT_PICKPOCKETING = 2, - LOOT_FISHING = 3, - LOOT_DISENCHANTING = 4, - // ignored always by client - LOOT_SKINNING = 6, - LOOT_PROSPECTING = 7, - LOOT_MILLING = 8, - LOOT_FISHINGHOLE = 20, // unsupported by client, sending LOOT_FISHING instead - LOOT_INSIGNIA = 21 // unsupported by client, sending LOOT_CORPSE instead -}; enum MirrorTimerType { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 9fa633605..308f2ff10 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7736" + #define REVISION_NR "7737" #endif // __REVISION_NR_H__ From c05a5312813592854409e6a660cffd3a6fc85c41 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 30 Apr 2009 04:24:48 +0400 Subject: [PATCH 6/6] [7738] Use proper indent instead if() for() style. --- src/game/Player.cpp | 530 ++++++++++++++++++++------------------- src/shared/revision_nr.h | 2 +- 2 files changed, 267 insertions(+), 265 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 8383aec49..f5f72e1c6 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -11441,301 +11441,303 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a return; if (!item->IsBroken()) - for (int s=0; s<3; s++) { - uint32 enchant_display_type = pEnchant->type[s]; - uint32 enchant_amount = pEnchant->amount[s]; - uint32 enchant_spell_id = pEnchant->spellid[s]; - - switch(enchant_display_type) + for (int s=0; s<3; s++) { - case ITEM_ENCHANTMENT_TYPE_NONE: - break; - case ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL: - // processed in Player::CastItemCombatSpell - break; - case ITEM_ENCHANTMENT_TYPE_DAMAGE: - if (item->GetSlot() == EQUIPMENT_SLOT_MAINHAND) - HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(enchant_amount), apply); - else if (item->GetSlot() == EQUIPMENT_SLOT_OFFHAND) - HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(enchant_amount), apply); - else if (item->GetSlot() == EQUIPMENT_SLOT_RANGED) - HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(enchant_amount), apply); - break; - case ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL: - if(enchant_spell_id) - { - if(apply) + uint32 enchant_display_type = pEnchant->type[s]; + uint32 enchant_amount = pEnchant->amount[s]; + uint32 enchant_spell_id = pEnchant->spellid[s]; + + switch(enchant_display_type) + { + case ITEM_ENCHANTMENT_TYPE_NONE: + break; + case ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL: + // processed in Player::CastItemCombatSpell + break; + case ITEM_ENCHANTMENT_TYPE_DAMAGE: + if (item->GetSlot() == EQUIPMENT_SLOT_MAINHAND) + HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(enchant_amount), apply); + else if (item->GetSlot() == EQUIPMENT_SLOT_OFFHAND) + HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(enchant_amount), apply); + else if (item->GetSlot() == EQUIPMENT_SLOT_RANGED) + HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(enchant_amount), apply); + break; + case ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL: + if(enchant_spell_id) { - int32 basepoints = 0; - // Random Property Exist - try found basepoints for spell (basepoints depends from item suffix factor) - if (item->GetItemRandomPropertyId()) + if(apply) { - ItemRandomSuffixEntry const *item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); - if (item_rand) + int32 basepoints = 0; + // Random Property Exist - try found basepoints for spell (basepoints depends from item suffix factor) + if (item->GetItemRandomPropertyId()) { - // Search enchant_amount - for (int k=0; k<3; k++) + ItemRandomSuffixEntry const *item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); + if (item_rand) { - if(item_rand->enchant_id[k] == enchant_id) + // Search enchant_amount + for (int k=0; k<3; k++) { - basepoints = int32((item_rand->prefix[k]*item->GetItemSuffixFactor()) / 10000 ); - break; + if(item_rand->enchant_id[k] == enchant_id) + { + basepoints = int32((item_rand->prefix[k]*item->GetItemSuffixFactor()) / 10000 ); + break; + } } } } + // Cast custom spell vs all equal basepoints getted from enchant_amount + if (basepoints) + CastCustomSpell(this,enchant_spell_id,&basepoints,&basepoints,&basepoints,true,item); + else + CastSpell(this,enchant_spell_id,true,item); } - // Cast custom spell vs all equal basepoints getted from enchant_amount - if (basepoints) - CastCustomSpell(this,enchant_spell_id,&basepoints,&basepoints,&basepoints,true,item); else - CastSpell(this,enchant_spell_id,true,item); + RemoveAurasDueToItemSpell(item,enchant_spell_id); } - else - RemoveAurasDueToItemSpell(item,enchant_spell_id); - } - break; - case ITEM_ENCHANTMENT_TYPE_RESISTANCE: - if (!enchant_amount) - { - ItemRandomSuffixEntry const *item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); - if(item_rand) + break; + case ITEM_ENCHANTMENT_TYPE_RESISTANCE: + if (!enchant_amount) { - for (int k=0; k<3; k++) + ItemRandomSuffixEntry const *item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); + if(item_rand) { - if(item_rand->enchant_id[k] == enchant_id) + for (int k=0; k<3; k++) { - enchant_amount = uint32((item_rand->prefix[k]*item->GetItemSuffixFactor()) / 10000 ); - break; + if(item_rand->enchant_id[k] == enchant_id) + { + enchant_amount = uint32((item_rand->prefix[k]*item->GetItemSuffixFactor()) / 10000 ); + break; + } } } } - } - HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + enchant_spell_id), TOTAL_VALUE, float(enchant_amount), apply); - break; - case ITEM_ENCHANTMENT_TYPE_STAT: - { - if (!enchant_amount) + HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + enchant_spell_id), TOTAL_VALUE, float(enchant_amount), apply); + break; + case ITEM_ENCHANTMENT_TYPE_STAT: { - ItemRandomSuffixEntry const *item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); - if(item_rand_suffix) + if (!enchant_amount) { - for (int k=0; k<3; k++) + ItemRandomSuffixEntry const *item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); + if(item_rand_suffix) { - if(item_rand_suffix->enchant_id[k] == enchant_id) + for (int k=0; k<3; k++) { - enchant_amount = uint32((item_rand_suffix->prefix[k]*item->GetItemSuffixFactor()) / 10000 ); - break; + if(item_rand_suffix->enchant_id[k] == enchant_id) + { + enchant_amount = uint32((item_rand_suffix->prefix[k]*item->GetItemSuffixFactor()) / 10000 ); + break; + } } } } - } - sLog.outDebug("Adding %u to stat nb %u",enchant_amount,enchant_spell_id); - switch (enchant_spell_id) - { - case ITEM_MOD_AGILITY: - sLog.outDebug("+ %u AGILITY",enchant_amount); - HandleStatModifier(UNIT_MOD_STAT_AGILITY, TOTAL_VALUE, float(enchant_amount), apply); - ApplyStatBuffMod(STAT_AGILITY, enchant_amount, apply); - break; - case ITEM_MOD_STRENGTH: - sLog.outDebug("+ %u STRENGTH",enchant_amount); - HandleStatModifier(UNIT_MOD_STAT_STRENGTH, TOTAL_VALUE, float(enchant_amount), apply); - ApplyStatBuffMod(STAT_STRENGTH, enchant_amount, apply); - break; - case ITEM_MOD_INTELLECT: - sLog.outDebug("+ %u INTELLECT",enchant_amount); - HandleStatModifier(UNIT_MOD_STAT_INTELLECT, TOTAL_VALUE, float(enchant_amount), apply); - ApplyStatBuffMod(STAT_INTELLECT, enchant_amount, apply); - break; - case ITEM_MOD_SPIRIT: - sLog.outDebug("+ %u SPIRIT",enchant_amount); - HandleStatModifier(UNIT_MOD_STAT_SPIRIT, TOTAL_VALUE, float(enchant_amount), apply); - ApplyStatBuffMod(STAT_SPIRIT, enchant_amount, apply); - break; - case ITEM_MOD_STAMINA: - sLog.outDebug("+ %u STAMINA",enchant_amount); - HandleStatModifier(UNIT_MOD_STAT_STAMINA, TOTAL_VALUE, float(enchant_amount), apply); - ApplyStatBuffMod(STAT_STAMINA, enchant_amount, apply); - break; - case ITEM_MOD_DEFENSE_SKILL_RATING: - ((Player*)this)->ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply); - sLog.outDebug("+ %u DEFENCE", enchant_amount); - break; - case ITEM_MOD_DODGE_RATING: - ((Player*)this)->ApplyRatingMod(CR_DODGE, enchant_amount, apply); - sLog.outDebug("+ %u DODGE", enchant_amount); - break; - case ITEM_MOD_PARRY_RATING: - ((Player*)this)->ApplyRatingMod(CR_PARRY, enchant_amount, apply); - sLog.outDebug("+ %u PARRY", enchant_amount); - break; - case ITEM_MOD_BLOCK_RATING: - ((Player*)this)->ApplyRatingMod(CR_BLOCK, enchant_amount, apply); - sLog.outDebug("+ %u SHIELD_BLOCK", enchant_amount); - break; - case ITEM_MOD_HIT_MELEE_RATING: - ((Player*)this)->ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply); - sLog.outDebug("+ %u MELEE_HIT", enchant_amount); - break; - case ITEM_MOD_HIT_RANGED_RATING: - ((Player*)this)->ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply); - sLog.outDebug("+ %u RANGED_HIT", enchant_amount); - break; - case ITEM_MOD_HIT_SPELL_RATING: - ((Player*)this)->ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply); - sLog.outDebug("+ %u SPELL_HIT", enchant_amount); - break; - case ITEM_MOD_CRIT_MELEE_RATING: - ((Player*)this)->ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply); - sLog.outDebug("+ %u MELEE_CRIT", enchant_amount); - break; - case ITEM_MOD_CRIT_RANGED_RATING: - ((Player*)this)->ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply); - sLog.outDebug("+ %u RANGED_CRIT", enchant_amount); - break; - case ITEM_MOD_CRIT_SPELL_RATING: - ((Player*)this)->ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply); - sLog.outDebug("+ %u SPELL_CRIT", enchant_amount); - break; -// Values from ITEM_STAT_MELEE_HA_RATING to ITEM_MOD_HASTE_RANGED_RATING are never used -// in Enchantments -// case ITEM_MOD_HIT_TAKEN_MELEE_RATING: -// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply); -// break; -// case ITEM_MOD_HIT_TAKEN_RANGED_RATING: -// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply); -// break; -// case ITEM_MOD_HIT_TAKEN_SPELL_RATING: -// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply); -// break; -// case ITEM_MOD_CRIT_TAKEN_MELEE_RATING: -// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply); -// break; -// case ITEM_MOD_CRIT_TAKEN_RANGED_RATING: -// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply); -// break; -// case ITEM_MOD_CRIT_TAKEN_SPELL_RATING: -// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply); -// break; -// case ITEM_MOD_HASTE_MELEE_RATING: -// ((Player*)this)->ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply); -// break; -// case ITEM_MOD_HASTE_RANGED_RATING: -// ((Player*)this)->ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply); -// break; - case ITEM_MOD_HASTE_SPELL_RATING: - ((Player*)this)->ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply); - break; - case ITEM_MOD_HIT_RATING: - ((Player*)this)->ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply); - ((Player*)this)->ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply); - ((Player*)this)->ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply); - sLog.outDebug("+ %u HIT", enchant_amount); - break; - case ITEM_MOD_CRIT_RATING: - ((Player*)this)->ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply); - ((Player*)this)->ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply); - ((Player*)this)->ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply); - sLog.outDebug("+ %u CRITICAL", enchant_amount); - break; -// Values ITEM_MOD_HIT_TAKEN_RATING and ITEM_MOD_CRIT_TAKEN_RATING are never used in Enchantment -// case ITEM_MOD_HIT_TAKEN_RATING: -// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply); -// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply); -// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply); -// break; -// case ITEM_MOD_CRIT_TAKEN_RATING: -// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply); -// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply); -// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply); -// break; - case ITEM_MOD_RESILIENCE_RATING: - ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply); - ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply); - ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply); - sLog.outDebug("+ %u RESILIENCE", enchant_amount); - break; - case ITEM_MOD_HASTE_RATING: - ((Player*)this)->ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply); - ((Player*)this)->ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply); - ((Player*)this)->ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply); - sLog.outDebug("+ %u HASTE", enchant_amount); - break; - case ITEM_MOD_EXPERTISE_RATING: - ((Player*)this)->ApplyRatingMod(CR_EXPERTISE, enchant_amount, apply); - sLog.outDebug("+ %u EXPERTISE", enchant_amount); - break; - case ITEM_MOD_ATTACK_POWER: - HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(enchant_amount), apply); - HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply); - sLog.outDebug("+ %u ATTACK_POWER", enchant_amount); - break; - case ITEM_MOD_RANGED_ATTACK_POWER: - HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply); - sLog.outDebug("+ %u RANGED_ATTACK_POWER", enchant_amount); - break; - case ITEM_MOD_FERAL_ATTACK_POWER: - ((Player*)this)->ApplyFeralAPBonus(enchant_amount, apply); - sLog.outDebug("+ %u FERAL_ATTACK_POWER", enchant_amount); - break; - case ITEM_MOD_SPELL_HEALING_DONE: - ((Player*)this)->ApplySpellHealingBonus(enchant_amount, apply); - sLog.outDebug("+ %u SPELL_HEALING_DONE", enchant_amount); - break; - case ITEM_MOD_SPELL_DAMAGE_DONE: - ((Player*)this)->ApplySpellDamageBonus(enchant_amount, apply); - sLog.outDebug("+ %u SPELL_DAMAGE_DONE", enchant_amount); - break; - case ITEM_MOD_MANA_REGENERATION: - ((Player*)this)->ApplyManaRegenBonus(enchant_amount, apply); - sLog.outDebug("+ %u MANA_REGENERATION", enchant_amount); - break; - case ITEM_MOD_ARMOR_PENETRATION_RATING: - ((Player*)this)->ApplyRatingMod(CR_ARMOR_PENETRATION, enchant_amount, apply); - sLog.outDebug("+ %u ARMOR PENETRATION", enchant_amount); - break; - case ITEM_MOD_SPELL_POWER: - ((Player*)this)->ApplySpellHealingBonus(enchant_amount, apply); - ((Player*)this)->ApplySpellDamageBonus(enchant_amount, apply); - sLog.outDebug("+ %u SPELL_POWER", enchant_amount); - break; - default: - break; - } - break; - } - case ITEM_ENCHANTMENT_TYPE_TOTEM: // Shaman Rockbiter Weapon - { - if(getClass() == CLASS_SHAMAN) - { - float addValue = 0.0f; - if(item->GetSlot() == EQUIPMENT_SLOT_MAINHAND) + sLog.outDebug("Adding %u to stat nb %u",enchant_amount,enchant_spell_id); + switch (enchant_spell_id) { - addValue = float(enchant_amount * item->GetProto()->Delay/1000.0f); - HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, addValue, apply); - } - else if(item->GetSlot() == EQUIPMENT_SLOT_OFFHAND ) - { - addValue = float(enchant_amount * item->GetProto()->Delay/1000.0f); - HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, addValue, apply); + case ITEM_MOD_AGILITY: + sLog.outDebug("+ %u AGILITY",enchant_amount); + HandleStatModifier(UNIT_MOD_STAT_AGILITY, TOTAL_VALUE, float(enchant_amount), apply); + ApplyStatBuffMod(STAT_AGILITY, enchant_amount, apply); + break; + case ITEM_MOD_STRENGTH: + sLog.outDebug("+ %u STRENGTH",enchant_amount); + HandleStatModifier(UNIT_MOD_STAT_STRENGTH, TOTAL_VALUE, float(enchant_amount), apply); + ApplyStatBuffMod(STAT_STRENGTH, enchant_amount, apply); + break; + case ITEM_MOD_INTELLECT: + sLog.outDebug("+ %u INTELLECT",enchant_amount); + HandleStatModifier(UNIT_MOD_STAT_INTELLECT, TOTAL_VALUE, float(enchant_amount), apply); + ApplyStatBuffMod(STAT_INTELLECT, enchant_amount, apply); + break; + case ITEM_MOD_SPIRIT: + sLog.outDebug("+ %u SPIRIT",enchant_amount); + HandleStatModifier(UNIT_MOD_STAT_SPIRIT, TOTAL_VALUE, float(enchant_amount), apply); + ApplyStatBuffMod(STAT_SPIRIT, enchant_amount, apply); + break; + case ITEM_MOD_STAMINA: + sLog.outDebug("+ %u STAMINA",enchant_amount); + HandleStatModifier(UNIT_MOD_STAT_STAMINA, TOTAL_VALUE, float(enchant_amount), apply); + ApplyStatBuffMod(STAT_STAMINA, enchant_amount, apply); + break; + case ITEM_MOD_DEFENSE_SKILL_RATING: + ((Player*)this)->ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply); + sLog.outDebug("+ %u DEFENCE", enchant_amount); + break; + case ITEM_MOD_DODGE_RATING: + ((Player*)this)->ApplyRatingMod(CR_DODGE, enchant_amount, apply); + sLog.outDebug("+ %u DODGE", enchant_amount); + break; + case ITEM_MOD_PARRY_RATING: + ((Player*)this)->ApplyRatingMod(CR_PARRY, enchant_amount, apply); + sLog.outDebug("+ %u PARRY", enchant_amount); + break; + case ITEM_MOD_BLOCK_RATING: + ((Player*)this)->ApplyRatingMod(CR_BLOCK, enchant_amount, apply); + sLog.outDebug("+ %u SHIELD_BLOCK", enchant_amount); + break; + case ITEM_MOD_HIT_MELEE_RATING: + ((Player*)this)->ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply); + sLog.outDebug("+ %u MELEE_HIT", enchant_amount); + break; + case ITEM_MOD_HIT_RANGED_RATING: + ((Player*)this)->ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply); + sLog.outDebug("+ %u RANGED_HIT", enchant_amount); + break; + case ITEM_MOD_HIT_SPELL_RATING: + ((Player*)this)->ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply); + sLog.outDebug("+ %u SPELL_HIT", enchant_amount); + break; + case ITEM_MOD_CRIT_MELEE_RATING: + ((Player*)this)->ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply); + sLog.outDebug("+ %u MELEE_CRIT", enchant_amount); + break; + case ITEM_MOD_CRIT_RANGED_RATING: + ((Player*)this)->ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply); + sLog.outDebug("+ %u RANGED_CRIT", enchant_amount); + break; + case ITEM_MOD_CRIT_SPELL_RATING: + ((Player*)this)->ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply); + sLog.outDebug("+ %u SPELL_CRIT", enchant_amount); + break; +// Values from ITEM_STAT_MELEE_HA_RATING to ITEM_MOD_HASTE_RANGED_RATING are never used +// in Enchantments +// case ITEM_MOD_HIT_TAKEN_MELEE_RATING: +// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply); +// break; +// case ITEM_MOD_HIT_TAKEN_RANGED_RATING: +// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply); +// break; +// case ITEM_MOD_HIT_TAKEN_SPELL_RATING: +// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply); +// break; +// case ITEM_MOD_CRIT_TAKEN_MELEE_RATING: +// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply); +// break; +// case ITEM_MOD_CRIT_TAKEN_RANGED_RATING: +// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply); +// break; +// case ITEM_MOD_CRIT_TAKEN_SPELL_RATING: +// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply); +// break; +// case ITEM_MOD_HASTE_MELEE_RATING: +// ((Player*)this)->ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply); +// break; +// case ITEM_MOD_HASTE_RANGED_RATING: +// ((Player*)this)->ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply); +// break; + case ITEM_MOD_HASTE_SPELL_RATING: + ((Player*)this)->ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply); + break; + case ITEM_MOD_HIT_RATING: + ((Player*)this)->ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply); + ((Player*)this)->ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply); + ((Player*)this)->ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply); + sLog.outDebug("+ %u HIT", enchant_amount); + break; + case ITEM_MOD_CRIT_RATING: + ((Player*)this)->ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply); + ((Player*)this)->ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply); + ((Player*)this)->ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply); + sLog.outDebug("+ %u CRITICAL", enchant_amount); + break; +// Values ITEM_MOD_HIT_TAKEN_RATING and ITEM_MOD_CRIT_TAKEN_RATING are never used in Enchantment +// case ITEM_MOD_HIT_TAKEN_RATING: +// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_MELEE, enchant_amount, apply); +// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_RANGED, enchant_amount, apply); +// ((Player*)this)->ApplyRatingMod(CR_HIT_TAKEN_SPELL, enchant_amount, apply); +// break; +// case ITEM_MOD_CRIT_TAKEN_RATING: +// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply); +// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply); +// ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply); +// break; + case ITEM_MOD_RESILIENCE_RATING: + ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_MELEE, enchant_amount, apply); + ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply); + ((Player*)this)->ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply); + sLog.outDebug("+ %u RESILIENCE", enchant_amount); + break; + case ITEM_MOD_HASTE_RATING: + ((Player*)this)->ApplyRatingMod(CR_HASTE_MELEE, enchant_amount, apply); + ((Player*)this)->ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply); + ((Player*)this)->ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply); + sLog.outDebug("+ %u HASTE", enchant_amount); + break; + case ITEM_MOD_EXPERTISE_RATING: + ((Player*)this)->ApplyRatingMod(CR_EXPERTISE, enchant_amount, apply); + sLog.outDebug("+ %u EXPERTISE", enchant_amount); + break; + case ITEM_MOD_ATTACK_POWER: + HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(enchant_amount), apply); + HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply); + sLog.outDebug("+ %u ATTACK_POWER", enchant_amount); + break; + case ITEM_MOD_RANGED_ATTACK_POWER: + HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply); + sLog.outDebug("+ %u RANGED_ATTACK_POWER", enchant_amount); + break; + case ITEM_MOD_FERAL_ATTACK_POWER: + ((Player*)this)->ApplyFeralAPBonus(enchant_amount, apply); + sLog.outDebug("+ %u FERAL_ATTACK_POWER", enchant_amount); + break; + case ITEM_MOD_SPELL_HEALING_DONE: + ((Player*)this)->ApplySpellHealingBonus(enchant_amount, apply); + sLog.outDebug("+ %u SPELL_HEALING_DONE", enchant_amount); + break; + case ITEM_MOD_SPELL_DAMAGE_DONE: + ((Player*)this)->ApplySpellDamageBonus(enchant_amount, apply); + sLog.outDebug("+ %u SPELL_DAMAGE_DONE", enchant_amount); + break; + case ITEM_MOD_MANA_REGENERATION: + ((Player*)this)->ApplyManaRegenBonus(enchant_amount, apply); + sLog.outDebug("+ %u MANA_REGENERATION", enchant_amount); + break; + case ITEM_MOD_ARMOR_PENETRATION_RATING: + ((Player*)this)->ApplyRatingMod(CR_ARMOR_PENETRATION, enchant_amount, apply); + sLog.outDebug("+ %u ARMOR PENETRATION", enchant_amount); + break; + case ITEM_MOD_SPELL_POWER: + ((Player*)this)->ApplySpellHealingBonus(enchant_amount, apply); + ((Player*)this)->ApplySpellDamageBonus(enchant_amount, apply); + sLog.outDebug("+ %u SPELL_POWER", enchant_amount); + break; + default: + break; } + break; } - break; - } - case ITEM_ENCHANTMENT_TYPE_USE_SPELL: - // processed in Player::CastItemUseSpell - break; - case ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET: - // nothing do.. - break; - default: - sLog.outError("Unknown item enchantment (id = %d) display type: %d", enchant_id, enchant_display_type); - break; - } /*switch(enchant_display_type)*/ - } /*for*/ + case ITEM_ENCHANTMENT_TYPE_TOTEM: // Shaman Rockbiter Weapon + { + if(getClass() == CLASS_SHAMAN) + { + float addValue = 0.0f; + if(item->GetSlot() == EQUIPMENT_SLOT_MAINHAND) + { + addValue = float(enchant_amount * item->GetProto()->Delay/1000.0f); + HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, addValue, apply); + } + else if(item->GetSlot() == EQUIPMENT_SLOT_OFFHAND ) + { + addValue = float(enchant_amount * item->GetProto()->Delay/1000.0f); + HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, addValue, apply); + } + } + break; + } + case ITEM_ENCHANTMENT_TYPE_USE_SPELL: + // processed in Player::CastItemUseSpell + break; + case ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET: + // nothing do.. + break; + default: + sLog.outError("Unknown item enchantment (id = %d) display type: %d", enchant_id, enchant_display_type); + break; + } /*switch(enchant_display_type)*/ + } /*for*/ + } // visualize enchantment at player and equipped items if(slot < MAX_INSPECTED_ENCHANTMENT_SLOT) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 308f2ff10..6944268d7 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7737" + #define REVISION_NR "7738" #endif // __REVISION_NR_H__