summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Enchantments.cpp642
-rw-r--r--src/Enchantments.h8
-rw-r--r--src/Item.cpp166
-rw-r--r--src/UI/SlotArea.cpp5
-rw-r--r--src/UI/Window.cpp8
5 files changed, 418 insertions, 411 deletions
diff --git a/src/Enchantments.cpp b/src/Enchantments.cpp
index ca72065ff..3a65b7284 100644
--- a/src/Enchantments.cpp
+++ b/src/Enchantments.cpp
@@ -219,270 +219,270 @@ bool cEnchantments::operator !=(const cEnchantments & a_Other) const
-void cEnchantments::AddItemEnchantmentWeights(cWeightedEnchantments & a_Enchantments, short & a_ItemType, int a_EnchantmentLevel)
+void cEnchantments::AddItemEnchantmentWeights(cWeightedEnchantments & a_Enchantments, short a_ItemType, int a_EnchantmentLevel)
{
if (ItemCategory::IsSword(a_ItemType))
{
// Sharpness
- if (a_EnchantmentLevel >= 34 && a_EnchantmentLevel <= 54)
+ if ((a_EnchantmentLevel >= 34) && (a_EnchantmentLevel <= 54))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Sharpness=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchSharpness, 4);
}
- else if (a_EnchantmentLevel >= 23 && a_EnchantmentLevel <= 43)
+ else if ((a_EnchantmentLevel >= 23) && (a_EnchantmentLevel <= 43))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Sharpness=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchSharpness, 3);
}
- else if (a_EnchantmentLevel >= 12 && a_EnchantmentLevel <= 32)
+ else if ((a_EnchantmentLevel >= 12) && (a_EnchantmentLevel <= 32))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Sharpness=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchSharpness, 2);
}
- else if (a_EnchantmentLevel >= 1 && a_EnchantmentLevel <= 21)
+ else if ((a_EnchantmentLevel >= 1) && (a_EnchantmentLevel <= 21))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Sharpness=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchSharpness, 1);
}
// Smite
- if (a_EnchantmentLevel >= 29 && a_EnchantmentLevel <= 49)
+ if ((a_EnchantmentLevel >= 29) && (a_EnchantmentLevel <= 49))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Smite=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchSmite, 4);
}
- else if (a_EnchantmentLevel >= 21 && a_EnchantmentLevel <= 41)
+ else if ((a_EnchantmentLevel >= 21) && (a_EnchantmentLevel <= 41))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Smite=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchSmite, 3);
}
- else if (a_EnchantmentLevel >= 13 && a_EnchantmentLevel <= 33)
+ else if ((a_EnchantmentLevel >= 13) && (a_EnchantmentLevel <= 33))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Smite=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchSmite, 2);
}
- else if (a_EnchantmentLevel >= 5 && a_EnchantmentLevel <= 25)
+ else if ((a_EnchantmentLevel >= 5) && (a_EnchantmentLevel <= 25))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Smite=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchSmite, 1);
}
// Bane of Arthropods
- if (a_EnchantmentLevel >= 29 && a_EnchantmentLevel <= 49)
+ if ((a_EnchantmentLevel >= 29) && (a_EnchantmentLevel <= 49))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("BaneOfArthropods=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchBaneOfArthropods, 4);
}
- else if (a_EnchantmentLevel >= 21 && a_EnchantmentLevel <= 41)
+ else if ((a_EnchantmentLevel >= 21) && (a_EnchantmentLevel <= 41))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("BaneOfArthropods=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchBaneOfArthropods, 3);
}
- else if (a_EnchantmentLevel >= 13 && a_EnchantmentLevel <= 33)
+ else if ((a_EnchantmentLevel >= 13) && (a_EnchantmentLevel <= 33))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("BaneOfArthropods=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchBaneOfArthropods, 2);
}
- else if (a_EnchantmentLevel >= 5 && a_EnchantmentLevel <= 25)
+ else if ((a_EnchantmentLevel >= 5) && (a_EnchantmentLevel <= 25))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("BaneOfArthropods=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchBaneOfArthropods, 1);
}
// Knockback
- if (a_EnchantmentLevel >= 25 && a_EnchantmentLevel <= 75)
+ if ((a_EnchantmentLevel >= 25) && (a_EnchantmentLevel <= 75))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Knockback=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchKnockback, 2);
}
- else if (a_EnchantmentLevel >= 5 && a_EnchantmentLevel <= 55)
+ else if ((a_EnchantmentLevel >= 5) && (a_EnchantmentLevel <= 55))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Knockback=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchKnockback, 1);
}
// Fire Aspect
- if (a_EnchantmentLevel >= 30 && a_EnchantmentLevel <= 80)
+ if ((a_EnchantmentLevel >= 30) && (a_EnchantmentLevel <= 80))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("FireAspect=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchFireAspect, 2);
}
- else if (a_EnchantmentLevel >= 10 && a_EnchantmentLevel <= 60)
+ else if ((a_EnchantmentLevel >= 10) && (a_EnchantmentLevel <= 60))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("FireAspect=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchFireAspect, 1);
}
// Looting
- if (a_EnchantmentLevel >= 33 && a_EnchantmentLevel <= 83)
+ if ((a_EnchantmentLevel >= 33) && (a_EnchantmentLevel <= 83))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Looting=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchLooting, 3);
}
- else if (a_EnchantmentLevel >= 24 && a_EnchantmentLevel <= 74)
+ else if ((a_EnchantmentLevel >= 24) && (a_EnchantmentLevel <= 74))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Looting=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchLooting, 2);
}
- else if (a_EnchantmentLevel >= 15 && a_EnchantmentLevel <= 65)
+ else if ((a_EnchantmentLevel >= 15) && (a_EnchantmentLevel <= 65))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Looting=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchLooting, 1);
}
}
else if (ItemCategory::IsTool(a_ItemType))
{
// Efficiency
- if (a_EnchantmentLevel >= 31 && a_EnchantmentLevel <= 81)
+ if ((a_EnchantmentLevel >= 31) && (a_EnchantmentLevel <= 81))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Efficiency=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchEfficiency, 4);
}
- else if (a_EnchantmentLevel >= 21 && a_EnchantmentLevel <= 71)
+ else if ((a_EnchantmentLevel >= 21) && (a_EnchantmentLevel <= 71))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Efficiency=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchEfficiency, 3);
}
- else if (a_EnchantmentLevel >= 11 && a_EnchantmentLevel <= 61)
+ else if ((a_EnchantmentLevel >= 11) && (a_EnchantmentLevel <= 61))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Efficiency=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchEfficiency, 2);
}
- else if (a_EnchantmentLevel >= 1 && a_EnchantmentLevel <= 51)
+ else if ((a_EnchantmentLevel >= 1) && (a_EnchantmentLevel <= 51))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Efficiency=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchEfficiency, 1);
}
// Silk Touch
- if (a_EnchantmentLevel >= 15 && a_EnchantmentLevel <= 65)
+ if ((a_EnchantmentLevel >= 15) && (a_EnchantmentLevel <= 65))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("SilkTouch=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchSilkTouch, 1);
}
// Fortune
- if (a_EnchantmentLevel >= 33 && a_EnchantmentLevel <= 83)
+ if ((a_EnchantmentLevel >= 33) && (a_EnchantmentLevel <= 83))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Fortune=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchFortune, 3);
}
- else if (a_EnchantmentLevel >= 24 && a_EnchantmentLevel <= 74)
+ else if ((a_EnchantmentLevel >= 24) && (a_EnchantmentLevel <= 74))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Fortune=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchFortune, 2);
}
- else if (a_EnchantmentLevel >= 15 && a_EnchantmentLevel <= 65)
+ else if ((a_EnchantmentLevel >= 15) && (a_EnchantmentLevel <= 65))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Fortune=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchFortune, 1);
}
}
else if (ItemCategory::IsArmor(a_ItemType))
{
// Protection
- if (a_EnchantmentLevel >= 34 && a_EnchantmentLevel <= 54)
+ if ((a_EnchantmentLevel >= 34) && (a_EnchantmentLevel <= 54))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Protection=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchProtection, 4);
}
- else if (a_EnchantmentLevel >= 23 && a_EnchantmentLevel <= 43)
+ else if ((a_EnchantmentLevel >= 23) && (a_EnchantmentLevel <= 43))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Protection=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchProtection, 3);
}
- else if (a_EnchantmentLevel >= 12 && a_EnchantmentLevel <= 32)
+ else if ((a_EnchantmentLevel >= 12) && (a_EnchantmentLevel <= 32))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Protection=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchProtection, 2);
}
- else if (a_EnchantmentLevel >= 1 && a_EnchantmentLevel <= 21)
+ else if ((a_EnchantmentLevel >= 1) && (a_EnchantmentLevel <= 21))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Protection=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchProtection, 1);
}
// Fire Protection
- if (a_EnchantmentLevel >= 34 && a_EnchantmentLevel <= 46)
+ if ((a_EnchantmentLevel >= 34) && (a_EnchantmentLevel <= 46))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FireProtection=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFireProtection, 4);
}
- else if (a_EnchantmentLevel >= 26 && a_EnchantmentLevel <= 38)
+ else if ((a_EnchantmentLevel >= 26) && (a_EnchantmentLevel <= 38))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FireProtection=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFireProtection, 3);
}
- else if (a_EnchantmentLevel >= 18 && a_EnchantmentLevel <= 30)
+ else if ((a_EnchantmentLevel >= 18) && (a_EnchantmentLevel <= 30))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FireProtection=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFireProtection, 2);
}
- else if (a_EnchantmentLevel >= 10 && a_EnchantmentLevel <= 22)
+ else if ((a_EnchantmentLevel >= 10) && (a_EnchantmentLevel <= 22))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FireProtection=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFireProtection, 1);
}
// Blast Protection
- if (a_EnchantmentLevel >= 29 && a_EnchantmentLevel <= 41)
+ if ((a_EnchantmentLevel >= 29) && (a_EnchantmentLevel <= 41))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("BlastProtection=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchBlastProtection, 4);
}
- else if (a_EnchantmentLevel >= 21 && a_EnchantmentLevel <= 33)
+ else if ((a_EnchantmentLevel >= 21) && (a_EnchantmentLevel <= 33))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("BlastProtection=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchBlastProtection, 3);
}
- else if (a_EnchantmentLevel >= 13 && a_EnchantmentLevel <= 25)
+ else if ((a_EnchantmentLevel >= 13) && (a_EnchantmentLevel <= 25))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("BlastProtection=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchBlastProtection, 2);
}
- else if (a_EnchantmentLevel >= 5 && a_EnchantmentLevel <= 17)
+ else if ((a_EnchantmentLevel >= 5) && (a_EnchantmentLevel <= 17))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("BlastProtection=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchBlastProtection, 1);
}
// Projectile Protection
- if (a_EnchantmentLevel >= 21 && a_EnchantmentLevel <= 36)
+ if ((a_EnchantmentLevel >= 21) && (a_EnchantmentLevel <= 36))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("ProjectileProtection=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchProjectileProtection, 4);
}
- else if (a_EnchantmentLevel >= 15 && a_EnchantmentLevel <= 30)
+ else if ((a_EnchantmentLevel >= 15) && (a_EnchantmentLevel <= 30))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("ProjectileProtection=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchProjectileProtection, 3);
}
- else if (a_EnchantmentLevel >= 9 && a_EnchantmentLevel <= 24)
+ else if ((a_EnchantmentLevel >= 9) && (a_EnchantmentLevel <= 24))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("ProjectileProtection=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchProjectileProtection, 2);
}
- else if (a_EnchantmentLevel >= 3 && a_EnchantmentLevel <= 18)
+ else if ((a_EnchantmentLevel >= 3) && (a_EnchantmentLevel <= 18))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("ProjectileProtection=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchProjectileProtection, 1);
}
// Thorns
- if (a_EnchantmentLevel >= 50 && a_EnchantmentLevel <= 100)
+ if ((a_EnchantmentLevel >= 50) && (a_EnchantmentLevel <= 100))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Thorns=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchThorns, 3);
}
- else if (a_EnchantmentLevel >= 30 && a_EnchantmentLevel <= 80)
+ else if ((a_EnchantmentLevel >= 30) && (a_EnchantmentLevel <= 80))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Thorns=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchThorns, 2);
}
- else if (a_EnchantmentLevel >= 10 && a_EnchantmentLevel <= 60)
+ else if ((a_EnchantmentLevel >= 10) && (a_EnchantmentLevel <= 60))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Thorns=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchThorns, 1);
}
if (ItemCategory::IsHelmet(a_ItemType))
{
// Respiration
- if (a_EnchantmentLevel >= 30 && a_EnchantmentLevel <= 60)
+ if ((a_EnchantmentLevel >= 30) && (a_EnchantmentLevel <= 60))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Respiration=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchRespiration, 3);
}
- else if (a_EnchantmentLevel >= 20 && a_EnchantmentLevel <= 50)
+ else if ((a_EnchantmentLevel >= 20) && (a_EnchantmentLevel <= 50))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Respiration=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchRespiration, 2);
}
- else if (a_EnchantmentLevel >= 10 && a_EnchantmentLevel <= 40)
+ else if ((a_EnchantmentLevel >= 10) && (a_EnchantmentLevel <= 40))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Respiration=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchRespiration, 1);
}
// Aqua Affinity
- if (a_EnchantmentLevel >= 1 && a_EnchantmentLevel <= 41)
+ if ((a_EnchantmentLevel >= 1) && (a_EnchantmentLevel <= 41))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("AquaAffinity=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchAquaAffinity, 1);
}
}
else if (ItemCategory::IsBoots(a_ItemType))
{
// Feather Fall
- if (a_EnchantmentLevel >= 23 && a_EnchantmentLevel <= 33)
+ if ((a_EnchantmentLevel >= 23) && (a_EnchantmentLevel <= 33))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FeatherFalling=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFeatherFalling, 4);
}
- else if (a_EnchantmentLevel >= 17 && a_EnchantmentLevel <= 27)
+ else if ((a_EnchantmentLevel >= 17) && (a_EnchantmentLevel <= 27))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FeatherFalling=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFeatherFalling, 3);
}
- else if (a_EnchantmentLevel >= 11 && a_EnchantmentLevel <= 21)
+ else if ((a_EnchantmentLevel >= 11) && (a_EnchantmentLevel <= 21))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FeatherFalling=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFeatherFalling, 2);
}
- else if (a_EnchantmentLevel >= 5 && a_EnchantmentLevel <= 15)
+ else if ((a_EnchantmentLevel >= 5) && (a_EnchantmentLevel <= 15))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FeatherFalling=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFeatherFalling, 1);
}
}
}
@@ -490,382 +490,380 @@ void cEnchantments::AddItemEnchantmentWeights(cWeightedEnchantments & a_Enchantm
else if (a_ItemType == E_ITEM_BOW)
{
// Power
- if (a_EnchantmentLevel >= 31 && a_EnchantmentLevel <= 46)
+ if ((a_EnchantmentLevel >= 31) && (a_EnchantmentLevel <= 46))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Power=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchPower, 4);
}
- else if (a_EnchantmentLevel >= 21 && a_EnchantmentLevel <= 36)
+ else if ((a_EnchantmentLevel >= 21) && (a_EnchantmentLevel <= 36))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Power=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchPower, 3);
}
- else if (a_EnchantmentLevel >= 11 && a_EnchantmentLevel <= 26)
+ else if ((a_EnchantmentLevel >= 11) && (a_EnchantmentLevel <= 26))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Power=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchPower, 2);
}
- else if (a_EnchantmentLevel >= 1 && a_EnchantmentLevel <= 16)
+ else if ((a_EnchantmentLevel >= 1) && (a_EnchantmentLevel <= 16))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Power=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchPower, 1);
}
// Punch
- if (a_EnchantmentLevel >= 32 && a_EnchantmentLevel <= 57)
+ if ((a_EnchantmentLevel >= 32) && (a_EnchantmentLevel <= 57))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Punch=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchPunch, 2);
}
- else if (a_EnchantmentLevel >= 12 && a_EnchantmentLevel <= 37)
+ else if ((a_EnchantmentLevel >= 12) && (a_EnchantmentLevel <= 37))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Punch=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchPunch, 1);
}
// Flame and Infinity
- if (a_EnchantmentLevel >= 20 && a_EnchantmentLevel <= 50)
+ if ((a_EnchantmentLevel >= 20) && (a_EnchantmentLevel <= 50))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Flame=1"));
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Infinity=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchFlame, 1);
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchInfinity, 1);
}
}
else if (a_ItemType == E_ITEM_FISHING_ROD)
{
// Luck of the Sea and Lure
- if (a_EnchantmentLevel >= 33 && a_EnchantmentLevel <= 83)
+ if ((a_EnchantmentLevel >= 33) && (a_EnchantmentLevel <= 83))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("LuckOfTheSea=3"));
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Lure=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchLuckOfTheSea, 3);
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchLure, 3);
}
- else if (a_EnchantmentLevel >= 24 && a_EnchantmentLevel <= 74)
+ else if ((a_EnchantmentLevel >= 24) && (a_EnchantmentLevel <= 74))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("LuckOfTheSea=2"));
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Lure=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchLuckOfTheSea, 2);
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchLure, 2);
}
- else if (a_EnchantmentLevel >= 15 && a_EnchantmentLevel <= 65)
+ else if ((a_EnchantmentLevel >= 15) && (a_EnchantmentLevel <= 65))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("LuckOfTheSea=1"));
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Lure=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchLuckOfTheSea, 1);
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchLure, 1);
}
}
else if (a_ItemType == E_ITEM_BOOK)
{
- // All &a_Enchantments
+ // All Enchantments
// Sharpness
- if (a_EnchantmentLevel >= 34 && a_EnchantmentLevel <= 54)
+ if ((a_EnchantmentLevel >= 34) && (a_EnchantmentLevel <= 54))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Sharpness=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchSharpness, 4);
}
- else if (a_EnchantmentLevel >= 23 && a_EnchantmentLevel <= 43)
+ else if ((a_EnchantmentLevel >= 23) && (a_EnchantmentLevel <= 43))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Sharpness=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchSharpness, 3);
}
- else if (a_EnchantmentLevel >= 12 && a_EnchantmentLevel <= 32)
+ else if ((a_EnchantmentLevel >= 12) && (a_EnchantmentLevel <= 32))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Sharpness=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchSharpness, 2);
}
- else if (a_EnchantmentLevel >= 1 && a_EnchantmentLevel <= 21)
+ else if ((a_EnchantmentLevel >= 1) && (a_EnchantmentLevel <= 21))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Sharpness=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchSharpness, 1);
}
// Smite
- if (a_EnchantmentLevel >= 29 && a_EnchantmentLevel <= 49)
+ if ((a_EnchantmentLevel >= 29) && (a_EnchantmentLevel <= 49))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Smite=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchSmite, 4);
}
- else if (a_EnchantmentLevel >= 21 && a_EnchantmentLevel <= 41)
+ else if ((a_EnchantmentLevel >= 21) && (a_EnchantmentLevel <= 41))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Smite=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchSmite, 3);
}
- else if (a_EnchantmentLevel >= 13 && a_EnchantmentLevel <= 33)
+ else if ((a_EnchantmentLevel >= 13) && (a_EnchantmentLevel <= 33))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Smite=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchSmite, 2);
}
- else if (a_EnchantmentLevel >= 5 && a_EnchantmentLevel <= 25)
+ else if ((a_EnchantmentLevel >= 5) && (a_EnchantmentLevel <= 25))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Smite=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchSmite, 1);
}
// Bane of Arthropods
- if (a_EnchantmentLevel >= 29 && a_EnchantmentLevel <= 49)
+ if ((a_EnchantmentLevel >= 29) && (a_EnchantmentLevel <= 49))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("BaneOfArthropods=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchBaneOfArthropods, 4);
}
- else if (a_EnchantmentLevel >= 21 && a_EnchantmentLevel <= 41)
+ else if ((a_EnchantmentLevel >= 21) && (a_EnchantmentLevel <= 41))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("BaneOfArthropods=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchBaneOfArthropods, 3);
}
- else if (a_EnchantmentLevel >= 13 && a_EnchantmentLevel <= 33)
+ else if ((a_EnchantmentLevel >= 13) && (a_EnchantmentLevel <= 33))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("BaneOfArthropods=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchBaneOfArthropods, 2);
}
- else if (a_EnchantmentLevel >= 5 && a_EnchantmentLevel <= 25)
+ else if ((a_EnchantmentLevel >= 5) && (a_EnchantmentLevel <= 25))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("BaneOfArthropods=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchBaneOfArthropods, 1);
}
// Knockback
- if (a_EnchantmentLevel >= 25 && a_EnchantmentLevel <= 75)
+ if ((a_EnchantmentLevel >= 25) && (a_EnchantmentLevel <= 75))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Knockback=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchKnockback, 2);
}
- else if (a_EnchantmentLevel >= 5 && a_EnchantmentLevel <= 55)
+ else if ((a_EnchantmentLevel >= 5) && (a_EnchantmentLevel <= 55))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Knockback=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchKnockback, 1);
}
// Fire Aspect
- if (a_EnchantmentLevel >= 30 && a_EnchantmentLevel <= 80)
+ if ((a_EnchantmentLevel >= 30) && (a_EnchantmentLevel <= 80))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("FireAspect=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchFireAspect, 2);
}
- else if (a_EnchantmentLevel >= 10 && a_EnchantmentLevel <= 60)
+ else if ((a_EnchantmentLevel >= 10) && (a_EnchantmentLevel <= 60))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("FireAspect=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchFireAspect, 1);
}
// Looting
- if (a_EnchantmentLevel >= 33 && a_EnchantmentLevel <= 83)
+ if ((a_EnchantmentLevel >= 33) && (a_EnchantmentLevel <= 83))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Looting=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchLooting, 3);
}
- else if (a_EnchantmentLevel >= 24 && a_EnchantmentLevel <= 74)
+ else if ((a_EnchantmentLevel >= 24) && (a_EnchantmentLevel <= 74))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Looting=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchLooting, 2);
}
- else if (a_EnchantmentLevel >= 15 && a_EnchantmentLevel <= 65)
+ else if ((a_EnchantmentLevel >= 15) && (a_EnchantmentLevel <= 65))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Looting=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchLooting, 1);
}
// Efficiency
- if (a_EnchantmentLevel >= 31 && a_EnchantmentLevel <= 81)
+ if ((a_EnchantmentLevel >= 31) && (a_EnchantmentLevel <= 81))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Efficiency=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchEfficiency, 4);
}
- else if (a_EnchantmentLevel >= 21 && a_EnchantmentLevel <= 71)
+ else if ((a_EnchantmentLevel >= 21) && (a_EnchantmentLevel <= 71))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Efficiency=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchEfficiency, 3);
}
- else if (a_EnchantmentLevel >= 11 && a_EnchantmentLevel <= 61)
+ else if ((a_EnchantmentLevel >= 11) && (a_EnchantmentLevel <= 61))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Efficiency=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchEfficiency, 2);
}
- else if (a_EnchantmentLevel >= 1 && a_EnchantmentLevel <= 51)
+ else if ((a_EnchantmentLevel >= 1) && (a_EnchantmentLevel <= 51))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Efficiency=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchEfficiency, 1);
}
// Silk Touch
- if (a_EnchantmentLevel >= 15 && a_EnchantmentLevel <= 65)
+ if ((a_EnchantmentLevel >= 15) && (a_EnchantmentLevel <= 65))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("SilkTouch=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchSilkTouch, 1);
}
// Fortune
- if (a_EnchantmentLevel >= 33 && a_EnchantmentLevel <= 83)
+ if ((a_EnchantmentLevel >= 33) && (a_EnchantmentLevel <= 83))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Fortune=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchFortune, 3);
}
- else if (a_EnchantmentLevel >= 24 && a_EnchantmentLevel <= 74)
+ else if ((a_EnchantmentLevel >= 24) && (a_EnchantmentLevel <= 74))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Fortune=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchFortune, 2);
}
- else if (a_EnchantmentLevel >= 15 && a_EnchantmentLevel <= 65)
+ else if ((a_EnchantmentLevel >= 15) && (a_EnchantmentLevel <= 65))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Fortune=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchFortune, 1);
}
// Protection
- if (a_EnchantmentLevel >= 34 && a_EnchantmentLevel <= 54)
+ if ((a_EnchantmentLevel >= 34) && (a_EnchantmentLevel <= 54))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Protection=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchProtection, 4);
}
- else if (a_EnchantmentLevel >= 23 && a_EnchantmentLevel <= 43)
+ else if ((a_EnchantmentLevel >= 23) && (a_EnchantmentLevel <= 43))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Protection=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchProtection, 3);
}
- else if (a_EnchantmentLevel >= 12 && a_EnchantmentLevel <= 32)
+ else if ((a_EnchantmentLevel >= 12) && (a_EnchantmentLevel <= 32))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Protection=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchProtection, 2);
}
- else if (a_EnchantmentLevel >= 1 && a_EnchantmentLevel <= 21)
+ else if ((a_EnchantmentLevel >= 1) && (a_EnchantmentLevel <= 21))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Protection=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchProtection, 1);
}
// Fire Protection
- if (a_EnchantmentLevel >= 34 && a_EnchantmentLevel <= 46)
+ if ((a_EnchantmentLevel >= 34) && (a_EnchantmentLevel <= 46))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FireProtection=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFireProtection, 4);
}
- else if (a_EnchantmentLevel >= 26 && a_EnchantmentLevel <= 38)
+ else if ((a_EnchantmentLevel >= 26) && (a_EnchantmentLevel <= 38))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FireProtection=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFireProtection, 3);
}
- else if (a_EnchantmentLevel >= 18 && a_EnchantmentLevel <= 30)
+ else if ((a_EnchantmentLevel >= 18) && (a_EnchantmentLevel <= 30))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FireProtection=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFireProtection, 2);
}
- else if (a_EnchantmentLevel >= 10 && a_EnchantmentLevel <= 22)
+ else if ((a_EnchantmentLevel >= 10) && (a_EnchantmentLevel <= 22))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FireProtection=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFireProtection, 1);
}
// Blast Protection
- if (a_EnchantmentLevel >= 29 && a_EnchantmentLevel <= 41)
+ if ((a_EnchantmentLevel >= 29) && (a_EnchantmentLevel <= 41))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("BlastProtection=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchBlastProtection, 4);
}
- else if (a_EnchantmentLevel >= 21 && a_EnchantmentLevel <= 33)
+ else if ((a_EnchantmentLevel >= 21) && (a_EnchantmentLevel <= 33))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("BlastProtection=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchBlastProtection, 3);
}
- else if (a_EnchantmentLevel >= 13 && a_EnchantmentLevel <= 25)
+ else if ((a_EnchantmentLevel >= 13) && (a_EnchantmentLevel <= 25))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("BlastProtection=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchBlastProtection, 2);
}
- else if (a_EnchantmentLevel >= 5 && a_EnchantmentLevel <= 17)
+ else if ((a_EnchantmentLevel >= 5) && (a_EnchantmentLevel <= 17))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("BlastProtection=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchBlastProtection, 1);
}
// Projectile Protection
- if (a_EnchantmentLevel >= 21 && a_EnchantmentLevel <= 36)
+ if ((a_EnchantmentLevel >= 21) && (a_EnchantmentLevel <= 36))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("ProjectileProtection=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchProjectileProtection, 4);
}
- else if (a_EnchantmentLevel >= 15 && a_EnchantmentLevel <= 30)
+ else if ((a_EnchantmentLevel >= 15) && (a_EnchantmentLevel <= 30))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("ProjectileProtection=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchProjectileProtection, 3);
}
- else if (a_EnchantmentLevel >= 9 && a_EnchantmentLevel <= 24)
+ else if ((a_EnchantmentLevel >= 9) && (a_EnchantmentLevel <= 24))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("ProjectileProtection=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchProjectileProtection, 2);
}
- else if (a_EnchantmentLevel >= 3 && a_EnchantmentLevel <= 18)
+ else if ((a_EnchantmentLevel >= 3) && (a_EnchantmentLevel <= 18))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("ProjectileProtection=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchProjectileProtection, 1);
}
// Thorns
- if (a_EnchantmentLevel >= 50 && a_EnchantmentLevel <= 100)
+ if ((a_EnchantmentLevel >= 50) && (a_EnchantmentLevel <= 100))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Thorns=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchThorns, 3);
}
- else if (a_EnchantmentLevel >= 30 && a_EnchantmentLevel <= 80)
+ else if ((a_EnchantmentLevel >= 30) && (a_EnchantmentLevel <= 80))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Thorns=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchThorns, 2);
}
- else if (a_EnchantmentLevel >= 10 && a_EnchantmentLevel <= 60)
+ else if ((a_EnchantmentLevel >= 10) && (a_EnchantmentLevel <= 60))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Thorns=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchThorns, 1);
}
// Respiration
- if (a_EnchantmentLevel >= 30 && a_EnchantmentLevel <= 60)
+ if ((a_EnchantmentLevel >= 30) && (a_EnchantmentLevel <= 60))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Respiration=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchRespiration, 3);
}
- else if (a_EnchantmentLevel >= 20 && a_EnchantmentLevel <= 50)
+ else if ((a_EnchantmentLevel >= 20) && (a_EnchantmentLevel <= 50))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Respiration=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchRespiration, 2);
}
- else if (a_EnchantmentLevel >= 10 && a_EnchantmentLevel <= 40)
+ else if ((a_EnchantmentLevel >= 10) && (a_EnchantmentLevel <= 40))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Respiration=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchRespiration, 1);
}
// Aqua Affinity
- if (a_EnchantmentLevel >= 1 && a_EnchantmentLevel <= 41)
+ if ((a_EnchantmentLevel >= 1) && (a_EnchantmentLevel <= 41))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("AquaAffinity=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchAquaAffinity, 1);
}
// Feather Fall
- if (a_EnchantmentLevel >= 23 && a_EnchantmentLevel <= 33)
+ if ((a_EnchantmentLevel >= 23) && (a_EnchantmentLevel <= 33))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FeatherFalling=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFeatherFalling, 4);
}
- else if (a_EnchantmentLevel >= 17 && a_EnchantmentLevel <= 27)
+ else if ((a_EnchantmentLevel >= 17) && (a_EnchantmentLevel <= 27))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FeatherFalling=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFeatherFalling, 3);
}
- else if (a_EnchantmentLevel >= 11 && a_EnchantmentLevel <= 21)
+ else if ((a_EnchantmentLevel >= 11) && (a_EnchantmentLevel <= 21))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FeatherFalling=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFeatherFalling, 2);
}
- else if (a_EnchantmentLevel >= 5 && a_EnchantmentLevel <= 15)
+ else if ((a_EnchantmentLevel >= 5) && (a_EnchantmentLevel <= 15))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("FeatherFalling=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchFeatherFalling, 1);
}
// Power
- if (a_EnchantmentLevel >= 31 && a_EnchantmentLevel <= 46)
+ if ((a_EnchantmentLevel >= 31) && (a_EnchantmentLevel <= 46))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Power=4"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchPower, 4);
}
- else if (a_EnchantmentLevel >= 21 && a_EnchantmentLevel <= 36)
+ else if ((a_EnchantmentLevel >= 21) && (a_EnchantmentLevel <= 36))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Power=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchPower, 3);
}
- else if (a_EnchantmentLevel >= 11 && a_EnchantmentLevel <= 26)
+ else if ((a_EnchantmentLevel >= 11) && (a_EnchantmentLevel <= 26))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Power=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchPower, 2);
}
- else if (a_EnchantmentLevel >= 1 && a_EnchantmentLevel <= 16)
+ else if ((a_EnchantmentLevel >= 1) && (a_EnchantmentLevel <= 16))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 10, cEnchantments("Power=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 10, enchPower, 1);
}
// Punch
- if (a_EnchantmentLevel >= 32 && a_EnchantmentLevel <= 57)
+ if ((a_EnchantmentLevel >= 32) && (a_EnchantmentLevel <= 57))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Punch=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchPunch, 2);
}
- else if (a_EnchantmentLevel >= 12 && a_EnchantmentLevel <= 37)
+ else if ((a_EnchantmentLevel >= 12) && (a_EnchantmentLevel <= 37))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Punch=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchPunch, 1);
}
// Flame and Infinity
- if (a_EnchantmentLevel >= 20 && a_EnchantmentLevel <= 50)
+ if ((a_EnchantmentLevel >= 20) && (a_EnchantmentLevel <= 50))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 2, cEnchantments("Flame=1"));
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Infinity=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 2, enchFlame, 1);
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchInfinity, 1);
}
// Luck of the Sea and Lure
- if (a_EnchantmentLevel >= 33 && a_EnchantmentLevel <= 83)
+ if ((a_EnchantmentLevel >= 33) && (a_EnchantmentLevel <= 83))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("LuckOfTheSea=3"));
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Lure=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchLuckOfTheSea, 3);
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchLure, 3);
}
- else if (a_EnchantmentLevel >= 24 && a_EnchantmentLevel <= 74)
+ else if ((a_EnchantmentLevel >= 24) && (a_EnchantmentLevel <= 74))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("LuckOfTheSea=2"));
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Lure=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchLuckOfTheSea, 2);
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchLure, 2);
}
- else if (a_EnchantmentLevel >= 15 && a_EnchantmentLevel <= 65)
+ else if ((a_EnchantmentLevel >= 15) && (a_EnchantmentLevel <= 65))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("LuckOfTheSea=1"));
- AddEnchantmentWeightToVector(&a_Enchantments, 1, cEnchantments("Lure=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchLuckOfTheSea, 1);
+ AddEnchantmentWeightToVector(&a_Enchantments, 1, enchLure, 1);
}
-
- a_ItemType = E_ITEM_ENCHANTED_BOOK;
}
// Unbreaking
- if (a_EnchantmentLevel >= 21 && a_EnchantmentLevel <= 71)
+ if ((a_EnchantmentLevel >= 21) && (a_EnchantmentLevel <= 71))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Unbreaking=3"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchUnbreaking, 3);
}
- else if (a_EnchantmentLevel >= 13 && a_EnchantmentLevel <= 63)
+ else if ((a_EnchantmentLevel >= 13) && (a_EnchantmentLevel <= 63))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Unbreaking=2"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchUnbreaking, 2);
}
- else if (a_EnchantmentLevel >= 5 && a_EnchantmentLevel <= 55)
+ else if ((a_EnchantmentLevel >= 5) && (a_EnchantmentLevel <= 55))
{
- AddEnchantmentWeightToVector(&a_Enchantments, 5, cEnchantments("Unbreaking=1"));
+ AddEnchantmentWeightToVector(&a_Enchantments, 5, enchUnbreaking, 1);
}
}
@@ -873,27 +871,27 @@ void cEnchantments::AddItemEnchantmentWeights(cWeightedEnchantments & a_Enchantm
-void cEnchantments::AddEnchantmentWeightToVector(cWeightedEnchantments * a_Enchantments, int a_Weight, cEnchantments a_Enchantment)
+void cEnchantments::AddEnchantmentWeightToVector(cWeightedEnchantments * a_Enchantments, int a_Weight, int a_EnchantmentID, int a_EnchantmentLevel)
{
- cWeightedEnchantment enchantment;
- enchantment.m_Weight = a_Weight;
- enchantment.m_Enchantments = a_Enchantment;
- a_Enchantments->push_back(enchantment);
+ cWeightedEnchantment weightedenchantment;
+ weightedenchantment.m_Weight = a_Weight;
+ cEnchantments enchantment;
+ enchantment.SetLevel(a_EnchantmentID, a_EnchantmentLevel);
+ weightedenchantment.m_Enchantments = enchantment;
+ a_Enchantments->push_back(weightedenchantment);
}
-void cEnchantments::RemoveEnchantmentWeightFromVector(cWeightedEnchantments * a_Enchantments, int a_EnchantmentID)
+void cEnchantments::RemoveEnchantmentWeightFromVector(cWeightedEnchantments & a_Enchantments, int a_EnchantmentID)
{
- for (cWeightedEnchantments::iterator it = a_Enchantments->begin(); it != a_Enchantments->end(); ++it)
+ for (cWeightedEnchantments::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it)
{
- int EnchantmentID = atoi(StringSplit((*it).m_Enchantments.ToString(), "=")[0].c_str());
-
- if (EnchantmentID == a_EnchantmentID)
+ if ((*it).m_Enchantments.GetLevel(a_EnchantmentID) > 0)
{
- a_Enchantments->erase(it);
+ a_Enchantments.erase(it);
break;
}
}
@@ -903,13 +901,13 @@ void cEnchantments::RemoveEnchantmentWeightFromVector(cWeightedEnchantments * a_
-void cEnchantments::RemoveEnchantmentWeightFromVector(cWeightedEnchantments * a_Enchantments, cEnchantments a_Enchantment)
+void cEnchantments::RemoveEnchantmentWeightFromVector(cWeightedEnchantments & a_Enchantments, const cEnchantments & a_Enchantment)
{
- for (cWeightedEnchantments::iterator it = a_Enchantments->begin(); it != a_Enchantments->end(); ++it)
+ for (cWeightedEnchantments::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it)
{
if ((*it).m_Enchantments == a_Enchantment)
{
- a_Enchantments->erase(it);
+ a_Enchantments.erase(it);
break;
}
}
@@ -921,55 +919,53 @@ void cEnchantments::RemoveEnchantmentWeightFromVector(cWeightedEnchantments * a_
void cEnchantments::CheckEnchantmentConflictsFromVector(cWeightedEnchantments & a_Enchantments, cEnchantments a_FirstEnchantment)
{
- int FirstEnchantmentID = atoi(StringSplit(a_FirstEnchantment.ToString(), "=")[0].c_str());
-
- if (FirstEnchantmentID == cEnchantments::enchProtection)
+ if (a_FirstEnchantment.GetLevel(cEnchantments::enchProtection) > 0)
{
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchFireProtection);
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchBlastProtection);
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchProjectileProtection);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchFireProtection);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchBlastProtection);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchProjectileProtection);
}
- else if (FirstEnchantmentID == cEnchantments::enchFireProtection)
+ else if (a_FirstEnchantment.GetLevel(cEnchantments::enchFireProtection) > 0)
{
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchProtection);
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchBlastProtection);
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchProjectileProtection);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchProtection);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchBlastProtection);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchProjectileProtection);
}
- else if (FirstEnchantmentID == cEnchantments::enchBlastProtection)
+ else if (a_FirstEnchantment.GetLevel(cEnchantments::enchBlastProtection) > 0)
{
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchProtection);
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchFireProtection);
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchProjectileProtection);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchProtection);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchFireProtection);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchProjectileProtection);
}
- else if (FirstEnchantmentID == cEnchantments::enchProjectileProtection)
+ else if (a_FirstEnchantment.GetLevel(cEnchantments::enchProjectileProtection) > 0)
{
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchProtection);
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchFireProtection);
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchBlastProtection);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchProtection);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchFireProtection);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchBlastProtection);
}
- else if (FirstEnchantmentID == cEnchantments::enchSharpness)
+ else if (a_FirstEnchantment.GetLevel(cEnchantments::enchSharpness) > 0)
{
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchSmite);
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchBaneOfArthropods);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchSmite);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchBaneOfArthropods);
}
- else if (FirstEnchantmentID == cEnchantments::enchSmite)
+ else if (a_FirstEnchantment.GetLevel(cEnchantments::enchSmite) > 0)
{
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchSharpness);
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchBaneOfArthropods);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchSharpness);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchBaneOfArthropods);
}
- else if (FirstEnchantmentID == cEnchantments::enchBaneOfArthropods)
+ else if (a_FirstEnchantment.GetLevel(cEnchantments::enchBaneOfArthropods) > 0)
{
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchSharpness);
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchSmite);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchSharpness);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchSmite);
}
- else if (FirstEnchantmentID == cEnchantments::enchSilkTouch)
+ else if (a_FirstEnchantment.GetLevel(cEnchantments::enchSilkTouch) > 0)
{
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchFortune);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchFortune);
}
- else if (FirstEnchantmentID == cEnchantments::enchFortune)
+ else if (a_FirstEnchantment.GetLevel(cEnchantments::enchFortune) > 0)
{
- RemoveEnchantmentWeightFromVector(&a_Enchantments, cEnchantments::enchSilkTouch);
+ RemoveEnchantmentWeightFromVector(a_Enchantments, cEnchantments::enchSilkTouch);
}
}
@@ -987,7 +983,6 @@ cEnchantments cEnchantments::GetRandomEnchantmentFromVector(cWeightedEnchantment
AllWeights += (*it).m_Weight;
}
int RandomNumber = Random.GenerateRandomInteger(0, AllWeights - 1);
- cEnchantments enchantment;
for (cWeightedEnchantments::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it)
{
RandomNumber -= (*it).m_Weight;
@@ -1003,10 +998,3 @@ cEnchantments cEnchantments::GetRandomEnchantmentFromVector(cWeightedEnchantment
-
-
-
-
-
-
-
diff --git a/src/Enchantments.h b/src/Enchantments.h
index 3cb979042..fc848ebec 100644
--- a/src/Enchantments.h
+++ b/src/Enchantments.h
@@ -103,13 +103,13 @@ public:
// tolua_end
/** Add enchantment weights from item to the vector */
- static void AddItemEnchantmentWeights(cWeightedEnchantments & a_Enchantments, short & a_ItemType, int a_EnchantmentLevel);
+ static void AddItemEnchantmentWeights(cWeightedEnchantments & a_Enchantments, short a_ItemType, int a_EnchantmentLevel);
/** Add a enchantment weight to the vector */
- static void AddEnchantmentWeightToVector(cWeightedEnchantments * a_Enchantments, int a_Weight, cEnchantments a_Enchantment);
+ static void AddEnchantmentWeightToVector(cWeightedEnchantments * a_Enchantments, int a_Weight, int a_EnchantmentID, int a_EnchantmentLevel);
/** Remove a enchantment weight from the vector */
- static void RemoveEnchantmentWeightFromVector(cWeightedEnchantments * a_Enchantments, int a_EnchantmentID);
- static void RemoveEnchantmentWeightFromVector(cWeightedEnchantments * a_Enchantments, cEnchantments a_Enchantment);
+ static void RemoveEnchantmentWeightFromVector(cWeightedEnchantments & a_Enchantments, int a_EnchantmentID);
+ static void RemoveEnchantmentWeightFromVector(cWeightedEnchantments & a_Enchantments, const cEnchantments & a_Enchantment);
/** Check enchantment conflicts from enchantments from the vector */
static void CheckEnchantmentConflictsFromVector(cWeightedEnchantments & a_Enchantments, cEnchantments a_FirstEnchantment);
diff --git a/src/Item.cpp b/src/Item.cpp
index 1941a6693..9899d7f32 100644
--- a/src/Item.cpp
+++ b/src/Item.cpp
@@ -215,49 +215,66 @@ int cItem::GetEnchantability()
{
int Enchantability = 0;
- if (m_ItemType == E_ITEM_WOODEN_SWORD || m_ItemType == E_ITEM_WOODEN_PICKAXE || m_ItemType == E_ITEM_WOODEN_SHOVEL || m_ItemType == E_ITEM_WOODEN_AXE || m_ItemType == E_ITEM_WOODEN_HOE)
- {
- Enchantability = 15;
- }
- else if (m_ItemType == E_ITEM_LEATHER_CAP || m_ItemType == E_ITEM_LEATHER_TUNIC || m_ItemType == E_ITEM_LEATHER_PANTS || m_ItemType == E_ITEM_LEATHER_BOOTS)
- {
- Enchantability = 15;
- }
- else if (m_ItemType == E_ITEM_STONE_SWORD || m_ItemType == E_ITEM_STONE_PICKAXE || m_ItemType == E_ITEM_STONE_SHOVEL || m_ItemType == E_ITEM_STONE_AXE || m_ItemType == E_ITEM_STONE_HOE)
- {
- Enchantability = 5;
- }
- else if (m_ItemType == E_ITEM_IRON_HELMET || m_ItemType == E_ITEM_IRON_CHESTPLATE || m_ItemType == E_ITEM_IRON_LEGGINGS || m_ItemType == E_ITEM_IRON_BOOTS)
- {
- Enchantability = 9;
- }
- else if (m_ItemType == E_ITEM_IRON_SWORD || m_ItemType == E_ITEM_IRON_PICKAXE || m_ItemType == E_ITEM_IRON_SHOVEL || m_ItemType == E_ITEM_IRON_AXE || m_ItemType == E_ITEM_IRON_HOE)
- {
- Enchantability = 14;
- }
- else if (m_ItemType == E_ITEM_CHAIN_HELMET || m_ItemType == E_ITEM_CHAIN_CHESTPLATE || m_ItemType == E_ITEM_CHAIN_LEGGINGS || m_ItemType == E_ITEM_CHAIN_BOOTS)
- {
- Enchantability = 12;
- }
- else if (m_ItemType == E_ITEM_DIAMOND_HELMET || m_ItemType == E_ITEM_DIAMOND_CHESTPLATE || m_ItemType == E_ITEM_DIAMOND_LEGGINGS || m_ItemType == E_ITEM_DIAMOND_BOOTS)
- {
- Enchantability = 10;
- }
- else if (m_ItemType == E_ITEM_DIAMOND_SWORD || m_ItemType == E_ITEM_DIAMOND_PICKAXE || m_ItemType == E_ITEM_DIAMOND_SHOVEL || m_ItemType == E_ITEM_DIAMOND_AXE || m_ItemType == E_ITEM_DIAMOND_HOE)
- {
- Enchantability = 10;
- }
- else if (m_ItemType == E_ITEM_GOLD_HELMET || m_ItemType == E_ITEM_GOLD_CHESTPLATE || m_ItemType == E_ITEM_GOLD_LEGGINGS || m_ItemType == E_ITEM_GOLD_BOOTS)
- {
- Enchantability = 25;
- }
- else if (m_ItemType == E_ITEM_GOLD_SWORD || m_ItemType == E_ITEM_GOLD_PICKAXE || m_ItemType == E_ITEM_GOLD_SHOVEL || m_ItemType == E_ITEM_GOLD_AXE || m_ItemType == E_ITEM_GOLD_HOE)
- {
- Enchantability = 22;
- }
- else if (m_ItemType == E_ITEM_FISHING_ROD || m_ItemType == E_ITEM_BOW || m_ItemType == E_ITEM_BOOK)
+ switch (m_ItemType)
{
- Enchantability = 1;
+ case E_ITEM_WOODEN_SWORD: Enchantability = 15;
+ case E_ITEM_WOODEN_PICKAXE: Enchantability = 15;
+ case E_ITEM_WOODEN_SHOVEL: Enchantability = 15;
+ case E_ITEM_WOODEN_AXE: Enchantability = 15;
+ case E_ITEM_WOODEN_HOE: Enchantability = 15;
+
+ case E_ITEM_LEATHER_CAP: Enchantability = 15;
+ case E_ITEM_LEATHER_TUNIC: Enchantability = 15;
+ case E_ITEM_LEATHER_PANTS: Enchantability = 15;
+ case E_ITEM_LEATHER_BOOTS: Enchantability = 15;
+
+ case E_ITEM_STONE_SWORD: Enchantability = 5;
+ case E_ITEM_STONE_PICKAXE: Enchantability = 5;
+ case E_ITEM_STONE_SHOVEL: Enchantability = 5;
+ case E_ITEM_STONE_AXE: Enchantability = 5;
+ case E_ITEM_STONE_HOE: Enchantability = 5;
+
+ case E_ITEM_IRON_HELMET: Enchantability = 9;
+ case E_ITEM_IRON_CHESTPLATE: Enchantability = 9;
+ case E_ITEM_IRON_LEGGINGS: Enchantability = 9;
+ case E_ITEM_IRON_BOOTS: Enchantability = 9;
+
+ case E_ITEM_IRON_SWORD: Enchantability = 14;
+ case E_ITEM_IRON_PICKAXE: Enchantability = 14;
+ case E_ITEM_IRON_SHOVEL: Enchantability = 14;
+ case E_ITEM_IRON_AXE: Enchantability = 14;
+ case E_ITEM_IRON_HOE: Enchantability = 14;
+
+ case E_ITEM_CHAIN_HELMET: Enchantability = 12;
+ case E_ITEM_CHAIN_CHESTPLATE: Enchantability = 12;
+ case E_ITEM_CHAIN_LEGGINGS: Enchantability = 12;
+ case E_ITEM_CHAIN_BOOTS: Enchantability = 12;
+
+ case E_ITEM_DIAMOND_HELMET: Enchantability = 10;
+ case E_ITEM_DIAMOND_CHESTPLATE: Enchantability = 10;
+ case E_ITEM_DIAMOND_LEGGINGS: Enchantability = 10;
+ case E_ITEM_DIAMOND_BOOTS: Enchantability = 10;
+
+ case E_ITEM_DIAMOND_SWORD: Enchantability = 10;
+ case E_ITEM_DIAMOND_PICKAXE: Enchantability = 10;
+ case E_ITEM_DIAMOND_SHOVEL: Enchantability = 10;
+ case E_ITEM_DIAMOND_AXE: Enchantability = 10;
+ case E_ITEM_DIAMOND_HOE: Enchantability = 10;
+
+ case E_ITEM_GOLD_HELMET: Enchantability = 25;
+ case E_ITEM_GOLD_CHESTPLATE: Enchantability = 25;
+ case E_ITEM_GOLD_LEGGINGS: Enchantability = 25;
+ case E_ITEM_GOLD_BOOTS: Enchantability = 25;
+
+ case E_ITEM_GOLD_SWORD: Enchantability = 22;
+ case E_ITEM_GOLD_PICKAXE: Enchantability = 22;
+ case E_ITEM_GOLD_SHOVEL: Enchantability = 22;
+ case E_ITEM_GOLD_AXE: Enchantability = 22;
+ case E_ITEM_GOLD_HOE: Enchantability = 22;
+
+ case E_ITEM_FISHING_ROD: Enchantability = 1;
+ case E_ITEM_BOW: Enchantability = 1;
+ case E_ITEM_BOOK: Enchantability = 1;
}
return Enchantability;
@@ -269,7 +286,7 @@ int cItem::GetEnchantability()
bool cItem::EnchantByXPLevels(int a_NumXPLevels)
{
- if (!cItem::IsEnchantable(m_ItemType) && m_ItemType != E_ITEM_BOOK)
+ if ((!cItem::IsEnchantable(m_ItemType)) && (m_ItemType != E_ITEM_BOOK))
{
return false;
}
@@ -284,9 +301,14 @@ bool cItem::EnchantByXPLevels(int a_NumXPLevels)
cWeightedEnchantments enchantments;
cEnchantments::AddItemEnchantmentWeights(enchantments, m_ItemType, FinalEnchantmentLevel);
+ if (m_ItemType == E_ITEM_BOOK)
+ {
+ m_ItemType = E_ITEM_ENCHANTED_BOOK;
+ }
+
cEnchantments Enchantment1 = cEnchantments::GetRandomEnchantmentFromVector(enchantments);
m_Enchantments.AddFromString(Enchantment1.ToString());
- cEnchantments::RemoveEnchantmentWeightFromVector(&enchantments, Enchantment1);
+ cEnchantments::RemoveEnchantmentWeightFromVector(enchantments, Enchantment1);
// Checking for conflicting enchantments
cEnchantments::CheckEnchantmentConflictsFromVector(enchantments, Enchantment1);
@@ -302,38 +324,38 @@ bool cItem::EnchantByXPLevels(int a_NumXPLevels)
{
cEnchantments Enchantment2 = cEnchantments::GetRandomEnchantmentFromVector(enchantments);
m_Enchantments.AddFromString(Enchantment2.ToString());
- cEnchantments::RemoveEnchantmentWeightFromVector(&enchantments, Enchantment2);
+ cEnchantments::RemoveEnchantmentWeightFromVector(enchantments, Enchantment2);
// Checking for conflicting enchantments
cEnchantments::CheckEnchantmentConflictsFromVector(enchantments, Enchantment2);
- }
- }
- // Next Enchantment (Third)
- NewEnchantmentLevel = NewEnchantmentLevel / 2;
- float ThirdEnchantmentChance = (NewEnchantmentLevel + 1) / 50 * 100;
- if (Random.NextFloat(100) <= ThirdEnchantmentChance)
- {
- if (enchantments.size() > 0)
- {
- cEnchantments Enchantment3 = cEnchantments::GetRandomEnchantmentFromVector(enchantments);
- m_Enchantments.AddFromString(Enchantment3.ToString());
- cEnchantments::RemoveEnchantmentWeightFromVector(&enchantments, Enchantment3);
-
- // Checking for conflicting enchantments
- cEnchantments::CheckEnchantmentConflictsFromVector(enchantments, Enchantment3);
- }
- }
-
- // Next Enchantment (Fourth)
- NewEnchantmentLevel = NewEnchantmentLevel / 2;
- float FourthEnchantmentChance = (NewEnchantmentLevel + 1) / 50 * 100;
- if (Random.NextFloat(100) <= FourthEnchantmentChance)
- {
- if (enchantments.size() > 0)
- {
- cEnchantments Enchantment4 = cEnchantments::GetRandomEnchantmentFromVector(enchantments);
- m_Enchantments.AddFromString(Enchantment4.ToString());
+ // Next Enchantment (Third)
+ NewEnchantmentLevel = NewEnchantmentLevel / 2;
+ float ThirdEnchantmentChance = (NewEnchantmentLevel + 1) / 50 * 100;
+ if (Random.NextFloat(100) <= ThirdEnchantmentChance)
+ {
+ if (enchantments.size() > 0)
+ {
+ cEnchantments Enchantment3 = cEnchantments::GetRandomEnchantmentFromVector(enchantments);
+ m_Enchantments.AddFromString(Enchantment3.ToString());
+ cEnchantments::RemoveEnchantmentWeightFromVector(enchantments, Enchantment3);
+
+ // Checking for conflicting enchantments
+ cEnchantments::CheckEnchantmentConflictsFromVector(enchantments, Enchantment3);
+
+ // Next Enchantment (Fourth)
+ NewEnchantmentLevel = NewEnchantmentLevel / 2;
+ float FourthEnchantmentChance = (NewEnchantmentLevel + 1) / 50 * 100;
+ if (Random.NextFloat(100) <= FourthEnchantmentChance)
+ {
+ if (enchantments.size() > 0)
+ {
+ cEnchantments Enchantment4 = cEnchantments::GetRandomEnchantmentFromVector(enchantments);
+ m_Enchantments.AddFromString(Enchantment4.ToString());
+ }
+ }
+ }
+ }
}
}
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 26fdfe928..5f74b4fa3 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -783,7 +783,8 @@ void cSlotAreaEnchanting::OnPlayerRemoved(cPlayer & a_Player)
{
// Toss the item in the enchanting slot
TossItems(a_Player, 0, 1);
- // Player not found - that is acceptable
+
+ super::OnPlayerRemoved(a_Player);
}
@@ -838,7 +839,7 @@ int cSlotAreaEnchanting::GetBookshelvesCount(cWorld * a_World)
static const struct
{
int m_BookX, m_BookY, m_BookZ; // Coords to check for bookcases
- int m_AirX, m_AirY, m_AirZ; // Coords to check for air; if not air, the bookcase won\'t be counted
+ int m_AirX, m_AirY, m_AirZ; // Coords to check for air; if not air, the bookcase won't be counted
} CheckCoords[] =
{
{ 0, 0, 0, 1, 0, 1 }, // Bookcase at {0, 0, 0}, air at {1, 0, 1}
diff --git a/src/UI/Window.cpp b/src/UI/Window.cpp
index fffe0e3fd..0a78578fc 100644
--- a/src/UI/Window.cpp
+++ b/src/UI/Window.cpp
@@ -826,11 +826,7 @@ void cEnchantingWindow::SetProperty(int a_Property, int a_Value)
{
m_PropertyValue[a_Property] = a_Value;
- cCSLock Lock(m_CS);
- for (cPlayerList::iterator itr = m_OpenedBy.begin(), end = m_OpenedBy.end(); itr != end; ++itr)
- {
- (*itr)->GetClientHandle()->SendWindowProperty(*this, a_Property, a_Value);
- } // for itr - m_OpenedBy[]
+ super::SetProperty(a_Property, a_Value);
}
@@ -841,7 +837,7 @@ void cEnchantingWindow::SetProperty(int a_Property, int a_Value, cPlayer & a_Pla
{
m_PropertyValue[a_Property] = a_Value;
- a_Player.GetClientHandle()->SendWindowProperty(*this, a_Property, a_Value);
+ super::SetProperty(a_Property, a_Value, a_Player);
}