From 2a192a61bbccded0a4ae2ac0cef12e8138202fcf Mon Sep 17 00:00:00 2001
From: HoraK-FDF <horak-fdf@web.de>
Date: Sat, 10 Jun 2023 06:08:06 +0000
Subject: Backport Maxlvl

---
 src/map/pc.cpp | 43 +++++++++++++++++++++++++++----------------
 1 file changed, 27 insertions(+), 16 deletions(-)

(limited to 'src')

diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 3e8cd6e..5196f16 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -149,49 +149,60 @@ earray<interval_t, ItemLook, ItemLook::COUNT> aspd_base_0 //=
 static const
 int exp_table_0[MAX_LEVEL] =
 {
-    // 1 .. 9
+    // 1 .. 10
                 9,          16,         25,         36,
     77,         112,        153,        200,        253,
-    // 10 .. 19
+    // 11 .. 20
     320,        385,        490,        585,        700,
     830,        970,        1120,       1260,       1420,
-    // 20 .. 29
+    // 21 .. 30
     1620,       1860,       1990,       2240,       2504,
     2950,       3426,       3934,       4474,       6889,
-    // 30 .. 39
+    // 31 .. 40
     7995,       9174,       10425,      11748,      13967,
     15775,      17678,      19677,      21773,      30543,
-    // 40 .. 49
+    // 41 .. 50
     34212,      38065,      42102,      46323,      53026,
     58419,      64041,      69892,      75973,      102468,
-    // 50 .. 59
+    // 51 .. 60
     115254,     128692,     142784,     157528,     178184,
     196300,     215198,     234879,     255341,     330188,
-    // 60 .. 69
+    // 61 .. 70
     365914,     403224,     442116,     482590,     536948,
     585191,     635278,     687211,     740988,     925400,
-    // 70 .. 79
+    // 71 .. 80
     1473746,    1594058,    1718928,    1848355,    1982340,
     2230113,    2386162,    2547417,    2713878,    3206160,
-    // 80 .. 89
+    // 81 .. 90
     3681024,    4022472,    4377024,    4744680,    5125440,
     5767272,    6204000,    6655464,    7121664,    7602600,
-    // 90 .. 99
+    // 91 .. 100
     9738720,    11649960,   13643520,   18339300,   23836800,
     35658000,   48687000,   58135000,   99999999,   103000000,
-    // 100 .. 109
+    // 101 .. 110
     107000000,  112000000,  116000000,  121000000,  125000000,
     130000000,  134000000,  139000000,  145000000,  152200000,
-    // 110 .. 119
+    // 111 .. 120
     160840000,  171200000,  191930000,  202290000,  214720000,
     229640000,  247550000,  283370000,  301280000,  322770000,
-    // 120 .. 129
+    // 121 .. 130
     348560000,  379500000,  417450000,  459195000,  505114500,
     555625950,  622301064,  696977191,  780614454,  880533104,
-    // 130 .. 135
-    993241342,  1120376234, 1263784392, 1425548794, 1608019039,
-    2147483647, 0
+    // 131 .. 140
+    993241342,  1120376234, 1263784392, 1425548794, 1588019039,
+    1680000000, 1780000000, 1890000000, 2010000000, 2140000000,
+    // 141
+    0
 };
+// The old table contained a bug, actually max level was 136 and not 135 but to reach level 136 you must hit exactly the value 2147483647
+// else and overflow occurs and you lose all the progress of that level and start with level 135 at 0% again.
+// I made a buffer that is great enough now I guess its 7483647 while looking through all gm logs I saw the highest values ever where 300%.
+// A Xakelbael killed on 300% exp one time tabbed gives around 6 mil so I have a little buffer on top of that as well, it won't make it for
+// 400% exp but since this will most likely never happen and the chance that one will make his lvl up with Xakelbael one time tabbed
+// is extremely rare as well.
+    // 130 .. 135
+    //993241342,  1120376234, 1263784392, 1425548794, 1608019039,
+    //2147483647, 0
 
 // is this *actually* used anywhere?
 static const
-- 
cgit v1.2.3-70-g09d2