Browse Source

修改升级bug

gitxsm 1 năm trước cách đây
mục cha
commit
6ba997584c
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 4 3
      script/core/ObjHuman.lua

+ 4 - 3
script/core/ObjHuman.lua

@@ -350,18 +350,19 @@ function getHeroAttrs(human, bagIndex)
 end
 end
 
 
 function checkLevelUp(human)
 function checkLevelUp(human)
-	if human.db.lv > #RoleExcel.exp then
+	local maxLevel = #RoleExcel.exp
+	if human.db.lv > maxLevel then
 		return 0
 		return 0
 	end
 	end
 
 
 	local levelUp = 0
 	local levelUp = 0
 	while human.db.exp > 0 do
 	while human.db.exp > 0 do
         local needExp = 0
         local needExp = 0
-        if human.db.lv < 200 then
+        if human.db.lv < maxLevel then
 		    needExp = RoleExcel.exp[human.db.lv + 1].exp
 		    needExp = RoleExcel.exp[human.db.lv + 1].exp
 		end
 		end
         if needExp <= human.db.exp then
         if needExp <= human.db.exp then
-		    if human.db.lv >= #RoleExcel.exp then
+		    if human.db.lv >= maxLevel then
 			    if human.db.exp > needExp then
 			    if human.db.exp > needExp then
 			        human.db.exp = needExp
 			        human.db.exp = needExp
 			    end
 			    end