@@ -174,72 +174,67 @@ uint32 GenerateEnchSuffixFactor(uint32 item_id)
174174 if (!itemProto->RandomSuffix )
175175 return 0 ;
176176
177- RandPropPointsEntry const * randomProperty = sRandPropPointsStore .LookupEntry (itemProto->ItemLevel );
178- if (!randomProperty)
179- return 0 ;
177+ return GetRandomPropertyPoints (itemProto->ItemLevel , itemProto->Quality , itemProto->InventoryType );
178+ }
180179
181- uint32 suffixFactor;
182- switch (itemProto->InventoryType )
180+ uint32 GetRandomPropertyPoints (uint32 itemLevel, uint32 quality, uint32 inventoryType)
181+ {
182+ uint32 propIndex;
183+
184+ switch (inventoryType)
183185 {
184- // Items of that type don`t have points
185- case INVTYPE_NON_EQUIP :
186- case INVTYPE_BAG :
187- case INVTYPE_TABARD :
188- case INVTYPE_AMMO :
189- case INVTYPE_QUIVER :
190- case INVTYPE_RELIC :
191- return 0 ;
192- // Select point coefficient
193186 case INVTYPE_HEAD :
194187 case INVTYPE_BODY :
195188 case INVTYPE_CHEST :
196189 case INVTYPE_LEGS :
197190 case INVTYPE_2HWEAPON :
198191 case INVTYPE_ROBE :
199- suffixFactor = 0 ;
192+ propIndex = 0 ;
200193 break ;
201194 case INVTYPE_SHOULDERS :
202195 case INVTYPE_WAIST :
203196 case INVTYPE_FEET :
204197 case INVTYPE_HANDS :
205198 case INVTYPE_TRINKET :
206- suffixFactor = 1 ;
199+ propIndex = 1 ;
207200 break ;
208201 case INVTYPE_NECK :
209202 case INVTYPE_WRISTS :
210203 case INVTYPE_FINGER :
211204 case INVTYPE_SHIELD :
212205 case INVTYPE_CLOAK :
213206 case INVTYPE_HOLDABLE :
214- suffixFactor = 2 ;
207+ propIndex = 2 ;
215208 break ;
216209 case INVTYPE_WEAPON :
217210 case INVTYPE_WEAPONMAINHAND :
218211 case INVTYPE_WEAPONOFFHAND :
219- suffixFactor = 3 ;
212+ propIndex = 3 ;
220213 break ;
221214 case INVTYPE_RANGED :
222215 case INVTYPE_THROWN :
223216 case INVTYPE_RANGEDRIGHT :
224- suffixFactor = 4 ;
217+ propIndex = 4 ;
225218 break ;
226219 default :
227220 return 0 ;
228221 }
229- // Select rare/epic modifier
230- switch (itemProto->Quality )
222+
223+ RandPropPointsEntry const * randPropPointsEntry = sRandPropPointsStore .LookupEntry (itemLevel);
224+ if (!randPropPointsEntry)
225+ return 0 ;
226+
227+ switch (quality)
231228 {
232229 case ITEM_QUALITY_UNCOMMON :
233- return randomProperty ->Good [suffixFactor ];
230+ return randPropPointsEntry ->Good [propIndex ];
234231 case ITEM_QUALITY_RARE :
235- return randomProperty ->Superior [suffixFactor ];
232+ return randPropPointsEntry ->Superior [propIndex ];
236233 case ITEM_QUALITY_EPIC :
237- return randomProperty->Epic [suffixFactor];
238- case ITEM_QUALITY_LEGENDARY :
239- case ITEM_QUALITY_ARTIFACT :
240- return 0 ; // not have random properties
234+ return randPropPointsEntry->Epic [propIndex];
241235 default :
242236 break ;
243237 }
238+
244239 return 0 ;
245240}
0 commit comments