Index: src/game/SharedDefines.h =================================================================== --- src/game/SharedDefines.h (revision 6121) +++ src/game/SharedDefines.h (working copy) @@ -534,7 +534,7 @@ SPELL_EFFECT_SUMMON_GUARDIAN = 42, SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER= 43, SPELL_EFFECT_SKILL_STEP = 44, - SPELL_EFFECT_UNDEFINED_45 = 45, + SPELL_EFFECT_ADD_HONOR = 45, SPELL_EFFECT_SPAWN = 46, SPELL_EFFECT_TRADE_SKILL = 47, SPELL_EFFECT_STEALTH = 48, Index: src/game/Spell.cpp =================================================================== --- src/game/Spell.cpp (revision 6121) +++ src/game/Spell.cpp (working copy) @@ -449,6 +449,7 @@ case SPELL_EFFECT_RESURRECT: case SPELL_EFFECT_LEARN_SPELL: case SPELL_EFFECT_SKILL_STEP: + case SPELL_EFFECT_ADD_HONOR: case SPELL_EFFECT_SELF_RESURRECT: case SPELL_EFFECT_PROFICIENCY: case SPELL_EFFECT_PARRY: Index: src/game/SpellEffects.cpp =================================================================== --- src/game/SpellEffects.cpp (revision 6121) +++ src/game/SpellEffects.cpp (working copy) @@ -3153,18 +3153,75 @@ ((Player*)unitTarget)->SetSkill(skillid, skillval?skillval:1, damage*75); } -void Spell::EffectAddHonor(uint32 /*i*/) +void Spell::EffectAddHonor(uint32 i) { + // implemented basic level based honor distribution for honor giving spells if(unitTarget->GetTypeId() != TYPEID_PLAYER) return; - sLog.outDebug("SpellEffect::AddHonor called for spell_id %u , that rewards %d honor points to player: %u", m_spellInfo->Id, this->damage, ((Player*)unitTarget)->GetGUIDLow()); + // TODO: find correct formula for honor reward based on player's level! + float current_level, max_current_level,level_value, div_level; + float honor_vet[100], honor_vet2[100]; + float mul = 0; + float mult = 0; + float multi = 0; + float level_point = 0; + int sub_level_point, conv_div_level, rest, honor_vet3[100]; + int max_level_point = m_currentBasePoints[i]; + int level = (((Player*)unitTarget)->getLevel()); + + div_level = (level) / (10); + conv_div_level = (int) (div_level); + level_point = (float)(max_level_point) / (float)(70); - // TODO: find formula for honor reward based on player's level! + for(int i = 0; i < 8; ++i) + { + mul=(mul) + ((float) (i) / (float) (1)); + mult=(mult) + ((float)(i)/(float) (10)); + multi=(multi) + ((float)(i)/(float) (100)); + } + + if(level_point > mul) + { + max_current_level = (((float) (7)) / (float (10)))+ (0.1); + current_level = (((float) (conv_div_level)) / (float (10))) + (0.1); + level_value = 0.1; + } + if((level_point < mul) && (level_point > mult)) + { + max_current_level = (((float) (7)) / (float (100)))+ (0.01); + current_level = (((float) (conv_div_level)) / (float (100))) + (0.01); + level_value = 0.01; + } + if((level_point < mult) && (level_point > multi)) + { + max_current_level = (((float) (7)) / (float (1000)))+ (0.001); + current_level = (((float) (conv_div_level)) / (float (1000))) + (0.001); + level_value = 0.001; + } - // now fixed only for level 70 players: - if (((Player*)unitTarget)->getLevel() == 70) - ((Player*)unitTarget)->RewardHonor(NULL, 1, this->damage); + for(int i = 70; i > 0; i--) + { + honor_vet[70] = level_point; + honor_vet[i] = (honor_vet[i+1]) - (max_current_level); + rest = (i) % 10; + if(rest == 0) + { + max_current_level = (max_current_level) - (0.1); + } + for(int j = 70; j > 0; j--) + { + honor_vet2[j]= honor_vet[j]; + honor_vet2[j]=(honor_vet2[j]) * (j); + honor_vet3[j]=(int) (honor_vet2[j]); + sub_level_point = honor_vet3[level]; + } + } + + if (((Player*)unitTarget)->getLevel() == (level)) + ((Player*)unitTarget)->RewardHonor(NULL, 1, sub_level_point); + + sLog.outDebug("SpellEffect::AddHonor called for spell_id %u , that rewards %d honor points to player: %u", m_spellInfo->Id, sub_level_point, ((Player*)unitTarget)->GetGUIDLow()); } void Spell::EffectTradeSkill(uint32 /*i*/)