member.go 871 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package model
  2. const (
  3. // ExpMulti exp multi
  4. ExpMulti = 100
  5. // level floor conf.
  6. level1 = 1
  7. level2 = 200
  8. level3 = 1500
  9. level4 = 4500
  10. level5 = 10800
  11. level6 = 28800
  12. levelMax = -1
  13. )
  14. // BuildLevel build level by LevelInfo
  15. func (lv *LevelInfo) BuildLevel(exp int64, sexp bool) {
  16. exp = exp / ExpMulti
  17. switch {
  18. case exp < level1:
  19. lv.Cur = 0
  20. lv.Min = 0
  21. lv.NextExp = level1
  22. case exp < level2:
  23. lv.Cur = 1
  24. lv.Min = level1
  25. lv.NextExp = level2
  26. case exp < level3:
  27. lv.Cur = 2
  28. lv.Min = level2
  29. lv.NextExp = level3
  30. case exp < level4:
  31. lv.Cur = 3
  32. lv.Min = level3
  33. lv.NextExp = level4
  34. case exp < level5:
  35. lv.Cur = 4
  36. lv.Min = level4
  37. lv.NextExp = level5
  38. case exp < level6:
  39. lv.Cur = 5
  40. lv.Min = level5
  41. lv.NextExp = level6
  42. default:
  43. lv.Cur = 6
  44. lv.Min = level6
  45. lv.NextExp = levelMax
  46. }
  47. if sexp {
  48. lv.NowExp = int32(exp)
  49. }
  50. }