main_lgy_test.go 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. package main
  2. import (
  3. "f1-game/internal/constant"
  4. "f1-game/internal/enum"
  5. "f1-game/tool/client-cli/cli"
  6. "testing"
  7. "time"
  8. )
  9. func testLgySetup() *cli.Robot {
  10. var (
  11. // loginURL = "http://dev.f1.chun-pu.com"
  12. // gateAddr = "192.168.1.232:30001"
  13. // gateAddr = "192.168.1.225:30001"
  14. // pid = "2188001"
  15. // serverId = "1"
  16. loginURL = "http://127.0.0.1:18080"
  17. gateAddr = "127.0.0.1:30001"
  18. pid = "2188002"
  19. serverId = "2"
  20. account = "nico004"
  21. password = "123456"
  22. )
  23. cli.RegisterDevAccount(loginURL, account, password)
  24. robot := cli.EnterServer(loginURL, pid, account, password, gateAddr, serverId, true)
  25. return robot
  26. }
  27. func TestLgyMain(t *testing.T) {
  28. robot := testLgySetup()
  29. // robot.Time()
  30. robot.MapLogin()
  31. time.Sleep(3 * time.Second)
  32. robot.MapJoin()
  33. time.Sleep(3 * time.Second)
  34. robot.MapSiegeRank(10002)
  35. // robot.GmAssetGet(39999, 10)
  36. select {}
  37. }
  38. func TestLgyNewMapLogin(t *testing.T) {
  39. robot := testLgySetup()
  40. robot.MapLogin()
  41. time.Sleep(3 * time.Second)
  42. robot.BornStateInfo()
  43. time.Sleep(3 * time.Second)
  44. robot.SelectState(1)
  45. time.Sleep(3 * time.Second)
  46. robot.MapEnter()
  47. time.Sleep(3 * time.Second)
  48. select {}
  49. }
  50. func TestLgyReinforce(t *testing.T) {
  51. robot := testLgySetup()
  52. robot.MapLogin()
  53. time.Sleep(3 * time.Second)
  54. robot.MapEnter()
  55. time.Sleep(3 * time.Second)
  56. robot.Reinforce()
  57. time.Sleep(3 * time.Second)
  58. // robot.ReinforceCancel()
  59. // time.Sleep(3 * time.Second)
  60. select {}
  61. }
  62. func TestLgyMapComeback(t *testing.T) {
  63. robot := testLgySetup()
  64. robot.MapLogin()
  65. time.Sleep(3 * time.Second)
  66. robot.MapJoin()
  67. time.Sleep(3 * time.Second)
  68. robot.MapComeback(true, 0)
  69. time.Sleep(3 * time.Second)
  70. robot.MapComeback(false, 0)
  71. time.Sleep(3 * time.Second)
  72. // robot.GmAssetGet(39999, 10)
  73. select {}
  74. }
  75. func TestLordUpgrade(t *testing.T) {
  76. robot := testLgySetup()
  77. robot.GmAssetGet(10001, 1000)
  78. select {}
  79. }
  80. func TestLgyHero(t *testing.T) {
  81. robot := testLgySetup()
  82. // robot.HeroStar(
  83. // 1050922,
  84. // 1050932,
  85. // 1050933,
  86. // 1050934,
  87. // 1050935,
  88. // 1050936,
  89. // 1050937,
  90. // )
  91. robot.HeroSkillUp(1050922, 3999901)
  92. select {}
  93. }
  94. func TestItemUse(t *testing.T) {
  95. robot := testLgySetup()
  96. robot.ItemUse(119997, 1)
  97. time.Sleep(500 * time.Millisecond)
  98. select {}
  99. }
  100. func TestQuest(t *testing.T) {
  101. robot := testLgySetup()
  102. robot.QuestGetReward(1001000)
  103. select {}
  104. }
  105. func TestEquip(t *testing.T) {
  106. robot := testLgySetup()
  107. // robot.EquipCraft(301611)
  108. // robot.EquipCraft(301512)
  109. // robot.EquipRandomCraft()
  110. // robot.EquipEnhance(1050912, true)
  111. // robot.EquipDimantle(1048587, 1048588)
  112. robot.EquipSkillActive(1050921)
  113. select {}
  114. }
  115. func TestLgyLeaguePoint(t *testing.T) {
  116. robot := testLgySetup()
  117. robot.CreateLeague("我的联盟1", "我1", 101, 201)
  118. // robot.JoinLeague(1875)
  119. select {}
  120. }
  121. func TestLgyEnterMap(t *testing.T) {
  122. robot := testLgySetup()
  123. time.Sleep(3 * time.Second)
  124. robot.MapLogin()
  125. time.Sleep(3 * time.Second)
  126. robot.MapJoin()
  127. time.Sleep(3 * time.Second)
  128. robot.MapSlide(57, 755)
  129. time.Sleep(3 * time.Second)
  130. // robot.MapQuit()
  131. // time.Sleep(3 * time.Second)
  132. // robot.MapSlide(164, 751)
  133. // time.Sleep(3 * time.Second)
  134. // robot.MapSlide(82, 820)
  135. // time.Sleep(3 * time.Second)
  136. // robot.MapLeave()
  137. // time.Sleep(3 * time.Second)
  138. // robot.MapSlide(164, 751)
  139. // time.Sleep(3 * time.Second)
  140. // robot.MapSlide(280, 790)
  141. // time.Sleep(3 * time.Second)
  142. // robot.MapSlide(313, 951)
  143. // time.Sleep(3 * time.Second)
  144. // robot.MapSlide(48, 964)
  145. select {}
  146. }
  147. func TestLgyMapMarchSiege(t *testing.T) {
  148. robot := testLgySetup()
  149. robot.MapLogin()
  150. time.Sleep(3 * time.Second)
  151. robot.MapJoin()
  152. time.Sleep(3 * time.Second)
  153. robot.MapMarch(1, enum.MarchType_Siege, 696, 255, false, 10003)
  154. time.Sleep(3 * time.Second)
  155. robot.MapMarch(2, enum.MarchType_Siege, 696, 255, false, 10003)
  156. time.Sleep(3 * time.Second)
  157. robot.MapMarch(3, enum.MarchType_Siege, 696, 255, false, 10003)
  158. time.Sleep(3 * time.Second)
  159. select {}
  160. }
  161. func TestLgyMapSiegeAssemble(t *testing.T) {
  162. robot := testLgySetup()
  163. robot.MapLogin()
  164. time.Sleep(3 * time.Second)
  165. robot.MapJoin()
  166. time.Sleep(3 * time.Second)
  167. robot.MapSiegeAssemble(1, 10016, true)
  168. time.Sleep(3 * time.Second)
  169. robot.MapSiegeAssemble(2, 10016, true)
  170. time.Sleep(3 * time.Second)
  171. robot.MapSiegeAssemble(3, 10016, false)
  172. time.Sleep(3 * time.Second)
  173. select {}
  174. }
  175. func TestLgyTeam(t *testing.T) {
  176. robot := testLgySetup()
  177. robot.TeamUp(1052265, 2, 1, 1)
  178. time.Sleep(3 * time.Second)
  179. select {}
  180. }
  181. func TestLgyMapRes(t *testing.T) {
  182. robot := testLgySetup()
  183. robot.MapLogin()
  184. time.Sleep(3 * time.Second)
  185. // robot.MapMarch(1, enum.MarchType_Occupy, 77, 708, true, false)
  186. // time.Sleep(3 * time.Second)
  187. // robot.MapDiscard(2409, enum.ObjectType_Res)
  188. select {}
  189. }
  190. func TestLgyMapBuild(t *testing.T) {
  191. robot := testLgySetup()
  192. robot.MapLogin()
  193. time.Sleep(3 * time.Second)
  194. robot.MapJoin()
  195. time.Sleep(3 * time.Second)
  196. // 地基
  197. // robot.MapPlayerBuild(constant.MapBuild_Camp, 857, 28)
  198. // robot.MapDiscard(21228, enum.ObjectType_Build)
  199. robot.MapLeagueBuild(constant.MapBuild_LeagueFlag, 857, 28)
  200. // robot.MapLeagueBuild(constant.MapBuild_LeaguePoint, 733, 33)
  201. // 攻城大营
  202. // robot.MapLeagueBuild(constant.MapBuild_SiegeCamp, 63, 755)
  203. // 联盟大营
  204. // robot.MapLeagueBuild(constant.MapBuild_LeaguePoint, 14, 769)
  205. select {}
  206. }
  207. func TestLgyMapRelocate(t *testing.T) {
  208. robot := testLgySetup()
  209. robot.MapLogin()
  210. time.Sleep(3 * time.Second)
  211. robot.MapJoin()
  212. time.Sleep(3 * time.Second)
  213. robot.MapRelocate(31466)
  214. // robot.MapRelocateBack()
  215. select {}
  216. }
  217. func TestLgyMapStartWar(t *testing.T) {
  218. robot := testLgySetup()
  219. robot.MapLogin()
  220. time.Sleep(3 * time.Second)
  221. robot.MapStartWar(10002, 1)
  222. time.Sleep(3 * time.Second)
  223. select {}
  224. }
  225. func TestLgyMapLeague(t *testing.T) {
  226. robot := testLgySetup()
  227. robot.JoinLeague(1000000)
  228. select {}
  229. }
  230. func TestLgyMapResArmies(t *testing.T) {
  231. robot := testLgySetup()
  232. robot.MapLogin()
  233. time.Sleep(3 * time.Second)
  234. robot.MapResArmies(10172)
  235. select {}
  236. }
  237. func TestLgyMapAssemble(t *testing.T) {
  238. robot := testLgySetup()
  239. robot.MapLogin()
  240. time.Sleep(3 * time.Second)
  241. robot.MapJoin()
  242. time.Sleep(3 * time.Second)
  243. robot.AssembleList()
  244. time.Sleep(3 * time.Second)
  245. robot.AssembleStop(24306)
  246. time.Sleep(3 * time.Second)
  247. robot.AssembleList()
  248. time.Sleep(3 * time.Second)
  249. // robot.Assemble(&pb.MapAssembleRequest{
  250. // TeamID: 1,
  251. // ObjectID: 15163,
  252. // ObjectType: int32(enum.ObjectType_Monster),
  253. // Point: &pb.Point{
  254. // X: 333,
  255. // Y: 878,
  256. // },
  257. // AssembleTime: 5,
  258. // })
  259. // time.Sleep(3 * time.Second)
  260. // robot.AssembleJoin(1, 23840)
  261. // time.Sleep(3 * time.Second)
  262. select {}
  263. }
  264. func TestMapWar(t *testing.T) {
  265. robot := testLgySetup()
  266. robot.MapLogin()
  267. time.Sleep(3 * time.Second)
  268. robot.MapJoin()
  269. time.Sleep(3 * time.Second)
  270. robot.MapWarList()
  271. time.Sleep(3 * time.Second)
  272. select {}
  273. }
  274. func TestDiscardCancel(t *testing.T) {
  275. robot := testLgySetup()
  276. robot.MapLogin()
  277. time.Sleep(3 * time.Second)
  278. robot.MapDiscardCancelPlayer(10001, enum.ObjectType_Res)
  279. time.Sleep(3 * time.Second)
  280. robot.MapDiscardCancelLeague(10002, enum.ObjectType_Build)
  281. select {}
  282. }