You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

DebugAPI.cpp 22 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. #include <optional>
  2. #include <string>
  3. #include "AI.h"
  4. #include "API.h"
  5. #include "utils.hpp"
  6. #include "structures.h"
  7. #define PI 3.14159265358979323846
  8. HumanDebugAPI::HumanDebugAPI(ILogic& logic, bool file, bool print, bool warnOnly, int64_t playerID) :
  9. logic(logic)
  10. {
  11. std::string fileName = "logs/api-" + std::to_string(playerID) + "-log.txt";
  12. auto fileLogger = std::make_shared<spdlog::sinks::basic_file_sink_mt>(fileName, true);
  13. auto printLogger = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
  14. std::string pattern = "[api " + std::to_string(playerID) + "] [%H:%M:%S.%e] [%l] %v";
  15. fileLogger->set_pattern(pattern);
  16. printLogger->set_pattern(pattern);
  17. if (file)
  18. fileLogger->set_level(spdlog::level::trace);
  19. else
  20. fileLogger->set_level(spdlog::level::off);
  21. if (print)
  22. printLogger->set_level(spdlog::level::info);
  23. else
  24. printLogger->set_level(spdlog::level::off);
  25. if (warnOnly)
  26. printLogger->set_level(spdlog::level::warn);
  27. logger = std::make_unique<spdlog::logger>("apiLogger", spdlog::sinks_init_list{fileLogger, printLogger});
  28. }
  29. ButcherDebugAPI::ButcherDebugAPI(ILogic& logic, bool file, bool print, bool warnOnly, int64_t playerID) :
  30. logic(logic)
  31. {
  32. std::string fileName = "logs/api-" + std::to_string(playerID) + "-log.txt";
  33. auto fileLogger = std::make_shared<spdlog::sinks::basic_file_sink_mt>(fileName, true);
  34. auto printLogger = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
  35. std::string pattern = "[api" + std::to_string(playerID) + "] [%H:%M:%S.%e] [%l] %v";
  36. fileLogger->set_pattern(pattern);
  37. printLogger->set_pattern(pattern);
  38. if (file)
  39. fileLogger->set_level(spdlog::level::trace);
  40. else
  41. fileLogger->set_level(spdlog::level::off);
  42. if (print)
  43. printLogger->set_level(spdlog::level::info);
  44. else
  45. printLogger->set_level(spdlog::level::off);
  46. if (warnOnly)
  47. printLogger->set_level(spdlog::level::warn);
  48. logger = std::make_unique<spdlog::logger>("apiLogger", spdlog::sinks_init_list{fileLogger, printLogger});
  49. }
  50. void HumanDebugAPI::StartTimer()
  51. {
  52. startPoint = std::chrono::system_clock::now();
  53. std::time_t t = std::chrono::system_clock::to_time_t(startPoint);
  54. logger->info("=== AI.play() ===");
  55. logger->info("StartTimer: {}", std::ctime(&t));
  56. }
  57. void ButcherDebugAPI::StartTimer()
  58. {
  59. startPoint = std::chrono::system_clock::now();
  60. std::time_t t = std::chrono::system_clock::to_time_t(startPoint);
  61. logger->info("=== AI.play() ===");
  62. logger->info("StartTimer: {}", std::ctime(&t));
  63. }
  64. void HumanDebugAPI::EndTimer()
  65. {
  66. logger->info("Time elapsed: {}ms", Time::TimeSinceStart(startPoint));
  67. }
  68. void ButcherDebugAPI::EndTimer()
  69. {
  70. logger->info("Time elapsed: {}ms", Time::TimeSinceStart(startPoint));
  71. }
  72. int HumanDebugAPI::GetFrameCount() const
  73. {
  74. return logic.GetCounter();
  75. }
  76. int ButcherDebugAPI::GetFrameCount() const
  77. {
  78. return logic.GetCounter();
  79. }
  80. std::future<bool> HumanDebugAPI::Move(int64_t timeInMilliseconds, double angleInRadian)
  81. {
  82. logger->info("Move: timeInMilliseconds = {}, angleInRadian = {}, called at {}ms", timeInMilliseconds, angleInRadian, Time::TimeSinceStart(startPoint));
  83. return std::async(std::launch::async, [=]()
  84. { auto result = logic.Move(timeInMilliseconds, angleInRadian);
  85. if (!result)
  86. logger->warn("Move: failed at {}ms", Time::TimeSinceStart(startPoint));
  87. return result; });
  88. }
  89. std::future<bool> HumanDebugAPI::MoveDown(int64_t timeInMilliseconds)
  90. {
  91. return Move(timeInMilliseconds, 0);
  92. }
  93. std::future<bool> HumanDebugAPI::MoveRight(int64_t timeInMilliseconds)
  94. {
  95. return Move(timeInMilliseconds, PI * 0.5);
  96. }
  97. std::future<bool> HumanDebugAPI::MoveUp(int64_t timeInMilliseconds)
  98. {
  99. return Move(timeInMilliseconds, PI);
  100. }
  101. std::future<bool> HumanDebugAPI::MoveLeft(int64_t timeInMilliseconds)
  102. {
  103. return Move(timeInMilliseconds, PI * 1.5);
  104. }
  105. std::future<bool> ButcherDebugAPI::Move(int64_t timeInMilliseconds, double angleInRadian)
  106. {
  107. logger->info("Move: timeInMilliseconds = {}, angleInRadian = {}, called at {}ms", timeInMilliseconds, angleInRadian, Time::TimeSinceStart(startPoint));
  108. return std::async(std::launch::async, [=]()
  109. { auto result = logic.Move(timeInMilliseconds, angleInRadian);
  110. if (!result)
  111. logger->warn("Move: failed at {}ms", Time::TimeSinceStart(startPoint));
  112. return result; });
  113. }
  114. std::future<bool> ButcherDebugAPI::MoveDown(int64_t timeInMilliseconds)
  115. {
  116. return Move(timeInMilliseconds, 0);
  117. }
  118. std::future<bool> ButcherDebugAPI::MoveRight(int64_t timeInMilliseconds)
  119. {
  120. return Move(timeInMilliseconds, PI * 0.5);
  121. }
  122. std::future<bool> ButcherDebugAPI::MoveUp(int64_t timeInMilliseconds)
  123. {
  124. return Move(timeInMilliseconds, PI);
  125. }
  126. std::future<bool> ButcherDebugAPI::MoveLeft(int64_t timeInMilliseconds)
  127. {
  128. return Move(timeInMilliseconds, PI * 1.5);
  129. }
  130. std::future<bool> HumanDebugAPI::PickProp(THUAI6::PropType prop)
  131. {
  132. logger->info("PickProp: prop = {}, called at {}ms", THUAI6::propTypeDict[prop], Time::TimeSinceStart(startPoint));
  133. return std::async(std::launch::async, [=]()
  134. { auto result = logic.PickProp(prop);
  135. if (!result)
  136. logger->warn("PickProp: failed at {}ms", Time::TimeSinceStart(startPoint));
  137. return result; });
  138. }
  139. std::future<bool> HumanDebugAPI::UseProp()
  140. {
  141. logger->info("UseProp: called at {}ms", Time::TimeSinceStart(startPoint));
  142. return std::async(std::launch::async, [=]()
  143. { auto result = logic.UseProp();
  144. if (!result)
  145. logger->warn("UseProp: failed at {}ms", Time::TimeSinceStart(startPoint));
  146. return result; });
  147. }
  148. std::future<bool> ButcherDebugAPI::PickProp(THUAI6::PropType prop)
  149. {
  150. logger->info("PickProp: prop = {}, called at {}ms", THUAI6::propTypeDict[prop], Time::TimeSinceStart(startPoint));
  151. return std::async(std::launch::async, [=]()
  152. { auto result = logic.PickProp(prop);
  153. if (!result)
  154. logger->warn("PickProp: failed at {}ms", Time::TimeSinceStart(startPoint));
  155. return result; });
  156. }
  157. std::future<bool> ButcherDebugAPI::UseProp()
  158. {
  159. logger->info("UseProp: called at {}ms", Time::TimeSinceStart(startPoint));
  160. return std::async(std::launch::async, [this]()
  161. { auto result = logic.UseProp();
  162. if (!result)
  163. logger->warn("UseProp: failed at {}ms", Time::TimeSinceStart(startPoint));
  164. return result; });
  165. }
  166. std::future<bool> HumanDebugAPI::UseSkill()
  167. {
  168. logger->info("UseSkill: called at {}ms", Time::TimeSinceStart(startPoint));
  169. return std::async(std::launch::async, [this]()
  170. { auto result = logic.UseSkill();
  171. if (!result)
  172. logger->warn("UseSkill: failed at {}ms", Time::TimeSinceStart(startPoint));
  173. return result; });
  174. }
  175. std::future<bool> ButcherDebugAPI::UseSkill()
  176. {
  177. logger->info("UseSkill: called at {}ms", Time::TimeSinceStart(startPoint));
  178. return std::async(std::launch::async, [this]()
  179. { auto result = logic.UseSkill();
  180. if (!result)
  181. logger->warn("UseSkill: failed at {}ms", Time::TimeSinceStart(startPoint));
  182. return result; });
  183. }
  184. std::future<bool> HumanDebugAPI::SendMessage(int64_t toID, std::string message)
  185. {
  186. logger->info("SendMessage: toID = {}, message = {}, called at {}ms", toID, message, Time::TimeSinceStart(startPoint));
  187. return std::async(std::launch::async, [=]()
  188. { auto result = logic.SendMessage(toID, message);
  189. if (!result)
  190. logger->warn("SendMessage: failed at {}ms", Time::TimeSinceStart(startPoint));
  191. return result; });
  192. }
  193. std::future<bool> ButcherDebugAPI::SendMessage(int64_t toID, std::string message)
  194. {
  195. logger->info("SendMessage: toID = {}, message = {}, called at {}ms", toID, message, Time::TimeSinceStart(startPoint));
  196. return std::async(std::launch::async, [=]()
  197. { auto result = logic.SendMessage(toID, message);
  198. if (!result)
  199. logger->warn("SendMessage: failed at {}ms", Time::TimeSinceStart(startPoint));
  200. return result; });
  201. }
  202. std::future<bool> HumanDebugAPI::HaveMessage()
  203. {
  204. logger->info("HaveMessage: called at {}ms", Time::TimeSinceStart(startPoint));
  205. return std::async(std::launch::async, [this]()
  206. { auto result = logic.HaveMessage();
  207. if (!result)
  208. logger->warn("HaveMessage: failed at {}ms", Time::TimeSinceStart(startPoint));
  209. return result; });
  210. }
  211. std::future<bool> ButcherDebugAPI::HaveMessage()
  212. {
  213. logger->info("HaveMessage: called at {}ms", Time::TimeSinceStart(startPoint));
  214. return std::async(std::launch::async, [this]()
  215. { auto result = logic.HaveMessage();
  216. if (!result)
  217. logger->warn("HaveMessage: failed at {}ms", Time::TimeSinceStart(startPoint));
  218. return result; });
  219. }
  220. std::future<std::optional<std::pair<int64_t, std::string>>> HumanDebugAPI::GetMessage()
  221. {
  222. logger->info("GetMessage: called at {}ms", Time::TimeSinceStart(startPoint));
  223. return std::async(std::launch::async, [this]()
  224. { auto result = logic.GetMessage();
  225. if (result == std::nullopt)
  226. logger->warn("GetMessage: failed at {}ms", Time::TimeSinceStart(startPoint));
  227. return result; });
  228. }
  229. std::future<std::optional<std::pair<int64_t, std::string>>> ButcherDebugAPI::GetMessage()
  230. {
  231. logger->info("GetMessage: called at {}ms", Time::TimeSinceStart(startPoint));
  232. return std::async(std::launch::async, [this]()
  233. { auto result = logic.GetMessage();
  234. if (result == std::nullopt)
  235. logger->warn("GetMessage: failed at {}ms", Time::TimeSinceStart(startPoint));
  236. return result; });
  237. }
  238. std::future<bool> HumanDebugAPI::Wait()
  239. {
  240. logger->info("Wait: called at {}ms", Time::TimeSinceStart(startPoint));
  241. if (logic.GetCounter() == -1)
  242. return std::async(std::launch::async, []()
  243. { return false; });
  244. else
  245. return std::async(std::launch::async, [this]()
  246. { return logic.WaitThread(); });
  247. }
  248. std::future<bool> ButcherDebugAPI::Wait()
  249. {
  250. logger->info("Wait: called at {}ms", Time::TimeSinceStart(startPoint));
  251. if (logic.GetCounter() == -1)
  252. return std::async(std::launch::async, []()
  253. { return false; });
  254. else
  255. return std::async(std::launch::async, [this]()
  256. { return logic.WaitThread(); });
  257. }
  258. std::vector<std::shared_ptr<const THUAI6::Butcher>> HumanDebugAPI::GetButcher() const
  259. {
  260. return logic.GetButchers();
  261. }
  262. std::vector<std::shared_ptr<const THUAI6::Human>> HumanDebugAPI::GetHuman() const
  263. {
  264. return logic.GetHumans();
  265. }
  266. std::vector<std::shared_ptr<const THUAI6::Butcher>> ButcherDebugAPI::GetButcher() const
  267. {
  268. return logic.GetButchers();
  269. }
  270. std::vector<std::shared_ptr<const THUAI6::Human>> ButcherDebugAPI::GetHuman() const
  271. {
  272. return logic.GetHumans();
  273. }
  274. std::vector<std::shared_ptr<const THUAI6::Prop>> HumanDebugAPI::GetProps() const
  275. {
  276. return logic.GetProps();
  277. }
  278. std::vector<std::shared_ptr<const THUAI6::Prop>> ButcherDebugAPI::GetProps() const
  279. {
  280. return logic.GetProps();
  281. }
  282. std::vector<std::vector<THUAI6::PlaceType>> HumanDebugAPI::GetFullMap() const
  283. {
  284. return logic.GetFullMap();
  285. }
  286. THUAI6::PlaceType HumanDebugAPI::GetPlaceType(int32_t CellX, int32_t CellY) const
  287. {
  288. return logic.GetPlaceType(CellX, CellY);
  289. }
  290. THUAI6::PlaceType ButcherDebugAPI::GetPlaceType(int32_t CellX, int32_t CellY) const
  291. {
  292. return logic.GetPlaceType(CellX, CellY);
  293. }
  294. std::vector<std::vector<THUAI6::PlaceType>> ButcherDebugAPI::GetFullMap() const
  295. {
  296. return logic.GetFullMap();
  297. }
  298. const std::vector<int64_t> HumanDebugAPI::GetPlayerGUIDs() const
  299. {
  300. return logic.GetPlayerGUIDs();
  301. }
  302. const std::vector<int64_t> ButcherDebugAPI::GetPlayerGUIDs() const
  303. {
  304. return logic.GetPlayerGUIDs();
  305. }
  306. std::future<bool> HumanDebugAPI::StartFixMachine()
  307. {
  308. logger->info("StartFixMachine: called at {}ms", Time::TimeSinceStart(startPoint));
  309. return std::async(std::launch::async, [this]()
  310. { auto result = logic.StartFixMachine();
  311. if (!result)
  312. logger->warn("StartFixMachine: failed at {}ms", Time::TimeSinceStart(startPoint));
  313. return result; });
  314. }
  315. std::future<bool> HumanDebugAPI::EndFixMachine()
  316. {
  317. logger->info("EndFixMachine: called at {}ms", Time::TimeSinceStart(startPoint));
  318. return std::async(std::launch::async, [this]()
  319. { auto result = logic.EndFixMachine();
  320. if (!result)
  321. logger->warn("EndFixMachine: failed at {}ms", Time::TimeSinceStart(startPoint));
  322. return result; });
  323. }
  324. std::future<bool> HumanDebugAPI::StartSaveHuman()
  325. {
  326. logger->info("StartSaveHuman: called at {}ms", Time::TimeSinceStart(startPoint));
  327. return std::async(std::launch::async, [this]()
  328. { auto result = logic.StartSaveHuman();
  329. if (!result)
  330. logger->warn("StartSaveHuman: failed at {}ms", Time::TimeSinceStart(startPoint));
  331. return result; });
  332. }
  333. std::future<bool> HumanDebugAPI::EndSaveHuman()
  334. {
  335. logger->info("EndSaveHuman: called at {}ms", Time::TimeSinceStart(startPoint));
  336. return std::async(std::launch::async, [this]()
  337. { auto result = logic.EndSaveHuman();
  338. if (!result)
  339. logger->warn("EndSaveHuman: failed at {}ms", Time::TimeSinceStart(startPoint));
  340. return result; });
  341. }
  342. std::future<bool> HumanDebugAPI::Escape()
  343. {
  344. logger->info("Escape: called at {}ms", Time::TimeSinceStart(startPoint));
  345. return std::async(std::launch::async, [this]()
  346. { auto result = logic.Escape();
  347. if (!result)
  348. logger->warn("Escape: failed at {}ms", Time::TimeSinceStart(startPoint));
  349. return result; });
  350. }
  351. std::shared_ptr<const THUAI6::Human> HumanDebugAPI::GetSelfInfo() const
  352. {
  353. return logic.HumanGetSelfInfo();
  354. }
  355. std::future<bool> ButcherDebugAPI::Attack(double angleInRadian)
  356. {
  357. logger->info("Attack: angleInRadian = {}, called at {}ms", angleInRadian, Time::TimeSinceStart(startPoint));
  358. return std::async(std::launch::async, [=]()
  359. { auto result = logic.Attack(angleInRadian);
  360. if (!result)
  361. logger->warn("Attack: failed at {}ms", Time::TimeSinceStart(startPoint));
  362. return result; });
  363. }
  364. std::future<bool> ButcherDebugAPI::CarryHuman()
  365. {
  366. logger->info("CarryHuman: called at {}ms", Time::TimeSinceStart(startPoint));
  367. return std::async(std::launch::async, [this]()
  368. { auto result = logic.CarryHuman();
  369. if (!result)
  370. logger->warn("CarryHuman: failed at {}ms", Time::TimeSinceStart(startPoint));
  371. return result; });
  372. }
  373. std::future<bool> ButcherDebugAPI::ReleaseHuman()
  374. {
  375. logger->info("ReleaseHuman: called at {}ms", Time::TimeSinceStart(startPoint));
  376. return std::async(std::launch::async, [this]()
  377. { auto result = logic.ReleaseHuman();
  378. if (!result)
  379. logger->warn("ReleaseHuman: failed at {}ms", Time::TimeSinceStart(startPoint));
  380. return result; });
  381. }
  382. std::future<bool> ButcherDebugAPI::HangHuman()
  383. {
  384. logger->info("HangHuman: called at {}ms", Time::TimeSinceStart(startPoint));
  385. return std::async(std::launch::async, [this]()
  386. { auto result = logic.HangHuman();
  387. if (!result)
  388. logger->warn("HangHuman: failed at {}ms", Time::TimeSinceStart(startPoint));
  389. return result; });
  390. }
  391. std::shared_ptr<const THUAI6::Butcher> ButcherDebugAPI::GetSelfInfo() const
  392. {
  393. return logic.ButcherGetSelfInfo();
  394. }
  395. void HumanDebugAPI::PrintHuman() const
  396. {
  397. for (auto human : logic.GetHumans())
  398. {
  399. logger->info("******Human Info******");
  400. logger->info("playerID={}, GUID={}, x={}, y={}", human->playerID, human->guid, human->x, human->y);
  401. logger->info("speed={}, view range={}, skill time={}, prop={}, place={}", human->speed, human->viewRange, human->timeUntilSkillAvailable, THUAI6::propTypeDict[human->prop], THUAI6::placeTypeDict[human->place]);
  402. logger->info("state={}, life={}, hangedTime={}", THUAI6::humanStateDict[human->state], human->life, human->hangedTime);
  403. std::string humanBuff = "buff=";
  404. for (auto buff : human->buff)
  405. humanBuff += THUAI6::humanBuffDict[buff] + ", ";
  406. logger->info(humanBuff);
  407. logger->info("**********************");
  408. }
  409. }
  410. void ButcherDebugAPI::PrintHuman() const
  411. {
  412. for (auto human : logic.GetHumans())
  413. {
  414. logger->info("******Human Info******");
  415. logger->info("playerID={}, GUID={}, x={}, y={}", human->playerID, human->guid, human->x, human->y);
  416. logger->info("speed={}, view range={}, skill time={}, prop={}, place={}", human->speed, human->viewRange, human->timeUntilSkillAvailable, THUAI6::propTypeDict[human->prop], THUAI6::placeTypeDict[human->place]);
  417. logger->info("state={}, life={}, hangedTime={}", THUAI6::humanStateDict[human->state], human->life, human->hangedTime);
  418. std::string humanBuff = "buff=";
  419. for (auto buff : human->buff)
  420. humanBuff += THUAI6::humanBuffDict[buff] + ", ";
  421. logger->info(humanBuff);
  422. logger->info("**********************");
  423. }
  424. }
  425. void HumanDebugAPI::PrintButcher() const
  426. {
  427. for (auto butcher : logic.GetButchers())
  428. {
  429. logger->info("******Butcher Info******");
  430. logger->info("playerID={}, GUID={}, x={}, y={}", butcher->playerID, butcher->guid, butcher->x, butcher->y);
  431. logger->info("speed={}, view range={}, skill time={}, prop={}, place={}", butcher->speed, butcher->viewRange, butcher->timeUntilSkillAvailable, THUAI6::propTypeDict[butcher->prop], THUAI6::placeTypeDict[butcher->place]);
  432. logger->info("damage={}, movable={}", butcher->damage, butcher->movable);
  433. std::string butcherBuff = "buff=";
  434. for (auto buff : butcher->buff)
  435. butcherBuff += THUAI6::butcherBuffDict[buff] + ", ";
  436. logger->info(butcherBuff);
  437. logger->info("************************");
  438. }
  439. }
  440. void ButcherDebugAPI::PrintButcher() const
  441. {
  442. for (auto butcher : logic.GetButchers())
  443. {
  444. logger->info("******Butcher Info******");
  445. logger->info("playerID={}, GUID={}, x={}, y={}", butcher->playerID, butcher->guid, butcher->x, butcher->y);
  446. logger->info("speed={}, view range={}, skill time={}, prop={}, place={}", butcher->speed, butcher->viewRange, butcher->timeUntilSkillAvailable, THUAI6::propTypeDict[butcher->prop], THUAI6::placeTypeDict[butcher->place]);
  447. logger->info("damage={}, movable={}", butcher->damage, butcher->movable);
  448. std::string butcherBuff = "buff=";
  449. for (auto buff : butcher->buff)
  450. butcherBuff += THUAI6::butcherBuffDict[buff] + ", ";
  451. logger->info(butcherBuff);
  452. logger->info("************************");
  453. }
  454. }
  455. void HumanDebugAPI::PrintProp() const
  456. {
  457. for (auto prop : logic.GetProps())
  458. {
  459. logger->info("******Prop Info******");
  460. logger->info("GUID={}, x={}, y={}, place={}, is moving={}", prop->guid, prop->x, prop->y, THUAI6::placeTypeDict[prop->place], prop->isMoving);
  461. logger->info("*********************");
  462. }
  463. }
  464. void ButcherDebugAPI::PrintProp() const
  465. {
  466. for (auto prop : logic.GetProps())
  467. {
  468. logger->info("******Prop Info******");
  469. logger->info("GUID={}, x={}, y={}, place={}, is moving={}", prop->guid, prop->x, prop->y, THUAI6::placeTypeDict[prop->place], prop->isMoving);
  470. logger->info("*********************");
  471. }
  472. }
  473. void HumanDebugAPI::PrintSelfInfo() const
  474. {
  475. auto self = logic.HumanGetSelfInfo();
  476. logger->info("******Self Info******");
  477. logger->info("playerID={}, GUID={}, x={}, y={}", self->playerID, self->guid, self->x, self->y);
  478. logger->info("speed={}, view range={}, skill time={}, prop={}, place={}", self->speed, self->viewRange, self->timeUntilSkillAvailable, THUAI6::propTypeDict[self->prop], THUAI6::placeTypeDict[self->place]);
  479. logger->info("state={}, life={}, hangedTime={}", THUAI6::humanStateDict[self->state], self->life, self->hangedTime);
  480. std::string humanBuff = "buff=";
  481. for (auto buff : self->buff)
  482. humanBuff += THUAI6::humanBuffDict[buff] + ", ";
  483. logger->info(humanBuff);
  484. logger->info("*********************");
  485. }
  486. void ButcherDebugAPI::PrintSelfInfo() const
  487. {
  488. auto self = logic.ButcherGetSelfInfo();
  489. logger->info("******Self Info******");
  490. logger->info("playerID={}, GUID={}, x={}, y={}", self->playerID, self->guid, self->x, self->y);
  491. logger->info("speed={}, view range={}, skill time={}, prop={}, place={}", self->speed, self->viewRange, self->timeUntilSkillAvailable, THUAI6::propTypeDict[self->prop], THUAI6::placeTypeDict[self->place]);
  492. logger->info("damage={}, movable={}", self->damage, self->movable);
  493. std::string butcherBuff = "buff=";
  494. for (auto buff : self->buff)
  495. butcherBuff += THUAI6::butcherBuffDict[buff] + ", ";
  496. logger->info(butcherBuff);
  497. logger->info("*********************");
  498. }
  499. void HumanDebugAPI::Play(IAI& ai)
  500. {
  501. ai.play(*this);
  502. }
  503. void ButcherDebugAPI::Play(IAI& ai)
  504. {
  505. ai.play(*this);
  506. }