hnsxp_stocks.inc
Original include source with line numbers.
| 1 | #if defined _hnsxp_stocks_included |
| 2 | #endinput |
| 3 | #endif |
| 4 | #define _hnsxp_stocks_included |
| 5 | |
| 6 | /* |
| 7 | * Calculates the XP required to buy a certain item's level |
| 8 | * |
| 9 | * @param first_xp - The xp required for the first level |
| 10 | * @param interval - The interval between levels |
| 11 | * @param level - The level to find xp required |
| 12 | * |
| 13 | * @return Returns the XP required. |
| 14 | * |
| 15 | */ |
| 16 | stock hnsxp_calculate_xp(const first_xp, const interval, const level) |
| 17 | { |
| 18 | if( level == 0 ) |
| 19 | { |
| 20 | return 0; |
| 21 | } |
| 22 | |
| 23 | new xp = first_xp; |
| 24 | if( interval == XP_INTERVAL_EXPONENTIAL ) |
| 25 | { |
| 26 | xp *= (1 << (level - 1)); |
| 27 | } |
| 28 | else if( interval != XP_INTERVAL_NONE && interval > 0 ) |
| 29 | { |
| 30 | xp += (interval * (level - 1)); |
| 31 | } |
| 32 | |
| 33 | return xp; |
| 34 | } |
| 35 | |
| 36 | /* |
| 37 | * Calculates the value of the item based on the current level, max level, and max value. |
| 38 | * |
| 39 | * @param level - The level of which the value is being found |
| 40 | * @param max_level - The maximum level of the item |
| 41 | * @param max_value - The value acquired on the maximum level |
| 42 | * |
| 43 | * @return The value of the item for the given level |
| 44 | * |
| 45 | */ |
| 46 | stock hnsxp_calculate_value(const level, const max_level, const max_value) |
| 47 | { |
| 48 | return (max_value * level / max_level); |
| 49 | } |
| 50 | /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE |
| 51 | *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang11274\\ f0\\ fs16 \n\\ par } |
| 52 | */ |
| 53 | |