Mercurial > mm7
comparison Player.cpp @ 1386:72191abc8116
Player::SelectPhrasesTransaction redone
author | Grumpy7 |
---|---|
date | Wed, 17 Jul 2013 00:19:33 +0200 |
parents | 5644aecb5082 |
children | 297b6f192232 |
comparison
equal
deleted
inserted
replaced
1385:5644aecb5082 | 1386:72191abc8116 |
---|---|
1081 } | 1081 } |
1082 } | 1082 } |
1083 } | 1083 } |
1084 // 506128: using guessed type int areWeLoadingTexture; | 1084 // 506128: using guessed type int areWeLoadingTexture; |
1085 | 1085 |
1086 //identf | |
1087 //----- (00490EEE) -------------------------------------------------------- | 1086 //----- (00490EEE) -------------------------------------------------------- |
1088 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) | 1087 int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) //TODO: probably move this somewhere else, not really Player:: stuff |
1089 { | 1088 { |
1090 int pSkillLevel; // eax@1 | 1089 unsigned int idemId; // edx@1 |
1091 int NotBuy; // eax@1 | 1090 signed int equipType; // esi@1 |
1092 int result; | 1091 float multiplier; // ST04_4@26 |
1093 signed int pEquipType; // esi@1 | 1092 int price; // edi@26 |
1094 float *pPriceMultiplier; // esi@26 | 1093 int merchantLevel; // [sp+10h] [bp-8h]@1 |
1095 int pPriceItemService; // edi@26 | 1094 int itemValue; |
1096 | 1095 |
1097 pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); | 1096 merchantLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); |
1098 NotBuy = 4; | 1097 idemId = pItem->uItemID; |
1099 pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; | 1098 equipType = pItemsTable->pItems[idemId].uEquipType; |
1100 if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) | 1099 itemValue = pItem->GetValue(); |
1101 && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) | 1100 |
1102 return 5; | 1101 switch (building_type) |
1103 if ( building_type == BildingType_WeaponShop ) | 1102 { |
1104 { | 1103 case 1: |
1105 if ( pEquipType > EQUIP_BOW ) | 1104 if (idemId >= 529) |
1106 return NotBuy; | 1105 return 5; |
1107 if (pItem->Stolen()) | 1106 if (equipType > 2) |
1108 return 6; | 1107 return 4; |
1109 } | 1108 break; |
1110 if ( building_type == BildingType_ArmorShop ) | 1109 case 2: |
1111 { | 1110 if (idemId >= 529) |
1112 if ( pEquipType < 3 && pEquipType > 9 ) | 1111 return 5; |
1113 return NotBuy; | 1112 if ( equipType < 3 || equipType > 9) |
1114 if (pItem->Stolen()) | 1113 return 4; |
1115 return 6; | 1114 break; |
1116 } | 1115 case 3: |
1117 if ( building_type == BildingType_MagicShop ) | 1116 if (idemId >= 529) |
1118 { | 1117 return 5; |
1119 if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) | 1118 if ( pItemsTable->pItems[idemId].uSkillType != 38 ) |
1120 { | 1119 return 4; |
1121 if (pItem->Stolen()) | 1120 break; |
1122 return 6; | 1121 case 4: |
1123 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | 1122 if ((idemId >= 529 && idemId < 740) || idemId > 771) |
1124 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | 1123 return 5; |
1125 if ( ShopMenuType == 3 )//Sell | 1124 if ( !(equipType == 13 || equipType == 14 || equipType == 17)) |
1126 { | 1125 return 4; |
1127 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | 1126 break; |
1128 if (!pItem->Broken()) | 1127 } |
1129 { | 1128 if (pItem->Stolen()) |
1130 if ( pSkillLevel ) | 1129 return 6; |
1131 result = (pPriceItemService == pItem->GetValue()) + 2; | 1130 |
1132 else | 1131 multiplier = p2DEvents[BuildID_2Events - 1].fPriceMultiplier; |
1133 result = 1; | 1132 switch (ShopMenuType) |
1134 return result; | 1133 { |
1135 } | 1134 case 2: |
1136 pPriceItemService = 1; | 1135 price = GetBuyingPrice(itemValue, multiplier); |
1137 if ( pSkillLevel ) | 1136 break; |
1138 result = (pPriceItemService == pItem->GetValue()) + 2; | 1137 case 3: |
1139 else | |
1140 result = 1; | |
1141 return result; | |
1142 } | |
1143 if ( ShopMenuType == 4 )//Identify | |
1144 { | |
1145 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1146 if ( pSkillLevel ) | |
1147 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1148 else | |
1149 result = 1; | |
1150 return result; | |
1151 } | |
1152 if ( ShopMenuType == 5 )//Repair | |
1153 { | |
1154 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1155 if ( pSkillLevel ) | |
1156 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1157 else | |
1158 result = 1; | |
1159 return result; | |
1160 } | |
1161 if ( ShopMenuType != 6 )//Buy and ??? | |
1162 { | |
1163 if ( pSkillLevel ) | |
1164 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1165 else | |
1166 result = 1; | |
1167 return result; | |
1168 } | |
1169 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
1170 if (pItem->Broken()) | 1138 if (pItem->Broken()) |
1171 pPriceItemService = 1; | 1139 price = 1; |
1172 if ( pPriceItemService >= 1 ) | |
1173 { | |
1174 if ( pSkillLevel ) | |
1175 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1176 else | |
1177 result = 1; | |
1178 return result; | |
1179 } | |
1180 pPriceItemService = 1; | |
1181 if ( pSkillLevel ) | |
1182 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1183 else | 1140 else |
1184 result = 1; | 1141 price = this->GetPriceSell(itemValue, multiplier); |
1185 return result; | 1142 break; |
1186 } | 1143 case 4: |
1187 if ( pEquipType != EQUIP_BOOK ) | 1144 price = this->GetPriceIdentification(multiplier); |
1188 return NotBuy; | 1145 break; |
1189 } | 1146 case 5: |
1190 if ( building_type == BildingType_AlchemistShop ) | 1147 price = this->GetPriceRepair(itemValue, multiplier); |
1191 { | 1148 break; |
1192 if ( pEquipType < EQUIP_REAGENT ) | 1149 } |
1193 return NotBuy; | 1150 if ( merchantLevel ) |
1194 if ( pEquipType > EQUIP_POTION ) | 1151 { |
1195 { | 1152 if (price == itemValue) |
1196 if ( pEquipType != EQUIP_MESSAGE_SCROLL ) | 1153 { |
1197 return NotBuy; | 1154 return 3; |
1198 } | 1155 } |
1199 if (pItem->Stolen()) | |
1200 return 6; | |
1201 } | |
1202 pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; | |
1203 pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); | |
1204 if ( ShopMenuType == 3 )//Sell | |
1205 { | |
1206 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); | |
1207 if (!pItem->Broken()) | |
1208 { | |
1209 if ( pSkillLevel ) | |
1210 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1211 else | |
1212 result = 1; | |
1213 return result; | |
1214 } | |
1215 pPriceItemService = 1; | |
1216 if ( pSkillLevel ) | |
1217 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1218 else | 1156 else |
1219 result = 1; | 1157 { |
1220 return result; | 1158 return 2; |
1221 } | 1159 } |
1222 if ( ShopMenuType == 4 )//Identify | 1160 } |
1223 { | |
1224 pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); | |
1225 if ( pSkillLevel ) | |
1226 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1227 else | |
1228 result = 1; | |
1229 return result; | |
1230 } | |
1231 if ( ShopMenuType == 5 )//Repair | |
1232 { | |
1233 pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); | |
1234 if ( pSkillLevel ) | |
1235 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1236 else | |
1237 result = 1; | |
1238 return result; | |
1239 } | |
1240 if ( ShopMenuType != 6 )//Buy and ??? | |
1241 { | |
1242 if ( pSkillLevel ) | |
1243 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1244 else | |
1245 result = 1; | |
1246 return result; | |
1247 } | |
1248 pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; | |
1249 if (pItem->Broken()) | |
1250 pPriceItemService = 1; | |
1251 if ( pPriceItemService >= 1 ) | |
1252 { | |
1253 if ( pSkillLevel ) | |
1254 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1255 else | |
1256 result = 1; | |
1257 return result; | |
1258 } | |
1259 pPriceItemService = 1; | |
1260 if ( pSkillLevel ) | |
1261 result = (pPriceItemService == pItem->GetValue()) + 2; | |
1262 else | 1161 else |
1263 result = 1; | 1162 { |
1264 return result; | 1163 return 1; |
1164 } | |
1265 } | 1165 } |
1266 | 1166 |
1267 //----- (0049107D) -------------------------------------------------------- | 1167 //----- (0049107D) -------------------------------------------------------- |
1268 int Player::GetBodybuilding() | 1168 int Player::GetBodybuilding() |
1269 { | 1169 { |