main_lcs_test.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881
  1. package main
  2. import (
  3. "f1-game/internal/pb"
  4. "f1-game/tool/client-cli/cli"
  5. "fmt"
  6. "math/rand"
  7. "sync"
  8. "testing"
  9. "time"
  10. cherryTime "github.com/cherry-game/cherry/extend/time"
  11. clog "github.com/cherry-game/cherry/logger"
  12. )
  13. func TestLcs_Local_10000_League(t *testing.T) {
  14. var (
  15. loginURL = "http://dev.f1.chun-pu.com"
  16. gateAddr = "127.0.0.1:30001"
  17. serverId = "5"
  18. pid = "2188005"
  19. maxAccountNum = 1000
  20. testAccounts = make(map[string]string)
  21. )
  22. for i := 1; i <= maxAccountNum; i++ {
  23. key := fmt.Sprintf("lcs%d", i)
  24. testAccounts[key] = key
  25. cli.RegisterDevAccount(loginURL, key, key)
  26. }
  27. now := cherryTime.Now()
  28. wg := &sync.WaitGroup{}
  29. for userName, password := range testAccounts {
  30. wg.Add(1)
  31. go func(userName, password string) {
  32. robot := cli.EnterServer(loginURL, pid, userName, password, gateAddr, serverId, true)
  33. if robot != nil {
  34. time.Sleep(time.Duration(rand.Int31n(100)) * time.Millisecond)
  35. robot.MapLogin()
  36. time.Sleep(time.Duration(rand.Int31n(100)) * time.Millisecond)
  37. } else {
  38. clog.Warnf("Failed to enter game robot for user %s", userName)
  39. }
  40. wg.Done()
  41. }(userName, password)
  42. }
  43. wg.Wait()
  44. clog.Infof("elapsedTime = %dms", now.NowDiffMillisecond())
  45. }
  46. func testLcsSetup() *cli.Robot {
  47. var (
  48. loginURL = "http://dev.f1.chun-pu.com"
  49. //loginURL = "http://192.168.1.232:18080"
  50. gateAddr = "127.0.0.1:30001"
  51. //gateAddr = "192.168.1.232:30001"
  52. serverId = "5"
  53. account = "l10"
  54. password = "123456"
  55. pid = "2188005"
  56. )
  57. cli.RegisterDevAccount(loginURL, account, password)
  58. robot := cli.EnterServer(loginURL, pid, account, password, gateAddr, serverId, true)
  59. robot.MapLogin()
  60. return robot
  61. }
  62. func TestRankList(t *testing.T) {
  63. robot := testLcsSetup()
  64. // 获取排行榜
  65. robot.MapPlayerRankList(101)
  66. time.Sleep(500 * time.Millisecond)
  67. //robot.MapPlayerRankList(102)
  68. //time.Sleep(500 * time.Millisecond)
  69. //robot.MapLeagueRankList(201)
  70. // 获取地图城池被攻占列表
  71. robot.MapOccupyCastleList()
  72. select {}
  73. }
  74. func TestSignIn(t *testing.T) {
  75. robot := testLcsSetup()
  76. // 签到
  77. robot.SignIn()
  78. time.Sleep(500 * time.Millisecond)
  79. // 补签
  80. robot.ReSignIn(1)
  81. time.Sleep(500 * time.Millisecond)
  82. // 领取累签奖励
  83. robot.SignInReward(101)
  84. time.Sleep(500 * time.Millisecond)
  85. select {}
  86. }
  87. func TestLcsBuild(t *testing.T) {
  88. robot := testLcsSetup()
  89. // 建筑建设
  90. //robot.MapLeagueBuild(201007, 927, 347)
  91. robot.MapLeagueBuildUpgrade(107573)
  92. //robot.MapLeagueBuildUpgrade(107576)
  93. //robot.BuildSet(1000, 1000, 1000, 1000, 1000, 1000)
  94. select {}
  95. }
  96. func TestOutsideConscript(t *testing.T) {
  97. robot := testLcsSetup()
  98. teamID := int32(1)
  99. // 设置城外自动征兵
  100. // robot.TeamOutsideAutoTroopsSet(teamID)
  101. // time.Sleep(500 * time.Millisecond)
  102. // 城外征兵
  103. troopNums := []*pb.I32I32{}
  104. troopNums = append(troopNums, &pb.I32I32{Key: 1, Value: 1000})
  105. troopNums = append(troopNums, &pb.I32I32{Key: 3, Value: 500})
  106. robot.TeamOutsideTroops(teamID, troopNums)
  107. time.Sleep(500 * time.Millisecond)
  108. // 取消城外征兵
  109. // teamIndexs := []int32{}
  110. // teamIndexs = append(teamIndexs, 1)
  111. // //teamIndexs = append(teamIndexs, 2)
  112. // teamIndexs = append(teamIndexs, 3)
  113. // robot.TeamOutsideTroopsCancel(teamID, teamIndexs)
  114. select {}
  115. }
  116. func TestLordInfo(t *testing.T) {
  117. robot := testLcsSetup()
  118. // 查看领主个人信息
  119. robot.LordInfo(1051321)
  120. // 改名
  121. //robot.LordChangeName("测试名字")
  122. // 更换头像框 更换失败
  123. //robot.LordChangeFrame(201)
  124. // 头像框激活
  125. //robot.LordShowActive(201)
  126. // 主页背景激活 有时效
  127. //robot.LordShowActive(304)
  128. // 更换头像
  129. //robot.LordChangeIcon(102)
  130. // 查看头像
  131. //robot.LordShowView(101)
  132. // 编辑个人简介
  133. //robot.LordChangeDesc("测试个人简介")
  134. // 语言选择
  135. //robot.LordLangSelect("th")
  136. // 展示数据设置
  137. // showDataList := []*pb.LordShowData{
  138. // {ShowType: 7, IsShow: true},
  139. // {ShowType: 1, IsShow: true},
  140. // {ShowType: 5, IsShow: true},
  141. // {ShowType: 2, IsShow: true},
  142. // {ShowType: 6, IsShow: true},
  143. // {ShowType: 3, IsShow: true},
  144. // {ShowType: 4, IsShow: false},
  145. // }
  146. // robot.LordShowDataSet(showDataList)
  147. select {}
  148. }
  149. func TestMapMark(t *testing.T) {
  150. robot := testLcsSetup()
  151. //robot.MapPlayerMapMark("", 1, 10)
  152. //time.Sleep(500 * time.Millisecond)
  153. //robot.MapPlayerMapMark("测试", 10, 10)
  154. //time.Sleep(500 * time.Millisecond)
  155. // 地图标记删除
  156. //robot.MapPlayerMapMarkDelete(10002)
  157. //time.Sleep(500 * time.Millisecond)
  158. // 联盟标记
  159. //robot.LeagueMapMark("测试", "测试指挥邮件", 10, 10, 1)
  160. //time.Sleep(500 * time.Millisecond)
  161. // 联盟地图标记编辑
  162. //robot.LeagueMapMarkEdit(10011, "兄弟们", "往前冲啊", 2)
  163. //time.Sleep(500 * time.Millisecond)
  164. // 联盟地图标记删除
  165. robot.LeagueMapMarkDelete(10011)
  166. time.Sleep(500 * time.Millisecond)
  167. select {}
  168. }
  169. func TestShop(t *testing.T) {
  170. robot := testLcsSetup()
  171. goodsList := []*pb.I32I32{}
  172. goodsList = append(goodsList, &pb.I32I32{Key: 1, Value: 1})
  173. goodsList = append(goodsList, &pb.I32I32{Key: 1, Value: 1})
  174. // 购买商店
  175. //robot.ShopBuy(105, goodsList)
  176. //time.Sleep(500 * time.Millisecond)
  177. // 购买超出上限
  178. //robot.ShopBuy(101, 1, 10)
  179. //time.Sleep(500 * time.Millisecond)
  180. // 购买其他商店
  181. //robot.ShopBuy(102, 1, 1)
  182. //time.Sleep(500 * time.Millisecond)
  183. // 地图商店购买
  184. robot.MapShopBuy(105, goodsList)
  185. select {}
  186. }
  187. func TestMedicineUse(t *testing.T) {
  188. robot := testLcsSetup()
  189. // 使用体力药
  190. robot.TeamMedicineUse(1, 120001)
  191. time.Sleep(500 * time.Millisecond)
  192. // 使用补兵药
  193. robot.TeamMedicineUse(1, 120002)
  194. time.Sleep(500 * time.Millisecond)
  195. // 使用重伤药
  196. robot.TeamMedicineUse(1, 120003)
  197. time.Sleep(500 * time.Millisecond)
  198. select {}
  199. }
  200. // 领取任务奖励
  201. func TestQuestReward(t *testing.T) {
  202. robot := testLcsSetup()
  203. //robot.QuestGetReward(21001001)
  204. //time.Sleep(1 * time.Second)
  205. // robot.QuestGetReward(21004002)
  206. // time.Sleep(1 * time.Second)
  207. // robot.QuestGetReward(21004003)
  208. // time.Sleep(1 * time.Second)
  209. // robot.QuestGetReward(21004004)
  210. // time.Sleep(1 * time.Second)
  211. // robot.QuestGetReward(21004005)
  212. // 领取主线章节奖励
  213. robot.QuestChapterReward(10101)
  214. select {}
  215. }
  216. // 一键阅读联盟邮件
  217. func TestLeagueMailFastRead(t *testing.T) {
  218. robot := testLcsSetup()
  219. // 读取法令邮件
  220. robot.LeagueMailFastRead(1)
  221. select {}
  222. }
  223. // 阅读联盟邮件
  224. func TestLeagueMailRead(t *testing.T) {
  225. robot := testLcsSetup()
  226. // 读取法令邮件
  227. robot.LeagueMailRead(1, 1)
  228. select {}
  229. }
  230. // 联盟发送邮件
  231. func TestLeagueSendMail(t *testing.T) {
  232. robot := testLcsSetup()
  233. // 发送法令邮件 上限10封 最后一封会失败
  234. BatchLeagueSendMail(robot, "法令", 1, 11)
  235. // 更新法令邮件
  236. //robot.LeagueSendMail(0, 1, title, content, false)
  237. //发送同盟邮件 检测删除旧的同盟邮件 暂时设置最多4封 理论上最开始那封会被删除掉
  238. BatchLeagueSendMail(robot, "同盟", 2, 5)
  239. // 发送指挥邮件 也是暂时最多4封 理论上最开始那封会被删除掉
  240. BatchLeagueSendMail(robot, "指挥", 3, 5)
  241. select {}
  242. }
  243. // 批量发送联盟邮件
  244. func BatchLeagueSendMail(robot *cli.Robot, mailName string, mailType int32, count int) {
  245. for i := 0; i < count; i++ {
  246. title := fmt.Sprintf("%v测试邮件%d", mailName, i)
  247. content := fmt.Sprintf("%v邮件%d", mailName, i)
  248. robot.LeagueMailSend(0, mailType, title, content, false)
  249. time.Sleep(500 * time.Microsecond)
  250. }
  251. }
  252. // 删除联盟邮件
  253. func TestLeagueDeleteMail(t *testing.T) {
  254. robot := testLcsSetup()
  255. // 删除法令邮件邮件
  256. robot.LeagueMailDel(7, 1)
  257. time.Sleep(500 * time.Microsecond)
  258. // 删除同盟邮件邮件
  259. robot.LeagueMailDel(15, 2)
  260. time.Sleep(500 * time.Microsecond)
  261. // 删除指挥邮件邮件
  262. robot.LeagueMailDel(19, 3)
  263. time.Sleep(500 * time.Microsecond)
  264. select {}
  265. }
  266. // 置顶联盟邮件
  267. func TestLeagueTopMail(t *testing.T) {
  268. robot := testLcsSetup()
  269. // 置顶法令邮件
  270. robot.LeagueMailTop(1, 1)
  271. time.Sleep(500 * time.Microsecond)
  272. // 取消置顶法令邮件
  273. //robot.LeagueTopMail(1, 1)
  274. // 置顶同盟邮件 理论上是不行的
  275. robot.LeagueMailTop(11, 2)
  276. select {}
  277. }
  278. func TestLcsMain(t *testing.T) {
  279. robot := testLcsSetup()
  280. //领取邮件奖励
  281. robot.TakeMailReward(1)
  282. // 一键阅读/领取邮件奖励
  283. robot.TakeAllMailReward()
  284. select {}
  285. }
  286. func TestMailRead(t *testing.T) {
  287. robot := testLcsSetup()
  288. //读取指定邮件
  289. robot.MailRead(2)
  290. select {}
  291. }
  292. func TestDelete(t *testing.T) {
  293. robot := testLcsSetup()
  294. //删除指定邮件
  295. robot.MailDelete(1)
  296. //删除所有邮件
  297. robot.MailDelete(0)
  298. select {}
  299. }
  300. // 招募
  301. func TestRecruit(t *testing.T) {
  302. robot := testLcsSetup()
  303. //招募池子1 5次
  304. robot.Recruit(1, 5)
  305. select {}
  306. }
  307. // 英雄升星
  308. func TestHeroStarUp(t *testing.T) {
  309. robot := testLcsSetup()
  310. robot.HeroStar(1050199)
  311. }
  312. // 英雄技能升级
  313. func TestHeroSkillLevelUp(t *testing.T) {
  314. robot := testLcsSetup()
  315. //英雄 1048578 升级天赋技能2
  316. //robot.HeroSkillUp(1048578, 3999901)
  317. //英雄1 升级主动技能3
  318. robot.HeroSkillUp(1048707, 10103)
  319. //英雄 1 升级被动技能4
  320. //robot.HeroSkillUp(1048578, 3999903)
  321. select {}
  322. }
  323. // 道具合成
  324. func TestItemCraft(t *testing.T) {
  325. robot := testLcsSetup()
  326. req := &pb.I32I32List{}
  327. req.List = append(req.List, &pb.I32I32{
  328. Key: 103011,
  329. Value: 1,
  330. })
  331. req.List = append(req.List, &pb.I32I32{
  332. Key: 103014,
  333. Value: 1,
  334. })
  335. // 合成矿石
  336. robot.ItemCraft(req)
  337. select {}
  338. }
  339. func TestLeague(t *testing.T) {
  340. robot := testLcsSetup()
  341. // 查看联盟列表
  342. //robot.GetLeagueInfo(1876)
  343. // 更改联盟名称
  344. //robot.LeagueNameChange("不知道")
  345. // 更改联盟简称
  346. //robot.LeagueAbbNameChange("不知道")
  347. // 设置联盟申请需要审核
  348. //robot.LeagueJoinApprovalSet()
  349. // 加入联盟
  350. //robot.JoinLeague(1882)
  351. // 获取申请列表
  352. //robot.LeagueApplyList()
  353. // 通过申请
  354. //robot.LeagueApplyOption(1048591, true)
  355. // 清除申请列表
  356. //robot.LeagueClearApplyList()
  357. // 设置联盟加入所需主城等级
  358. //robot.LeagueJoinLevelSet(50)
  359. // 设置联盟公告
  360. //robot.LeagueNoticeSet("不知道")
  361. // 设置联盟旗帜
  362. robot.LeagueFlagSet(102, 202)
  363. select {}
  364. }
  365. // 创建联盟
  366. func TestCreateLeague(t *testing.T) {
  367. robot := testLcsSetup()
  368. //robot.CreateLeague("", "我不知道.423d")
  369. //robot.CreateLeague("我不知道.423d", "")
  370. //robot.CreateLeague("哈哈哈哈哈哈哈哈哈哈哈", "不知道")
  371. robot.CreateLeague("硅基1", "konw1", 101, 201)
  372. //创建相同联盟名称/联盟简称
  373. //robot.CreateLeague("硅基", "konw1")
  374. //robot.CreateLeague("硅基1", "konw")
  375. select {}
  376. }
  377. // 加入联盟
  378. func TestJoinLeague(t *testing.T) {
  379. robot := testLcsSetup()
  380. //加入不存在联盟
  381. //robot.JoinLeague(1887)
  382. //加入联盟
  383. robot.JoinLeague(1876)
  384. select {}
  385. //检测重复加入
  386. //robot.JoinLeague(1886)
  387. }
  388. // 获取联盟成员列表
  389. func TestGetLeagueMembers(t *testing.T) {
  390. robot := testLcsSetup()
  391. //未加入/加入联盟联盟测试
  392. robot.GetLeagueMembers()
  393. select {}
  394. }
  395. // 获取推荐联盟列表
  396. func TestLeagueList(t *testing.T) {
  397. robot := testLcsSetup()
  398. //查看联盟列表
  399. robot.GetLeagueList()
  400. select {}
  401. }
  402. // 查询联盟列表
  403. func TestSearchLeague(t *testing.T) {
  404. robot := testLcsSetup()
  405. //获取联盟列表
  406. robot.SearchLeague("硅")
  407. //通过联盟id获取联盟列表
  408. //robot.SearchLeague("1886")
  409. //搜索不存在联盟名称
  410. //robot.SearchLeague("硅基1")
  411. //robot.SearchLeague("1895")
  412. select {}
  413. }
  414. // 入会申请处理
  415. func TestLeagueApplyOption(t *testing.T) {
  416. robot := testLcsSetup()
  417. // 拒绝入会申请
  418. //robot.LeagueApplyOption(1048587, false)
  419. // 同意入会申请
  420. robot.LeagueApplyOption(1048594, true)
  421. select {}
  422. }
  423. // 离开联盟
  424. func TestLeagueQuit(t *testing.T) {
  425. robot := testLcsSetup()
  426. robot.LeagueQuit()
  427. select {}
  428. }
  429. // 踢出联盟
  430. func TestKickLeague(t *testing.T) {
  431. robot := testLcsSetup()
  432. // 踢自己出联盟
  433. //robot.KickLeague(1048594)
  434. // 踢出存在联盟成员
  435. robot.KickLeague(1048609)
  436. select {}
  437. }
  438. // 英雄上阵 //
  439. func TestTeamUp(t *testing.T) {
  440. robot := testLcsSetup()
  441. // 上阵队伍位置下表错误
  442. //robot.TeamUp(1050058, 1, 0)
  443. //robot.TeamUp(1050058, 1, 10)
  444. // 上阵队伍正确
  445. robot.TeamUp(1048876, 1, 1, 1)
  446. time.Sleep(500 * time.Microsecond)
  447. robot.TeamUp(1048889, 1, 2, 3)
  448. time.Sleep(500 * time.Microsecond)
  449. robot.TeamUp(1048898, 1, 3, 5)
  450. time.Sleep(500 * time.Microsecond)
  451. // 同英雄上阵同一位置
  452. //robot.TeamUp(1050058, 1, 1)
  453. // 不同英雄上阵存在的位置
  454. //robot.TeamUp(1050060, 1, 1)
  455. // //上阵相同英雄到不同位置
  456. //robot.TeamUp(1050059, 1, 2)
  457. // 上阵满英雄
  458. // robot.TeamUp(1050078, 1, 6)
  459. // robot.TeamUp(1050068, 1, 3)
  460. // robot.TeamUp(1050069, 1, 4)
  461. // robot.TeamUp(1050062, 1, 5)
  462. select {}
  463. }
  464. // 英雄下阵
  465. func TestTeamLeave(t *testing.T) {
  466. robot := testLcsSetup()
  467. // 下阵队伍错误
  468. robot.TeamLeave(0, 0)
  469. // 下阵位置错误
  470. robot.TeamLeave(1, 0)
  471. // 下阵正确
  472. robot.TeamLeave(1, 1)
  473. robot.TeamLeave(1, 3)
  474. select {}
  475. }
  476. // 英雄换阵
  477. func TestTeamChange(t *testing.T) {
  478. robot := testLcsSetup()
  479. // 换阵队伍&位置不变
  480. robot.TeamChange(1, 1, 1, 1, 1)
  481. // 换阵错误
  482. robot.TeamChange(1, 1, 0, 1, 1)
  483. robot.TeamChange(1, 1, 0, 0, 1)
  484. // 换阵正确
  485. // 同队伍换位置
  486. robot.TeamChange(1, 2, 1, 3, 6)
  487. robot.TeamChange(1, 3, 1, 4, 4)
  488. // 不同队伍换位置
  489. robot.TeamChange(1, 4, 1, 3, 3)
  490. select {}
  491. }
  492. // 同队伍英雄换阵
  493. func TestTeamInnerChange(t *testing.T) {
  494. robot := testLcsSetup()
  495. // 换阵队伍&位置不变
  496. robot.TeamInnerChange(1, 1, 1)
  497. time.Sleep(500 * time.Millisecond)
  498. // 换阵错误
  499. robot.TeamInnerChange(1, 1, 0)
  500. time.Sleep(500 * time.Millisecond)
  501. robot.TeamInnerChange(1, 1, 4)
  502. time.Sleep(500 * time.Millisecond)
  503. // 换阵正确
  504. // 同队伍换位置
  505. robot.TeamInnerChange(1, 2, 1)
  506. time.Sleep(500 * time.Millisecond)
  507. robot.TeamInnerChange(1, 3, 1)
  508. time.Sleep(500 * time.Millisecond)
  509. select {}
  510. }
  511. // 阵容设置
  512. func TestTeamLineup(t *testing.T) {
  513. robot := testLcsSetup()
  514. // 阵容位置错误
  515. robot.TeamLineup(1, 0, 1)
  516. robot.TeamLineup(1, 1, 0)
  517. robot.TeamLineup(1, 1, 1)
  518. // 切换到无人的位置
  519. robot.TeamLineup(1, 1, 2)
  520. // 切换到有人的位置 互换
  521. robot.TeamLineup(1, 3, 2)
  522. // 切换到无人的位置上
  523. robot.TeamLineup(1, 3, 7)
  524. select {}
  525. }
  526. // 队伍补兵
  527. func TestTeamTroops(t *testing.T) {
  528. robot := testLcsSetup()
  529. // 补单个英雄
  530. memberTroops := []*pb.TeamMemberTroops{}
  531. memberTroops = append(memberTroops, &pb.TeamMemberTroops{TeamIndex: 1, TroopsID: 201, TroopsNum: 100})
  532. robot.TeamTroops(1, memberTroops)
  533. // 再次补兵 超出上限
  534. //robot.TeamTroops(1, 201, memberTroops)
  535. // 补多个英雄(附带超出队伍上限)
  536. // memberTroops = append(memberTroops, &pb.I32I32{Key: 1, Value: -410})
  537. // memberTroops = append(memberTroops, &pb.I32I32{Key: 2, Value: 410})
  538. // memberTroops = append(memberTroops, &pb.I32I32{Key: 3, Value: 100})
  539. // memberTroops = append(memberTroops, &pb.I32I32{Key: 4, Value: 300})
  540. // memberTroops = append(memberTroops, &pb.I32I32{Key: 5, Value: 2000})
  541. // memberTroops = append(memberTroops, &pb.I32I32{Key: 6, Value: 1000})
  542. // robot.TeamTroops(1, 201, memberTroops)
  543. // // //补充不存在的队伍
  544. // robot.TeamTroops(8, 201, memberTroops)
  545. select {}
  546. }
  547. func TestTeamAutoTroops(t *testing.T) {
  548. robot := testLcsSetup()
  549. // 自动补兵 未解锁的队伍
  550. //robot.TeamAutoTroops(5)
  551. // 正常补兵队伍设置自动补兵 重复
  552. robot.TeamAutoTroops(1)
  553. time.Sleep(500 * time.Millisecond)
  554. // 正常取消自动补兵
  555. //robot.TeamAutoTroops(1)
  556. select {}
  557. }
  558. // 队伍成员体力恢复
  559. func TestTeamEnergyRecovery(t *testing.T) {
  560. robot := testLcsSetup()
  561. // 队伍体力恢复
  562. robot.TeamEnergyRecovery(1)
  563. time.Sleep(500 * time.Millisecond)
  564. select {}
  565. }
  566. // 兵营-征兵
  567. func TestConscript(t *testing.T) {
  568. robot := testLcsSetup()
  569. // 征兵
  570. //robot.ConscriptBegin(201, 1000)
  571. //time.Sleep(500 * time.Millisecond)
  572. // 士兵升级
  573. //robot.ConscriptUp(201, 202, 200)
  574. //time.Sleep(500 * time.Millisecond)
  575. // 取消征兵
  576. //robot.ConscriptCancel()
  577. //time.Sleep(500 * time.Millisecond)
  578. // 取消士兵升级
  579. //robot.ConscriptUpCancel()
  580. //time.Sleep(500 * time.Millisecond)
  581. // 士兵升级
  582. //robot.ConscriptUp(202, 100, 203)
  583. //time.Sleep(500 * time.Millisecond)
  584. // 取消士兵升级
  585. //robot.ConscriptUpCancel()
  586. //time.Sleep(500 * time.Millisecond)
  587. // 设置自动征兵
  588. robot.ConscriptAuto(202)
  589. time.Sleep(500 * time.Millisecond)
  590. //robot.ConscriptAuto(0)
  591. //time.Sleep(500 * time.Millisecond)
  592. select {}
  593. }
  594. // 阵容英雄上阵
  595. func TestLineupUp(t *testing.T) {
  596. robot := testLcsSetup()
  597. robot.LineupUp(1, 1048977, 1, 1)
  598. time.Sleep(500 * time.Millisecond)
  599. robot.LineupUp(1, 1048975, 1, 2)
  600. time.Sleep(500 * time.Millisecond)
  601. robot.LineupUp(1, 1048983, 1, 1)
  602. time.Sleep(500 * time.Millisecond)
  603. robot.LineupUp(1, 1048975, 2, 2)
  604. time.Sleep(500 * time.Millisecond)
  605. robot.LineupUp(1, 1048983, 2, 2)
  606. time.Sleep(500 * time.Millisecond)
  607. robot.LineupUp(1, 1048983, 2, 2)
  608. select {}
  609. }
  610. // 阵容英雄下阵
  611. func TestLineupLeave(t *testing.T) {
  612. robot := testLcsSetup()
  613. robot.LineupLeave(1, 1, 1)
  614. time.Sleep(500 * time.Millisecond)
  615. robot.LineupLeave(1, 1, 2)
  616. time.Sleep(500 * time.Millisecond)
  617. robot.LineupLeave(1, 2, 2)
  618. select {}
  619. }
  620. // 阵容换阵
  621. func TestLineupChange(t *testing.T) {
  622. robot := testLcsSetup()
  623. robot.LineupChange(1, 1, 5, 1, 5)
  624. time.Sleep(500 * time.Millisecond)
  625. robot.LineupChange(1, 1, 5, 1, 2)
  626. time.Sleep(500 * time.Millisecond)
  627. robot.LineupChange(1, 1, 2, 2, 2)
  628. select {}
  629. }
  630. // 阵容调整
  631. func TestLineupAdjust(t *testing.T) {
  632. robot := testLcsSetup()
  633. robot.LineupAdjust(1, 1, 1, 1)
  634. time.Sleep(500 * time.Millisecond)
  635. robot.LineupAdjust(1, 1, 1, 10)
  636. time.Sleep(500 * time.Millisecond)
  637. robot.LineupAdjust(1, 1, 1, 5)
  638. select {}
  639. }
  640. // 探险
  641. func TestChapter(t *testing.T) {
  642. robot := testLcsSetup()
  643. // 获取最近一次精力恢复时间戳 单位秒
  644. //robot.ChapterLastRecoverTime()
  645. //time.Sleep(500 * time.Millisecond)
  646. // 取出精力
  647. robot.ChapterTaskOutStamina(100)
  648. time.Sleep(500 * time.Millisecond)
  649. select {}
  650. }
  651. // 探险扫荡
  652. func TestChapterLevelSweep(t *testing.T) {
  653. robot := testLcsSetup()
  654. // 扫荡一次
  655. robot.ChapterLevelSweep(101, 1)
  656. time.Sleep(500 * time.Millisecond)
  657. // 扫荡次数超出上限
  658. robot.ChapterLevelSweep(101, 3)
  659. time.Sleep(500 * time.Millisecond)
  660. // 未解锁关卡
  661. robot.ChapterLevelSweep(102, 1)
  662. time.Sleep(500 * time.Millisecond)
  663. select {}
  664. }
  665. // 章节累计星级奖励领取
  666. func TestChapterStarReward(t *testing.T) {
  667. robot := testLcsSetup()
  668. // 领取累计6星奖励
  669. robot.ChapterStarReward(101, 6)
  670. time.Sleep(500 * time.Millisecond)
  671. // 领取奖励不够的奖励
  672. robot.ChapterStarReward(101, 12)
  673. time.Sleep(500 * time.Millisecond)
  674. // 领取不存在的星级奖励
  675. robot.ChapterStarReward(101, 1)
  676. time.Sleep(500 * time.Millisecond)
  677. // 领取未解锁章节奖励
  678. robot.ChapterStarReward(102, 6)
  679. time.Sleep(500 * time.Millisecond)
  680. select {}
  681. }
  682. // 探险次数购买
  683. func TestChapterTimesBuy(t *testing.T) {
  684. robot := testLcsSetup()
  685. // 购买一次
  686. robot.ChapterTimesBuy(101, 1)
  687. time.Sleep(500 * time.Millisecond)
  688. // 购买次数超出上限
  689. robot.ChapterTimesBuy(101, 3)
  690. time.Sleep(500 * time.Millisecond)
  691. // 未解锁关卡
  692. robot.ChapterTimesBuy(102, 1)
  693. time.Sleep(500 * time.Millisecond)
  694. select {}
  695. }