robotCommon.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package robot
  2. import (
  3. "bet24.com/log"
  4. "bet24.com/servers/insecureframe/gate"
  5. )
  6. func RunRobot(s gate.GateSink, g *gate.Gate) {
  7. robotMMgr = NewRobotManager(s, g)
  8. }
  9. func IsRunning() bool {
  10. return robotMMgr != nil
  11. }
  12. func GetOneRobotEnterTable(tableID, min, max int) bool {
  13. if robotMMgr == nil {
  14. return false
  15. }
  16. return robotMMgr.getOneRobotEnterTable(tableID, min, max, false, false)
  17. }
  18. func GetOneRobotEnterTableAndReady(tableID, min, max int) bool {
  19. if robotMMgr == nil {
  20. return false
  21. }
  22. return robotMMgr.getOneRobotEnterTable(tableID, min, max, false, true)
  23. }
  24. func RobotOutTable(userIndex int32, tableID int) {
  25. if robotMMgr == nil {
  26. return
  27. }
  28. robotMMgr.robotOutTable(userIndex, tableID)
  29. }
  30. func OneRobotLogin() bool {
  31. if robotMMgr == nil {
  32. return false
  33. }
  34. return robotMMgr.oneRobotLogin()
  35. }
  36. func OneRobotLogout(userIndex int32) {
  37. if robotMMgr == nil {
  38. return
  39. }
  40. robotMMgr.oneRobotLogout(userIndex)
  41. }
  42. func Exit() {
  43. if robotMMgr == nil {
  44. return
  45. }
  46. robotMMgr.Exit()
  47. }
  48. func Dump() {
  49. if robotMMgr == nil {
  50. log.Debug("Robot Manager not running")
  51. return
  52. }
  53. robotMMgr.Dump()
  54. }
  55. func UserExit(userIndex int32) {
  56. if robotMMgr == nil {
  57. return
  58. }
  59. robotMMgr.userExit(userIndex)
  60. }
  61. func IsRetired(userIndex int32) bool {
  62. if robotMMgr == nil {
  63. return false
  64. }
  65. return robotMMgr.isRetired(userIndex)
  66. }