bullet.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package bullet
  2. import "bet24.com/log"
  3. type Bullet struct {
  4. BulletID int `json:"ID"`
  5. BulletKey int `json:"BK"`
  6. Angle int `json:"A"`
  7. UserID int `json:"U"`
  8. FishKey int `json:"FK"`
  9. ClientID int `json:"C"`
  10. }
  11. var bullet_cfg *BulletCfg
  12. func Run() {
  13. bullet_cfg = new_bulletcfg()
  14. }
  15. func GetBullet(bulletID int) *BulletInfo {
  16. if bullet_cfg == nil {
  17. bullet_cfg = new_bulletcfg()
  18. }
  19. return bullet_cfg.getBullet(bulletID)
  20. }
  21. func (b *Bullet) GetOdds() int {
  22. bi := GetBullet(b.BulletID)
  23. if bi == nil {
  24. log.Release("Bullet.GetOdds bullet not found %d", b.BulletID)
  25. return 1
  26. }
  27. return bi.Odds
  28. }
  29. func GetConfig() string {
  30. return bullet_cfg.getConfig()
  31. }
  32. func GetMinBulletID() int {
  33. return bullet_cfg.Bullets[0].BulletID
  34. }
  35. func GetUpgradeCount(curBulletId int) int {
  36. return bullet_cfg.getUpgradeCount(curBulletId)
  37. }
  38. func Dump() {
  39. log.Release("-------------------------------")
  40. log.Release("bullet.Dump")
  41. defer func() {
  42. log.Release("+++++++++++++++++++++++++++++++")
  43. log.Release("")
  44. }()
  45. log.Release(GetConfig())
  46. }