changeset 1116:6a4d654ef9fb

minor GetMaxMana cleanup
author Grumpy7
date Wed, 29 May 2013 03:21:19 +0200
parents 849b848ed871
children ad89d1905b48 8a965c8faf05
files Player.cpp
diffstat 1 files changed, 40 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/Player.cpp	Wed May 29 03:19:12 2013 +0200
+++ b/Player.cpp	Wed May 29 03:21:19 2013 +0200
@@ -4131,65 +4131,60 @@
   int v8; // esi@6
   int v9; // esi@6
   int result; // eax@7
-
+  
   switch (classType)
   {
-    case 5u:
-    case 6u:
-    case 7u:
-    case 0x10u:
-    case 0x11u:
-    case 0x12u:
-    case 0x13u:
-    case 0x20u:
-    case 0x21u:
-    case 0x22u:
-    case 0x23u:
+    case PLAYER_CLASS_ROGUE:
+    case PLAYER_CLASS_SPY:
+    case PLAYER_CLASS_ASSASSIN:
+    case PLAYER_CLASS_ARCHER:
+    case PLAYER_CLASS_WARRIOR_MAGE:
+    case PLAYER_CLASS_MASTER_ARCHER:
+    case PLAYER_CLASS_SNIPER:
+    case PLAYER_CLASS_SORCERER:
+    case PLAYER_CLASS_WIZARD:
+    case PLAYER_CLASS_ARCHMAGE:
+    case PLAYER_CLASS_LICH:
       v2 = GetActualIntelligence();
       v3 = GetParameterBonus(v2);
-      goto LABEL_6;
-    case 9u:
-    case 0xAu:
-    case 0xBu:
-    case 0xCu:
-    case 0xDu:
-    case 0xEu:
-    case 0xFu:
-    case 0x18u:
-    case 0x19u:
-    case 0x1Au:
-    case 0x1Bu:
+      break;
+    case PLAYER_CLASS_INITIATE:
+    case PLAYER_CLASS_MASTER:
+    case PLAYER_CLASS_NINJA:
+    case PLAYER_CLASS_PALADIN:
+    case PLAYER_CLASS_CRUSADER:
+    case PLAYER_CLASS_HERO:
+    case PLAYER_CLASS_VILLIAN:
+    case PLAYER_CLASS_CLERIC:
+    case PLAYER_CLASS_PRIEST:
+    case PLAYER_CLASS_PRIEST_OF_SUN:
+    case PLAYER_CLASS_PRIEST_OF_MOON:
       v2 = GetActualWillpower();
       v3 = GetParameterBonus(v2);
-      goto LABEL_6;
-    case 0x15u:
-    case 0x16u:
-    case 0x17u:
-    case 0x1Cu:
-    case 0x1Du:
-    case 0x1Eu:
-    case 0x1Fu:
+      break;
+    case PLAYER_CLASS_HUNTER:
+    case PLAYER_CLASS_RANGER_LORD:
+    case PLAYER_CLASS_BOUNTY_HUNTER:
+    case PLAYER_CLASS_DRUID:
+    case PLAYER_CLASS_GREAT_DRUID:
+    case PLAYER_CLASS_ARCH_DRUID:
+    case PLAYER_CLASS_WARLOCK:
       v4 = GetActualWillpower();
       v5 = GetParameterBonus(v4);
       v6 = GetActualIntelligence();
       v3 = GetParameterBonus(v6) + v5;
-LABEL_6:
-      v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3);
-      v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7;
-      v9 = uFullManaBonus
-         + pBaseManaByClass[classType / 4]
-         + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA)
-         + v8;
-      if ( v9 < 1 )
-        goto LABEL_7;
-      result = v9;
       break;
     default:
-LABEL_7:
-      result = 0;
+      return 0;
       break;
   }
-  return result;
+  v7 = pBaseManaPerLevelByClass[classType] * (GetActualLevel() + v3);
+  v8 = GetItemsBonus(CHARACTER_ATTRIBUTE_MANA, 0) + v7;
+  v9 = uFullManaBonus
+      + pBaseManaByClass[classType / 4]
+  + GetSkillBonus(CHARACTER_ATTRIBUTE_MANA)
+      + v8;
+  return max(0,v9);
 }
 
 //----- (0048E656) --------------------------------------------------------