Mercurial > mm7
changeset 1604:4b79ff62df3a
Moved enchantment attribute bonus list to items.cpp/h, created static function that create the enchantments + helper functions to get the enchantment strength, moved the whole logic of Player::GetItemsBonus to a case
author | Grumpy7 |
---|---|
date | Sat, 14 Sep 2013 06:04:18 +0200 |
parents | c58916c53d8e |
children | 434b796cdfd3 8e99b4a7176f |
files | Items.cpp Items.h Player.cpp Player.h |
diffstat | 4 files changed, 696 insertions(+), 783 deletions(-) [+] |
line wrap: on
line diff
--- a/Items.cpp Thu Sep 12 09:58:07 2013 +0200 +++ b/Items.cpp Sat Sep 14 06:04:18 2013 +0200 @@ -792,7 +792,7 @@ { for(int ii=0; ii<24; ++ii) { - if (_stricmp(test_string,pEnchantments[ii].pBonusStat)) + if (!_stricmp(test_string,pEnchantments[ii].pOfName)) { pItems[item_counter]._bonus_type=ii+1; break; @@ -802,7 +802,7 @@ { for(int ii=0; ii<72; ++ii) { - if (_stricmp(test_string,pSpecialEnchantments[ii].pBonusStatement)) + if (!_stricmp(test_string,pSpecialEnchantments[ii].pNameAdd)) { pItems[item_counter]._additional_value=ii+1; } @@ -1245,6 +1245,13 @@ } while ((decode_step<2)&&!break_loop); } + + + ItemGen::PopulateSpecialBonusMap(); + ItemGen::PopulateArtifactBonusMap(); + ItemGen::PopulateRegularBonusMap(); + + } //----- (00456D17) -------------------------------------------------------- @@ -1915,6 +1922,482 @@ return false; } + +std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* >ItemGen::regularBonusMap; +std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* >ItemGen::specialBonusMap; +std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* >ItemGen::artifactBonusMap; + +#define NEWBONUSINTOSPECIALLIST(x,y) AddToMap(ItemGen::specialBonusMap, enchId, x, y); +#define NEWBONUSINTOSPECIALLIST2(x,y,z) AddToMap(ItemGen::specialBonusMap, enchId, x, y, z); + +#define NEWBONUSINTOREGULARLIST(x) AddToMap(ItemGen::regularBonusMap, enchId, x); + +#define NEWBONUSINTOARTIFACTLIST(x,y) AddToMap(ItemGen::artifactBonusMap, itemId, x, y); +#define NEWBONUSINTOARTIFACTLIST2(x,y,z) AddToMap(ItemGen::artifactBonusMap, itemId, x, y, z); + +void ItemGen::AddToMap( std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* > &maptoadd, int enchId, CHARACTER_ATTRIBUTE_TYPE attrId, int bonusValue /*= 0*/, unsigned __int16 Player::* skillPtr /*= NULL*/ ) +{ + auto key = maptoadd.find(enchId); + std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currMap; + if (key == maptoadd.end()) + { + currMap = new std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>; + maptoadd[enchId] = currMap; + } + else + { + currMap = key->second; + } + Assert(currMap->find(attrId) == currMap->end(), "Attribute %d already present for enchantment %d", attrId, enchId); + (*currMap)[attrId] = new CEnchantment(bonusValue, skillPtr); +} + +void ItemGen::PopulateSpecialBonusMap() +{ + int enchId = 1;// of Protection, +10 to all Resistances + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 10); + NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_AIR, 10); + NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_WATER, 10); + NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_EARTH, 10); + NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_MIND, 10); + NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_BODY, 10); + + enchId = 2;//of The Gods, +10 to all Seven Statistics + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 10); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 10); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 10); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 10); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 10); + + enchId = 26;//of Air Magic + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_AIR,0, &Player::skillAir); + + enchId = 27;//of Body Magic + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_BODY,0, &Player::skillBody); + + enchId = 28;//of Dark Magic + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_DARK,0, &Player::skillDark); + + enchId = 29;//of Earth Magic + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_EARTH,0, &Player::skillEarth); + + enchId = 30;//of Fire Magic + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_FIRE,0, &Player::skillFire); + + enchId = 31;//of Light Magic + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_LIGHT,0, &Player::skillLight); + + enchId = 32;//of Mind Magic + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_MIND,0, &Player::skillMind); + + enchId = 33;//of Spirit Magic + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_SPIRIT,0, &Player::skillSpirit); + + enchId = 34;//of Water Magic + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_WATER,0, &Player::skillWater); + + enchId = 42;//of Doom + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_HEALTH, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_MANA, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, 1); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, 1); + + enchId = 43;//of Earth + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 10); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_HEALTH, 10); + + enchId = 44;//of Life + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_HEALTH, 10); + + enchId = 45;//Rogues + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 5); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 5); + + enchId = 46;//of The Dragon + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 25); + + enchId = 47;//of The Eclipse + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_MANA, 10); + + enchId = 48;//of The Golem + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 15); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 5); + + enchId = 49;//of The Moon + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 10); + + enchId = 50;//of The Phoenix + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 30); + + enchId = 51;//of The Sky + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_MANA, 10); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 10); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10); + + enchId = 52;//of The Stars + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 10); + + enchId = 53;//of The Sun + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 10); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 10); + + enchId = 54;//of The Troll + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 15); + + enchId = 55;//of The Unicorn + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 15); + + enchId = 56;//Warriors + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 5); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 5); + + enchId = 57;//Wizards + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 5); + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 5); + + enchId = 60;//Monks' + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_DODGE, 3, &Player::skillDodge); + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 3, &Player::skillUnarmed); + + enchId = 61;//Thieves' + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 3, &Player::skillStealing); + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_STEALING, 3, &Player::skillDisarmTrap); + + enchId = 62;//of Identifying + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 3, &Player::skillItemId); + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 3, &Player::skillMonsterId); + + enchId = 67;//Assassins' + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 2, &Player::skillDisarmTrap); + + enchId = 68;//Barbarians' + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 5); + + enchId = 69;//of the Storm + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 20); + + enchId = 70;//of the Ocean + NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, 10); + NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 2, &Player::skillAlchemy); +} + +void ItemGen::PopulateRegularBonusMap() +{ + int enchId = 1;//of Might + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_STRENGTH); + + enchId = 2;//of Thought + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE); + + enchId = 3;//of Charm + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_WILLPOWER); + + enchId = 4;//of Vigor + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_ENDURANCE); + + enchId = 5;//of Precision + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_ACCURACY); + + enchId = 6;//of Speed + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SPEED); + + enchId = 7;//of Luck + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_LUCK); + + enchId = 8;//of Health + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_HEALTH); + + enchId = 9;//of Magic + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_MANA); + + enchId = 10;//of Defense + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_AC_BONUS); + + enchId = 11;//of Fire Resistance + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE); + + enchId = 12;//of Air Resistance + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_AIR); + + enchId = 13;//of Water Resistance + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_WATER); + + enchId = 14;//of Earth Resistance + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH); + + enchId = 15;//of Mind Resistance + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_MIND); + + enchId = 16;//of Body Resistance + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_BODY); + + enchId = 17;//of Alchemy + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY); + + enchId = 18;//of Stealing + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_STEALING); + + enchId = 19;//of Disarming + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM); + + enchId = 20;//of Items + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID); + + enchId = 21;//of Monsters + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID); + + enchId = 22;//of Arms + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER); + + enchId = 23;//of Dodging + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_DODGE); + + enchId = 24;//of the Fist + NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_UNARMED); +} + +void ItemGen::PopulateArtifactBonusMap() +{ + int itemId; + itemId = ITEM_ARTIFACT_PUCK; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 40); + + itemId = ITEM_ARTIFACT_IRON_FEATHER; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 40); + + itemId = ITEM_ARTIFACT_WALLACE; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 40); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 10); + + itemId = ITEM_ARTIFACT_CORSAIR; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, 40); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 5); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_STEALING, 5); + + itemId = ITEM_ARTICACT_GOVERNONS_ARMOR; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 10); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 10); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 10); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 10); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, 10); + + itemId = ITEM_ARTIFACT_YORUBA; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 25); + + itemId = ITEM_ARTIFACT_SPLITTER; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 50); + + itemId = ITEM_ARTEFACT_ULLYSES, + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 50); + + itemId = ITEM_ARTEFACT_HANDS_OF_THE_MASTER, + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_DODGE, 10); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 10); + + itemId = ITEM_ARTIFACT_LEAGUE_BOOTS; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 40); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_WATER, 0, &Player::skillWater); + + itemId = ITEM_ARTIFACT_RULERS_RING; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_MIND, 0, &Player::skillMind); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_DARK, 0, &Player::skillDark); + + itemId = ITEM_RELIC_MASH; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 150); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, -40); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, -40); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, -40); + + itemId = ITEM_RELIC_ETHRICS_STAFF; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_DARK, 0, &Player::skillDark); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_MEDITATION, 15); + + itemId = ITEM_RELIC_HARECS_LEATHER; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 5); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_STEALING, 5); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, 50); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, -10); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, -10); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, -10); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, -10); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, -10); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, -10); + + itemId = ITEM_RELIC_OLD_NICK; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 5); + + itemId = ITEM_RELIC_AMUCK; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 100); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 100); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_AC_BONUS, -15); + + itemId = ITEM_RELIC_GLORY_SHIELD; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0, &Player::skillSpirit); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_SHIELD, 5); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, -10); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, -10); + + itemId = ITEM_RELIC_KELEBRIM; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 50); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, -30); + + itemId = ITEM_RELIC_TALEDONS_HELM; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_LIGHT, 0, &Player::skillLight); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 15); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 15); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, -40); + + itemId = ITEM_RELIC_SCHOLARS_CAP; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_LEARNING, +15); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, -50); + + itemId = ITEM_RELIC_PHYNAXIAN_CROWN; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_FIRE, 0, &Player::skillFire); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, +50); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 30); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_AC_BONUS, -20); + + itemId = ITEM_RILIC_TITANS_BELT; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 75); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, -40); + + itemId = ITEM_RELIC_TWILIGHT; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 50); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_LUCK, 50); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, -15); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, -15); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, -15); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, -15); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, -15); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, -15); + + itemId = ITEM_RELIC_ANIA_SELVING; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 150); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_BOW, 5); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_AC_BONUS, -25); + + itemId = ITEM_RELIC_JUSTICE; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_MIND, 0, &Player::skillMind); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_BODY, 0, &Player::skillBody); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, -40); + + itemId = ITEM_RELIC_MEKORIGS_HAMMER; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_SPIRIT, 0, &Player::skillSpirit); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 75); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, -50); + + itemId = ITEM_ARTIFACT_HERMES_SANDALS; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 100); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 50); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 50); + + itemId = ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, -20); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, -20); + + itemId = ITEM_ARTIFACT_MINDS_EYE; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 15); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 15); + + itemId = ITEM_ELVEN_CHAINMAIL; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SPEED, 15); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ACCURACY, 15); + + itemId = ITEM_FORGE_GAUNTLETS; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 15); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 15); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 30); + + itemId = ITEM_ARTIFACT_HEROS_BELT; + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 15); + NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER, 5); +} + +void ItemGen::GetItemBonusSpecialEnchantment( Player* owner, CHARACTER_ATTRIBUTE_TYPE attrToGet, int* additiveBonus, int* halfSkillBonus ) +{ + auto bonusList = ItemGen::specialBonusMap.find(this->uSpecEnchantmentType); + if (bonusList == ItemGen::specialBonusMap.end()) + { + return; + } + std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currList = bonusList->second; + if (currList->find(attrToGet) != currList->end()) + { + CEnchantment* currBonus = (*currList)[attrToGet]; + if (currBonus->statPtr != NULL) + { + if (currBonus->statBonus == 0) + { + *halfSkillBonus = owner->*currBonus->statPtr / 2; + } + else + { + if (*additiveBonus < currBonus->statBonus) + { + *additiveBonus = currBonus->statBonus; + } + } + } + else + { + *additiveBonus += currBonus->statBonus; + } + } +} + +void ItemGen::GetItemBonusArtifact( Player* owner, CHARACTER_ATTRIBUTE_TYPE attrToGet, int* bonusSum ) +{ + auto bonusList = ItemGen::artifactBonusMap.find(this->uItemID); + if (bonusList == ItemGen::artifactBonusMap.end()) + { + return; + } + std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currList = bonusList->second; + if (currList->find(attrToGet) != currList->end()) + { + CEnchantment* currBonus = (*currList)[attrToGet]; + if (currBonus->statPtr != NULL) + { + *bonusSum = owner->*currBonus->statPtr / 2; + } + else + { + *bonusSum += currBonus->statBonus; + } + } +} + +bool ItemGen::IsRegularEnchanmentForAttribute( CHARACTER_ATTRIBUTE_TYPE attrToGet ) +{ + auto bonusList = ItemGen::specialBonusMap.find(this->uSpecEnchantmentType); + if (bonusList == ItemGen::specialBonusMap.end()) + { + return false; + } + std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currList = bonusList->second; + return (currList->find(attrToGet) != currList->end()); + return false; +} + //----- (004B8E3D) -------------------------------------------------------- void GenerateStandartShopItems() {
--- a/Items.h Thu Sep 12 09:58:07 2013 +0200 +++ b/Items.h Sat Sep 14 06:04:18 2013 +0200 @@ -1,5 +1,6 @@ #pragma once #include <array> +#include <map> enum DAMAGE_TYPE:unsigned int { @@ -135,10 +136,22 @@ ITEM_FORGE_GAUNTLETS = 534, ITEM_ARTIFACT_HEROS_BELT = 535,//217 ITEM_ARTIFACT_LADYS_ESCORT = 536, + ITEM_RARE_CLANKERS_AMULET = 537, + ITEM_RARE_LIETENANTS_CUTLASS = 538, + ITEM_RARE_MEDUSAS_MIRROR = 539, + ITEM_RARE_LADY_CARMINES_DAGGER = 540, + ITEM_RARE_VILLAINS_BLADE = 541, + ITEM_RARE_PERFECT_BOW = 542, + ITEM_RARE_PERFECT_BOW_FIXED = 543, ITEM_RARE_SHADOWS_MASK = 544,//220 + ITEM_RARE_GHOST_RING = 545,//220 + ITEM_RARE_FAERIE_RING = 546,//220 ITEM_RARE_SUN_CLOAK = 547,//223 ITEM_RARE_MOON_CLOAK = 548,//224 + ITEM_RARE_ZOKKARS_AXE = 549,//224 ITEM_RARE_VAMPIRES_CAPE = 550,//226 + ITEM_RARE_MINOTAURS_AXE = 551,//226 + ITEM_RARE_GROGNARDS_CUTLASS = 552,//226 ITEM_LICH_JAR_FULL = 601, ITEM_WETSUIT = 604, ITEM_LICH_JAR_EMPTY = 615, @@ -173,7 +186,19 @@ EQUIP_NONE = 20 }; +enum CHARACTER_ATTRIBUTE_TYPE; +struct Player; +typedef struct CEnchantment +{ + CEnchantment(int bonus, unsigned __int16 Player::* skillPtr = NULL): +statBonus(bonus), + statPtr(skillPtr) +{ +} +int statBonus; +unsigned __int16 Player::* statPtr; +} CEnchantment; /* 64 */ #pragma pack(push, 1) @@ -184,6 +209,23 @@ // { // Reset(); // } + static void AddToMap(std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* > &maptoadd, + int enchId, + CHARACTER_ATTRIBUTE_TYPE attrId, + int bonusValue = 0, + unsigned __int16 Player::* skillPtr = NULL); + + static std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* > regularBonusMap; + static std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* > specialBonusMap; + static std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* > artifactBonusMap; + + static void PopulateSpecialBonusMap(); + static void PopulateRegularBonusMap(); + static void PopulateArtifactBonusMap(); + + void GetItemBonusSpecialEnchantment(Player* owner, CHARACTER_ATTRIBUTE_TYPE attrToGet, int* additiveBonus, int* halfSkillBonus); + void GetItemBonusArtifact(Player* owner, CHARACTER_ATTRIBUTE_TYPE attrToGet, int* bonusSum); + bool IsRegularEnchanmentForAttribute(CHARACTER_ATTRIBUTE_TYPE attrToGet); inline bool IsBroken() {return (uAttributes & ITEM_BROKEN) != 0;} inline void SetBroken() {uAttributes |= ITEM_BROKEN;}
--- a/Player.cpp Thu Sep 12 09:58:07 2013 +0200 +++ b/Player.cpp Sat Sep 14 06:04:18 2013 +0200 @@ -156,329 +156,6 @@ 30 // PLAYER_SKILL_PLATE }; -#include <map> -#include <list> - -typedef struct CEnchantment -{ - CEnchantment(int bonus, unsigned __int16 Player::* skillPtr = NULL): - statBonus(bonus), - statPtr(skillPtr) - { - } - int statBonus; - unsigned __int16 Player::* statPtr; -} CEnchantment; - -#define NEWBONUSINTOSPECIALLIST(x,y) AddToMap(specialBonusMap, enchId, x, y); -#define NEWBONUSINTOSPECIALLIST2(x,y,z) AddToMap(specialBonusMap, enchId, x, y, z); - -#define NEWBONUSINTOREGULARLIST(x) AddToMap(regularBonusMap, enchId, x); - -#define NEWBONUSINTOARTIFACTLIST(x,y) AddToMap(artifactBonusMap, enchId, x, y); -#define NEWBONUSINTOARTIFACTLIST2(x,y,z) AddToMap(artifactBonusMap, enchId, x, y, z); - -std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* > regularBonusMap; -std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* > specialBonusMap; -std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* > artifactBonusMap; -//------------------------------------------------------------------------- - -void AddToMap(std::map<int, std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* > &maptoadd, - int enchId, - CHARACTER_ATTRIBUTE_TYPE attrId, - int bonusValue = 0, - unsigned __int16 Player::* skillPtr = NULL) -{ - auto key = maptoadd.find(enchId); - std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currMap; - if (key == maptoadd.end()) - { - currMap = new std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>; - maptoadd[enchId] = currMap; - } - else - { - currMap = key->second; - } - Assert(currMap->find(attrId) == currMap->end(), "Attribute %d already present for enchantment %d", attrId, enchId); - (*currMap)[attrId] = new CEnchantment(bonusValue, skillPtr); -} -//------------------------------------------------------------------------- - -void PopulateSpecialBonusMap() -{ - int enchId = 1;// of Protection, +10 to all Resistances - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 10); - NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_AIR, 10); - NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_WATER, 10); - NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_EARTH, 10); - NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_MIND, 10); - NEWBONUSINTOSPECIALLIST( CHARACTER_ATTRIBUTE_RESIST_BODY, 10); - - enchId = 2;//of The Gods, +10 to all Seven Statistics - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 10); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 10); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 10); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 10); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 10); - - enchId = 26;//of Air Magic - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_AIR,0, &Player::skillAir); - - enchId = 27;//of Body Magic - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_BODY,0, &Player::skillBody); - - enchId = 28;//of Dark Magic - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_DARK,0, &Player::skillDark); - - enchId = 29;//of Earth Magic - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_EARTH,0, &Player::skillEarth); - - enchId = 30;//of Fire Magic - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_FIRE,0, &Player::skillFire); - - enchId = 31;//of Light Magic - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_LIGHT,0, &Player::skillLight); - - enchId = 32;//of Mind Magic - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_MIND,0, &Player::skillMind); - - enchId = 33;//of Spirit Magic - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_SPIRIT,0, &Player::skillSpirit); - - enchId = 34;//of Water Magic - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_WATER,0, &Player::skillWater); - - enchId = 42;//of Doom - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_HEALTH, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_MANA, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_MIND, 1); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_BODY, 1); - - enchId = 43;//of Earth - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 10); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_HEALTH, 10); - - enchId = 44;//of Life - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_HEALTH, 10); - - enchId = 45;//Rogues - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 5); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 5); - - enchId = 46;//of The Dragon - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 25); - - enchId = 47;//of The Eclipse - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_MANA, 10); - - enchId = 48;//of The Golem - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 15); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 5); - - enchId = 49;//of The Moon - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 10); - - enchId = 50;//of The Phoenix - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE, 30); - - enchId = 51;//of The Sky - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_MANA, 10); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_SPEED, 10); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 10); - - enchId = 52;//of The Stars - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 10); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ACCURACY, 10); - - enchId = 53;//of The Sun - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 10); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 10); - - enchId = 54;//of The Troll - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 15); - - enchId = 55;//of The Unicorn - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_LUCK, 15); - - enchId = 56;//Warriors - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_STRENGTH, 5); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_ENDURANCE, 5); - - enchId = 57;//Wizards - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE, 5); - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_WILLPOWER, 5); - - enchId = 60;//Monks' - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_DODGE, 3, &Player::skillDodge); - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_UNARMED, 3, &Player::skillUnarmed); - - enchId = 61;//Thieves' - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 3, &Player::skillStealing); - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_STEALING, 3, &Player::skillDisarmTrap); - - enchId = 62;//of Identifying - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID, 3, &Player::skillItemId); - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID, 3, &Player::skillMonsterId); - - enchId = 67;//Assassins' - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM, 2, &Player::skillDisarmTrap); - - enchId = 68;//Barbarians' - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_AC_BONUS, 5); - - enchId = 69;//of the Storm - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_AIR, 20); - - enchId = 70;//of the Ocean - NEWBONUSINTOSPECIALLIST(CHARACTER_ATTRIBUTE_RESIST_WATER, 10); - NEWBONUSINTOSPECIALLIST2(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY, 2, &Player::skillAlchemy); -} -//------------------------------------------------------------------------- - -void PopulateRegularBonusMap() -{ - int enchId = 1;//of Might - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_STRENGTH); - - enchId = 2;//of Thought - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_INTELLIGENCE); - - enchId = 3;//of Charm - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_WILLPOWER); - - enchId = 4;//of Vigor - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_ENDURANCE); - - enchId = 5;//of Precision - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_ACCURACY); - - enchId = 6;//of Speed - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SPEED); - - enchId = 7;//of Luck - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_LUCK); - - enchId = 8;//of Health - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_HEALTH); - - enchId = 9;//of Magic - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_MANA); - - enchId = 10;//of Defense - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_AC_BONUS); - - enchId = 11;//of Fire Resistance - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_FIRE); - - enchId = 12;//of Air Resistance - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_AIR); - - enchId = 13;//of Water Resistance - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_WATER); - - enchId = 14;//of Earth Resistance - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_EARTH); - - enchId = 15;//of Mind Resistance - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_MIND); - - enchId = 16;//of Body Resistance - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_RESIST_BODY); - - enchId = 17;//of Alchemy - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_ALCHEMY); - - enchId = 18;//of Stealing - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_STEALING); - - enchId = 19;//of Disarming - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM); - - enchId = 20;//of Items - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_ITEM_ID); - - enchId = 21;//of Monsters - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID); - - enchId = 22;//of Arms - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER); - - enchId = 23;//of Dodging - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_DODGE); - - enchId = 24;//of the Fist - NEWBONUSINTOREGULARLIST(CHARACTER_ATTRIBUTE_SKILL_UNARMED); -} - -//------------------------------------------------------------------------- -void PopulateArtifactBonusMap() -{ - int enchId = 1;//of Might - NEWBONUSINTOARTIFACTLIST(CHARACTER_ATTRIBUTE_STRENGTH, 5); -} -//------------------------------------------------------------------------- - -void Player::GetItemBonusSpecialEnchantment(int enchantmentId, CHARACTER_ATTRIBUTE_TYPE attrToGet, int* additiveBonus, int* halfSkillBonus) -{ - auto bonusList = specialBonusMap.find(enchantmentId); - if (bonusList == specialBonusMap.end()) - { - return; - } - std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currList = bonusList->second; - if (currList->find(attrToGet) != currList->end()) - { - CEnchantment* currBonus = (*currList)[attrToGet]; - if (currBonus->statPtr != NULL) - { - if (currBonus->statBonus == 0) - { - *halfSkillBonus = this->*currBonus->statPtr / 2; - } - else - { - if (*additiveBonus < currBonus->statBonus) - { - *additiveBonus = currBonus->statBonus; - } - } - } - else - { - *additiveBonus += currBonus->statBonus; - } - } -} - -//------------------------------------------------------------------------- -bool IsRegularEnchanmentForAttribute(int enchantmentId, CHARACTER_ATTRIBUTE_TYPE attrToGet) -{ - auto bonusList = specialBonusMap.find(enchantmentId); - if (bonusList == specialBonusMap.end()) - { - return false; - } - std::map<CHARACTER_ATTRIBUTE_TYPE, CEnchantment*>* currList = bonusList->second; - return (currList->find(attrToGet) != currList->end()); -} - //----- (00490913) -------------------------------------------------------- int PlayerCreation_GetUnspentAttributePointCount() { @@ -1461,7 +1138,7 @@ { unsigned __int16 v2; // ax@1 int v5; // edi@7 - + return true; if (CheckHiredNPCSpeciality(Scholar)) return true; @@ -1561,11 +1238,6 @@ //----- (0048C6AF) -------------------------------------------------------- Player::Player() { - if (specialBonusMap.empty()) - { - PopulateSpecialBonusMap(); - } - memset(&pEquipment, 0, sizeof(PlayerEquipment)); memset(pInventoryMatrix, 0, 126 * sizeof(int)); for (uint i = 0; i < 126; ++i) @@ -3450,72 +3122,30 @@ //----- (0048EAAE) -------------------------------------------------------- int Player::GetItemsBonus( enum CHARACTER_ATTRIBUTE_TYPE attr, bool getOnlyMainHandDmg /*= false*/ ) { - // signed int v4; // eax@1 int v5; // edi@1 - Player *v8; // ecx@48 int v9; // eax@49 - int v10; // edx@49 - Player *v11; // ecx@55 - int v12; // eax@56 - int v13; // edx@56 int v14; // ecx@58 int v15; // eax@58 - Player *v16; // ecx@61 int v17; // eax@62 - Player *v18; // ecx@66 - int v19; // eax@67 int v20; // eax@69 - Player *v21; // ecx@75 int v22; // eax@76 int v23; // edx@76 - //int v24; // eax@79 int v25; // ecx@80 int v26; // edi@80 - Player *v27; // ecx@84 - int v28; // eax@85 - int v29; // edx@85 - Player *v30; // ecx@96 int v31; // ebp@97 int v32; // eax@98 unsigned int v33; // eax@100 - int v34; // eax@103 - char v35; // zf@104 - char v36; // zf@107 - unsigned __int8 v37; // zf@119 - char v38; // sf@119 - unsigned __int8 v39; // of@119 - char v40; // zf@122 - char v41; // zf@145 - char v42; // zf@164 - char v43; // zf@173 - char v44; // zf@189 - char v45; // zf@198 - char v46; // zf@239 - int v47; // eax@268 - int v48; // eax@269 - int v49; // eax@291 - char v50; // zf@295 - int v51; // eax@306 - int v52; // eax@307 - char v53; // zf@312 - char v54; // zf@336 - char v55; // zf@348 int v56; // eax@365 int v57; // ebx@368 signed int v58; // [sp-4h] [bp-20h]@10 - signed int v59; // [sp-4h] [bp-20h]@71 - signed int v60; // [sp-4h] [bp-20h]@347 int v61; // [sp+10h] [bp-Ch]@1 int v62; // [sp+14h] [bp-8h]@1 - int v63; // [sp+18h] [bp-4h]@101 - ItemGen *attra; // [sp+20h] [bp+4h]@101 - unsigned int v65; // [sp+24h] [bp+8h]@95 + ItemGen *currEquippedItem; // [sp+20h] [bp+4h]@101 bool no_skills; v5 = 0; v62 = 0; v61 = 0; - no_skills=false; switch (attr) @@ -3550,455 +3180,214 @@ return 0; } - if ( (signed int)attr > 28 ) - { - if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS || attr == CHARACTER_ATTRIBUTE_RANGED_ATTACK) - { + switch(attr) //TODO would be nice to move these into separate functions + { + case CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS: + case CHARACTER_ATTRIBUTE_RANGED_ATTACK: if ( HasItemEquipped(EQUIP_BOW) ) v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uBow-1].uItemID].uDamageMod; - return v5 + v62 + v61; - } - if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MIN ) - { + return v5; + break; + + case CHARACTER_ATTRIBUTE_RANGED_DMG_MIN: if ( !HasItemEquipped(EQUIP_BOW) ) - return v5 + v62 + v61; + return 0; v57 = this->pOwnItems[this->pEquipment.uBow-1].uItemID; v5 = pItemsTable->pItems[v57].uDamageMod; v56 = pItemsTable->pItems[v57].uDamageDice; - v5 += v56; - return v5 + v62 + v61; - } - if ( attr == CHARACTER_ATTRIBUTE_RANGED_DMG_MAX ) - { + return v5 + v56; + break; + + case CHARACTER_ATTRIBUTE_RANGED_DMG_MAX: if ( !HasItemEquipped(EQUIP_BOW) ) - return v5 + v62 + v61; + return 0; v20 = this->pOwnItems[this->pEquipment.uBow-1].uItemID; v5 = pItemsTable->pItems[v20].uDamageDice * pItemsTable->pItems[v20].uDamageRoll; v56 = pItemsTable->pItems[v20].uDamageMod; - v5 += v56; - return v5 + v62 + v61; - } - if ( (signed int)attr <= 33 || (signed int)attr > 46 ) - return v5 + v62 + v61; -LABEL_95: - v65 = 0; - while ( 1 ) - { - if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) - goto LABEL_361; - v31 = this->pEquipment.pIndices[v65] - 1; - if ( attr == CHARACTER_ATTRIBUTE_AC_BONUS ) - { - v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); - if ( v32 >= 3 && v32 <= 11 ) - { - v33 = this->pInventoryItemList[v31].uItemID; - v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; - } - } - v63 = (int)((char *)this + 36 * v31); - attra = (ItemGen *)(v63 + 532); - if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(attra)) == 1 - && !pItemsTable->IsMaterialSpecial(attra) ) + return v5 + v56; + + case CHARACTER_ATTRIBUTE_LEVEL: + if ( !Player::HasEnchantedItemEquipped(25) ) + return 0; + return 5; + break; + + case CHARACTER_ATTRIBUTE_MELEE_DMG_MAX: + if ( IsUnarmed() ) { - v34 = attra->uItemID; - switch ( attra->uItemID ) - { - case ITEM_ARTIFACT_PUCK: - if ( attr == 5 ) - v5 += 50; - goto LABEL_361; - case ITEM_ARTIFACT_IRON_FEATHER: - if ( attr == 0 ) - v5 += 40; - goto LABEL_361; - case ITEM_ARTIFACT_WALLACE: - if ( attr == 21 ) - v61 += 10; - if ( attr == 2 ) - v5 += 40; - goto LABEL_361; - case ITEM_ARTIFACT_CORSAIR: - if ( attr == 17 ) - v61 += 5; - if ( attr == 18 ) - v61 += 5; - if ( attr == 6 ) - v5 += 40; - goto LABEL_361; - case ITEM_ARTICACT_GOVERNONS_ARMOR: - if (attr <= 6) - v5 += 10; - goto LABEL_361; - case ITEM_ARTIFACT_YORUBA: - if ( attr == 3 ) - v5 += 25; - goto LABEL_361; - case ITEM_ARTIFACT_SPLITTER: - if ( attr == 10 ) - v5 += 50; - goto LABEL_361; - case ITEM_ARTEFACT_ULLYSES: - if ( attr == 4 ) - v5 += 50; - goto LABEL_361; - case ITEM_ARTEFACT_HANDS_OF_THE_MASTER: - if ( attr == 23 ) - v61 += 10; - if ( attr == 22 ) - v61 += 10; - goto LABEL_361; - case ITEM_ARTIFACT_LEAGUE_BOOTS: - if ( attr == 36 ) - { - v34 = this->pActiveSkills[PLAYER_SKILL_WATER]; - v62 = (v32 / 2) & 0x1F; - } - if ( attr == 5 ) - v5 += 40; - goto LABEL_361; - case ITEM_ARTIFACT_RULERS_RING: - if ( attr == 39 ) - { - v34 = this->pActiveSkills[PLAYER_SKILL_MIND]; - v62 = (v34 / 2 ) & 0x1F; - } - if ( attr == 42 ) - { - v34 = this->pActiveSkills[PLAYER_SKILL_DARK]; - v62 = (v34 / 2 ) & 0x1F; - } - goto LABEL_361; - case ITEM_RELIC_MASH: - if ( attr == 0 ) - v5 += 150; - if ( attr == 1 ) - v5 -= 40; - if ( attr == 2 ) - v5 -= 40; - if ( attr == 5 ) - v5 -= 40; - goto LABEL_361; - case ITEM_RELIC_ETHRICS_STAFF: - if ( attr == 42 ) - { - v34 = this->pActiveSkills[PLAYER_SKILL_DARK]; - v62 = (v34 / 2 ) & 0x1F; - } - if ( attr == 43 ) - v61 += 15; - goto LABEL_361; - case ITEM_RELIC_HARECS_LEATHER: - if ( attr == 17 ) - v61 += 5; - if ( attr == 18 ) - v61 += 5; - if ( attr == 6 ) - v5 += 50; - if ( attr == 11 || attr == 10 || attr == 12 || attr == 13 || attr == 33 || attr == 14 ) - { - v5 -= 10; - goto LABEL_361; - } - if ( attr == 15 ) - v5 -= 10; - goto LABEL_361; - case ITEM_RELIC_OLD_NICK: - if ( attr == 18 ) - v61 += 5; - goto LABEL_361; - case ITEM_RELIC_AMUCK: - if ( attr == 0) - v5 += 100; - if ( attr == 3 ) - v5 += 100; - if ( attr == 9 ) - v5 -= 15; - goto LABEL_361; - case ITEM_RELIC_GLORY_SHIELD: - if ( attr == 45 ) - v61 += 5; - if ( attr == 15 ) - v5 -= 10; - if ( attr == 14 ) - v5 -= 10; - goto LABEL_361; - case ITEM_RELIC_KELEBRIM: - if ( attr == 3 ) - v5 += 50; - goto LABEL_361; - case ITEM_RELIC_TALEDONS_HELM: - if ( attr == 2 ) - v5 += 15; - if ( !attr ) - v5 += 15; - if ( attr == 6 ) - v5 -= 40; - goto LABEL_361; - case ITEM_RELIC_SCHOLARS_CAP: - if ( attr == 46 ) - v61 += 15; - if ( attr == 3 ) - v5 -= 50; - goto LABEL_361; - case ITEM_RELIC_PHYNAXIAN_CROWN: - if ( attr == 34 ) - { - v34 = this->pActiveSkills[PLAYER_SKILL_FIRE]; - v62 = (v34 / 2 ) & 0x1F; - } - if ( attr == 12 ) - v5 += 50; - if ( attr == 2 ) - v5 += 30; - if ( attr == 9 ) - v5 -= 20; - goto LABEL_361; - case ITEM_RILIC_TITANS_BELT: - if ( !attr ) - v5 += 75; - if ( attr == 5 ) - v5 -= 40; - goto LABEL_361; - case ITEM_RELIC_TWILIGHT: - if ( attr == CHARACTER_ATTRIBUTE_SPEED ) - v5 += 50; - if ( attr == CHARACTER_ATTRIBUTE_LUCK ) - v5 += 50; - if ( attr == CHARACTER_ATTRIBUTE_RESIST_AIR || attr == CHARACTER_ATTRIBUTE_RESIST_FIRE || attr == CHARACTER_ATTRIBUTE_RESIST_WATER || attr == CHARACTER_ATTRIBUTE_RESIST_EARTH || attr == CHARACTER_ATTRIBUTE_RESIST_SPIRIT || attr == CHARACTER_ATTRIBUTE_RESIST_MIND ) - { - v5 -= 15; - goto LABEL_361; - } - if ( attr == 15 ) - v5 -= 15; - goto LABEL_361; - case ITEM_RELIC_ANIA_SELVING: - if ( attr == CHARACTER_ATTRIBUTE_ACCURACY ) - v5 += 150; - if ( attr == CHARACTER_ATTRIBUTE_SKILL_BOW ) - v61 += 5; - if ( attr == CHARACTER_ATTRIBUTE_AC_BONUS ) - v5 -= 25; - goto LABEL_361; - case ITEM_RELIC_JUSTICE: - if ( attr == 39 ) - { - v34 = this->pActiveSkills[PLAYER_SKILL_MIND]; - v62 = (v34 / 2 ) & 0x1F; - } - if ( attr == 40 ) - { - v34 = this->pActiveSkills[PLAYER_SKILL_BODY]; - v62 = (v34 / 2 ) & 0x1F; - } - if ( attr == 5 ) - v5 -= 40; - goto LABEL_361; - case ITEM_RELIC_MEKORIGS_HAMMER: - if ( attr == 38 ) - { - v34 = this->pActiveSkills[PLAYER_SKILL_SPIRIT]; - v62 = ( v34 / 2 ) & 0x1F; - } - if ( attr == 0 ) - v5 += 75; - if ( attr == 11 ) - v5 -= 50; - goto LABEL_361; - case ITEM_ARTIFACT_HERMES_SANDALS: - if ( attr == 5 ) - v5 += 100; - if ( attr == 4 ) - v5 += 50; - if ( attr == 11 ) - v5 += 50; - goto LABEL_361; - case ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP: - if ( attr == 1 ) - v5 -= 20; - if ( attr == 2 ) - v5 -= 20; - goto LABEL_361; - case ITEM_ARTIFACT_MINDS_EYE: - if ( attr == 1 ) - v5 += 15; - if ( attr == 2 ) - v5 += 15; - goto LABEL_361; - case ITEM_ELVEN_CHAINMAIL: - if ( attr == 5 ) - v5 += 15; - if ( attr == 4 ) - v5 += 15; - goto LABEL_361; - case ITEM_FORGE_GAUNTLETS: - if ( attr == 10 ) - v5 += 30; - if ( attr == 0 ) - v5 += 15; - if ( attr == 3 ) - v5 += 15; - goto LABEL_361; - case ITEM_ARTIFACT_HEROS_BELT: - if ( attr == 21 ) - v61 += 5; - if ( attr == 0 ) - v5 += 15; - if (attr >= 10 && attr <= 15) - v5 += 10; - goto LABEL_361; - case ITEM_ARTIFACT_LADYS_ESCORT: - if (attr >= 10 && attr <= 15) - v5 += 10; - goto LABEL_361; - default: - goto LABEL_361; - } - goto LABEL_361; - } - if ( this->pOwnItems[v65].uEnchantmentType == attr + 1 ) - { - if ( attr >= CHARACTER_ATTRIBUTE_STRENGTH ) - { - if ( attr <= CHARACTER_ATTRIBUTE_RESIST_BODY ) - { - v5 += this->pOwnItems[v65].m_enchantmentStrength; - } - else - { - if ( attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED && v5 < this->pOwnItems[v65].m_enchantmentStrength ) - v5 = this->pOwnItems[v65].m_enchantmentStrength; - } - } + return 3; } else { - v34 = this->pOwnItems[v65].uSpecEnchantmentType; - GetItemBonusSpecialEnchantment(v34, attr, &v5, &v61); - } - -LABEL_361: - ++v65; - if ( (signed int)v65 >= 16 ) - return v5 + v62 + v61; - } - } - if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MAX ) - { - if ( IsUnarmed() != 1 ) - { - if ( this->HasItemEquipped(EQUIP_MAIN_HAND) ) - { - v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); - if ( v22 >= 0 ) + if ( this->HasItemEquipped(EQUIP_MAIN_HAND) ) { - if ( v22 <= 2 ) + v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); + if ( v22 >= 0 && v22 <= 2) { - v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; + v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; + v26 = pItemsTable->pItems[v23].uDamageRoll; if ( this->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) { - v26 = pItemsTable->pItems[v23].uDamageRoll; v25 = pItemsTable->pItems[v23].uDamageDice; } else { - v25 = pItemsTable->pItems[v23].uDamageRoll; - v26 = pItemsTable->pItems[v23].uDamageDice + 1; + v25 = pItemsTable->pItems[v23].uDamageDice + 1; } v5 = pItemsTable->pItems[v23].uDamageMod + v25 * v26; } } - } - - if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) ) - { - - v28 = this->GetEquippedItemEquipType(EQUIP_OFF_HAND); - if ((v28 < 0) || v28 > 2 ) - return v5 + v62 + v61; + if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0 && GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2)) + { + return v5; } - v15 = pItemsTable->pItems[v23].uDamageMod; - v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; - v5 += v15 + v14; - return v5 + v62 + v61; - } - v59 = 3; - v5 = v59; - return v5 + v62 + v61; - } - if ( (signed int)attr < 0 ) - return v5 + v62 + v61; - if ( (signed int)attr <= CHARACTER_ATTRIBUTE_SKILL_UNARMED ) - goto LABEL_95; - if ( attr == CHARACTER_ATTRIBUTE_LEVEL ) + else + { + v23 = this->pOwnItems[this->pEquipment.uShield].uItemID; + v15 = pItemsTable->pItems[v23].uDamageMod; + v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; + return v5 + v15 + v14; + } + } + break; + + case CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS: + case CHARACTER_ATTRIBUTE_ATTACK: + if ( IsUnarmed() ) { - if ( !Player::HasEnchantedItemEquipped(25) ) - return v5 + v62 + v61; - v5 = 5; - return v5 + v62 + v61; + return 0; } - if ( (signed int)attr <= CHARACTER_ATTRIBUTE_LEVEL ) - return v5 + v62 + v61; - if ( (signed int)attr <= CHARACTER_ATTRIBUTE_MELEE_DMG_BONUS ) - { - if ( IsUnarmed() == 1 ) - { - v5 = 0; - return v5 + v62 + v61; - } - if ( this->HasItemEquipped(EQUIP_MAIN_HAND) ) - { - v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); - if ( v17 >= 0 ) + if ( this->HasItemEquipped(EQUIP_MAIN_HAND) ) { - if ( v17 <= 2 ) + v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); + if ( v17 >= 0 && v17 <= 2) + { v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand-1].uItemID].uDamageMod; + } } - } - if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = this->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) - return v5 + v62 + v61; - v20 = this->pOwnItems[this->pEquipment.uShield - 1].uItemID; - v56 = pItemsTable->pItems[v20].uDamageMod; - v5 += v56; - return v5 + v62 + v61; - } - if ( attr == CHARACTER_ATTRIBUTE_MELEE_DMG_MIN ) - { - if ( IsUnarmed() == 1 ) - { - v5 = 1; - return v5 + v62 + v61; - } - if ( this->HasItemEquipped(EQUIP_MAIN_HAND) ) - { - v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); - if ( v9 >= 0 ) + if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (this->GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0) || this->GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2 ) + return v5; + else { - if ( v9 <= 2 ) + v20 = this->pOwnItems[this->pEquipment.uShield - 1].uItemID; + v56 = pItemsTable->pItems[v20].uDamageMod; + return v5 + v56; + } + break; + + case CHARACTER_ATTRIBUTE_MELEE_DMG_MIN: + if ( IsUnarmed() ) + { + return 1; + } + if ( this->HasItemEquipped(EQUIP_MAIN_HAND) ) + { + v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); + if ( v9 >= 0 && v9 <= 2) { v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + - pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; - if ( !this->pEquipment.uShield ) + pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; + if ( !this->pEquipment.uShield && pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4) { - if ( pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) - ++v5; + ++v5; } } } - } - - if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND)) + + if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (this->GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0) || this->GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2 ) + { + return v5; + } + else + { + v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; + v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; + return v5 + v15 + v14; + } + break; + + case CHARACTER_ATTRIBUTE_STRENGTH: + case CHARACTER_ATTRIBUTE_INTELLIGENCE: + case CHARACTER_ATTRIBUTE_WILLPOWER: + case CHARACTER_ATTRIBUTE_ENDURANCE: + case CHARACTER_ATTRIBUTE_ACCURACY: + case CHARACTER_ATTRIBUTE_SPEED: + case CHARACTER_ATTRIBUTE_LUCK: + case CHARACTER_ATTRIBUTE_HEALTH: + case CHARACTER_ATTRIBUTE_MANA: + case CHARACTER_ATTRIBUTE_AC_BONUS: + + case CHARACTER_ATTRIBUTE_RESIST_FIRE: + case CHARACTER_ATTRIBUTE_RESIST_AIR: + case CHARACTER_ATTRIBUTE_RESIST_WATER: + case CHARACTER_ATTRIBUTE_RESIST_EARTH: + case CHARACTER_ATTRIBUTE_RESIST_MIND: + case CHARACTER_ATTRIBUTE_RESIST_BODY: + case CHARACTER_ATTRIBUTE_RESIST_SPIRIT: + + case CHARACTER_ATTRIBUTE_SKILL_ALCHEMY: + case CHARACTER_ATTRIBUTE_SKILL_STEALING: + case CHARACTER_ATTRIBUTE_SKILL_TRAP_DISARM: + case CHARACTER_ATTRIBUTE_SKILL_ITEM_ID: + case CHARACTER_ATTRIBUTE_SKILL_MONSTER_ID: + case CHARACTER_ATTRIBUTE_SKILL_ARMSMASTER: + case CHARACTER_ATTRIBUTE_SKILL_DODGE: + case CHARACTER_ATTRIBUTE_SKILL_UNARMED: + + case CHARACTER_ATTRIBUTE_SKILL_FIRE: + case CHARACTER_ATTRIBUTE_SKILL_AIR: + case CHARACTER_ATTRIBUTE_SKILL_WATER: + case CHARACTER_ATTRIBUTE_SKILL_EARTH: + case CHARACTER_ATTRIBUTE_SKILL_SPIRIT: + case CHARACTER_ATTRIBUTE_SKILL_MIND: + case CHARACTER_ATTRIBUTE_SKILL_BODY: + case CHARACTER_ATTRIBUTE_SKILL_LIGHT: + case CHARACTER_ATTRIBUTE_SKILL_DARK: + case CHARACTER_ATTRIBUTE_SKILL_MEDITATION: + case CHARACTER_ATTRIBUTE_SKILL_BOW: + case CHARACTER_ATTRIBUTE_SKILL_SHIELD: + case CHARACTER_ATTRIBUTE_SKILL_LEARNING: + for (int i = 0; i < 16; i++) + { + if ( HasItemEquipped((ITEM_EQUIP_TYPE)i) ) { - v12 = this->GetEquippedItemEquipType(EQUIP_OFF_HAND); - if ((v12 < 0) || v12 > 2 ) - return v5 + v62 + v61; + v31 = this->pEquipment.pIndices[i] - 1; + currEquippedItem = &this->pInventoryItemList[v31]; + if ( attr == CHARACTER_ATTRIBUTE_AC_BONUS ) + { + v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)i); + if ( v32 >= 3 && v32 <= 11 ) + { + v33 = currEquippedItem->uItemID; + v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; + } + } + if ( pItemsTable->IsMaterialNonCommon((ItemGen *)(currEquippedItem)) + && !pItemsTable->IsMaterialSpecial(currEquippedItem) ) + { + currEquippedItem->GetItemBonusArtifact(this, attr, &v62); + } + else if ( currEquippedItem->uEnchantmentType != 0 ) + { + if (currEquippedItem->IsRegularEnchanmentForAttribute(attr)) + { + if ( attr > CHARACTER_ATTRIBUTE_RESIST_BODY && v5 < currEquippedItem->m_enchantmentStrength ) + v5 = currEquippedItem->m_enchantmentStrength; + else + v5 += currEquippedItem->m_enchantmentStrength; + } + } + else + { + currEquippedItem->GetItemBonusSpecialEnchantment(this, attr, &v5, &v61); + } } - v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; - v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; - v5 += v15 + v14; - } - return v5 + v62 + v61; + } + return v5 + v62 + v61; + break; + default: + return 0; + } } //----- (0048F73C) --------------------------------------------------------
--- a/Player.h Thu Sep 12 09:58:07 2013 +0200 +++ b/Player.h Sat Sep 14 06:04:18 2013 +0200 @@ -627,7 +627,6 @@ inline bool IsMale() { return GetSexByVoice() == SEX_MALE;} inline bool IsFemale() { return !IsMale();} - void GetItemBonusSpecialEnchantment(int enchantmentId, CHARACTER_ATTRIBUTE_TYPE attrToGet, int* additiveBonus, int* halfSkillBonus); __int64 pConditions[20]; unsigned __int64 uExperience; char pName[16];