*Emalon the Stormwatcher fully scripted, by Necroo (boss needs to be spawned and ScriptName needs to be updated)
*Added config options: DurabilityLoss.OnDeath and DurabilityLoss.InPvP, optimized Rate.RepairCost --HG-- branch : trunk
This commit is contained in:
+1
-2
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "Language.h"
|
||||
#include "Config/ConfigEnv.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
#include "Opcodes.h"
|
||||
@@ -4557,7 +4556,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
|
||||
uint32 dmultiplier = dcost->multiplier[ItemSubClassToDurabilityMultiplierId(ditemProto->Class,ditemProto->SubClass)];
|
||||
uint32 costs = uint32(LostDurability*dmultiplier*double(dQualitymodEntry->quality_mod));
|
||||
|
||||
costs = uint32(costs * discountMod) * sConfig.GetFloatDefault("Rate.RepairCost", 1);
|
||||
costs = uint32(costs * discountMod) * sWorld.getRate(RATE_REPAIRCOST);
|
||||
|
||||
if (costs==0) //fix for ITEM_QUALITY_ARTIFACT
|
||||
costs = 1;
|
||||
|
||||
+3
-3
@@ -14016,10 +14016,10 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
|
||||
((Player*)pVictim)->SetPvPDeath(player!=NULL);
|
||||
|
||||
// only if not player and not controlled by player pet. And not at BG
|
||||
if (durabilityLoss && !player && !((Player*)pVictim)->InBattleGround())
|
||||
if ( (durabilityLoss && !player && !((Player*)pVictim)->InBattleGround()) || ( player && sWorld.getConfig(CONFIG_DURABILITY_LOSS_IN_PVP) ) )
|
||||
{
|
||||
DEBUG_LOG("We are dead, loosing 10 percents durability");
|
||||
((Player*)pVictim)->DurabilityLossAll(0.10f,false);
|
||||
DEBUG_LOG("We are dead, losing %u percent durability", sWorld.getRate(RATE_DURABILITY_LOSS_ON_DEATH));
|
||||
((Player*)pVictim)->DurabilityLossAll(sWorld.getRate(RATE_DURABILITY_LOSS_ON_DEATH),false);
|
||||
// durability lost message
|
||||
WorldPacket data(SMSG_DURABILITY_DAMAGE_DEATH, 0);
|
||||
((Player*)pVictim)->GetSession()->SendPacket(&data);
|
||||
|
||||
@@ -469,6 +469,12 @@ void World::LoadConfigSettings(bool reload)
|
||||
rate_values[RATE_XP_KILL] = sConfig.GetFloatDefault("Rate.XP.Kill", 1.0f);
|
||||
rate_values[RATE_XP_QUEST] = sConfig.GetFloatDefault("Rate.XP.Quest", 1.0f);
|
||||
rate_values[RATE_XP_EXPLORE] = sConfig.GetFloatDefault("Rate.XP.Explore", 1.0f);
|
||||
rate_values[RATE_REPAIRCOST] = sConfig.GetFloatDefault("Rate.RepairCost", 1.0f);
|
||||
if(rate_values[RATE_REPAIRCOST] < 0.0f)
|
||||
{
|
||||
sLog.outError("Rate.RepairCost (%f) must be >=0. Using 0.0 instead.",rate_values[RATE_REPAIRCOST]);
|
||||
rate_values[RATE_REPAIRCOST] = 0.0f;
|
||||
}
|
||||
rate_values[RATE_REPUTATION_GAIN] = sConfig.GetFloatDefault("Rate.Reputation.Gain", 1.0f);
|
||||
rate_values[RATE_REPUTATION_LOWLEVEL_KILL] = sConfig.GetFloatDefault("Rate.Reputation.LowLevel.Kill", 1.0f);
|
||||
rate_values[RATE_REPUTATION_LOWLEVEL_QUEST] = sConfig.GetFloatDefault("Rate.Reputation.LowLevel.Quest", 1.0f);
|
||||
@@ -520,6 +526,19 @@ void World::LoadConfigSettings(bool reload)
|
||||
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = NOMINAL_MELEE_RANGE;
|
||||
}
|
||||
|
||||
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = sConfig.GetFloatDefault("DurabilityLoss.OnDeath", 10.0f);
|
||||
if(rate_values[RATE_DURABILITY_LOSS_ON_DEATH] < 0.0f)
|
||||
{
|
||||
sLog.outError("DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.",rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
|
||||
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f;
|
||||
}
|
||||
if(rate_values[RATE_DURABILITY_LOSS_ON_DEATH] > 100.0f)
|
||||
{
|
||||
sLog.outError("DurabilityLoss.OnDeath (%f) must be <=100. Using 100.0 instead.",rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
|
||||
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f;
|
||||
}
|
||||
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = rate_values[RATE_DURABILITY_LOSS_ON_DEATH] / 100.0f;
|
||||
|
||||
rate_values[RATE_DURABILITY_LOSS_DAMAGE] = sConfig.GetFloatDefault("DurabilityLossChance.Damage",0.5f);
|
||||
if(rate_values[RATE_DURABILITY_LOSS_DAMAGE] < 0.0f)
|
||||
{
|
||||
@@ -547,6 +566,8 @@ void World::LoadConfigSettings(bool reload)
|
||||
|
||||
///- Read other configuration items from the config file
|
||||
|
||||
m_configs[CONFIG_DURABILITY_LOSS_IN_PVP] = sConfig.GetBoolDefault("DurabilityLoss.InPvP", false);
|
||||
|
||||
m_configs[CONFIG_COMPRESSION] = sConfig.GetIntDefault("Compression", 1);
|
||||
if(m_configs[CONFIG_COMPRESSION] < 1 || m_configs[CONFIG_COMPRESSION] > 9)
|
||||
{
|
||||
|
||||
@@ -164,6 +164,7 @@ enum WorldConfigs
|
||||
CONFIG_SKILL_GAIN_DEFENSE,
|
||||
CONFIG_SKILL_GAIN_GATHERING,
|
||||
CONFIG_SKILL_GAIN_WEAPON,
|
||||
CONFIG_DURABILITY_LOSS_IN_PVP,
|
||||
CONFIG_MAX_OVERSPEED_PINGS,
|
||||
CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY,
|
||||
CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL,
|
||||
@@ -279,6 +280,7 @@ enum Rates
|
||||
RATE_XP_KILL,
|
||||
RATE_XP_QUEST,
|
||||
RATE_XP_EXPLORE,
|
||||
RATE_REPAIRCOST,
|
||||
RATE_REPUTATION_GAIN,
|
||||
RATE_REPUTATION_LOWLEVEL_KILL,
|
||||
RATE_REPUTATION_LOWLEVEL_QUEST,
|
||||
@@ -312,6 +314,7 @@ enum Rates
|
||||
RATE_CORPSE_DECAY_LOOTED,
|
||||
RATE_INSTANCE_RESET_TIME,
|
||||
RATE_TARGET_POS_RECALCULATION_RANGE,
|
||||
RATE_DURABILITY_LOSS_ON_DEATH,
|
||||
RATE_DURABILITY_LOSS_DAMAGE,
|
||||
RATE_DURABILITY_LOSS_PARRY,
|
||||
RATE_DURABILITY_LOSS_ABSORB,
|
||||
|
||||
Reference in New Issue
Block a user