matchbase.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package matchbase
  2. import (
  3. item "bet24.com/servers/micros/item_inventory/proto"
  4. )
  5. const (
  6. MatchStatus_Invalid = iota
  7. MatchStatus_Free
  8. MatchStatus_Playing
  9. MatchStatus_Ended
  10. )
  11. var status_desc = []string{"n/a", "free", "playing", "ended"}
  12. func GetMatchStatusDesc(status int) string {
  13. if status > MatchStatus_Ended || status < MatchStatus_Invalid {
  14. status = MatchStatus_Invalid
  15. }
  16. return status_desc[status]
  17. }
  18. const (
  19. MatchType_Invalid = -1 // 无效值
  20. MatchType_SimpleMatch = 0 // 淘汰晋级赛
  21. MatchType_PointMatch = 1 // 定时淘汰赛
  22. MatchType_SetsMatch = 2 // 局数配置赛
  23. MatchType_SNG = "SNG" // sng赛事集合
  24. MatchType_Combo = "Combo" // 配置赛集合
  25. )
  26. const (
  27. Match_noti_userenter = "userenter"
  28. Match_noti_userexit = "userexit"
  29. Match_noti_statuschanged = "statuschanged"
  30. Match_noti_scorechanged = "scorechanged"
  31. Match_noti_promoted = "promoted"
  32. Match_noti_eliminated = "eliminated"
  33. Match_noti_rank = "rank"
  34. Match_noti_rank_changed = "rank_changed"
  35. Match_noti_matchroom = "matchroom"
  36. Match_noti_shrink = "shrink"
  37. )
  38. type Match_notificationInfo struct {
  39. Msg string `json:",omitempty"`
  40. UserId int `json:",omitempty"`
  41. OldStatus int `json:",omitempty"`
  42. NewStatus int `json:",omitempty"`
  43. Score int `json:",omitempty"`
  44. Rank int `json:",omitempty"`
  45. Prize int `json:",omitempty"`
  46. ServerAddr string `json:",omitempty"`
  47. TableId int `json:",omitempty"`
  48. ChairId int
  49. FaceId int `json:",omitempty"`
  50. FaceUrl string `json:",omitempty"`
  51. NickName string `json:",omitempty"`
  52. ShrinkScore int `json:",omitempty"` // 这里命名错误,实际是EliminatScore,淘汰分数
  53. PrizeItems []item.ItemPack `json:",omitempty"`
  54. ReviveCost item.ItemPack `json:",omitempty"`
  55. MatchData string `json:",omitempty"`
  56. ReviveTimeoutSec int
  57. }
  58. func GetMatchNo() int {
  59. return getMatchNumber().getMatchNo()
  60. }
  61. func Run() {
  62. getMatchNumber()
  63. }
  64. func IsElementIn(ele int, list []int) bool {
  65. for _, v := range list {
  66. if ele == v {
  67. return true
  68. }
  69. }
  70. return false
  71. }