Best JavaScript code snippet using wpt
c2s.js
Source:c2s.js
1module.exports = require("protobufjs").newBuilder({})['import']({2 "package": "Protocol.C2S",3 "messages": [4 {5 "name": "LOGIN_CS_ACCOUNT_LOGIN",6 "fields": [7 {8 "rule": "optional",9 "type": "int32",10 "name": "cmd_id",11 "id": 1,12 "options": {13 "default": 1000014 }15 },16 {17 "rule": "required",18 "type": "string",19 "name": "account",20 "id": 221 },22 {23 "rule": "required",24 "type": "string",25 "name": "pwd_md5",26 "id": 327 },28 {29 "rule": "required",30 "type": "int32",31 "name": "platform_id",32 "id": 433 }34 ]35 },36 {37 "name": "LOGIN_CS_PLATFORM_LOGIN",38 "fields": [39 {40 "rule": "optional",41 "type": "int32",42 "name": "cmd_id",43 "id": 1,44 "options": {45 "default": 1000146 }47 },48 {49 "rule": "required",50 "type": "string",51 "name": "uid",52 "id": 253 },54 {55 "rule": "required",56 "type": "string",57 "name": "token",58 "id": 359 },60 {61 "rule": "required",62 "type": "string",63 "name": "device_token",64 "id": 465 },66 {67 "rule": "required",68 "type": "string",69 "name": "device",70 "id": 571 },72 {73 "rule": "required",74 "type": "string",75 "name": "device_type",76 "id": 677 },78 {79 "rule": "required",80 "type": "string",81 "name": "open_uid",82 "id": 783 },84 {85 "rule": "required",86 "type": "string",87 "name": "apple_uid",88 "id": 889 },90 {91 "rule": "required",92 "type": "int32",93 "name": "platform",94 "id": 995 }96 ]97 },98 {99 "name": "LOGIN_CS_FAST_LOGIN",100 "fields": [101 {102 "rule": "optional",103 "type": "int32",104 "name": "cmd_id",105 "id": 1,106 "options": {107 "default": 10002108 }109 },110 {111 "rule": "required",112 "type": "string",113 "name": "uid",114 "id": 2115 },116 {117 "rule": "required",118 "type": "string",119 "name": "device",120 "id": 3121 },122 {123 "rule": "required",124 "type": "string",125 "name": "device_type",126 "id": 4127 },128 {129 "rule": "required",130 "type": "string",131 "name": "open_uid",132 "id": 5133 },134 {135 "rule": "required",136 "type": "string",137 "name": "apple_uid",138 "id": 6139 },140 {141 "rule": "required",142 "type": "int32",143 "name": "platform",144 "id": 7145 },146 {147 "rule": "required",148 "type": "int32",149 "name": "ios_version",150 "id": 8151 }152 ]153 },154 {155 "name": "LOGIN_CS_GET_SERVER",156 "fields": [157 {158 "rule": "optional",159 "type": "int32",160 "name": "cmd_id",161 "id": 1,162 "options": {163 "default": 10003164 }165 },166 {167 "rule": "required",168 "type": "string",169 "name": "version",170 "id": 2171 },172 {173 "rule": "required",174 "type": "string",175 "name": "res_version",176 "id": 3177 }178 ]179 },180 {181 "name": "LOGIN_CS_CHOOSE_SERVER",182 "fields": [183 {184 "rule": "optional",185 "type": "int32",186 "name": "cmd_id",187 "id": 1,188 "options": {189 "default": 10004190 }191 },192 {193 "rule": "required",194 "type": "int32",195 "name": "server_id",196 "id": 2197 }198 ]199 },200 {201 "name": "LOGIN_CS_REGISTER",202 "fields": [203 {204 "rule": "optional",205 "type": "int32",206 "name": "cmd_id",207 "id": 1,208 "options": {209 "default": 10005210 }211 },212 {213 "rule": "required",214 "type": "string",215 "name": "uid",216 "id": 2217 },218 {219 "rule": "required",220 "type": "string",221 "name": "account",222 "id": 3223 },224 {225 "rule": "required",226 "type": "string",227 "name": "pwd_md5",228 "id": 4229 },230 {231 "rule": "required",232 "type": "int32",233 "name": "platform_id",234 "id": 5235 },236 {237 "rule": "required",238 "type": "string",239 "name": "device",240 "id": 6241 },242 {243 "rule": "required",244 "type": "string",245 "name": "device_type",246 "id": 7247 },248 {249 "rule": "required",250 "type": "string",251 "name": "open_udid",252 "id": 8253 },254 {255 "rule": "required",256 "type": "string",257 "name": "apple_udid",258 "id": 9259 }260 ]261 },262 {263 "name": "LOGIN_CS_MODIFY_PASSWD",264 "fields": [265 {266 "rule": "optional",267 "type": "int32",268 "name": "cmd_id",269 "id": 1,270 "options": {271 "default": 10006272 }273 },274 {275 "rule": "required",276 "type": "string",277 "name": "new_passwd",278 "id": 3279 }280 ]281 },282 {283 "name": "LOGIN_CS_PTR_GET_INFO",284 "fields": [285 {286 "rule": "optional",287 "type": "int32",288 "name": "cmd_id",289 "id": 1,290 "options": {291 "default": 10007292 }293 },294 {295 "rule": "required",296 "type": "uint32",297 "name": "gm_id",298 "id": 2299 },300 {301 "rule": "required",302 "type": "uint32",303 "name": "account_id",304 "id": 3305 }306 ]307 },308 {309 "name": "LOGIN_CS_PTR_REGISTER",310 "fields": [311 {312 "rule": "optional",313 "type": "uint32",314 "name": "cmd_id",315 "id": 1,316 "options": {317 "default": 10008318 }319 },320 {321 "rule": "required",322 "type": "uint32",323 "name": "gm_id",324 "id": 2325 },326 {327 "rule": "required",328 "type": "uint32",329 "name": "account_id",330 "id": 3331 },332 {333 "rule": "required",334 "type": "string",335 "name": "server_ip_ori",336 "id": 4337 },338 {339 "rule": "required",340 "type": "uint32",341 "name": "server_id",342 "id": 5343 },344 {345 "rule": "required",346 "type": "string",347 "name": "uid",348 "id": 6349 },350 {351 "rule": "required",352 "type": "string",353 "name": "account",354 "id": 7355 },356 {357 "rule": "required",358 "type": "string",359 "name": "pwdMd5",360 "id": 8361 },362 {363 "rule": "required",364 "type": "uint32",365 "name": "platformId",366 "id": 10367 },368 {369 "rule": "required",370 "type": "string",371 "name": "device",372 "id": 11373 },374 {375 "rule": "required",376 "type": "string",377 "name": "deviceType",378 "id": 12379 },380 {381 "rule": "required",382 "type": "string",383 "name": "open_udid",384 "id": 13385 },386 {387 "rule": "required",388 "type": "string",389 "name": "apple_udid",390 "id": 14391 }392 ]393 },394 {395 "name": "LOGIN_CS_CDK",396 "fields": [397 {398 "rule": "optional",399 "type": "int32",400 "name": "cmd_id",401 "id": 1,402 "options": {403 "default": 10009404 }405 },406 {407 "rule": "required",408 "type": "string",409 "name": "cdk",410 "id": 2411 }412 ]413 },414 {415 "name": "CS_GAME_AUTH",416 "fields": [417 {418 "rule": "optional",419 "type": "int32",420 "name": "cmd_id",421 "id": 1,422 "options": {423 "default": 11000424 }425 },426 {427 "rule": "required",428 "type": "int32",429 "name": "role_id",430 "id": 2431 },432 {433 "rule": "required",434 "type": "string",435 "name": "device",436 "id": 3437 },438 {439 "rule": "required",440 "type": "string",441 "name": "device_type",442 "id": 4443 },444 {445 "rule": "required",446 "type": "string",447 "name": "device_uid",448 "id": 5449 },450 {451 "rule": "required",452 "type": "bool",453 "name": "reconnect",454 "id": 6455 }456 ]457 },458 {459 "name": "CS_GM_COMMAND",460 "fields": [461 {462 "rule": "optional",463 "type": "int32",464 "name": "cmd_id",465 "id": 1,466 "options": {467 "default": 11010468 }469 },470 {471 "rule": "required",472 "type": "string",473 "name": "content",474 "id": 2475 }476 ]477 },478 {479 "name": "CS_TIME_REQUEST",480 "fields": [481 {482 "rule": "optional",483 "type": "int32",484 "name": "cmd_id",485 "id": 1,486 "options": {487 "default": 11020488 }489 }490 ]491 },492 {493 "name": "CS_CREATE_NAME",494 "fields": [495 {496 "rule": "optional",497 "type": "int32",498 "name": "cmd_id",499 "id": 1,500 "options": {501 "default": 11200502 }503 },504 {505 "rule": "required",506 "type": "string",507 "name": "name",508 "id": 2509 }510 ]511 },512 {513 "name": "CS_CREATE_ACCOUNT",514 "fields": [515 {516 "rule": "optional",517 "type": "int32",518 "name": "cmd_id",519 "id": 1,520 "options": {521 "default": 11201522 }523 },524 {525 "rule": "required",526 "type": "string",527 "name": "name",528 "id": 2529 },530 {531 "rule": "required",532 "type": "Sexual",533 "name": "sexual",534 "id": 3535 },536 {537 "rule": "optional",538 "type": "int32",539 "name": "fashion_id",540 "id": 4,541 "options": {542 "default": 0543 }544 }545 ],546 "enums": [547 {548 "name": "Sexual",549 "values": [550 {551 "name": "MAN",552 "id": 0553 },554 {555 "name": "WOMAN",556 "id": 1557 }558 ]559 }560 ]561 },562 {563 "name": "CS_GET_RANDOM_NAME",564 "fields": [565 {566 "rule": "optional",567 "type": "int32",568 "name": "cmd_id",569 "id": 1,570 "options": {571 "default": 11202572 }573 },574 {575 "rule": "required",576 "type": "Sex",577 "name": "sex",578 "id": 2579 }580 ],581 "enums": [582 {583 "name": "Sex",584 "values": [585 {586 "name": "MAN",587 "id": 0588 },589 {590 "name": "WOMAN",591 "id": 1592 }593 ]594 }595 ]596 },597 {598 "name": "CS_SYSTEM_OPTION_SET",599 "fields": [600 {601 "rule": "optional",602 "type": "int32",603 "name": "cmd_id",604 "id": 1,605 "options": {606 "default": 11203607 }608 },609 {610 "rule": "optional",611 "type": "int32",612 "name": "music",613 "id": 2,614 "options": {615 "default": -1616 }617 },618 {619 "rule": "optional",620 "type": "int32",621 "name": "voice",622 "id": 3,623 "options": {624 "default": -1625 }626 }627 ]628 },629 {630 "name": "CS_CHANGE_NAME",631 "fields": [632 {633 "rule": "optional",634 "type": "int32",635 "name": "cmd_id",636 "id": 1,637 "options": {638 "default": 11204639 }640 },641 {642 "rule": "required",643 "type": "string",644 "name": "name",645 "id": 2646 }647 ]648 },649 {650 "name": "CS_GUIDE_SET_STEP",651 "fields": [652 {653 "rule": "optional",654 "type": "int32",655 "name": "cmd_id",656 "id": 1,657 "options": {658 "default": 11205659 }660 },661 {662 "rule": "required",663 "type": "int32",664 "name": "guide_id",665 "id": 2666 },667 {668 "rule": "required",669 "type": "int32",670 "name": "step",671 "id": 3672 }673 ]674 },675 {676 "name": "CS_GUIDE_SET_SPECIAL_INFO",677 "fields": [678 {679 "rule": "optional",680 "type": "int32",681 "name": "cmd_id",682 "id": 1,683 "options": {684 "default": 11206685 }686 },687 {688 "rule": "required",689 "type": "int32",690 "name": "number",691 "id": 2692 }693 ]694 },695 {696 "name": "CS_GIFT_CODE",697 "fields": [698 {699 "rule": "optional",700 "type": "int32",701 "name": "cmd_id",702 "id": 1,703 "options": {704 "default": 11207705 }706 },707 {708 "rule": "required",709 "type": "string",710 "name": "code",711 "id": 2712 }713 ]714 },715 {716 "name": "CS_GUIDE_COMPLETE_FIRST_FIGHT",717 "fields": [718 {719 "rule": "optional",720 "type": "int32",721 "name": "cmd_id",722 "id": 1,723 "options": {724 "default": 11208725 }726 }727 ]728 },729 {730 "name": "CS_TALK_TO_NPC",731 "fields": [732 {733 "rule": "optional",734 "type": "int32",735 "name": "cmd_id",736 "id": 1,737 "options": {738 "default": 11210739 }740 },741 {742 "rule": "required",743 "type": "int32",744 "name": "npc_id",745 "id": 2746 }747 ]748 },749 {750 "name": "CS_HERO_ADVANCE",751 "fields": [752 {753 "rule": "optional",754 "type": "int32",755 "name": "cmd_id",756 "id": 1,757 "options": {758 "default": 11220759 }760 },761 {762 "rule": "required",763 "type": "int32",764 "name": "hero_uid",765 "id": 2766 }767 ]768 },769 {770 "name": "CS_HERO_DECOMPOSE",771 "fields": [772 {773 "rule": "optional",774 "type": "int32",775 "name": "cmd_id",776 "id": 1,777 "options": {778 "default": 11221779 }780 },781 {782 "rule": "repeated",783 "type": "int32",784 "name": "heros_uid",785 "id": 2786 }787 ]788 },789 {790 "name": "CS_HERO_REBORN",791 "fields": [792 {793 "rule": "optional",794 "type": "int32",795 "name": "cmd_id",796 "id": 1,797 "options": {798 "default": 11222799 }800 },801 {802 "rule": "repeated",803 "type": "int32",804 "name": "heros_uid",805 "id": 2806 }807 ]808 },809 {810 "name": "CS_HERO_COMBINE",811 "fields": [812 {813 "rule": "optional",814 "type": "int32",815 "name": "cmd_id",816 "id": 1,817 "options": {818 "default": 11223819 }820 },821 {822 "rule": "required",823 "type": "int32",824 "name": "hero_id",825 "id": 2826 }827 ]828 },829 {830 "name": "CS_HERO_UPGRADE",831 "fields": [832 {833 "rule": "optional",834 "type": "int32",835 "name": "cmd_id",836 "id": 1,837 "options": {838 "default": 11224839 }840 },841 {842 "rule": "required",843 "type": "int32",844 "name": "hero_uid",845 "id": 2846 },847 {848 "rule": "required",849 "type": "int32",850 "name": "qty",851 "id": 3852 },853 {854 "rule": "required",855 "type": "int32",856 "name": "item_id",857 "id": 4858 }859 ]860 },861 {862 "name": "CS_HERO_STAR_EMBED",863 "fields": [864 {865 "rule": "optional",866 "type": "int32",867 "name": "cmd_id",868 "id": 1,869 "options": {870 "default": 11225871 }872 },873 {874 "rule": "required",875 "type": "int32",876 "name": "hero_uid",877 "id": 2878 },879 {880 "rule": "required",881 "type": "int32",882 "name": "stone_index",883 "id": 3884 },885 {886 "rule": "required",887 "type": "int32",888 "name": "qty",889 "id": 4890 }891 ]892 },893 {894 "name": "CS_HERO_STAR",895 "fields": [896 {897 "rule": "optional",898 "type": "int32",899 "name": "cmd_id",900 "id": 1,901 "options": {902 "default": 11226903 }904 },905 {906 "rule": "required",907 "type": "int32",908 "name": "hero_uid",909 "id": 2910 }911 ]912 },913 {914 "name": "CS_HERO_SKILL_SELECT_GROUP",915 "fields": [916 {917 "rule": "optional",918 "type": "int32",919 "name": "cmd_id",920 "id": 1,921 "options": {922 "default": 11227923 }924 },925 {926 "rule": "required",927 "type": "int32",928 "name": "hero_uid",929 "id": 2930 },931 {932 "rule": "required",933 "type": "int32",934 "name": "group_id",935 "id": 3936 }937 ]938 },939 {940 "name": "CS_HERO_SKILL_UPGRADE",941 "fields": [942 {943 "rule": "optional",944 "type": "int32",945 "name": "cmd_id",946 "id": 1,947 "options": {948 "default": 11228949 }950 },951 {952 "rule": "required",953 "type": "int32",954 "name": "hero_uid",955 "id": 2956 },957 {958 "rule": "required",959 "type": "int32",960 "name": "group_id",961 "id": 3962 },963 {964 "rule": "required",965 "type": "int32",966 "name": "skill_index",967 "id": 4968 }969 ]970 },971 {972 "name": "CS_HERO_CHANGE_PROTRAIT",973 "fields": [974 {975 "rule": "optional",976 "type": "int32",977 "name": "cmd_id",978 "id": 1,979 "options": {980 "default": 11229981 }982 },983 {984 "rule": "required",985 "type": "int32",986 "name": "hero_uid",987 "id": 2988 },989 {990 "rule": "required",991 "type": "int32",992 "name": "protrait_id",993 "id": 3994 }995 ]996 },997 {998 "name": "CS_ITEM_USE",999 "fields": [1000 {1001 "rule": "optional",1002 "type": "int32",1003 "name": "cmd_id",1004 "id": 1,1005 "options": {1006 "default": 113001007 }1008 },1009 {1010 "rule": "required",1011 "type": "int32",1012 "name": "item_uid",1013 "id": 21014 },1015 {1016 "rule": "required",1017 "type": "int32",1018 "name": "qty",1019 "id": 31020 }1021 ]1022 },1023 {1024 "name": "CS_ITEM_SELL",1025 "fields": [1026 {1027 "rule": "optional",1028 "type": "int32",1029 "name": "cmd_id",1030 "id": 1,1031 "options": {1032 "default": 113011033 }1034 },1035 {1036 "rule": "required",1037 "type": "int32",1038 "name": "item_uid",1039 "id": 21040 },1041 {1042 "rule": "required",1043 "type": "int32",1044 "name": "qty",1045 "id": 31046 }1047 ]1048 },1049 {1050 "name": "CS_ITEM_COMBINE",1051 "fields": [1052 {1053 "rule": "optional",1054 "type": "int32",1055 "name": "cmd_id",1056 "id": 1,1057 "options": {1058 "default": 113021059 }1060 },1061 {1062 "rule": "required",1063 "type": "int32",1064 "name": "item_id",1065 "id": 21066 },1067 {1068 "rule": "required",1069 "type": "int32",1070 "name": "qty",1071 "id": 31072 }1073 ]1074 },1075 {1076 "name": "CS_ITEM_OPEN_SELECT_BOX",1077 "fields": [1078 {1079 "rule": "optional",1080 "type": "int32",1081 "name": "cmd_id",1082 "id": 1,1083 "options": {1084 "default": 113031085 }1086 },1087 {1088 "rule": "required",1089 "type": "int32",1090 "name": "item_uid",1091 "id": 21092 },1093 {1094 "rule": "required",1095 "type": "int32",1096 "name": "qty",1097 "id": 31098 },1099 {1100 "rule": "required",1101 "type": "int32",1102 "name": "select_type",1103 "id": 41104 },1105 {1106 "rule": "required",1107 "type": "int32",1108 "name": "select_id",1109 "id": 51110 }1111 ]1112 },1113 {1114 "name": "CS_BATTLE_SLOT_SET_HERO",1115 "fields": [1116 {1117 "rule": "optional",1118 "type": "int32",1119 "name": "cmd_id",1120 "id": 1,1121 "options": {1122 "default": 113301123 }1124 },1125 {1126 "rule": "required",1127 "type": "int32",1128 "name": "slot_idx",1129 "id": 21130 },1131 {1132 "rule": "required",1133 "type": "int32",1134 "name": "hero_uid",1135 "id": 31136 }1137 ]1138 },1139 {1140 "name": "CS_BATTLE_SLOT_SET_EQUIP",1141 "fields": [1142 {1143 "rule": "optional",1144 "type": "int32",1145 "name": "cmd_id",1146 "id": 1,1147 "options": {1148 "default": 113311149 }1150 },1151 {1152 "rule": "required",1153 "type": "int32",1154 "name": "slot_idx",1155 "id": 21156 },1157 {1158 "rule": "required",1159 "type": "int32",1160 "name": "pos",1161 "id": 31162 },1163 {1164 "rule": "required",1165 "type": "int32",1166 "name": "equip_uid",1167 "id": 41168 }1169 ]1170 },1171 {1172 "name": "CS_BATTLE_SLOT_SET_TALISMAN",1173 "fields": [1174 {1175 "rule": "optional",1176 "type": "int32",1177 "name": "cmd_id",1178 "id": 1,1179 "options": {1180 "default": 113321181 }1182 },1183 {1184 "rule": "required",1185 "type": "int32",1186 "name": "pos",1187 "id": 31188 },1189 {1190 "rule": "required",1191 "type": "int32",1192 "name": "Talisman_id",1193 "id": 41194 }1195 ]1196 },1197 {1198 "name": "CS_BATTLE_SLOT_SET_HALLOW",1199 "fields": [1200 {1201 "rule": "optional",1202 "type": "int32",1203 "name": "cmd_id",1204 "id": 1,1205 "options": {1206 "default": 113331207 }1208 },1209 {1210 "rule": "required",1211 "type": "int32",1212 "name": "slot_idx",1213 "id": 21214 },1215 {1216 "rule": "required",1217 "type": "int32",1218 "name": "hallow_uid",1219 "id": 31220 }1221 ]1222 },1223 {1224 "name": "CS_BATTLE_SLOT_SET_GEM_UP",1225 "fields": [1226 {1227 "rule": "optional",1228 "type": "int32",1229 "name": "cmd_id",1230 "id": 1,1231 "options": {1232 "default": 113341233 }1234 },1235 {1236 "rule": "required",1237 "type": "int32",1238 "name": "slot_idx",1239 "id": 21240 },1241 {1242 "rule": "required",1243 "type": "int32",1244 "name": "pos",1245 "id": 31246 },1247 {1248 "rule": "required",1249 "type": "int32",1250 "name": "gem_id",1251 "id": 41252 }1253 ]1254 },1255 {1256 "name": "CS_BATTLE_SLOT_SET_GEM_OFF",1257 "fields": [1258 {1259 "rule": "optional",1260 "type": "int32",1261 "name": "cmd_id",1262 "id": 1,1263 "options": {1264 "default": 113351265 }1266 },1267 {1268 "rule": "required",1269 "type": "int32",1270 "name": "slot_idx",1271 "id": 21272 },1273 {1274 "rule": "required",1275 "type": "int32",1276 "name": "pos",1277 "id": 31278 },1279 {1280 "rule": "required",1281 "type": "int32",1282 "name": "gem_idx",1283 "id": 41284 }1285 ]1286 },1287 {1288 "name": "CS_BATTLE_SLOT_SWAP_HERO",1289 "fields": [1290 {1291 "rule": "optional",1292 "type": "int32",1293 "name": "cmd_id",1294 "id": 1,1295 "options": {1296 "default": 113361297 }1298 },1299 {1300 "rule": "required",1301 "type": "int32",1302 "name": "slot_idx1",1303 "id": 21304 },1305 {1306 "rule": "required",1307 "type": "int32",1308 "name": "slot_idx2",1309 "id": 31310 }1311 ]1312 },1313 {1314 "name": "CS_BATTLE_SET_YUANJUN",1315 "fields": [1316 {1317 "rule": "optional",1318 "type": "int32",1319 "name": "cmd_id",1320 "id": 1,1321 "options": {1322 "default": 113371323 }1324 },1325 {1326 "rule": "required",1327 "type": "int32",1328 "name": "yuanjun_idx",1329 "id": 21330 },1331 {1332 "rule": "required",1333 "type": "int32",1334 "name": "hero_uid",1335 "id": 31336 }1337 ]1338 },1339 {1340 "name": "CS_BATTLE_SET_WING",1341 "fields": [1342 {1343 "rule": "optional",1344 "type": "int32",1345 "name": "cmd_id",1346 "id": 1,1347 "options": {1348 "default": 113381349 }1350 },1351 {1352 "rule": "required",1353 "type": "int32",1354 "name": "wing_id",1355 "id": 21356 }1357 ]1358 },1359 {1360 "name": "CS_BATTLE_SET_FASHION",1361 "fields": [1362 {1363 "rule": "optional",1364 "type": "int32",1365 "name": "cmd_id",1366 "id": 1,1367 "options": {1368 "default": 113391369 }1370 },1371 {1372 "rule": "required",1373 "type": "int32",1374 "name": "pos",1375 "id": 21376 },1377 {1378 "rule": "required",1379 "type": "int32",1380 "name": "id",1381 "id": 31382 }1383 ]1384 },1385 {1386 "name": "CS_BATTLE_SET_TITLE",1387 "fields": [1388 {1389 "rule": "optional",1390 "type": "int32",1391 "name": "cmd_id",1392 "id": 1,1393 "options": {1394 "default": 113401395 }1396 },1397 {1398 "rule": "required",1399 "type": "int32",1400 "name": "id",1401 "id": 21402 }1403 ]1404 },1405 {1406 "name": "STRUCT_COST_ITEM",1407 "fields": [1408 {1409 "rule": "required",1410 "type": "int32",1411 "name": "item_uid",1412 "id": 11413 },1414 {1415 "rule": "required",1416 "type": "int32",1417 "name": "number",1418 "id": 21419 }1420 ]1421 },1422 {1423 "name": "CS_TALISMAN_UPGRADE",1424 "fields": [1425 {1426 "rule": "optional",1427 "type": "int32",1428 "name": "cmd_id",1429 "id": 1,1430 "options": {1431 "default": 114001432 }1433 },1434 {1435 "rule": "required",1436 "type": "int32",1437 "name": "hero_uid",1438 "id": 21439 }1440 ]1441 },1442 {1443 "name": "CS_TALISMAN_ADV",1444 "fields": [1445 {1446 "rule": "optional",1447 "type": "int32",1448 "name": "cmd_id",1449 "id": 1,1450 "options": {1451 "default": 114011452 }1453 },1454 {1455 "rule": "required",1456 "type": "int32",1457 "name": "hero_uid",1458 "id": 21459 }1460 ]1461 },1462 {1463 "name": "CS_TALISMAN_STAR_UP",1464 "fields": [1465 {1466 "rule": "optional",1467 "type": "int32",1468 "name": "cmd_id",1469 "id": 1,1470 "options": {1471 "default": 114021472 }1473 },1474 {1475 "rule": "required",1476 "type": "int32",1477 "name": "hero_uid",1478 "id": 21479 }1480 ]1481 },1482 {1483 "name": "CS_TALISMAN_COAT_UP",1484 "fields": [1485 {1486 "rule": "optional",1487 "type": "int32",1488 "name": "cmd_id",1489 "id": 1,1490 "options": {1491 "default": 114041492 }1493 },1494 {1495 "rule": "required",1496 "type": "int32",1497 "name": "hero_uid",1498 "id": 21499 },1500 {1501 "rule": "required",1502 "type": "int32",1503 "name": "coat_id",1504 "id": 31505 },1506 {1507 "rule": "required",1508 "type": "int32",1509 "name": "item_id",1510 "id": 41511 },1512 {1513 "rule": "required",1514 "type": "int32",1515 "name": "item_qty",1516 "id": 51517 }1518 ]1519 },1520 {1521 "name": "CS_TALISMAN_COAT_ONE_KEY_UP",1522 "fields": [1523 {1524 "rule": "optional",1525 "type": "int32",1526 "name": "cmd_id",1527 "id": 1,1528 "options": {1529 "default": 114051530 }1531 },1532 {1533 "rule": "required",1534 "type": "int32",1535 "name": "hero_uid",1536 "id": 21537 },1538 {1539 "rule": "required",1540 "type": "int32",1541 "name": "coat_id",1542 "id": 31543 }1544 ]1545 },1546 {1547 "name": "CS_TALISMAN_COAT_STAR_UP",1548 "fields": [1549 {1550 "rule": "optional",1551 "type": "int32",1552 "name": "cmd_id",1553 "id": 1,1554 "options": {1555 "default": 114061556 }1557 },1558 {1559 "rule": "required",1560 "type": "int32",1561 "name": "hero_uid",1562 "id": 21563 },1564 {1565 "rule": "required",1566 "type": "int32",1567 "name": "coat_id",1568 "id": 31569 }1570 ]1571 },1572 {1573 "name": "CS_STAGE_VERIFY",1574 "fields": [1575 {1576 "rule": "optional",1577 "type": "int32",1578 "name": "cmd_id",1579 "id": 1,1580 "options": {1581 "default": 115001582 }1583 },1584 {1585 "rule": "required",1586 "type": "int32",1587 "name": "token",1588 "id": 21589 },1590 {1591 "rule": "required",1592 "type": "STRUCT_BATTLE_STAGE_INFO",1593 "name": "info",1594 "id": 31595 }1596 ]1597 },1598 {1599 "name": "CS_STAGE_GOLD_BEFORE",1600 "fields": [1601 {1602 "rule": "optional",1603 "type": "int32",1604 "name": "cmd_id",1605 "id": 1,1606 "options": {1607 "default": 115011608 }1609 },1610 {1611 "rule": "required",1612 "type": "int32",1613 "name": "stage_id",1614 "id": 21615 }1616 ]1617 },1618 {1619 "name": "CS_STAGE_FAIL",1620 "fields": [1621 {1622 "rule": "optional",1623 "type": "int32",1624 "name": "cmd_id",1625 "id": 1,1626 "options": {1627 "default": 115021628 }1629 },1630 {1631 "rule": "required",1632 "type": "int32",1633 "name": "stage_id",1634 "id": 21635 }1636 ]1637 },1638 {1639 "name": "CS_STAGE_REFRESH",1640 "fields": [1641 {1642 "rule": "optional",1643 "type": "int32",1644 "name": "cmd_id",1645 "id": 1,1646 "options": {1647 "default": 115031648 }1649 }1650 ]1651 },1652 {1653 "name": "CS_STAGE_START",1654 "fields": [1655 {1656 "rule": "optional",1657 "type": "int32",1658 "name": "cmd_id",1659 "id": 1,1660 "options": {1661 "default": 115041662 }1663 },1664 {1665 "rule": "required",1666 "type": "int32",1667 "name": "stage_id",1668 "id": 21669 }1670 ]1671 },1672 {1673 "name": "CS_STAGE_QUICK_COMPLETE",1674 "fields": [1675 {1676 "rule": "optional",1677 "type": "int32",1678 "name": "cmd_id",1679 "id": 1,1680 "options": {1681 "default": 115051682 }1683 },1684 {1685 "rule": "required",1686 "type": "int32",1687 "name": "stage_id",1688 "id": 21689 }1690 ]1691 },1692 {1693 "name": "CS_STAGE_OPEN_CHEST",1694 "fields": [1695 {1696 "rule": "optional",1697 "type": "int32",1698 "name": "cmd_id",1699 "id": 1,1700 "options": {1701 "default": 115061702 }1703 },1704 {1705 "rule": "required",1706 "type": "int32",1707 "name": "map_id",1708 "id": 21709 },1710 {1711 "rule": "required",1712 "type": "int32",1713 "name": "index",1714 "id": 31715 }1716 ]1717 },1718 {1719 "name": "CS_STAGE_REFILL",1720 "fields": [1721 {1722 "rule": "optional",1723 "type": "int32",1724 "name": "cmd_id",1725 "id": 1,1726 "options": {1727 "default": 115071728 }1729 },1730 {1731 "rule": "required",1732 "type": "int32",1733 "name": "stage_id",1734 "id": 21735 }1736 ]1737 },1738 {1739 "name": "CS_DAILY_STAGE_VERIFY",1740 "fields": [1741 {1742 "rule": "optional",1743 "type": "int32",1744 "name": "cmd_id",1745 "id": 1,1746 "options": {1747 "default": 115081748 }1749 },1750 {1751 "rule": "required",1752 "type": "int32",1753 "name": "stage_id",1754 "id": 21755 },1756 {1757 "rule": "required",1758 "type": "int32",1759 "name": "token",1760 "id": 31761 },1762 {1763 "rule": "required",1764 "type": "STRUCT_BATTLE_STAGE_INFO",1765 "name": "info",1766 "id": 41767 }1768 ]1769 },1770 {1771 "name": "CS_DAILY_STAGE_IS_AVALIABLE",1772 "fields": [1773 {1774 "rule": "optional",1775 "type": "int32",1776 "name": "cmd_id",1777 "id": 1,1778 "options": {1779 "default": 115091780 }1781 },1782 {1783 "rule": "required",1784 "type": "int32",1785 "name": "stage_id",1786 "id": 21787 }1788 ]1789 },1790 {1791 "name": "CS_DAILY_STAGE_QUICK_COMPLETE",1792 "fields": [1793 {1794 "rule": "optional",1795 "type": "int32",1796 "name": "cmd_id",1797 "id": 1,1798 "options": {1799 "default": 115101800 }1801 },1802 {1803 "rule": "required",1804 "type": "int32",1805 "name": "stage_id",1806 "id": 21807 }1808 ]1809 },1810 {1811 "name": "CS_DAILY_STAGE_REFRESH",1812 "fields": [1813 {1814 "rule": "optional",1815 "type": "int32",1816 "name": "cmd_id",1817 "id": 1,1818 "options": {1819 "default": 115111820 }1821 }1822 ]1823 },1824 {1825 "name": "CS_DAILY_STAGE_START",1826 "fields": [1827 {1828 "rule": "optional",1829 "type": "int32",1830 "name": "cmd_id",1831 "id": 1,1832 "options": {1833 "default": 115121834 }1835 },1836 {1837 "rule": "required",1838 "type": "int32",1839 "name": "stage_id",1840 "id": 21841 }1842 ]1843 },1844 {1845 "name": "CS_GEM_SELL",1846 "fields": [1847 {1848 "rule": "optional",1849 "type": "int32",1850 "name": "cmd_id",1851 "id": 1,1852 "options": {1853 "default": 116011854 }1855 },1856 {1857 "rule": "required",1858 "type": "int32",1859 "name": "gem_uid",1860 "id": 21861 },1862 {1863 "rule": "required",1864 "type": "int32",1865 "name": "qty",1866 "id": 31867 }1868 ]1869 },1870 {1871 "name": "CS_GEM_COMBINE",1872 "fields": [1873 {1874 "rule": "optional",1875 "type": "int32",1876 "name": "cmd_id",1877 "id": 1,1878 "options": {1879 "default": 116021880 }1881 },1882 {1883 "rule": "required",1884 "type": "int32",1885 "name": "gem_id",1886 "id": 21887 },1888 {1889 "rule": "required",1890 "type": "int32",1891 "name": "qty",1892 "id": 31893 }1894 ]1895 },1896 {1897 "name": "CS_GEM_UPGRADE",1898 "fields": [1899 {1900 "rule": "optional",1901 "type": "int32",1902 "name": "cmd_id",1903 "id": 1,1904 "options": {1905 "default": 116031906 }1907 },1908 {1909 "rule": "required",1910 "type": "int32",1911 "name": "slot_idx",1912 "id": 21913 },1914 {1915 "rule": "required",1916 "type": "int32",1917 "name": "pos",1918 "id": 31919 },1920 {1921 "rule": "required",1922 "type": "int32",1923 "name": "gem_idx",1924 "id": 41925 }1926 ]1927 },1928 {1929 "name": "CS_EQUIP_FORGE",1930 "fields": [1931 {1932 "rule": "optional",1933 "type": "int32",1934 "name": "cmd_id",1935 "id": 1,1936 "options": {1937 "default": 117001938 }1939 },1940 {1941 "rule": "required",1942 "type": "int32",1943 "name": "equip_id",1944 "id": 21945 }1946 ]1947 },1948 {1949 "name": "CS_EQUIP_MOVE_STR",1950 "fields": [1951 {1952 "rule": "optional",1953 "type": "int32",1954 "name": "cmd_id",1955 "id": 1,1956 "options": {1957 "default": 117011958 }1959 },1960 {1961 "rule": "required",1962 "type": "int32",1963 "name": "source_equip_uid",1964 "id": 21965 },1966 {1967 "rule": "required",1968 "type": "int32",1969 "name": "target_equip_uid",1970 "id": 31971 },1972 {1973 "rule": "required",1974 "type": "bool",1975 "name": "is_perfect",1976 "id": 41977 }1978 ]1979 },1980 {1981 "name": "CS_EQUIP_UPGRADE",1982 "fields": [1983 {1984 "rule": "optional",1985 "type": "int32",1986 "name": "cmd_id",1987 "id": 1,1988 "options": {1989 "default": 117021990 }1991 },1992 {1993 "rule": "required",1994 "type": "int32",1995 "name": "equip_uid",1996 "id": 21997 },1998 {1999 "rule": "required",2000 "type": "int32",2001 "name": "time",2002 "id": 32003 }2004 ]2005 },2006 {2007 "name": "CS_EQUIP_ADV",2008 "fields": [2009 {2010 "rule": "optional",2011 "type": "int32",2012 "name": "cmd_id",2013 "id": 1,2014 "options": {2015 "default": 117032016 }2017 },2018 {2019 "rule": "required",2020 "type": "int32",2021 "name": "equip_uid",2022 "id": 22023 }2024 ]2025 },2026 {2027 "name": "CS_EQUIP_DECOMPOSE",2028 "fields": [2029 {2030 "rule": "optional",2031 "type": "int32",2032 "name": "cmd_id",2033 "id": 1,2034 "options": {2035 "default": 117042036 }2037 },2038 {2039 "rule": "repeated",2040 "type": "int32",2041 "name": "equips_uid",2042 "id": 22043 }2044 ]2045 },2046 {2047 "name": "CS_EQUIP_REBORN",2048 "fields": [2049 {2050 "rule": "optional",2051 "type": "int32",2052 "name": "cmd_id",2053 "id": 1,2054 "options": {2055 "default": 117052056 }2057 },2058 {2059 "rule": "repeated",2060 "type": "int32",2061 "name": "equips_uid",2062 "id": 22063 }2064 ]2065 },2066 {2067 "name": "CS_EQUIP_STAR_UP",2068 "fields": [2069 {2070 "rule": "optional",2071 "type": "int32",2072 "name": "cmd_id",2073 "id": 1,2074 "options": {2075 "default": 117062076 }2077 },2078 {2079 "rule": "required",2080 "type": "int32",2081 "name": "equip_uid",2082 "id": 22083 },2084 {2085 "rule": "required",2086 "type": "bool",2087 "name": "bIsProtect",2088 "id": 32089 }2090 ]2091 },2092 {2093 "name": "CS_EQUIP_COMBINE",2094 "fields": [2095 {2096 "rule": "optional",2097 "type": "int32",2098 "name": "cmd_id",2099 "id": 1,2100 "options": {2101 "default": 117072102 }2103 },2104 {2105 "rule": "required",2106 "type": "int32",2107 "name": "equip_id",2108 "id": 22109 }2110 ]2111 },2112 {2113 "name": "CS_EQUIP_ONEKEY_UPGRADE",2114 "fields": [2115 {2116 "rule": "optional",2117 "type": "int32",2118 "name": "cmd_id",2119 "id": 1,2120 "options": {2121 "default": 117082122 }2123 },2124 {2125 "rule": "required",2126 "type": "int32",2127 "name": "slot_idx",2128 "id": 22129 }2130 ]2131 },2132 {2133 "name": "CS_HALLOW_UPGRADE",2134 "fields": [2135 {2136 "rule": "optional",2137 "type": "int32",2138 "name": "cmd_id",2139 "id": 1,2140 "options": {2141 "default": 117202142 }2143 },2144 {2145 "rule": "required",2146 "type": "int32",2147 "name": "hallow_target_uid",2148 "id": 22149 },2150 {2151 "rule": "repeated",2152 "type": "int32",2153 "name": "hallow_exp_uids",2154 "id": 32155 },2156 {2157 "rule": "repeated",2158 "type": "STRUCT_EXP_HALLOW",2159 "name": "exp_hallows",2160 "id": 42161 }2162 ],2163 "messages": [2164 {2165 "name": "STRUCT_EXP_HALLOW",2166 "fields": [2167 {2168 "rule": "required",2169 "type": "int32",2170 "name": "exp_hallow_id",2171 "id": 22172 },2173 {2174 "rule": "required",2175 "type": "int32",2176 "name": "qty",2177 "id": 32178 }2179 ]2180 }2181 ]2182 },2183 {2184 "name": "CS_HALLOW_ADV",2185 "fields": [2186 {2187 "rule": "optional",2188 "type": "int32",2189 "name": "cmd_id",2190 "id": 1,2191 "options": {2192 "default": 117212193 }2194 },2195 {2196 "rule": "required",2197 "type": "int32",2198 "name": "hallow_uid",2199 "id": 22200 }2201 ]2202 },2203 {2204 "name": "CS_HALLOW_ENCHANT",2205 "fields": [2206 {2207 "rule": "optional",2208 "type": "int32",2209 "name": "cmd_id",2210 "id": 1,2211 "options": {2212 "default": 117222213 }2214 },2215 {2216 "rule": "required",2217 "type": "int32",2218 "name": "hallow_uid",2219 "id": 22220 },2221 {2222 "rule": "repeated",2223 "type": "int32",2224 "name": "lock_props",2225 "id": 32226 }2227 ]2228 },2229 {2230 "name": "CS_HALLOW_ENCHANT_RESPONSE",2231 "fields": [2232 {2233 "rule": "optional",2234 "type": "int32",2235 "name": "cmd_id",2236 "id": 1,2237 "options": {2238 "default": 117232239 }2240 },2241 {2242 "rule": "required",2243 "type": "int32",2244 "name": "hallow_uid",2245 "id": 22246 },2247 {2248 "rule": "required",2249 "type": "bool",2250 "name": "is_accept",2251 "id": 32252 }2253 ]2254 },2255 {2256 "name": "CS_HALLOW_REBORN",2257 "fields": [2258 {2259 "rule": "optional",2260 "type": "int32",2261 "name": "cmd_id",2262 "id": 1,2263 "options": {2264 "default": 117242265 }2266 },2267 {2268 "rule": "required",2269 "type": "int32",2270 "name": "hallow_uid",2271 "id": 22272 }2273 ]2274 },2275 {2276 "name": "CS_HALLOW_DEC",2277 "fields": [2278 {2279 "rule": "optional",2280 "type": "int32",2281 "name": "cmd_id",2282 "id": 1,2283 "options": {2284 "default": 117252285 }2286 },2287 {2288 "rule": "required",2289 "type": "int32",2290 "name": "hallow_uid",2291 "id": 22292 }2293 ]2294 },2295 {2296 "name": "CS_HALLOW_TRANSFER_ENCHANT",2297 "fields": [2298 {2299 "rule": "optional",2300 "type": "int32",2301 "name": "cmd_id",2302 "id": 1,2303 "options": {2304 "default": 117262305 }2306 },2307 {2308 "rule": "required",2309 "type": "int32",2310 "name": "from_uid",2311 "id": 22312 },2313 {2314 "rule": "required",2315 "type": "int32",2316 "name": "target_uid",2317 "id": 32318 }2319 ]2320 },2321 {2322 "name": "CS_HALLOW_COMBINE",2323 "fields": [2324 {2325 "rule": "optional",2326 "type": "int32",2327 "name": "cmd_id",2328 "id": 1,2329 "options": {2330 "default": 117272331 }2332 },2333 {2334 "rule": "required",2335 "type": "int32",2336 "name": "hallow_id",2337 "id": 22338 }2339 ]2340 },2341 {2342 "name": "CS_OPERATION_DAILY_SIGN",2343 "fields": [2344 {2345 "rule": "optional",2346 "type": "int32",2347 "name": "cmd_id",2348 "id": 1,2349 "options": {2350 "default": 118002351 }2352 },2353 {2354 "rule": "required",2355 "type": "bool",2356 "name": "is_use_diamond",2357 "id": 22358 }2359 ]2360 },2361 {2362 "name": "CS_OPERATION_DAILY_SIGN_TOTAL",2363 "fields": [2364 {2365 "rule": "optional",2366 "type": "int32",2367 "name": "cmd_id",2368 "id": 1,2369 "options": {2370 "default": 118012371 }2372 },2373 {2374 "rule": "required",2375 "type": "int32",2376 "name": "index",2377 "id": 22378 }2379 ]2380 },2381 {2382 "name": "CS_OPERATION_REFRESH_ALL",2383 "fields": [2384 {2385 "rule": "optional",2386 "type": "int32",2387 "name": "cmd_id",2388 "id": 1,2389 "options": {2390 "default": 118022391 }2392 }2393 ]2394 },2395 {2396 "name": "CS_OPERATION_DIANJIN",2397 "fields": [2398 {2399 "rule": "optional",2400 "type": "int32",2401 "name": "cmd_id",2402 "id": 1,2403 "options": {2404 "default": 118032405 }2406 },2407 {2408 "rule": "optional",2409 "type": "bool",2410 "name": "is_batch",2411 "id": 2,2412 "options": {2413 "default": false2414 }2415 }2416 ]2417 },2418 {2419 "name": "CS_OPERATION_REFRESH_SIGN",2420 "fields": [2421 {2422 "rule": "optional",2423 "type": "int32",2424 "name": "cmd_id",2425 "id": 1,2426 "options": {2427 "default": 118302428 }2429 }2430 ]2431 },2432 {2433 "name": "CS_OPERATION_REFRESH_DIANJIN",2434 "fields": [2435 {2436 "rule": "optional",2437 "type": "int32",2438 "name": "cmd_id",2439 "id": 1,2440 "options": {2441 "default": 118312442 }2443 }2444 ]2445 },2446 {2447 "name": "CS_MAIL_GET_REWARD",2448 "fields": [2449 {2450 "rule": "optional",2451 "type": "int32",2452 "name": "cmd_id",2453 "id": 1,2454 "options": {2455 "default": 119002456 }2457 },2458 {2459 "rule": "required",2460 "type": "int64",2461 "name": "mail_id",2462 "id": 22463 }2464 ]2465 },2466 {2467 "name": "CS_MAIL_REMOVE",2468 "fields": [2469 {2470 "rule": "optional",2471 "type": "int32",2472 "name": "cmd_id",2473 "id": 1,2474 "options": {2475 "default": 119012476 }2477 },2478 {2479 "rule": "required",2480 "type": "int64",2481 "name": "mail_id",2482 "id": 22483 }2484 ]2485 },2486 {2487 "name": "CS_QUEST_GET_REWARD",2488 "fields": [2489 {2490 "rule": "optional",2491 "type": "int32",2492 "name": "cmd_id",2493 "id": 1,2494 "options": {2495 "default": 120002496 }2497 },2498 {2499 "rule": "required",2500 "type": "int32",2501 "name": "config_id",2502 "id": 22503 },2504 {2505 "rule": "required",2506 "type": "int32",2507 "name": "quest_id",2508 "id": 32509 }2510 ]2511 },2512 {2513 "name": "CS_QUEST_REFRESH",2514 "fields": [2515 {2516 "rule": "optional",2517 "type": "int32",2518 "name": "cmd_id",2519 "id": 1,2520 "options": {2521 "default": 120012522 }2523 },2524 {2525 "rule": "required",2526 "type": "int32",2527 "name": "config_id",2528 "id": 22529 },2530 {2531 "rule": "optional",2532 "type": "int32",2533 "name": "quest_type",2534 "id": 3,2535 "options": {2536 "default": 02537 }2538 }2539 ]2540 },2541 {2542 "name": "CS_NIUDAN_DRAW",2543 "fields": [2544 {2545 "rule": "optional",2546 "type": "int32",2547 "name": "cmd_id",2548 "id": 1,2549 "options": {2550 "default": 121002551 }2552 },2553 {2554 "rule": "required",2555 "type": "int32",2556 "name": "toy_id",2557 "id": 22558 },2559 {2560 "rule": "required",2561 "type": "int32",2562 "name": "times",2563 "id": 32564 }2565 ]2566 },2567 {2568 "name": "CS_NIUDAN_REFRESH",2569 "fields": [2570 {2571 "rule": "optional",2572 "type": "int32",2573 "name": "cmd_id",2574 "id": 1,2575 "options": {2576 "default": 121012577 }2578 }2579 ]2580 },2581 {2582 "name": "CS_SHOP_REFRESH",2583 "fields": [2584 {2585 "rule": "optional",2586 "type": "int32",2587 "name": "cmd_id",2588 "id": 1,2589 "options": {2590 "default": 122002591 }2592 },2593 {2594 "rule": "required",2595 "type": "int32",2596 "name": "shop_id",2597 "id": 22598 }2599 ]2600 },2601 {2602 "name": "CS_SHOP_PLAYER_REFRESH",2603 "fields": [2604 {2605 "rule": "optional",2606 "type": "int32",2607 "name": "cmd_id",2608 "id": 1,2609 "options": {2610 "default": 122012611 }2612 },2613 {2614 "rule": "required",2615 "type": "int32",2616 "name": "shop_id",2617 "id": 22618 }2619 ]2620 },2621 {2622 "name": "CS_SHOP_BUY_ITEM",2623 "fields": [2624 {2625 "rule": "optional",2626 "type": "int32",2627 "name": "cmd_id",2628 "id": 1,2629 "options": {2630 "default": 122022631 }2632 },2633 {2634 "rule": "required",2635 "type": "int32",2636 "name": "shop_id",2637 "id": 22638 },2639 {2640 "rule": "required",2641 "type": "int32",2642 "name": "position",2643 "id": 32644 },2645 {2646 "rule": "required",2647 "type": "int32",2648 "name": "qty",2649 "id": 42650 }2651 ]2652 },2653 {2654 "name": "CS_COMMON_SHOP_REFRESH",2655 "fields": [2656 {2657 "rule": "optional",2658 "type": "int32",2659 "name": "cmd_id",2660 "id": 1,2661 "options": {2662 "default": 122032663 }2664 }2665 ]2666 },2667 {2668 "name": "CS_COMMON_SHOP_BUY_ITEM",2669 "fields": [2670 {2671 "rule": "optional",2672 "type": "int32",2673 "name": "cmd_id",2674 "id": 1,2675 "options": {2676 "default": 122042677 }2678 },2679 {2680 "rule": "required",2681 "type": "int32",2682 "name": "id",2683 "id": 22684 },2685 {2686 "rule": "required",2687 "type": "int32",2688 "name": "qty",2689 "id": 32690 }2691 ]2692 },2693 {2694 "name": "CS_VIP_SHOP_GM_PAY",2695 "fields": [2696 {2697 "rule": "optional",2698 "type": "int32",2699 "name": "cmd_id",2700 "id": 1,2701 "options": {2702 "default": 122052703 }2704 },2705 {2706 "rule": "required",2707 "type": "int32",2708 "name": "id",2709 "id": 22710 },2711 {2712 "rule": "required",2713 "type": "int32",2714 "name": "version",2715 "id": 32716 }2717 ]2718 },2719 {2720 "name": "CS_VIP_SHOP_IS_AVALIABLE",2721 "fields": [2722 {2723 "rule": "optional",2724 "type": "int32",2725 "name": "cmd_id",2726 "id": 1,2727 "options": {2728 "default": 122062729 }2730 },2731 {2732 "rule": "required",2733 "type": "int32",2734 "name": "id",2735 "id": 22736 },2737 {2738 "rule": "required",2739 "type": "int32",2740 "name": "version",2741 "id": 32742 }2743 ]2744 },2745 {2746 "name": "CS_VIP_SHOP_REFRESH",2747 "fields": [2748 {2749 "rule": "optional",2750 "type": "int32",2751 "name": "cmd_id",2752 "id": 1,2753 "options": {2754 "default": 122072755 }2756 }2757 ]2758 },2759 {2760 "name": "CS_VIP_GET_DAILY_CARD_AWARD",2761 "fields": [2762 {2763 "rule": "optional",2764 "type": "int32",2765 "name": "cmd_id",2766 "id": 1,2767 "options": {2768 "default": 122082769 }2770 },2771 {2772 "rule": "required",2773 "type": "int32",2774 "name": "card_id",2775 "id": 22776 }2777 ]2778 },2779 {2780 "name": "CS_VIP_GET_GIFT",2781 "fields": [2782 {2783 "rule": "optional",2784 "type": "int32",2785 "name": "cmd_id",2786 "id": 1,2787 "options": {2788 "default": 122092789 }2790 },2791 {2792 "rule": "required",2793 "type": "int32",2794 "name": "vip_lv",2795 "id": 22796 }2797 ]2798 },2799 {2800 "name": "CS_TRAVEL_REFRESH",2801 "fields": [2802 {2803 "rule": "optional",2804 "type": "int32",2805 "name": "cmd_id",2806 "id": 1,2807 "options": {2808 "default": 123002809 }2810 }2811 ]2812 },2813 {2814 "name": "CS_TRAVEL_TRY",2815 "fields": [2816 {2817 "rule": "optional",2818 "type": "int32",2819 "name": "cmd_id",2820 "id": 1,2821 "options": {2822 "default": 123012823 }2824 },2825 {2826 "rule": "required",2827 "type": "int32",2828 "name": "stage_id",2829 "id": 22830 }2831 ]2832 },2833 {2834 "name": "CS_TRAVEL_OPEN_CHEST",2835 "fields": [2836 {2837 "rule": "optional",2838 "type": "int32",2839 "name": "cmd_id",2840 "id": 1,2841 "options": {2842 "default": 123022843 }2844 },2845 {2846 "rule": "required",2847 "type": "int32",2848 "name": "map_id",2849 "id": 22850 },2851 {2852 "rule": "required",2853 "type": "int32",2854 "name": "chest_index",2855 "id": 32856 }2857 ]2858 },2859 {2860 "name": "CS_TRAVEL_EVENT_RESPONSE",2861 "fields": [2862 {2863 "rule": "optional",2864 "type": "int32",2865 "name": "cmd_id",2866 "id": 1,2867 "options": {2868 "default": 133032869 }2870 },2871 {2872 "rule": "required",2873 "type": "int32",2874 "name": "stage_id",2875 "id": 22876 },2877 {2878 "rule": "repeated",2879 "type": "int32",2880 "name": "choice",2881 "id": 32882 }2883 ]2884 },2885 {2886 "name": "CS_TRAVEL_CHALLENGE_BOSS",2887 "fields": [2888 {2889 "rule": "optional",2890 "type": "int32",2891 "name": "cmd_id",2892 "id": 1,2893 "options": {2894 "default": 133042895 }2896 },2897 {2898 "rule": "required",2899 "type": "int32",2900 "name": "stage_id",2901 "id": 22902 }2903 ]2904 },2905 {2906 "name": "CS_TRAVEL_RANDOM_BOSS",2907 "fields": [2908 {2909 "rule": "optional",2910 "type": "int32",2911 "name": "cmd_id",2912 "id": 1,2913 "options": {2914 "default": 133052915 }2916 },2917 {2918 "rule": "required",2919 "type": "int32",2920 "name": "boss_uid",2921 "id": 22922 }2923 ]2924 },2925 {2926 "name": "CS_TRAVEL_RESET_RANDOM_BOSS",2927 "fields": [2928 {2929 "rule": "optional",2930 "type": "int32",2931 "name": "cmd_id",2932 "id": 1,2933 "options": {2934 "default": 133062935 }2936 },2937 {2938 "rule": "required",2939 "type": "bool",2940 "name": "is_diamond",2941 "id": 22942 }2943 ]2944 },2945 {2946 "name": "CS_TRAVEL_CHALLENGE_BOSS_START",2947 "fields": [2948 {2949 "rule": "optional",2950 "type": "int32",2951 "name": "cmd_id",2952 "id": 1,2953 "options": {2954 "default": 133072955 }2956 },2957 {2958 "rule": "required",2959 "type": "int32",2960 "name": "stage_id",2961 "id": 22962 }2963 ]2964 },2965 {2966 "name": "CS_TRAVEL_CHALLENGE_BOSS_VERIFY",2967 "fields": [2968 {2969 "rule": "optional",2970 "type": "int32",2971 "name": "cmd_id",2972 "id": 1,2973 "options": {2974 "default": 133082975 }2976 },2977 {2978 "rule": "required",2979 "type": "int32",2980 "name": "token",2981 "id": 22982 },2983 {2984 "rule": "required",2985 "type": "STRUCT_BATTLE_STAGE_INFO",2986 "name": "info",2987 "id": 32988 }2989 ]2990 },2991 {2992 "name": "CS_TRAVEL_RANDOM_BOSS_START",2993 "fields": [2994 {2995 "rule": "optional",2996 "type": "int32",2997 "name": "cmd_id",2998 "id": 1,2999 "options": {3000 "default": 133093001 }3002 },3003 {3004 "rule": "required",3005 "type": "int32",3006 "name": "boss_uid",3007 "id": 23008 }3009 ]3010 },3011 {3012 "name": "CS_TRAVEL_RANDOM_BOSS_VERIFY",3013 "fields": [3014 {3015 "rule": "optional",3016 "type": "int32",3017 "name": "cmd_id",3018 "id": 1,3019 "options": {3020 "default": 133103021 }3022 },3023 {3024 "rule": "required",3025 "type": "int32",3026 "name": "token",3027 "id": 23028 },3029 {3030 "rule": "required",3031 "type": "STRUCT_BATTLE_STAGE_INFO",3032 "name": "info",3033 "id": 33034 }3035 ]3036 },3037 {3038 "name": "CS_AUTO_TRAVEL_AREA_START",3039 "fields": [3040 {3041 "rule": "optional",3042 "type": "int32",3043 "name": "cmd_id",3044 "id": 1,3045 "options": {3046 "default": 133113047 }3048 },3049 {3050 "rule": "required",3051 "type": "int32",3052 "name": "auto_travel_area_id",3053 "id": 23054 },3055 {3056 "rule": "required",3057 "type": "int32",3058 "name": "hours",3059 "id": 33060 }3061 ]3062 },3063 {3064 "name": "CS_AUTO_TRAVEL_REFRESH",3065 "fields": [3066 {3067 "rule": "optional",3068 "type": "int32",3069 "name": "cmd_id",3070 "id": 1,3071 "options": {3072 "default": 133123073 }3074 },3075 {3076 "rule": "repeated",3077 "type": "int32",3078 "name": "auto_travel_area_ids",3079 "id": 23080 }3081 ]3082 },3083 {3084 "name": "CS_AUTO_TRAVEL_GET_REWARD",3085 "fields": [3086 {3087 "rule": "optional",3088 "type": "int32",3089 "name": "cmd_id",3090 "id": 1,3091 "options": {3092 "default": 133133093 }3094 },3095 {3096 "rule": "required",3097 "type": "int32",3098 "name": "auto_travel_area_id",3099 "id": 23100 }3101 ]3102 },3103 {3104 "name": "CS_RANK_GET_TOP_LEVEL",3105 "fields": [3106 {3107 "rule": "optional",3108 "type": "int32",3109 "name": "cmd_id",3110 "id": 1,3111 "options": {3112 "default": 134003113 }3114 }3115 ]3116 },3117 {3118 "name": "CS_RANK_GET_TOP_STAGE",3119 "fields": [3120 {3121 "rule": "optional",3122 "type": "int32",3123 "name": "cmd_id",3124 "id": 1,3125 "options": {3126 "default": 134013127 }3128 }3129 ]3130 },3131 {3132 "name": "CS_RANK_GET_TOP_ARENA",3133 "fields": [3134 {3135 "rule": "optional",3136 "type": "int32",3137 "name": "cmd_id",3138 "id": 1,3139 "options": {3140 "default": 134023141 }3142 }3143 ]3144 },3145 {3146 "name": "CS_RANK_GET_TOP_RANDOM_BOSS",3147 "fields": [3148 {3149 "rule": "optional",3150 "type": "int32",3151 "name": "cmd_id",3152 "id": 1,3153 "options": {3154 "default": 134033155 }3156 }3157 ]3158 },3159 {3160 "name": "CS_RANK_GET_TOP_ACHIEVEMENT",3161 "fields": [3162 {3163 "rule": "optional",3164 "type": "int32",3165 "name": "cmd_id",3166 "id": 1,3167 "options": {3168 "default": 134043169 }3170 }3171 ]3172 },3173 {3174 "name": "CS_RANK_GET_TOP_SHENMO",3175 "fields": [3176 {3177 "rule": "optional",3178 "type": "int32",3179 "name": "cmd_id",3180 "id": 1,3181 "options": {3182 "default": 134053183 }3184 }3185 ]3186 },3187 {3188 "name": "CS_RANK_GET_TOP_CLUB",3189 "fields": [3190 {3191 "rule": "optional",3192 "type": "int32",3193 "name": "cmd_id",3194 "id": 1,3195 "options": {3196 "default": 134063197 }3198 }3199 ]3200 },3201 {3202 "name": "CS_RANK_GET_TOP_CLUB_BY_COMBAT_POINT",3203 "fields": [3204 {3205 "rule": "optional",3206 "type": "int32",3207 "name": "cmd_id",3208 "id": 1,3209 "options": {3210 "default": 134073211 }3212 }3213 ]3214 },3215 {3216 "name": "CS_RANK_GET_TOP_COMBAT_POINT",3217 "fields": [3218 {3219 "rule": "optional",3220 "type": "int32",3221 "name": "cmd_id",3222 "id": 1,3223 "options": {3224 "default": 134083225 }3226 }3227 ]3228 },3229 {3230 "name": "CS_GET_PLAYER_DETAIL",3231 "fields": [3232 {3233 "rule": "optional",3234 "type": "int32",3235 "name": "cmd_id",3236 "id": 1,3237 "options": {3238 "default": 134203239 }3240 },3241 {3242 "rule": "required",3243 "type": "int32",3244 "name": "role_id",3245 "id": 23246 }3247 ]3248 },3249 {3250 "name": "CS_GET_PLAYER_SNAPSHOT",3251 "fields": [3252 {3253 "rule": "optional",3254 "type": "int32",3255 "name": "cmd_id",3256 "id": 1,3257 "options": {3258 "default": 134213259 }3260 },3261 {3262 "rule": "required",3263 "type": "int32",3264 "name": "role_id",3265 "id": 23266 }3267 ]3268 },3269 {3270 "name": "CS_ARENA_ATTACK",3271 "fields": [3272 {3273 "rule": "optional",3274 "type": "int32",3275 "name": "cmd_id",3276 "id": 1,3277 "options": {3278 "default": 135003279 }3280 },3281 {3282 "rule": "required",3283 "type": "int32",3284 "name": "target_rank",3285 "id": 23286 }3287 ]3288 },3289 {3290 "name": "CS_ARENA_GET_TARGET_LIST",3291 "fields": [3292 {3293 "rule": "optional",3294 "type": "int32",3295 "name": "cmd_id",3296 "id": 1,3297 "options": {3298 "default": 135013299 }3300 }3301 ]3302 },3303 {3304 "name": "CS_ARENA_RECHARGE_FIGHT_TIMES",3305 "fields": [3306 {3307 "rule": "optional",3308 "type": "int32",3309 "name": "cmd_id",3310 "id": 1,3311 "options": {3312 "default": 135023313 }3314 }3315 ]3316 },3317 {3318 "name": "CS_ARENA_CLEAR_CD",3319 "fields": [3320 {3321 "rule": "optional",3322 "type": "int32",3323 "name": "cmd_id",3324 "id": 1,3325 "options": {3326 "default": 135033327 }3328 }3329 ]3330 },3331 {3332 "name": "CS_ARENA_VERIFY",3333 "fields": [3334 {3335 "rule": "optional",3336 "type": "int32",3337 "name": "cmd_id",3338 "id": 1,3339 "options": {3340 "default": 135043341 }3342 },3343 {3344 "rule": "required",3345 "type": "int32",3346 "name": "token",3347 "id": 23348 },3349 {3350 "rule": "required",3351 "type": "STRUCT_BATTLE_STAGE_INFO",3352 "name": "info",3353 "id": 33354 }3355 ]3356 },3357 {3358 "name": "CS_ARENA_READ_RECORD",3359 "fields": [3360 {3361 "rule": "optional",3362 "type": "int32",3363 "name": "cmd_id",3364 "id": 1,3365 "options": {3366 "default": 135053367 }3368 },3369 {3370 "rule": "repeated",3371 "type": "int32",3372 "name": "ids",3373 "id": 23374 }3375 ]3376 },3377 {3378 "name": "STRUCT_CHAT_MESSAGE",3379 "fields": [3380 {3381 "rule": "optional",3382 "type": "int32",3383 "name": "receiver_id",3384 "id": 1,3385 "options": {3386 "default": 03387 }3388 },3389 {3390 "rule": "required",3391 "type": "int32",3392 "name": "type",3393 "id": 53394 },3395 {3396 "rule": "optional",3397 "type": "string",3398 "name": "text",3399 "id": 4,3400 "options": {3401 "default": ""3402 }3403 },3404 {3405 "rule": "optional",3406 "type": "string",3407 "name": "voice_txt",3408 "id": 6,3409 "options": {3410 "default": ""3411 }3412 },3413 {3414 "rule": "optional",3415 "type": "bytes",3416 "name": "voice_byte",3417 "id": 7,3418 "options": {3419 "default": ""3420 }3421 },3422 {3423 "rule": "optional",3424 "type": "int32",3425 "name": "voice_cnt",3426 "id": 8,3427 "options": {3428 "default": -13429 }3430 },3431 {3432 "rule": "optional",3433 "type": "int32",3434 "name": "voice_freq",3435 "id": 9,3436 "options": {3437 "default": -13438 }3439 }3440 ]3441 },3442 {3443 "name": "CS_CHAT_SEND_MESSAGE",3444 "fields": [3445 {3446 "rule": "optional",3447 "type": "int32",3448 "name": "cmd_id",3449 "id": 1,3450 "options": {3451 "default": 136003452 }3453 },3454 {3455 "rule": "optional",3456 "type": "int32",3457 "name": "chat_chanel",3458 "id": 2,3459 "options": {3460 "default": 13461 }3462 },3463 {3464 "rule": "required",3465 "type": "STRUCT_CHAT_MESSAGE",3466 "name": "message",3467 "id": 33468 }3469 ]3470 },3471 {3472 "name": "CS_CHAT_JOIN_CHANEL",3473 "fields": [3474 {3475 "rule": "optional",3476 "type": "int32",3477 "name": "cmd_id",3478 "id": 1,3479 "options": {3480 "default": 136013481 }3482 },3483 {3484 "rule": "required",3485 "type": "int32",3486 "name": "chat_chanel",3487 "id": 23488 },3489 {3490 "rule": "required",3491 "type": "int32",3492 "name": "chanel_id",3493 "id": 33494 }3495 ]3496 },3497 {3498 "name": "CS_CHAT_REQUEST_VOICE",3499 "fields": [3500 {3501 "rule": "optional",3502 "type": "int32",3503 "name": "cmd_id",3504 "id": 1,3505 "options": {3506 "default": 136023507 }3508 },3509 {3510 "rule": "required",3511 "type": "int32",3512 "name": "chanel_type",3513 "id": 23514 },3515 {3516 "rule": "required",3517 "type": "int32",3518 "name": "token",3519 "id": 43520 }3521 ]3522 },3523 {3524 "name": "CS_CHAT_READ_CHANEL",3525 "fields": [3526 {3527 "rule": "optional",3528 "type": "int32",3529 "name": "cmd_id",3530 "id": 1,3531 "options": {3532 "default": 136033533 }3534 },3535 {3536 "rule": "required",3537 "type": "int32",3538 "name": "chanel_type",3539 "id": 23540 }3541 ]3542 },3543 {3544 "name": "CS_CHAT_GET_CHANEL_ID",3545 "fields": [3546 {3547 "rule": "optional",3548 "type": "int32",3549 "name": "cmd_id",3550 "id": 1,3551 "options": {3552 "default": 136043553 }3554 },3555 {3556 "rule": "required",3557 "type": "string",3558 "name": "room_id",3559 "id": 23560 }3561 ]3562 },3563 {3564 "name": "CS_CHAT_LEAVE_CHANEL",3565 "fields": [3566 {3567 "rule": "optional",3568 "type": "int32",3569 "name": "cmd_id",3570 "id": 1,3571 "options": {3572 "default": 136053573 }3574 },3575 {3576 "rule": "required",3577 "type": "int32",3578 "name": "chanel_type",3579 "id": 23580 }3581 ]3582 },3583 {3584 "name": "CS_SHENMO_PLAYER_RESET",3585 "fields": [3586 {3587 "rule": "optional",3588 "type": "int32",3589 "name": "cmd_id",3590 "id": 1,3591 "options": {3592 "default": 137013593 }3594 }3595 ]3596 },3597 {3598 "name": "CS_SHENMO_VERIFY_BATTLE",3599 "fields": [3600 {3601 "rule": "optional",3602 "type": "int32",3603 "name": "cmd_id",3604 "id": 1,3605 "options": {3606 "default": 137023607 }3608 },3609 {3610 "rule": "optional",3611 "type": "int32",3612 "name": "level",3613 "id": 2,3614 "options": {3615 "default": -13616 }3617 },3618 {3619 "rule": "required",3620 "type": "int32",3621 "name": "token",3622 "id": 33623 },3624 {3625 "rule": "required",3626 "type": "STRUCT_BATTLE_STAGE_INFO",3627 "name": "info",3628 "id": 43629 }3630 ]3631 },3632 {3633 "name": "CS_SHENMO_IS_AVAILABLE",3634 "fields": [3635 {3636 "rule": "optional",3637 "type": "int32",3638 "name": "cmd_id",3639 "id": 1,3640 "options": {3641 "default": 137033642 }3643 },3644 {3645 "rule": "required",3646 "type": "int32",3647 "name": "level",3648 "id": 23649 }3650 ]3651 },3652 {3653 "name": "CS_SHENMO_QUICK_COMPLETE",3654 "fields": [3655 {3656 "rule": "optional",3657 "type": "int32",3658 "name": "cmd_id",3659 "id": 1,3660 "options": {3661 "default": 137043662 }3663 }3664 ]3665 },3666 {3667 "name": "CS_SHENMO_VIP_QUICK_COMPLETE",3668 "fields": [3669 {3670 "rule": "optional",3671 "type": "int32",3672 "name": "cmd_id",3673 "id": 1,3674 "options": {3675 "default": 137053676 }3677 }3678 ]3679 },3680 {3681 "name": "CS_SHENMO_START",3682 "fields": [3683 {3684 "rule": "optional",3685 "type": "int32",3686 "name": "cmd_id",3687 "id": 1,3688 "options": {3689 "default": 137063690 }3691 },3692 {3693 "rule": "required",3694 "type": "int32",3695 "name": "level",3696 "id": 23697 }3698 ]3699 },3700 {3701 "name": "CS_SHENMO_BUY_VIP_RESET",3702 "fields": [3703 {3704 "rule": "optional",3705 "type": "int32",3706 "name": "cmd_id",3707 "id": 1,3708 "options": {3709 "default": 137073710 }3711 }3712 ]3713 },3714 {3715 "name": "CS_SHENMO_REFRESH",3716 "fields": [3717 {3718 "rule": "optional",3719 "type": "int32",3720 "name": "cmd_id",3721 "id": 1,3722 "options": {3723 "default": 137083724 }3725 }3726 ]3727 },3728 {3729 "name": "CS_WING_ADV",3730 "fields": [3731 {3732 "rule": "optional",3733 "type": "int32",3734 "name": "cmd_id",3735 "id": 1,3736 "options": {3737 "default": 138003738 }3739 },3740 {3741 "rule": "optional",3742 "type": "bool",3743 "name": "is_diamond",3744 "id": 2,3745 "options": {3746 "default": false3747 }3748 }3749 ]3750 },3751 {3752 "name": "CS_WING_STAR_UP",3753 "fields": [3754 {3755 "rule": "optional",3756 "type": "int32",3757 "name": "cmd_id",3758 "id": 1,3759 "options": {3760 "default": 138013761 }3762 },3763 {3764 "rule": "required",3765 "type": "int32",3766 "name": "wing_id",3767 "id": 23768 }3769 ]3770 },3771 {3772 "name": "CS_WING_COMBINE",3773 "fields": [3774 {3775 "rule": "optional",3776 "type": "int32",3777 "name": "cmd_id",3778 "id": 1,3779 "options": {3780 "default": 138023781 }3782 },3783 {3784 "rule": "required",3785 "type": "int32",3786 "name": "wing_id",3787 "id": 23788 }3789 ]3790 },3791 {3792 "name": "CS_WING_SET_DISPLAY",3793 "fields": [3794 {3795 "rule": "optional",3796 "type": "int32",3797 "name": "cmd_id",3798 "id": 1,3799 "options": {3800 "default": 138033801 }3802 },3803 {3804 "rule": "required",3805 "type": "int32",3806 "name": "display",3807 "id": 23808 }3809 ]3810 },3811 {3812 "name": "CS_WING_REFRESH",3813 "fields": [3814 {3815 "rule": "optional",3816 "type": "int32",3817 "name": "cmd_id",3818 "id": 1,3819 "options": {3820 "default": 138043821 }3822 }3823 ]3824 },3825 {3826 "name": "CS_FASHION_ADV",3827 "fields": [3828 {3829 "rule": "optional",3830 "type": "int32",3831 "name": "cmd_id",3832 "id": 1,3833 "options": {3834 "default": 138203835 }3836 },3837 {3838 "rule": "optional",3839 "type": "bool",3840 "name": "is_diamond",3841 "id": 2,3842 "options": {3843 "default": false3844 }3845 }3846 ]3847 },3848 {3849 "name": "CS_FASHION_COMBINE",3850 "fields": [3851 {3852 "rule": "optional",3853 "type": "int32",3854 "name": "cmd_id",3855 "id": 1,3856 "options": {3857 "default": 138213858 }3859 },3860 {3861 "rule": "required",3862 "type": "int32",3863 "name": "fashion",3864 "id": 23865 }3866 ]3867 },3868 {3869 "name": "CS_FASHION_SET_DISPLAY",3870 "fields": [3871 {3872 "rule": "optional",3873 "type": "int32",3874 "name": "cmd_id",3875 "id": 1,3876 "options": {3877 "default": 138223878 }3879 },3880 {3881 "rule": "required",3882 "type": "int32",3883 "name": "display",3884 "id": 23885 }3886 ]3887 },3888 {3889 "name": "CS_FASHION_REFRESH",3890 "fields": [3891 {3892 "rule": "optional",3893 "type": "int32",3894 "name": "cmd_id",3895 "id": 1,3896 "options": {3897 "default": 138233898 }3899 }3900 ]3901 },3902 {3903 "name": "CS_GET_MY_CLUB_DETAIL",3904 "fields": [3905 {3906 "rule": "optional",3907 "type": "int32",3908 "name": "cmd_id",3909 "id": 1,3910 "options": {3911 "default": 139003912 }3913 }3914 ]3915 },3916 {3917 "name": "CS_CLUB_SEARCH_BY_NAME",3918 "fields": [3919 {3920 "rule": "optional",3921 "type": "int32",3922 "name": "cmd_id",3923 "id": 1,3924 "options": {3925 "default": 139013926 }3927 },3928 {3929 "rule": "required",3930 "type": "string",3931 "name": "name",3932 "id": 23933 }3934 ]3935 },3936 {3937 "name": "CS_CLUB_OBSERVE",3938 "fields": [3939 {3940 "rule": "optional",3941 "type": "int32",3942 "name": "cmd_id",3943 "id": 1,3944 "options": {3945 "default": 139023946 }3947 },3948 {3949 "rule": "required",3950 "type": "int32",3951 "name": "top",3952 "id": 23953 }3954 ]3955 },3956 {3957 "name": "CS_CLUB_APPLY",3958 "fields": [3959 {3960 "rule": "optional",3961 "type": "int32",3962 "name": "cmd_id",3963 "id": 1,3964 "options": {3965 "default": 139033966 }3967 },3968 {3969 "rule": "required",3970 "type": "int32",3971 "name": "club_id",3972 "id": 23973 }3974 ]3975 },3976 {3977 "name": "CS_CLUB_APPLICATION_RESPONSE",3978 "fields": [3979 {3980 "rule": "optional",3981 "type": "int32",3982 "name": "cmd_id",3983 "id": 1,3984 "options": {3985 "default": 139043986 }3987 },3988 {3989 "rule": "required",3990 "type": "int32",3991 "name": "target_id",3992 "id": 23993 },3994 {3995 "rule": "required",3996 "type": "bool",3997 "name": "is_accept",3998 "id": 33999 }4000 ]4001 },4002 {4003 "name": "CS_CLUB_SET_TITLE",4004 "fields": [4005 {4006 "rule": "optional",4007 "type": "int32",4008 "name": "cmd_id",4009 "id": 1,4010 "options": {4011 "default": 139054012 }4013 },4014 {4015 "rule": "required",4016 "type": "int32",4017 "name": "target_id",4018 "id": 24019 },4020 {4021 "rule": "required",4022 "type": "int32",4023 "name": "title",4024 "id": 34025 }4026 ]4027 },4028 {4029 "name": "CS_CLUB_LEAVE",4030 "fields": [4031 {4032 "rule": "optional",4033 "type": "int32",4034 "name": "cmd_id",4035 "id": 1,4036 "options": {4037 "default": 139064038 }4039 }4040 ]4041 },4042 {4043 "name": "CS_CLUB_KICK",4044 "fields": [4045 {4046 "rule": "optional",4047 "type": "int32",4048 "name": "cmd_id",4049 "id": 1,4050 "options": {4051 "default": 139074052 }4053 },4054 {4055 "rule": "required",4056 "type": "int32",4057 "name": "target_id",4058 "id": 24059 }4060 ]4061 },4062 {4063 "name": "CS_CLUB_TANHE",4064 "fields": [4065 {4066 "rule": "optional",4067 "type": "int32",4068 "name": "cmd_id",4069 "id": 1,4070 "options": {4071 "default": 139084072 }4073 },4074 {4075 "rule": "required",4076 "type": "bool",4077 "name": "is_leader",4078 "id": 24079 }4080 ]4081 },4082 {4083 "name": "CS_CLUB_GIVE_STAMINA",4084 "fields": [4085 {4086 "rule": "optional",4087 "type": "int32",4088 "name": "cmd_id",4089 "id": 1,4090 "options": {4091 "default": 139094092 }4093 },4094 {4095 "rule": "required",4096 "type": "int32",4097 "name": "target_id",4098 "id": 24099 }4100 ]4101 },4102 {4103 "name": "CS_CLUB_GET_STAMINA",4104 "fields": [4105 {4106 "rule": "optional",4107 "type": "int32",4108 "name": "cmd_id",4109 "id": 1,4110 "options": {4111 "default": 139104112 }4113 },4114 {4115 "rule": "required",4116 "type": "int32",4117 "name": "target_id",4118 "id": 24119 }4120 ]4121 },4122 {4123 "name": "CS_CLUB_CREATE",4124 "fields": [4125 {4126 "rule": "optional",4127 "type": "int32",4128 "name": "cmd_id",4129 "id": 1,4130 "options": {4131 "default": 139114132 }4133 },4134 {4135 "rule": "required",4136 "type": "string",4137 "name": "name",4138 "id": 24139 },4140 {4141 "rule": "required",4142 "type": "int32",4143 "name": "icon",4144 "id": 34145 }4146 ]4147 },4148 {4149 "name": "CS_CLUB_CHANGE_INFO",4150 "fields": [4151 {4152 "rule": "optional",4153 "type": "int32",4154 "name": "cmd_id",4155 "id": 1,4156 "options": {4157 "default": 139124158 }4159 },4160 {4161 "rule": "optional",4162 "type": "string",4163 "name": "name",4164 "id": 24165 },4166 {4167 "rule": "optional",4168 "type": "int32",4169 "name": "icon",4170 "id": 34171 }4172 ]4173 },4174 {4175 "name": "CS_CLUB_SET_NOTICE",4176 "fields": [4177 {4178 "rule": "optional",4179 "type": "int32",4180 "name": "cmd_id",4181 "id": 1,4182 "options": {4183 "default": 139134184 }4185 },4186 {4187 "rule": "required",4188 "type": "string",4189 "name": "notice",4190 "id": 24191 }4192 ]4193 },4194 {4195 "name": "CS_CLUB_DONATE",4196 "fields": [4197 {4198 "rule": "optional",4199 "type": "int32",4200 "name": "cmd_id",4201 "id": 1,4202 "options": {4203 "default": 139144204 }4205 },4206 {4207 "rule": "required",4208 "type": "int32",4209 "name": "id",4210 "id": 24211 }4212 ]4213 },4214 {4215 "name": "CS_CLUB_OPEN_DONATE_SCHEDULE_BOX",4216 "fields": [4217 {4218 "rule": "optional",4219 "type": "int32",4220 "name": "cmd_id",4221 "id": 1,4222 "options": {4223 "default": 139154224 }4225 },4226 {4227 "rule": "required",4228 "type": "int32",4229 "name": "id",4230 "id": 24231 }4232 ]4233 },4234 {4235 "name": "CS_CLUB_SETTING",4236 "fields": [4237 {4238 "rule": "optional",4239 "type": "int32",4240 "name": "cmd_id",4241 "id": 1,4242 "options": {4243 "default": 139164244 }4245 },4246 {4247 "rule": "required",4248 "type": "int32",4249 "name": "icon",4250 "id": 24251 },4252 {4253 "rule": "required",4254 "type": "int32",4255 "name": "min_lv",4256 "id": 34257 },4258 {4259 "rule": "required",4260 "type": "bool",4261 "name": "is_verify",4262 "id": 44263 }4264 ]4265 },4266 {4267 "name": "CS_CLUB_BUILDING_REQUEST",4268 "fields": [4269 {4270 "rule": "optional",4271 "type": "int32",4272 "name": "cmd_id",4273 "id": 1,4274 "options": {4275 "default": 139174276 }4277 }4278 ]4279 },4280 {4281 "name": "CS_CLUB_BUILDING_LV_UP",4282 "fields": [4283 {4284 "rule": "optional",4285 "type": "int32",4286 "name": "cmd_id",4287 "id": 1,4288 "options": {4289 "default": 139184290 }4291 },4292 {4293 "rule": "required",4294 "type": "int32",4295 "name": "building_idx",4296 "id": 24297 }4298 ]4299 },4300 {4301 "name": "CS_CLUB_OFFICE_MISSION_OPEN_BOX",4302 "fields": [4303 {4304 "rule": "optional",4305 "type": "int32",4306 "name": "cmd_id",4307 "id": 1,4308 "options": {4309 "default": 139204310 }4311 },4312 {4313 "rule": "required",4314 "type": "int32",4315 "name": "idx",4316 "id": 24317 }4318 ]4319 },4320 {4321 "name": "CS_CLUB_OFFICE_MISSION_REFRESH",4322 "fields": [4323 {4324 "rule": "optional",4325 "type": "int32",4326 "name": "cmd_id",4327 "id": 1,4328 "options": {4329 "default": 139214330 }4331 },4332 {4333 "rule": "required",4334 "type": "int32",4335 "name": "idx",4336 "id": 24337 }4338 ]4339 },4340 {4341 "name": "CS_CLUB_OFFICE_MISSION_ALL_FIVE_STAR",4342 "fields": [4343 {4344 "rule": "optional",4345 "type": "int32",4346 "name": "cmd_id",4347 "id": 1,4348 "options": {4349 "default": 139224350 }4351 }4352 ]4353 },4354 {4355 "name": "CS_CLUB_OFFICE_MISSION_DONATE",4356 "fields": [4357 {4358 "rule": "optional",4359 "type": "int32",4360 "name": "cmd_id",4361 "id": 1,4362 "options": {4363 "default": 139234364 }4365 },4366 {4367 "rule": "required",4368 "type": "int32",4369 "name": "idx",4370 "id": 24371 }4372 ]4373 },4374 {4375 "name": "CS_CLUB_OFFICE_MISSION_GET_REWARD",4376 "fields": [4377 {4378 "rule": "optional",4379 "type": "int32",4380 "name": "cmd_id",4381 "id": 1,4382 "options": {4383 "default": 139244384 }4385 },4386 {4387 "rule": "required",4388 "type": "int32",4389 "name": "idx",4390 "id": 24391 }4392 ]4393 },4394 {4395 "name": "CS_CLUB_SKILL_UPGRADE",4396 "fields": [4397 {4398 "rule": "optional",4399 "type": "int32",4400 "name": "cmd_id",4401 "id": 1,4402 "options": {4403 "default": 139304404 }4405 },4406 {4407 "rule": "required",4408 "type": "int32",4409 "name": "skill_id",4410 "id": 24411 }4412 ]4413 },4414 {4415 "name": "CS_CLUB_LOG_REQUEST",4416 "fields": [4417 {4418 "rule": "optional",4419 "type": "int32",4420 "name": "cmd_id",4421 "id": 1,4422 "options": {4423 "default": 139314424 }4425 }4426 ]4427 },4428 {4429 "name": "CS_CLUB_REFRESH_APPLICATION",4430 "fields": [4431 {4432 "rule": "optional",4433 "type": "int32",4434 "name": "cmd_id",4435 "id": 1,4436 "options": {4437 "default": 139324438 }4439 }4440 ]4441 },4442 {4443 "name": "CS_CLUB_STAGE_GET_INFO",4444 "fields": [4445 {4446 "rule": "optional",4447 "type": "int32",4448 "name": "cmd_id",4449 "id": 1,4450 "options": {4451 "default": 139404452 }4453 }4454 ]4455 },4456 {4457 "name": "CS_CLUB_STAGE_AWARD_APPLY",4458 "fields": [4459 {4460 "rule": "optional",4461 "type": "int32",4462 "name": "cmd_id",4463 "id": 1,4464 "options": {4465 "default": 139414466 }4467 },4468 {4469 "rule": "required",4470 "type": "int32",4471 "name": "stage_id",4472 "id": 24473 },4474 {4475 "rule": "required",4476 "type": "int32",4477 "name": "award_type",4478 "id": 34479 },4480 {4481 "rule": "required",4482 "type": "int32",4483 "name": "award_id",4484 "id": 44485 }4486 ]4487 },4488 {4489 "name": "CS_CLUB_STAGE_GET_APPLY_INFO",4490 "fields": [4491 {4492 "rule": "optional",4493 "type": "int32",4494 "name": "cmd_id",4495 "id": 1,4496 "options": {4497 "default": 139424498 }4499 },4500 {4501 "rule": "required",4502 "type": "int32",4503 "name": "stage_id",4504 "id": 24505 }4506 ]4507 },4508 {4509 "name": "CS_CLUB_STAGE_GET_APPLY_LIST_DETAIL",4510 "fields": [4511 {4512 "rule": "optional",4513 "type": "int32",4514 "name": "cmd_id",4515 "id": 1,4516 "options": {4517 "default": 139434518 }4519 },4520 {4521 "rule": "required",4522 "type": "int32",4523 "name": "stage_id",4524 "id": 24525 },4526 {4527 "rule": "required",4528 "type": "int32",4529 "name": "award_type",4530 "id": 34531 },4532 {4533 "rule": "required",4534 "type": "int32",4535 "name": "award_id",4536 "id": 44537 }4538 ]4539 },4540 {4541 "name": "CS_CLUB_STAGE_RESET",4542 "fields": [4543 {4544 "rule": "optional",4545 "type": "int32",4546 "name": "cmd_id",4547 "id": 1,4548 "options": {4549 "default": 139444550 }4551 },4552 {4553 "rule": "required",4554 "type": "int32",4555 "name": "stage_id",4556 "id": 24557 }4558 ]4559 },4560 {4561 "name": "CS_ROOM_GET_INFO",4562 "fields": [4563 {4564 "rule": "optional",4565 "type": "int32",4566 "name": "cmd_id",4567 "id": 1,4568 "options": {4569 "default": 160004570 }4571 },4572 {4573 "rule": "required",4574 "type": "string",4575 "name": "root_room",4576 "id": 24577 },4578 {4579 "rule": "optional",4580 "type": "int32",4581 "name": "depth",4582 "id": 3,4583 "options": {4584 "default": 14585 }4586 },4587 {4588 "rule": "optional",4589 "type": "int32",4590 "name": "is_simple",4591 "id": 4,4592 "options": {4593 "default": 04594 }4595 }4596 ]4597 },4598 {4599 "name": "CS_ROOM_JOIN",4600 "fields": [4601 {4602 "rule": "optional",4603 "type": "int32",4604 "name": "cmd_id",4605 "id": 1,4606 "options": {4607 "default": 160014608 }4609 },4610 {4611 "rule": "required",4612 "type": "string",4613 "name": "room_id",4614 "id": 24615 },4616 {4617 "rule": "optional",4618 "type": "string",4619 "name": "sceret",4620 "id": 3,4621 "options": {4622 "default": ""4623 }4624 },4625 {4626 "rule": "optional",4627 "type": "int32",4628 "name": "leader_id",4629 "id": 4,4630 "options": {4631 "default": -14632 }4633 }4634 ]4635 },4636 {4637 "name": "CS_ROOM_START",4638 "fields": [4639 {4640 "rule": "optional",4641 "type": "int32",4642 "name": "cmd_id",4643 "id": 1,4644 "options": {4645 "default": 160024646 }4647 },4648 {4649 "rule": "required",4650 "type": "string",4651 "name": "room_id",4652 "id": 24653 }4654 ]4655 },4656 {4657 "name": "CS_ROOM_PREPARE",4658 "fields": [4659 {4660 "rule": "optional",4661 "type": "int32",4662 "name": "cmd_id",4663 "id": 1,4664 "options": {4665 "default": 160034666 }4667 },4668 {4669 "rule": "required",4670 "type": "string",4671 "name": "room_id",4672 "id": 24673 }4674 ]4675 },4676 {4677 "name": "CS_ROOM_CHANGE_SLOT",4678 "fields": [4679 {4680 "rule": "optional",4681 "type": "int32",4682 "name": "cmd_id",4683 "id": 1,4684 "options": {4685 "default": 160044686 }4687 },4688 {4689 "rule": "repeated",4690 "type": "int32",4691 "name": "room_id",4692 "id": 24693 },4694 {4695 "rule": "required",4696 "type": "int32",4697 "name": "slot_idx",4698 "id": 44699 }4700 ]4701 },4702 {4703 "name": "CS_ROOM_GET_RECOMMEND_PLAYER",4704 "fields": [4705 {4706 "rule": "optional",4707 "type": "int32",4708 "name": "cmd_id",4709 "id": 1,4710 "options": {4711 "default": 160054712 }4713 },4714 {4715 "rule": "required",4716 "type": "string",4717 "name": "root_room",4718 "id": 24719 },4720 {4721 "rule": "optional",4722 "type": "int32",4723 "name": "max_local_server",4724 "id": 3,4725 "options": {4726 "default": 104727 }4728 },4729 {4730 "rule": "optional",4731 "type": "int32",4732 "name": "max_from_other_server",4733 "id": 4,4734 "options": {4735 "default": 54736 }4737 }4738 ]4739 },4740 {4741 "name": "STRUCT_ROOM_OPTION",4742 "fields": []4743 },4744 {4745 "name": "CS_ROOM_CREATE",4746 "fields": [4747 {4748 "rule": "optional",4749 "type": "int32",4750 "name": "cmd_id",4751 "id": 1,4752 "options": {4753 "default": 160064754 }4755 },4756 {4757 "rule": "required",4758 "type": "string",4759 "name": "root_room",4760 "id": 24761 },4762 {4763 "rule": "optional",4764 "type": "STRUCT_ROOM_OPTION",4765 "name": "option",4766 "id": 34767 }4768 ]4769 },4770 {4771 "name": "CS_ROOM_INVITE",4772 "fields": [4773 {4774 "rule": "optional",4775 "type": "int32",4776 "name": "cmd_id",4777 "id": 1,4778 "options": {4779 "default": 160074780 }4781 },4782 {4783 "rule": "required",4784 "type": "int32",4785 "name": "server_id",4786 "id": 24787 },4788 {4789 "rule": "required",4790 "type": "int32",4791 "name": "role_id",4792 "id": 34793 },4794 {4795 "rule": "required",4796 "type": "string",4797 "name": "room_id",4798 "id": 44799 }4800 ]4801 },4802 {4803 "name": "CS_ROOM_LEAVE",4804 "fields": [4805 {4806 "rule": "optional",4807 "type": "int32",4808 "name": "cmd_id",4809 "id": 1,4810 "options": {4811 "default": 160084812 }4813 },4814 {4815 "rule": "required",4816 "type": "string",4817 "name": "room_id",4818 "id": 24819 }4820 ]4821 },4822 {4823 "name": "CS_ROOM_UNPERARE",4824 "fields": [4825 {4826 "rule": "optional",4827 "type": "int32",4828 "name": "cmd_id",4829 "id": 1,4830 "options": {4831 "default": 160094832 }4833 },4834 {4835 "rule": "required",4836 "type": "string",4837 "name": "room_id",4838 "id": 24839 }4840 ]4841 },4842 {4843 "name": "CS_ROOM_GET_RECOMMEND_CLUB_PLAYER",4844 "fields": [4845 {4846 "rule": "optional",4847 "type": "int32",4848 "name": "cmd_id",4849 "id": 1,4850 "options": {4851 "default": 160104852 }4853 },4854 {4855 "rule": "required",4856 "type": "string",4857 "name": "root_room",4858 "id": 24859 }4860 ]4861 },4862 {4863 "name": "CS_ROOM_PRIVATE_INVITATION_RESPONSE",4864 "fields": [4865 {4866 "rule": "optional",4867 "type": "int32",4868 "name": "cmd_id",4869 "id": 1,4870 "options": {4871 "default": 160114872 }4873 },4874 {4875 "rule": "required",4876 "type": "string",4877 "name": "room_id",4878 "id": 24879 },4880 {4881 "rule": "optional",4882 "type": "STRUCT_PLAYER_SNAPSHOT",4883 "name": "role_info",4884 "id": 34885 },4886 {4887 "rule": "required",4888 "type": "int32",4889 "name": "response",4890 "id": 44891 }4892 ]4893 },4894 {4895 "name": "CS_ROOM_HERAT_BEAT",4896 "fields": [4897 {4898 "rule": "optional",4899 "type": "int32",4900 "name": "cmd_id",4901 "id": 1,4902 "options": {4903 "default": 160204904 }4905 },4906 {4907 "rule": "required",4908 "type": "string",4909 "name": "room_id",4910 "id": 24911 }4912 ]4913 },4914 {4915 "name": "CS_ROOM_SEARCH_BY_PLAYER_FULL_NAME",4916 "fields": [4917 {4918 "rule": "optional",4919 "type": "int32",4920 "name": "cmd_id",4921 "id": 1,4922 "options": {4923 "default": 160214924 }4925 },4926 {4927 "rule": "optional",4928 "type": "int32",4929 "name": "role_id",4930 "id": 24931 },4932 {4933 "rule": "optional",4934 "type": "int32",4935 "name": "server_type",4936 "id": 3,4937 "options": {4938 "default": 44939 }4940 },4941 {4942 "rule": "required",4943 "type": "string",4944 "name": "root_room",4945 "id": 44946 },4947 {4948 "rule": "optional",4949 "type": "string",4950 "name": "target_full_name",4951 "id": 5,4952 "options": {4953 "default": ""4954 }4955 }4956 ]4957 },4958 {4959 "name": "CS_ROOM_QUICK_GAME",4960 "fields": [4961 {4962 "rule": "optional",4963 "type": "int32",4964 "name": "cmd_id",4965 "id": 1,4966 "options": {4967 "default": 160224968 }4969 },4970 {4971 "rule": "required",4972 "type": "string",4973 "name": "root_room",4974 "id": 24975 }4976 ]4977 },4978 {4979 "name": "CS_ROOM_KICK",4980 "fields": [4981 {4982 "rule": "optional",4983 "type": "int32",4984 "name": "cmd_id",4985 "id": 1,4986 "options": {4987 "default": 160234988 }4989 },4990 {4991 "rule": "required",4992 "type": "string",4993 "name": "room_id",4994 "id": 24995 },4996 {4997 "rule": "required",4998 "type": "int32",4999 "name": "target_id",5000 "id": 35001 }5002 ]5003 },5004 {5005 "name": "CS_ROOM_INVITE_LINK",5006 "fields": [5007 {5008 "rule": "optional",5009 "type": "int32",5010 "name": "cmd_id",5011 "id": 1,5012 "options": {5013 "default": 160245014 }5015 },5016 {5017 "rule": "required",5018 "type": "string",5019 "name": "room_id",5020 "id": 25021 }5022 ]5023 },5024 {5025 "name": "CS_AREA_UPDATE_LOCATION",5026 "fields": [5027 {5028 "rule": "optional",5029 "type": "int32",5030 "name": "cmd_id",5031 "id": 1,5032 "options": {5033 "default": 170005034 }5035 },5036 {5037 "rule": "required",5038 "type": "int32",5039 "name": "area",5040 "id": 25041 },5042 {5043 "rule": "optional",5044 "type": "int32",5045 "name": "location_x",5046 "id": 3,5047 "options": {5048 "default": -15049 }5050 },5051 {5052 "rule": "optional",5053 "type": "int32",5054 "name": "location_y",5055 "id": 4,5056 "options": {5057 "default": -15058 }5059 },5060 {5061 "rule": "optional",5062 "type": "int32",5063 "name": "target_id",5064 "id": 5,5065 "options": {5066 "default": -15067 }5068 }5069 ]5070 },5071 {5072 "name": "CS_AREA_HEART_BEAT",5073 "fields": [5074 {5075 "rule": "optional",5076 "type": "int32",5077 "name": "cmd_id",5078 "id": 1,5079 "options": {5080 "default": 170015081 }5082 }5083 ]5084 },5085 {5086 "name": "CS_AREA_CHANGE_ROLE_STATUS",5087 "fields": [5088 {5089 "rule": "optional",5090 "type": "int32",5091 "name": "cmd_id",5092 "id": 1,5093 "options": {5094 "default": 170025095 }5096 },5097 {5098 "rule": "optional",5099 "type": "int32",5100 "name": "is_able_to_be_invited",5101 "id": 2,5102 "options": {5103 "default": -15104 }5105 }5106 ]5107 },5108 {5109 "name": "STRUCT_PLAYER_SNAPSHOT",5110 "fields": [5111 {5112 "rule": "required",5113 "type": "int32",5114 "name": "role_id",5115 "id": 15116 },5117 {5118 "rule": "optional",5119 "type": "string",5120 "name": "name",5121 "id": 2,5122 "options": {5123 "default": ""5124 }5125 },5126 {5127 "rule": "optional",5128 "type": "int32",5129 "name": "level",5130 "id": 3,5131 "options": {5132 "default": -15133 }5134 },5135 {5136 "rule": "optional",5137 "type": "int32",5138 "name": "vip_lv",5139 "id": 4,5140 "options": {5141 "default": -15142 }5143 },5144 {5145 "rule": "optional",5146 "type": "int32",5147 "name": "hero_id",5148 "id": 5,5149 "options": {5150 "default": -15151 }5152 },5153 {5154 "rule": "optional",5155 "type": "int64",5156 "name": "combat_point",5157 "id": 6,5158 "options": {5159 "default": -15160 }5161 },5162 {5163 "rule": "optional",5164 "type": "string",5165 "name": "club_name",5166 "id": 7,5167 "options": {5168 "default": ""5169 }5170 },5171 {5172 "rule": "optional",5173 "type": "int32",5174 "name": "club_id",5175 "id": 8,5176 "options": {5177 "default": -15178 }5179 },5180 {5181 "rule": "optional",5182 "type": "int32",5183 "name": "color",5184 "id": 9,5185 "options": {5186 "default": -15187 }5188 },5189 {5190 "rule": "optional",5191 "type": "int32",5192 "name": "server_id",5193 "id": 10,5194 "options": {5195 "default": -15196 }5197 }5198 ]5199 },5200 {5201 "name": "CS_WILD_GET_INFO",5202 "fields": [5203 {5204 "rule": "optional",5205 "type": "int32",5206 "name": "cmd_id",5207 "id": 1,5208 "options": {5209 "default": 171005210 }5211 },5212 {5213 "rule": "optional",5214 "type": "int32",5215 "name": "role_id",5216 "id": 25217 },5218 {5219 "rule": "optional",5220 "type": "int32",5221 "name": "server_type",5222 "id": 3,5223 "options": {5224 "default": 35225 }5226 },5227 {5228 "rule": "optional",5229 "type": "int32",5230 "name": "wild_id",5231 "id": 4,5232 "options": {5233 "default": 05234 }5235 }5236 ]5237 },5238 {5239 "name": "CS_WILD_OPEN_BOX",5240 "fields": [5241 {5242 "rule": "optional",5243 "type": "int32",5244 "name": "cmd_id",5245 "id": 1,5246 "options": {5247 "default": 171015248 }5249 },5250 {5251 "rule": "optional",5252 "type": "STRUCT_PLAYER_SNAPSHOT",5253 "name": "role",5254 "id": 25255 },5256 {5257 "rule": "optional",5258 "type": "int32",5259 "name": "server_type",5260 "id": 3,5261 "options": {5262 "default": 35263 }5264 },5265 {5266 "rule": "required",5267 "type": "int32",5268 "name": "wild_id",5269 "id": 45270 },5271 {5272 "rule": "required",5273 "type": "int32",5274 "name": "mission_idx",5275 "id": 55276 }5277 ]5278 },5279 {5280 "name": "CS_WILD_GET_BOSS_INFO",5281 "fields": [5282 {5283 "rule": "optional",5284 "type": "int32",5285 "name": "cmd_id",5286 "id": 1,5287 "options": {5288 "default": 171025289 }5290 },5291 {5292 "rule": "optional",5293 "type": "int32",5294 "name": "role_id",5295 "id": 25296 },5297 {5298 "rule": "optional",5299 "type": "int32",5300 "name": "server_type",5301 "id": 3,5302 "options": {5303 "default": 35304 }5305 },5306 {5307 "rule": "required",5308 "type": "int32",5309 "name": "wild_id",5310 "id": 45311 }5312 ]5313 },5314 {5315 "name": "CS_ACTIVITY_GET_QUEST_REWARD",5316 "fields": [5317 {5318 "rule": "optional",5319 "type": "int32",5320 "name": "cmd_id",5321 "id": 1,5322 "options": {5323 "default": 171205324 }5325 },5326 {5327 "rule": "required",5328 "type": "string",5329 "name": "quest_id",5330 "id": 25331 },5332 {5333 "rule": "optional",5334 "type": "int32",5335 "name": "award_idx",5336 "id": 3,5337 "options": {5338 "default": 05339 }5340 }5341 ]5342 },5343 {5344 "name": "CS_ACTIVITY_BUY",5345 "fields": [5346 {5347 "rule": "optional",5348 "type": "int32",5349 "name": "cmd_id",5350 "id": 1,5351 "options": {5352 "default": 171215353 }5354 },5355 {5356 "rule": "required",5357 "type": "string",5358 "name": "buy_id",5359 "id": 25360 },5361 {5362 "rule": "required",5363 "type": "int32",5364 "name": "qty",5365 "id": 35366 },5367 {5368 "rule": "optional",5369 "type": "int32",5370 "name": "award_idx",5371 "id": 4,5372 "options": {5373 "default": 05374 }5375 }5376 ]5377 },5378 {5379 "name": "CS_ACTIVITY_CLICK",5380 "fields": [5381 {5382 "rule": "optional",5383 "type": "int32",5384 "name": "cmd_id",5385 "id": 1,5386 "options": {5387 "default": 171225388 }5389 },5390 {5391 "rule": "required",5392 "type": "string",5393 "name": "click_id",5394 "id": 25395 },5396 {5397 "rule": "optional",5398 "type": "int32",5399 "name": "parm",5400 "id": 3,5401 "options": {5402 "default": 05403 }5404 }5405 ]5406 },5407 {5408 "name": "CS_ACTIVITY_OPEN_CHEST",5409 "fields": [5410 {5411 "rule": "optional",5412 "type": "int32",5413 "name": "cmd_id",5414 "id": 1,5415 "options": {5416 "default": 171235417 }5418 },5419 {5420 "rule": "required",5421 "type": "int32",5422 "name": "activity_id",5423 "id": 25424 },5425 {5426 "rule": "required",5427 "type": "int32",5428 "name": "idx",5429 "id": 35430 }5431 ]5432 },5433 {5434 "name": "CS_ACTIVITY_REFRESH",5435 "fields": [5436 {5437 "rule": "optional",5438 "type": "int32",5439 "name": "cmd_id",5440 "id": 1,5441 "options": {5442 "default": 171245443 }5444 },5445 {5446 "rule": "required",5447 "type": "int32",5448 "name": "activity_id",5449 "id": 25450 }5451 ]5452 },5453 {5454 "name": "CS_MAIN_MISSION_GET_REWARD",5455 "fields": [5456 {5457 "rule": "optional",5458 "type": "int32",5459 "name": "cmd_id",5460 "id": 1,5461 "options": {5462 "default": 171405463 }5464 }5465 ]5466 },5467 {5468 "name": "CS_FLOP_CARDS",5469 "fields": [5470 {5471 "rule": "optional",5472 "type": "int32",5473 "name": "cmd_id",5474 "id": 1,5475 "options": {5476 "default": 171605477 }5478 },5479 {5480 "rule": "required",5481 "type": "int32",5482 "name": "idx",5483 "id": 25484 }5485 ]5486 },5487 {5488 "name": "CS_NEWDAY",5489 "fields": [5490 {5491 "rule": "optional",5492 "type": "int32",5493 "name": "cmd_id",5494 "id": 1,5495 "options": {5496 "default": 172005497 }5498 }5499 ]5500 },5501 {5502 "name": "CS_GROW_AIM_ACTIVE",5503 "fields": [5504 {5505 "rule": "optional",5506 "type": "int32",5507 "name": "cmd_id",5508 "id": 1,5509 "options": {5510 "default": 172105511 }5512 },5513 {5514 "rule": "required",5515 "type": "int32",5516 "name": "grow_aim_id",5517 "id": 25518 }5519 ]5520 },5521 {5522 "name": "CS_GROW_AIM_BUY_ITEM",5523 "fields": [5524 {5525 "rule": "optional",5526 "type": "int32",5527 "name": "cmd_id",5528 "id": 1,5529 "options": {5530 "default": 172115531 }5532 },5533 {5534 "rule": "required",5535 "type": "int32",5536 "name": "grow_aim_id",5537 "id": 25538 },5539 {5540 "rule": "required",5541 "type": "int32",5542 "name": "buy_item_idx",5543 "id": 35544 }5545 ]5546 },5547 {5548 "name": "CS_FRIEND_REQ",5549 "fields": [5550 {5551 "rule": "optional",5552 "type": "int32",5553 "name": "cmd_id",5554 "id": 1,5555 "options": {5556 "default": 172305557 }5558 },5559 {5560 "rule": "required",5561 "type": "int32",5562 "name": "target_id",5563 "id": 25564 }5565 ]5566 },5567 {5568 "name": "CS_FRIEND_REQ_RESULT",5569 "fields": [5570 {5571 "rule": "optional",5572 "type": "int32",5573 "name": "cmd_id",5574 "id": 1,5575 "options": {5576 "default": 172315577 }5578 },5579 {5580 "rule": "required",5581 "type": "ResultType",5582 "name": "result",5583 "id": 25584 },5585 {5586 "rule": "required",5587 "type": "int32",5588 "name": "requestid",5589 "id": 35590 }5591 ],5592 "enums": [5593 {5594 "name": "ResultType",5595 "values": [5596 {5597 "name": "Agreed",5598 "id": 15599 },5600 {5601 "name": "Refused",5602 "id": 25603 }5604 ]5605 }5606 ]5607 },5608 {5609 "name": "CS_DEL_FRIEND",5610 "fields": [5611 {5612 "rule": "optional",5613 "type": "int32",5614 "name": "cmd_id",5615 "id": 1,5616 "options": {5617 "default": 172325618 }5619 },5620 {5621 "rule": "required",5622 "type": "int32",5623 "name": "target_id",5624 "id": 25625 }5626 ]5627 },5628 {5629 "name": "CS_GET_FRIEND_INFO",5630 "fields": [5631 {5632 "rule": "optional",5633 "type": "int32",5634 "name": "cmd_id",5635 "id": 1,5636 "options": {5637 "default": 172345638 }5639 }5640 ]5641 },5642 {5643 "name": "CS_STAGE_TEST",5644 "fields": [5645 {5646 "rule": "optional",5647 "type": "int32",5648 "name": "cmd_id",5649 "id": 1,5650 "options": {5651 "default": 333335652 }5653 },5654 {5655 "rule": "required",5656 "type": "int32",5657 "name": "stage_id",5658 "id": 25659 }5660 ]5661 },5662 {5663 "name": "CS_BATTLE_MULTI_CONNECT",5664 "fields": [5665 {5666 "rule": "optional",5667 "type": "int32",5668 "name": "cmd_id",5669 "id": 1,5670 "options": {5671 "default": 300015672 }5673 },5674 {5675 "rule": "required",5676 "type": "int32",5677 "name": "id",5678 "id": 25679 }5680 ]5681 },5682 {5683 "name": "CS_BATTLE_MULTI_SYNC_TIME_REQ",5684 "fields": [5685 {5686 "rule": "optional",5687 "type": "int32",5688 "name": "cmd_id",5689 "id": 1,5690 "options": {5691 "default": 300025692 }5693 },5694 {5695 "rule": "optional",5696 "type": "float",5697 "name": "clientTs",5698 "id": 25699 },5700 {5701 "rule": "required",5702 "type": "int32",5703 "name": "idx",5704 "id": 35705 }5706 ]5707 },5708 {5709 "name": "CS_BATTLE_MULTI_READY",5710 "fields": [5711 {5712 "rule": "optional",5713 "type": "int32",5714 "name": "cmd_id",5715 "id": 1,5716 "options": {5717 "default": 300035718 }5719 }5720 ]5721 },5722 {5723 "name": "CS_BATTLE_MULTI_HEARTBEAT",5724 "fields": [5725 {5726 "rule": "optional",5727 "type": "int32",5728 "name": "cmd_id",5729 "id": 1,5730 "options": {5731 "default": 300045732 }5733 }5734 ]5735 },5736 {5737 "name": "CS_BATTLE_MULTI_OPR",5738 "fields": [5739 {5740 "rule": "optional",5741 "type": "int32",5742 "name": "cmd_id",5743 "id": 1,5744 "options": {5745 "default": 300105746 }5747 },5748 {5749 "rule": "required",5750 "type": "float",5751 "name": "ts",5752 "id": 25753 },5754 {5755 "rule": "required",5756 "type": "int32",5757 "name": "command",5758 "id": 35759 },5760 {5761 "rule": "required",5762 "type": "int32",5763 "name": "uid",5764 "id": 45765 },5766 {5767 "rule": "repeated",5768 "type": "int32",5769 "name": "argsInt",5770 "id": 105771 },5772 {5773 "rule": "repeated",5774 "type": "float",5775 "name": "argsFloat",5776 "id": 115777 },5778 {5779 "rule": "repeated",5780 "type": "string",5781 "name": "argsString",5782 "id": 125783 }5784 ]5785 },5786 {5787 "name": "STRUCT_PLAYER_STAGE_INFO",5788 "fields": [5789 {5790 "rule": "required",5791 "type": "int32",5792 "name": "role_id",5793 "id": 15794 },5795 {5796 "rule": "optional",5797 "type": "int32",5798 "name": "is_complete",5799 "id": 2,5800 "options": {5801 "default": -15802 }5803 },5804 {5805 "rule": "optional",5806 "type": "int32",5807 "name": "start_time",5808 "id": 3,5809 "options": {5810 "default": -15811 }5812 },5813 {5814 "rule": "optional",5815 "type": "int32",5816 "name": "token",5817 "id": 4,5818 "options": {5819 "default": -15820 }5821 },5822 {5823 "rule": "optional",5824 "type": "int32",5825 "name": "health",5826 "id": 5,5827 "options": {5828 "default": -15829 }5830 },5831 {5832 "rule": "optional",5833 "type": "int32",5834 "name": "damage",5835 "id": 6,5836 "options": {5837 "default": -15838 }5839 },5840 {5841 "rule": "optional",5842 "type": "STRUCT_MISSION_INFO",5843 "name": "mission_info",5844 "id": 75845 }5846 ]5847 },5848 {5849 "name": "STRUCT_MISSION_INFO",5850 "fields": [5851 {5852 "rule": "required",5853 "type": "int32",5854 "name": "type",5855 "id": 15856 },5857 {5858 "rule": "optional",5859 "type": "int32",5860 "name": "value1",5861 "id": 2,5862 "options": {5863 "default": -15864 }5865 },5866 {5867 "rule": "required",5868 "type": "int32",5869 "name": "value2",5870 "id": 35871 },5872 {5873 "rule": "required",5874 "type": "int32",5875 "name": "number",5876 "id": 45877 }5878 ]5879 },5880 {5881 "name": "STRUCT_BATTLE_STAGE_INFO",5882 "fields": [5883 {5884 "rule": "repeated",5885 "type": "STRUCT_PLAYER_STAGE_INFO",5886 "name": "role_infos",5887 "id": 15888 },5889 {5890 "rule": "optional",5891 "type": "int32",5892 "name": "is_complete",5893 "id": 2,5894 "options": {5895 "default": -15896 }5897 },5898 {5899 "rule": "optional",5900 "type": "int32",5901 "name": "is_win",5902 "id": 3,5903 "options": {5904 "default": -15905 }5906 },5907 {5908 "rule": "optional",5909 "type": "STRUCT_MISSION_INFO",5910 "name": "mission_info",5911 "id": 45912 },5913 {5914 "rule": "optional",5915 "type": "int32",5916 "name": "percent",5917 "id": 5,5918 "options": {5919 "default": -15920 }5921 },5922 {5923 "rule": "optional",5924 "type": "int32",5925 "name": "dead_hero",5926 "id": 6,5927 "options": {5928 "default": -15929 }5930 },5931 {5932 "rule": "optional",5933 "type": "int32",5934 "name": "boss_hp",5935 "id": 7,5936 "options": {5937 "default": -15938 }5939 },5940 {5941 "rule": "optional",5942 "type": "int32",5943 "name": "star",5944 "id": 8,5945 "options": {5946 "default": -15947 }5948 }5949 ]5950 },5951 {5952 "name": "CS_ECHO",5953 "fields": [5954 {5955 "rule": "optional",5956 "type": "int32",5957 "name": "cmd_id",5958 "id": 1,5959 "options": {5960 "default": 1015961 }5962 },5963 {5964 "rule": "required",5965 "type": "string",5966 "name": "msg",5967 "id": 25968 },5969 {5970 "rule": "repeated",5971 "type": "int32",5972 "name": "data",5973 "id": 35974 },5975 {5976 "rule": "optional",5977 "type": "Color",5978 "name": "color",5979 "id": 45980 }5981 ],5982 "enums": [5983 {5984 "name": "Color",5985 "values": [5986 {5987 "name": "RED",5988 "id": 05989 },5990 {5991 "name": "BLUE",5992 "id": 15993 },5994 {5995 "name": "YELLOW",5996 "id": 15997 }5998 ],5999 "options": {6000 "allow_alias": true6001 }6002 }6003 ]6004 }6005 ]...
_api.js
Source:_api.js
1// QT4i-Instruments端-JavaScript-API2(function($) {3 UIAElementsCache = function() {4 this.caches = {};5 this.id = 0;6 this.append(UIATarget.localTarget().frontMostApp());7 };8 UIAElementsCache.prototype = {9 release_all : function() {10 this.caches = {};11 },12 release_invalid : function() {13 //for (var id in this.caches) {14 // if (!this.caches[id].isValid()) {15 // delete this.caches[id];16 // };17 //};18 },19 release : function(id) {20 //var element = this.caches[id];21 //if (!element.isValid()) {22 // delete this.caches[id];23 //};24 },25 append : function(element) {26 if (element == null || element.toString() == "[object UIAElementNil]") {27 return undefined;28 }29 var id = (this.id += 1);30 this.caches[id] = element;31 return id;32 },33 append_elements : function(elements) {34 var ids = new Array();35 for (var i = 0; i < elements.length; i++) {36 ids.push(this.append(elements[i]));37 };38 return ids;39 },40 set : function(id, element) {41 if (this.caches[id]) {42 this.caches[id] = element;43 return true;44 };45 return false;46 },47 get : function(id) {48 this.set(1, UIATarget.localTarget().frontMostApp());49 if ( typeof id == 'number') {50 var element = this.caches[id];51 if (element) {52 //if (element.isValid()) {53 return element;54 //} else {55 // this.release(id);56 //};57 };58 };59 if ( typeof id == 'string' && new RegExp(/^\/classname *\= *(\'|\")\w+(\'|\").*$/i).test(id)) {60 var element = $.QPath(id).findElement(0);61 if (element) {62 return element;63 };64 throw new Error("element not found: " + id);65 };66 throw new Error("element id is invalid: " + id);67 }68 };69})($);70// -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*-71(function($) {72 var uia_elements_cache = new UIAElementsCache();73 var switch_locator = function(strategy, locator) {74 switch(strategy.toLocaleLowerCase()) {75 case 'qpath':76 return $.QPath(locator);77 };78 };79 var last_alert_msg = null;80 var flag_alert_auto_handled = Environment.flag_alert_auto_handled ? Environment.flag_alert_auto_handled : false;81 var rules_of_alert_auto_handle = Environment.rules_of_alert_auto_handle ? Environment.rules_of_alert_auto_handle : new Array();82 UIATarget.onAlert = function(alert) {83 alert.logElementTreeExt();84 $.log("enter onAlert flag_alert_auto_handled: "+$.str.objectToString(flag_alert_auto_handled))85 var texts = alert.getAllTexts();86 last_alert_msg = texts;87 var buttons = [];88 buttons = alert.getElementsByClassName('^UIAButton$');89 if (buttons.length == 0) {90 buttons = alert.getElementsByClassName('^UIACollectionCell$');91 };92 if (buttons.length == 0) {93 buttons = alert.getElementsByClassName('^UIATableCell$');94 };95 for (var rule_i = 0; rule_i < rules_of_alert_auto_handle.length; rule_i++) {96 var rule = rules_of_alert_auto_handle[rule_i];97 for (var text_i = 0; text_i < texts.length; text_i++) {98 var text = texts[text_i];99 if (rule.message_text == text || new RegExp(rule.message_text).test(text)) {100 if (rule.button_text) {101 for (var button_i = 0; button_i < buttons.length; button_i++) {102 var button = buttons[button_i];103 var button_texts = button.getAllTexts();104 for (var button_text_i = 0; button_text_i < button_texts.length; button_text_i++) {105 var button_text = button_texts[button_text_i];106 if (rule.button_text == button_text || new RegExp(rule.button_text).test(button_text)) {107 button.tap();108 //for(var delay_i=0; delay_i<30; delay_i++){109 // UIATarget.localTarget().delay(0.1);110 // if (alert.isValid()==false){111 // return true;112 // };113 //};114 $.log("onAlert double matched: "+$.str.objectToString(flag_alert_auto_handled))115 return true;116 };117 };118 };119 };120 $.log("onAlert single matched: "+$.str.objectToString(flag_alert_auto_handled))121 return true;122 };123 };124 };125 $.log("onAlert no matched: "+$.str.objectToString(flag_alert_auto_handled))126 return flag_alert_auto_handled;127 };128 // -*- -*- -*- -*- -*- -*-129 api = {130 'DoNotReturn' : encodeURIComponent("<<<[[[DoNotReturn]]]>>>"),131 // -*- -*- -*- -*- -*- -*-132 'uia.release' : function(cmd_id) {133 /**134 * ç»æ¢å¹¶éåºDriver135 * Returns136 * 'released' - ç»æ¢å®æ¯137 */138 return bootstrap.release();139 },140 'uia.set_cmd_fetch_delegate_timeout' : function(cmd_id, seconds) {141 /**142 * 设置cmd_fetch_delegateçè¶
æ¶å¼143 * Paramaters:144 * seconds - ç§145 */146 var seconds = parseInt(seconds);147 if (seconds > 0) {148 Environment.cmd_fetch_delegate_timeout = seconds;149 };150 },151 'uia.get_cmd_fetch_delegate_timeout' : function(cmd_id) {152 /**153 * è·åcmd_fetch_delegateçè¶
æ¶å¼154 * Returns155 * seconds - ç§156 */157 return Environment.cmd_fetch_delegate_timeout;158 },159 'uia.uia_elements_cache.release_all' : function(cmd_id) {160 /**161 * æ¸
空ææçelementsçç¼åï¼å¼å¸¸æ¶ä¼èªå¨æ¸
çï¼elementæ ææ¶ä¼èªå¨æ¸
çï¼162 */163 uia_elements_cache.release_all();164 },165 'uia.uia_elements_cache.release_invalid' : function(cmd_id) {166 /**167 * æ¸
空æ æçelementçç¼åï¼å¼å¸¸æ¶ä¼èªå¨æ¸
çï¼elementæ ææ¶ä¼èªå¨æ¸
çï¼168 */169 uia_elements_cache.release_invalid();170 },171 'uia.uia_elements_cache.release_element' : function(cmd_id, id) {172 /**173 * æ¸
çæå®elementçç¼å174 * Paramaters:175 * id - elementçid176 */177 uia_elements_cache.release(id);178 },179 'uia.front_most_app' : function(cmd_id) {180 return uia_elements_cache.append(UIATarget.localTarget().frontMostApp());181 },182 // -*- -*- -*- -*- -*- -*-183 'uia.element.function' : function(cmd_id, id, func, args) {184 /**185 * è°ç¨æå®elementçåçå½æ°ï¼UIAElementï¼186 * Paramaters:187 * id - elementçid188 * func - å½æ°å189 * args - å½æ°çæåºåæ°éå190 * Returns:191 * return value - 被è°ç¨å½æ°çè¿åå¼ï¼åºç¡ç±»åï¼192 */193 var element = uia_elements_cache.get(id);194 var args = args ? args : [];195 if (element[func]) {196 return element[func].apply(element, args);197 };198 throw new Error('uia.element.function "func: ' + func + '" is invalid.');199 },200 'uia.element.is_valid' : function(cmd_id, id) {201 try {202 uia_elements_cache.get(id);203 return true;204 } catch(e) {205 return false;206 };207 },208 'uia.element.find' : function(cmd_id, locator, timeout, interval, strategy, parent_id) {209 /**210 * æ¥æ¾å个element对象ï¼è¿åæ¥æ¾å°çelement对象çç¼åidãä¸æå®parent_idåä»UIAApplicationä¸å¼å§æç´¢ã211 * 第ä¸ä¸ªå¯¹è±¡æ°¸è¿æ¯UIAApplication - è¿æ¯ä¸ºäºå
¼å®¹Pythonå±Windowå°è£
ä¸åPathã212 * Paramaters:213 * locator - å®ä½elementçå符串ï¼ä¾å¦: "/classname='UIAWindow'"214 * parent_id - ç¶elementçidï¼å¦ä¸æå®åä»UIAApplicationä¸æ¥æ¾215 * timeout - æ¥æ¾elementçè¶
æ¶å¼ï¼åä½: ç§ï¼216 * strategy - locatorçç±»åï¼ä¾å¦: "qpath"217 * Returns - json: {'element': id, 'path': <encode str>, 'valid_path_part': <encode str>, 'invalid_path_part': <encode str>, 'find_count': <int>, "find_time": int}218 */219 var strategy = strategy ? strategy : 'qpath';220 var locator = switch_locator(strategy, locator);221 var parent = parent_id ? uia_elements_cache.get(parent_id) : null;222 var timeout = timeout ? (timeout * 1000 - 80) : 0;223 var interval = interval ? (interval * 1000) : 10;224 var result = locator.findElement(timeout, interval, parent);225 var element = result['element'];226 var element_id = element ? uia_elements_cache.append(element) : null;227 result['element'] = element_id;228 $.log("TORPC: " + $.str.objectToString({'id':cmd_id, 'result':result}));229 return api.DoNotReturn;230 },231 'uia.element.find_elements' : function(cmd_id, locator, timeout, interval, strategy, parent_id) {232 /**233 * æ¥æ¾å¤ä¸ªelement对象ï¼è¿åæ¥æ¾å°çelement对象çç¼åçidéåãä¸æå®parent_idåä»UIAApplicationä¸å¼å§æç´¢ã234 * Paramaters:235 * locator - å®ä½elementçå符串ï¼ä¾å¦: "/classname='UIAWindow'"236 * parent_id - ç¶elementçidï¼å¦ä¸æå®åä»UIAApplicationä¸æ¥æ¾237 * timeout - æ¥æ¾elementçè¶
æ¶å¼ï¼åä½: ç§ï¼238 * strategy - locatorçç±»åï¼ä¾å¦: "qpath"239 * Returns - json: {'elements': [{'element':id, 'attributes':<encode str>}], 'path': <encode str>, 'valid_path_part': <encode str>, 'invalid_path_part': <encode str>, 'find_count': <int>, "find_time": int}240 */241 var strategy = strategy ? strategy : 'qpath';242 var locator = switch_locator(strategy, locator);243 var parent = parent_id ? uia_elements_cache.get(parent_id) : null;244 var timeout = timeout ? (timeout * 1000 - 100) : 0;245 var interval = interval ? (interval * 1000) : 10;246 var result = locator.findElements(timeout, interval, parent);247 var elements = result['elements'];248 var elements_dict = new Array();249 for (var i=0; i<elements.length; i++){250 var element_id = uia_elements_cache.append(elements[i]);251 var element_dict = encodeURIComponent($.str.objectToString(elements[i].getElementDict()));252 elements_dict.push({'element': element_id, 'attributes': element_dict});253 };254 result['elements'] = elements_dict;255 $.log("TORPC: " + $.str.objectToString({'id':cmd_id, 'result':result}));256 return api.DoNotReturn;257 },258 'uia.element.first_with_name' : function(cmd_id, id, name) {259 /**260 * éè¿nameææ¬è·å第ä¸ä¸ªå¹é
çåelement261 * Paramaters:262 * id - elementçid263 * name - é¢æåelementçname264 * Returns:265 * id - åæ§ä»¶çid266 */267 var root = uia_elements_cache.get(id);268 var elem = root.elements().firstWithName(name);269 return uia_elements_cache.append(elem);270 },271 'uia.element.with_name' : function(cmd_id, id, name) {272 /**273 * éè¿nameææ¬è·åå¹é
çåelements274 * Paramaters:275 * id - elementçid276 * name - é¢æåelementçname277 * Returns:278 * id - åæ§ä»¶çidéå279 */280 var root = uia_elements_cache.get(id);281 var elems = root.elements().withName(name);282 return uia_elements_cache.append_elements(elems);283 },284 'uia.element.first_with_predicate' : function(cmd_id, id, predicate) {285 /**286 * éè¿predicateææ¬è·å第ä¸ä¸ªå¹é
çåelement287 * Paramaters:288 * id - elementçid289 * predicate - é¢æåelementçpredicate ï¼ä¾å¦ï¼âname beginswith 'xxx'âï¼290 * Returns:291 * id - åæ§ä»¶çid292 */293 var root = uia_elements_cache.get(id);294 var elem = root.elements().firstWithPredicate(predicate);295 return uia_elements_cache.append(elem);296 },297 'uia.element.with_predicate' : function(cmd_id, id, predicate) {298 /**299 * éè¿predicateææ¬è·åå¹é
çåelements300 * Paramaters:301 * id - elementçid302 * predicate - é¢æåelementçpredicate ï¼ä¾å¦ï¼âname beginswith âxxx'âï¼303 * Returns:304 * id - åæ§ä»¶çidéå305 */306 var root = uia_elements_cache.get(id);307 var elems = root.elements().withPredicate(predicate);308 return uia_elements_cache.append_elements(elems);309 },310 'uia.element.first_with_value_for_key' : function(cmd_id, id, key, value) {311 /**312 * éè¿å¹é
æå®keyçvalueï¼è·å第ä¸ä¸ªå¹é
çåelement313 * Paramaters:314 * id - elementçid315 * key - key ï¼ä¾å¦ï¼labelãnameãvalueï¼316 * value - 对åºkeyçvalueå¼317 * Returns:318 * id - åæ§ä»¶çid319 */320 var root = uia_elements_cache.get(id);321 var elem = root.elements().firstWithValueForKey(value, key);322 return uia_elements_cache.append(elem);323 },324 'uia.element.with_value_for_key' : function(cmd_id, id, key, value) {325 /**326 * éè¿å¹é
æå®keyçvalueï¼è·åå¹é
çåelements327 * Paramaters:328 * id - elementçid329 * key - key ï¼ä¾å¦ï¼labelãnameãvalueï¼330 * value - 对åºkeyçvalueå¼331 * Returns:332 * id - åæ§ä»¶çidéå333 */334 var root = uia_elements_cache.get(id);335 var elems = root.elements().withValueForKey(value, key);336 return uia_elements_cache.append_elements(elems);337 },338 'uia.element.get_parent' : function(cmd_id, id) {339 /**340 * è·åæå®elementçç¶elementçid341 * Paramaters:342 * id - elementçid343 * Returns:344 * id - ç¶elementçid345 */346 var parent = uia_elements_cache.get(id).parent();347 return parent ? uia_elements_cache.append(parent) : undefined;348 },349 'uia.element.get_children' : function(cmd_id, id) {350 /**351 * è·åæå®elementçåelementséå352 * Paramaters:353 * id - elementçid354 * Returns:355 * [id, ...] - åelementsçidéå356 */357 var elements = uia_elements_cache.get(id).elements();358 return elements.length > 0 ? uia_elements_cache.append_elements(elements) : [];359 },360 'uia.element.get_attr' : function(cmd_id, id, name) {361 /**362 * è·åæå®elementçå±æ§363 * Paramaters:364 * id - elementçid365 * name - å±æ§åï¼ä¾å¦: nameãlableãvalue366 * Returns:367 * attr value - è¿ååºç¡ç±»åçæ°æ®368 */369 var name = name.toLowerCase();370 if (new RegExp(/^isEnabled$|^enabled$|^isValid$|^valid$|^isVisible$|^visible$|^hasKeyboardFocus$|^focus$/i).test(name)) {371 switch (name) {372 case "isenabled":373 name = "isEnabled";374 break;375 case "enabled":376 name = "isEnabled";377 break;378 case "isvalid":379 name = "isValid";380 break;381 case "valid":382 name = "isValid";383 break;384 case "isvisible":385 name = "isVisible";386 break;387 case "visible":388 name = "isVisible";389 break;390 case "haskeyboardfocus":391 name = "hasKeyboardFocus";392 break;393 case "focus":394 name = "hasKeyboardFocus";395 break;396 };397 };398 return api['uia.element.function'](cmd_id, id, name);399 },400 'uia.element.get_rect' : function(cmd_id, id) {401 /**402 * è·åæå®elementçåæ åé¿å®½403 * Paramaters:404 * id - element id405 * Returns:406 * JSON - åæ åé¿å®½407 */408 return uia_elements_cache.get(id).rect();409 },410 'uia.element.capture' : function(cmd_id, id, path) {411 /**412 * æªå¾ï¼æªåæå®elementçå¾çï¼å¹¶å°å¾çè¾åºè³æå®çè·¯å¾ï¼413 * Paramaters:414 * path - å°å¾çåå¨è³è¯¥è·¯å¾ï¼pngæ ¼å¼ï¼ï¼ä¾å¦ï¼/Users/tester/Desktop/test.png415 * ä¸ä¼ è·¯å¾ æ è·¯å¾ä»
å«æ件åï¼åæªå¾ååå¨è³é»è®¤è·¯å¾ï¼é»è®¤è·¯å¾å
åå¨çå¾çæ¯æ¬¡éå¯é½ä¼è¢«æ¸
空ï¼ã416 */417 var rect = uia_elements_cache.get(id).rect();418 return api['uia.target.capture_rect'](cmd_id, rect, path);419 },420 'uia.element.tap' : function(cmd_id, id, x, y) {421 /**422 * ç¹å»æå®çelement423 * Paramaters:424 * id - element id425 * x - xåæ ï¼ç¸å¯¹äºå½åelementï¼ï¼å¯ä¸ä¼ å
¥è¯¥åæ°426 * y - yåæ ï¼ç¸å¯¹äºå½åelementï¼ï¼å¯ä¸ä¼ å
¥è¯¥åæ°427 */428 var element = uia_elements_cache.get(id);429 var rect = element.rect();430 var size = rect['size'];431 var x = size['width'] * x;432 var y = size['height'] * y;433 //element.scrollToVisible();434 element.tap(x, y);435 },436 'uia.element.double_tap' : function(cmd_id, id, x, y) {437 /**438 * åå»æå®çelement439 * Paramaters:440 * id - element id441 * x - xåæ ï¼ç¸å¯¹äºå½åelementï¼ï¼å¯ä¸ä¼ å
¥è¯¥åæ°442 * y - yåæ ï¼ç¸å¯¹äºå½åelementï¼ï¼å¯ä¸ä¼ å
¥è¯¥åæ°443 */444 if (x && y) {445 for (var i = 0; i < 2; i++) {446 api['uia.element.tap'](cmd_id, id, x, y);447 };448 } else {449 var element = uia_elements_cache.get(id);450 //element.scrollToVisible();451 element.doubleTap();452 };453 },454 'uia.element.tap_with_options' : function(cmd_id, id, options) {455 /**456 * èªå®ä¹ç¹å»457 * Paramaters:458 * id - element id459 * options = {460 * tapCount : 1, // 轻触次æ°461 * touchCount : 1, // 触æ¸ç¹462 * duration : 1, // æç»æ¶é´463 * tapOffset : { x: 1.0, y: 0.1 } // 轻触å移ç¾åæ¯464 * }465 */466 var element = uia_elements_cache.get(id);467 //element.scrollToVisible();468 element.tapWithOptions(options);469 },470 'uia.element.click' : function(cmd_id, id, x, y) {471 /**472 * ç¹å»æå®çelement(éé
QTA)473 * Paramaters:474 * id - element id475 * x - xåæ ï¼ç¸å¯¹äºå½åelementï¼ï¼å¯ä¸ä¼ å
¥è¯¥åæ°476 * y - yåæ ï¼ç¸å¯¹äºå½åelementï¼ï¼å¯ä¸ä¼ å
¥è¯¥åæ°477 */478 api['uia.element.tap'](cmd_id, id, x, y);479 },480 'uia.element.double_click' : function(cmd_id, id, x, y) {481 /**482 * åå»æå®çelement483 * Paramaters:484 * id - element id485 * x - xåæ ï¼ç¸å¯¹äºå½åelementï¼ï¼å¯ä¸ä¼ å
¥è¯¥åæ°486 * y - yåæ ï¼ç¸å¯¹äºå½åelementï¼ï¼å¯ä¸ä¼ å
¥è¯¥åæ°487 */488 api['uia.element.double_tap'](cmd_id, id, x, y);489 },490 'uia.element.drag_inside_with_options' : function(cmd_id, id, options) {491 /**492 * ææ½493 * Paramaters:494 * id - element id495 * options = {496 * touchCount : 1, // 触æ¸ç¹497 * duration : 0.5, // æ¶é´498 * startOffset : { x: 0.0, y: 0.1}, // å移ç¾åæ¯499 * endOffset : { x: 1.0, y: 0.1 }, // å移ç¾åæ¯500 * repeat : 1 // éå¤è¯¥æä½501 * interval : 0 // éå¤è¯¥æä½çé´éæ¶é´ï¼ç§ï¼502 * }503 */504 var repeat = options.repeat ? options.repeat : 1;505 var interval = options.interval ? options.interval : 0;506 for (var i = 0; i < repeat; i++) {507 uia_elements_cache.get(id).dragInsideWithOptions(options);508 if (repeat > 1 && interval > 0) {509 UIATarget.localTarget().delay(interval);510 };511 };512 },513 'uia.element.drag_inside_right_to_left' : function(cmd_id, id) {514 /**515 * åæå¨æ§ä»¶çä¸å¤®ä»å³åå·¦ææ½ï¼åé¿æ§ä»¶è¾¹ç¼ï¼ææ½è¿ç¨ä½¿ç¨1ç§ï¼516 */517 var _options = {518 touchCount : 1,519 duration : 1.5,520 startOffset : {521 x : 0.5,522 y : 0.5523 },524 endOffset : {525 x : 0.1,526 y : 0.5527 }528 };529 uia_elements_cache.get(id).dragInsideWithOptions(_options);530 },531 'uia.element.drag_inside_left_to_right' : function(cmd_id, id) {532 /**533 * åæå¨æ§ä»¶çä¸å¤®ä»å·¦åå³ææ½ï¼åé¿æ§ä»¶è¾¹ç¼ï¼ææ½è¿ç¨ä½¿ç¨1ç§ï¼534 */535 var _options = {536 touchCount : 1,537 duration : 1.5,538 startOffset : {539 x : 0.5,540 y : 0.5541 },542 endOffset : {543 x : 0.9,544 y : 0.5545 }546 };547 uia_elements_cache.get(id).dragInsideWithOptions(_options);548 },549 'uia.element.drag_inside_up_to_down' : function(cmd_id, id) {550 /**551 * åæå¨æ§ä»¶çä¸å¤®ä»ä¸åä¸ææ½ï¼åé¿æ§ä»¶è¾¹ç¼ï¼ææ½è¿ç¨ä½¿ç¨1ç§ï¼552 */553 var _options = {554 touchCount : 1,555 duration : 1.5,556 startOffset : {557 x : 0.5,558 y : 0.5559 },560 endOffset : {561 x : 0.5,562 y : 0.9563 }564 };565 uia_elements_cache.get(id).dragInsideWithOptions(_options);566 },567 'uia.element.drag_inside_down_to_up' : function(cmd_id, id) {568 /**569 * åæå¨æ§ä»¶çä¸å¤®ä»ä¸åä¸ææ½ï¼åé¿æ§ä»¶è¾¹ç¼ï¼ææ½è¿ç¨ä½¿ç¨1ç§ï¼570 */571 var _options = {572 touchCount : 1,573 duration : 1.5,574 startOffset : {575 x : 0.5,576 y : 0.5577 },578 endOffset : {579 x : 0.5,580 y : 0.1581 }582 };583 uia_elements_cache.get(id).dragInsideWithOptions(_options);584 },585 'uia.element.flick_inside_with_options' : function(cmd_id, id, options) {586 /**587 * å¼¹å»/æå»588 * Paramaters:589 * id - element id590 * options = {591 * touchCount : 1, // 触æ¸ç¹592 * startOffset : { x: 0.5, y: 0.9 }, // å移ç¾åæ¯593 * endOffset : { x: 1.0, y: 0.9 } // å移ç¾åæ¯594 * repeat : 1 // éå¤è¯¥æä½595 * interval : 0 // éå¤è¯¥æä½çé´éæ¶é´ï¼ç§ï¼596 * }597 */598 var repeat = options.repeat ? options.repeat : 1;599 var interval = options.interval ? options.interval : 0;600 for (var i = 0; i < repeat; i++) {601 uia_elements_cache.get(id).flickInsideWithOptions(options);602 if (repeat > 1 && interval > 0) {603 UIATarget.localTarget().delay(interval);604 };605 };606 },607 'uia.element.flick_inside_right_to_left' : function(cmd_id, id) {608 /**609 * åæå¨æ§ä»¶ä¸å¤®ä»å³å左弹å»/æå»ï¼åé¿æ§ä»¶è¾¹ç¼ï¼610 */611 var _options = {612 touchCount : 1,613 startOffset : {614 x : 0.5,615 y : 0.5616 },617 endOffset : {618 x : 0.1,619 y : 0.5620 }621 };622 uia_elements_cache.get(id).flickInsideWithOptions(_options);623 },624 'uia.element.flick_inside_left_to_right' : function(cmd_id, id) {625 /**626 * åæå¨æ§ä»¶ä¸å¤®ä»å·¦åå³å¼¹å»/æå»ï¼åé¿æ§ä»¶è¾¹ç¼ï¼627 */628 var _options = {629 touchCount : 1,630 startOffset : {631 x : 0.5,632 y : 0.5633 },634 endOffset : {635 x : 0.9,636 y : 0.5637 }638 };639 uia_elements_cache.get(id).flickInsideWithOptions(_options);640 },641 'uia.element.flick_inside_up_to_down' : function(cmd_id, id) {642 /**643 * åæå¨æ§ä»¶ä¸å¤®ä»ä¸åä¸å¼¹å»/æå»ï¼åé¿æ§ä»¶è¾¹ç¼ï¼644 */645 var _options = {646 touchCount : 1,647 startOffset : {648 x : 0.5,649 y : 0.5650 },651 endOffset : {652 x : 0.5,653 y : 0.9654 }655 };656 uia_elements_cache.get(id).flickInsideWithOptions(_options);657 },658 'uia.element.flick_inside_down_to_up' : function(cmd_id, id) {659 /**660 * åæå¨æ§ä»¶ä¸å¤®ä»ä¸åä¸å¼¹å»/æå»ï¼åé¿æ§ä»¶è¾¹ç¼ï¼661 */662 var _options = {663 touchCount : 1,664 startOffset : {665 x : 0.5,666 y : 0.5667 },668 endOffset : {669 x : 0.5,670 y : 0.1671 }672 };673 uia_elements_cache.get(id).flickInsideWithOptions(_options);674 },675 'uia.element.rotate_with_options' : function(cmd_id, id, options) {676 /**677 * æ转678 * Paramaters:679 * id - element id680 * options = {681 * centerOffset : {x:0.0, y:0.0}, // ä¸å¿ç¹682 * duration : 1.5, // æç»æ¶é´683 * radius : 100, // åå¾684 * rotation : 100, // æ转弧度çé¿åº¦ï¼é»è®¤ä¸ºåå¨çPI685 * touchCount : 2 // 触æ¸ç¹ï¼æ大5个ç¹ï¼è¿éé»è®¤2个ï¼686 * }687 */688 uia_elements_cache.get(id).rotateWithOptions(options);689 },690 'uia.element.scroll_to_visible' : function(cmd_id, id) {691 /**692 * èªå¨æ»å¨å°è¯¥element为å¯è§693 * Paramaters:694 * id - element id695 */696 uia_elements_cache.get(id).scrollToVisible();697 // --- --- --- retryæ æ698 //var element = uia_elements_cache.get(id);699 //var retry = retry ? retry : 5;700 //var target = UIATarget.localTarget();701 //var error = null;702 //for (var i = 0; i < retry; i++) {703 // try {704 // element.scrollToVisible();705 // return;706 // } catch(e) {707 // target.delay(1);708 // error = e;709 // };710 //};711 //throw error;712 // --- --- ---713 },714 'uia.element.touch_and_hold' : function(cmd_id, id, duration) {715 /**716 * æç»æä½717 * Paramaters:718 * id - element id719 * duration - æä½å¤é¿æ¶é´ï¼ç§ï¼720 */721 uia_elements_cache.get(id).touchAndHold(duration);722 },723 'uia.element.two_finger_tap' : function(cmd_id, id) {724 /**725 * äºæ轻触726 * Paramaters:727 * id - element id728 */729 uia_elements_cache.get(id).twoFingerTap();730 },731 'uia.element.wait_for_invalid' : function(cmd_id, id, timeout) {732 /**733 * çå¾
å½åelementç´å°æ æ734 * Paramaters:735 * id - element id736 * timeout - è¶
æ¶å¼ï¼ç§ï¼737 */738 var element = uia_elements_cache.get(id);739 var timeout = timeout ? timeout : 5;740 var target = UIATarget.localTarget();741 target.pushTimeout(timeout);742 var result = element.waitForInvalid();743 target.popTimeout();744 return result;745 },746 'uia.element.set_value' : function(cmd_id, id, value) {747 /**748 * 设置æå®elementçvalue749 * Paramaters:750 * id - element id751 * value - å¼752 */753 uia_elements_cache.get(id).setValue(value);754 },755 'uia.element.drag_to_value' : function(cmd_id, id, value) {756 /**757 * 设置æå®sliderçvalue758 * Paramaters:759 * id - element id760 * value - å¼761 */762 uia_elements_cache.get(id).dragToValue(value);763 }, 764 'uia.element.sent_keys' : function(cmd_id, id, keys) {765 /**766 * å¨æå®elementä¸é®çè¾å
¥767 * Paramaters:768 * id - element id769 * keys - é®å
¥çå符串770 */771 var elem = uia_elements_cache.get(id);772 elem.tap();773 elem.typeString(keys);774 },775 'uia.element.get_element_dict' : function(cmd_id, id) {776 /**777 * è·åæå®elementçå±æ§ä¿¡æ¯778 * Returns779 * JSON String - å±æ§780 */781 var dict = uia_elements_cache.get(id).getElementDict();782 var result = encodeURIComponent($.str.objectToString(dict, true));783 $.log("TORPC: " + $.str.objectToString({784 'id' : cmd_id,785 'result' : result786 }));787 return api.DoNotReturn;788 },789 'uia.element.log_element_dict' : function(cmd_id, id) {790 /**791 * æå°å¹¶è·åæå®elementçå±æ§ä¿¡æ¯792 * Returns793 * JSON String - å±æ§794 */795 var dict = uia_elements_cache.get(id).logElementDict();796 var result = encodeURIComponent($.str.objectToString(dict, true));797 $.log("TORPC: " + $.str.objectToString({798 'id' : cmd_id,799 'result' : result800 }));801 return api.DoNotReturn;802 },803 'uia.element.get_element_tree' : function(cmd_id, id) {804 /**805 * è·åæå®elementçææååelementæ 806 * Paramaters:807 * id - elementçid808 * Returns:809 * JSON - ååèç¹æ 810 */811 var dict = uia_elements_cache.get(id).getElementTree();812 var result = encodeURIComponent($.str.objectToString(dict, true));813 $.log("TORPC: " + $.str.objectToString({814 'id' : cmd_id,815 'result' : result816 }));817 return api.DoNotReturn;818 },819 'uia.element.log_element_tree_ext' : function(cmd_id, id) {820 /**821 * ä»æå®elementå¼å§è·åUIæ 822 * Returns823 * JSON String - UIæ 824 */825 var dict = uia_elements_cache.get(id).logElementTreeExt();826 var result = encodeURIComponent($.str.objectToString(dict, true));827 $.log("TORPC: " + $.str.objectToString({828 'id' : cmd_id,829 'result' : result830 }));831 return api.DoNotReturn;832 },833 // -*- -*- -*- -*- -*- -*-834 'uia.application.function' : function(cmd_id, func, args) {835 /**836 * è°ç¨UIAApplicationçåçå½æ°837 * Paramaters:838 * func - å½æ°å839 * args - å½æ°çæåºåæ°é840 * Returns:841 * return value - 被è°ç¨å½æ°çè¿åå¼ï¼åºç¡ç±»åï¼842 */843 var app = UIATarget.localTarget().frontMostApp();844 var args = args ? args : [];845 if (app[func]) {846 return app[func].apply(app, args);847 };848 throw new Error('uia.application.function "func: ' + func + '" is invalid.');849 },850 //'uia.application.get_attr' : function(cmd_id, name) {851 // /**852 // * è·åUIAApplicationçå±æ§853 // * Paramaters:854 // * name - å±æ§åï¼ä¾å¦: nameãlableãvalue855 // * Returns:856 // * attr value - è¿ååºç¡ç±»åçæ°æ®857 // */858 // return api['uia.application.function'](cmd_id, name);859 //},860 'uia.application.get_main_window' : function(cmd_id) {861 /**862 * è·åAppç主çªå£863 * Returns864 * id - elementçid865 */866 return uia_elements_cache.append(UIATarget.localTarget().frontMostApp().mainWindow());867 },868 'uia.application.get_interface_orientation' : function(cmd_id) {869 /**870 * è·åæ¥å£æ¹å871 * Returns872 * number - 表示æ¹å873 */874 return UIATarget.localTarget().frontMostApp().interfaceOrientation();875 },876 'uia.application.get_app_bundle_id' : function(cmd_id) {877 /**878 * è·åAppçbundleID879 * Returns880 * string - bundleID881 */882 return UIATarget.localTarget().frontMostApp().bundleID();883 },884 'uia.application.get_app_version' : function(cmd_id) {885 /**886 * è·åAppçversion887 * Returns888 * string - version889 */890 return UIATarget.localTarget().frontMostApp().version();891 },892 // -*- -*- -*- -*- -*- -*-893 'uia.target.function' : function(cmd_id, func, args) {894 /**895 * è°ç¨UIATargetçåçå½æ°ï¼æ³¨ï¼deviceå½å空é´å¯¹åºUIATarget对象ï¼896 * Paramaters:897 * func - å½æ°å898 * args - å½æ°çæåºåæ°é899 * Returns:900 * return value - 被è°ç¨å½æ°çè¿åå¼ï¼åºç¡ç±»åï¼901 */902 var target = UIATarget.localTarget();903 var args = args ? args : [];904 if (target[func]) {905 return target[func].apply(target, args);906 };907 throw new Error('uia.target.function "func: ' + func + '" is invalid.');908 },909 //'uia.target.get_attr' : function(cmd_id, name) {910 // /**911 // * è·åUIATargetçå±æ§912 // * Paramaters:913 // * name - å±æ§åï¼ä¾å¦: nameãlableãvalue914 // * Returns:915 // * attr value - è¿ååºç¡ç±»åçæ°æ®916 // */917 // return api['uia.target.function'](cmd_id, name);918 //},919 'uia.target.get_rect' : function(cmd_id) {920 /**921 * è·å设å¤å±å¹å¤§å°922 * Returns:923 * 宽é«924 */925 return UIATarget.localTarget().rect();926 },927 'uia.target.get_model' : function(cmd_id) {928 /**929 * è·å设å¤æ¨¡å930 * Returns:931 * string932 */933 return UIATarget.localTarget().model();934 },935 'uia.target.get_name' : function(cmd_id) {936 /**937 * è·å设å¤å938 * Returns:939 * string940 */941 return UIATarget.localTarget().name();942 },943 'uia.target.get_system_name' : function(cmd_id) {944 /**945 * è·åç³»ç»å946 * Returns:947 * string948 */949 return UIATarget.localTarget().systemName();950 },951 'uia.target.get_system_version' : function(cmd_id) {952 /**953 * è·åç³»ç»çæ¬954 * Returns:955 * string956 */957 return UIATarget.localTarget().systemVersion();958 },959 'uia.target.capture_rect' : function(cmd_id, rect, path) {960 /**961 * æªå¾ï¼æå®åºåæªå¾ï¼å¹¶å°å¾çè¾åºè³æå®çè·¯å¾ï¼962 * Paramaters:963 * rect - æå®åºå964 * {965 * origin : { x: xposition, y: yposition },966 * size : { width: widthvalue, height: heightvalue}967 * }968 * path - å°å¾çåå¨è³è¯¥è·¯å¾ï¼pngæ ¼å¼ï¼ï¼ä¾å¦ï¼/Users/tester/Desktop/test.png969 * ä¸ä¼ è·¯å¾ æ è·¯å¾ä»
å«æ件åï¼åæªå¾ååå¨è³é»è®¤è·¯å¾ï¼é»è®¤è·¯å¾å
åå¨çå¾çæ¯æ¬¡éå¯é½ä¼è¢«æ¸
空ï¼ã970 */971 var name = String(new Date().getTime());972 if (path) {973 var nodes = path.split('/');974 if (nodes[nodes.length - 1].length > 0) {975 name = nodes[nodes.length - 1].replace(/\.\w{3,4} *$/, '');976 nodes[nodes.length - 1] = name;977 };978 path = nodes.join('/');979 };980 if (!new RegExp('^/').test(path)) {981 path = [Environment.screen_shot_path, name].join('/');982 };983 UIATarget.localTarget().captureRectWithName(rect, name);984 name += '.png';985 path += '.png';986 $.log('ScreenshotCaptured: {"name": "' + name + '", "path": "' + path + '"}');987 return path;988 },989 'uia.target.capture_screen' : function(cmd_id, path) {990 /**991 * æªå±(å°è¾åºå¾çè³æå®çè·¯å¾)992 * Paramaters:993 * path - å°å¾çåå¨è³è¯¥è·¯å¾ï¼pngæ ¼å¼ï¼ï¼ä¾å¦ï¼/Users/tester/Desktop/test.png994 * - ä¸ä¼ è·¯å¾ æ è·¯å¾ä»
å«æ件åï¼åæªå¾ååå¨è³é»è®¤è·¯å¾ï¼é»è®¤è·¯å¾å
åå¨çå¾çæ¯æ¬¡éå¯é½ä¼è¢«æ¸
空ï¼ã995 */996 var name = String(new Date().getTime());997 if (path) {998 var nodes = path.split('/');999 if (nodes[nodes.length - 1].length > 0) {1000 name = nodes[nodes.length - 1].replace(/\.\w{3,4} *$/, '');1001 nodes[nodes.length - 1] = name;1002 };1003 path = nodes.join('/');1004 };1005 if (!new RegExp('^/').test(path)) {1006 path = [Environment.screen_shot_path, name].join('/');1007 };1008 UIATarget.localTarget().captureScreenWithName(name);1009 name += '.png';1010 path += '.png';1011 $.log('ScreenshotCaptured: {"name": "' + name + '", "path": "' + path + '"}');1012 return path;1013 },1014 'uia.target.get_element_tree_and_capture_screen' : function(cmd_id, path) {1015 /**1016 * è·åUIæ 并æªå±ï¼è¾åºçJSONå符串æ°æ®éè¦URL解ç ï¼1017 * Paramaters:1018 * path - å°å¾çåå¨è³è¯¥è·¯å¾ï¼pngæ ¼å¼ï¼ï¼ä¾å¦ï¼/Users/tester/Desktop/test.png1019 * - ä¸ä¼ è·¯å¾ æ è·¯å¾ä»
å«æ件åï¼åæªå¾ååå¨è³é»è®¤è·¯å¾ï¼é»è®¤è·¯å¾å
åå¨çå¾çæ¯æ¬¡éå¯é½ä¼è¢«æ¸
空ï¼ã1020 * Returns:1021 * Dict - { element_tree: {}, capture_screen: file_path }1022 */1023 $.log("TORPC: " + $.str.objectToString({1024 'id' : cmd_id,1025 'result' : encodeURIComponent($.str.objectToString({1026 element_tree : UIATarget.localTarget().getElementTree(),1027 capture_screen : api['uia.target.capture_screen'](cmd_id, path)1028 }, true))1029 }));1030 return api.DoNotReturn;1031 },1032 'uia.target.set_rules_of_alert_auto_handle' : function(cmd_id, rules) {1033 /**1034 * 设置èªå¨å¤çAlertè§å1035 * Paramaters:1036 * rules = [ {"message_text": "message_text", "button_text": "button_text"}, ... ]1037 * message_text - (æ¯ææ£å表达å¼)å¨Alertå
ææElementçææ¬ä¸çæææ¬ï¼åä¸Elementçlabelãnameãvalueï¼çäºä¸æ®µææ¬ãå
¶ä¸ä¸é¡¹å¹é
å³å¯ãï¼1038 * button_text - (æ¯ææ£å表达å¼)å¨Alertå
çå¹é
ææ¬çæé®ï¼UIAButtonçlabelãnameãvalueï¼çäºä¸æ®µææ¬ãå
¶ä¸ä¸é¡¹å¹é
å³å¯ãï¼1039 */1040 rules_of_alert_auto_handle = rules;1041 },1042 'uia.target.get_rules_of_alert_auto_handle' : function(cmd_id) {1043 /**1044 * æ¥è¯¢å·²è®¾ç½®çèªå¨å¤çAlertè§å1045 * Returns:1046 * list - [ {"message_text": "message_text", "button_text": "button_text"}, ... ]1047 */1048 return encodeURIComponent($.str.objectToString(rules_of_alert_auto_handle, true));1049 },1050 'uia.target.add_rule_of_alert_auto_handle' : function(cmd_id, message_text, button_text) {1051 /**1052 * èªå¨å¤çAlertè§åå¢å ä¸é¡¹1053 * Paramaters:1054 * message_text - (æ¯ææ£å表达å¼)å¨Alertå
ææElementçææ¬ä¸çæææ¬ï¼åä¸Elementçlabelãnameãvalueï¼çäºä¸æ®µææ¬ãå
¶ä¸ä¸é¡¹å¹é
å³å¯ãï¼1055 * button_text - (æ¯ææ£å表达å¼)å¨Alertå
çå¹é
ææ¬çæé®ï¼UIAButtonçlabelãnameãvalueï¼çäºä¸æ®µææ¬ãå
¶ä¸ä¸é¡¹å¹é
å³å¯ãï¼1056 */1057 rules_of_alert_auto_handle.push({1058 message_text : message_text,1059 button_text : button_text1060 });1061 },1062 'uia.target.clean_rules_of_alert_auto_handle' : function(cmd_id) {1063 /**1064 * æ¸
é¤ææèªå¨å¤çAlertçè§å1065 */1066 rules_of_alert_auto_handle = new Array();1067 },1068 'uia.target.turn_on_auto_close_alert' : function(cmd_id) {1069 /**1070 * æå¼èªå¨å
³éalertæ¡(å¦ærules_of_alert_auto_handleæ å¹é
ï¼å交ç±ç³»ç»èªå¨å
³é)1071 */1072 flag_alert_auto_handled = false;1073 // ææ¹æªå¤çï¼UIAé»è®¤èªå¨å¤ç1074 },1075 'uia.target.turn_off_auto_close_alert' : function(cmd_id) {1076 /**1077 * å
³éèªå¨å
³éalertæ¡1078 */1079 flag_alert_auto_handled = true;1080 // ææ¹å·²å¤çï¼UIAä¸åèªå¨å¤ç1081 },1082 'uia.target.get_last_alert_msg' : function(cmd_id) {1083 /**1084 * è·åæè¿ä¸æ¬¡alertæ¡çæ示å
容1085 * Returns1086 * msg - ææ¬å
容1087 */1088 return last_alert_msg;1089 },1090 'uia.target.delay' : function(cmd_id, seconds) {1091 /**1092 * çå¾
1093 * Paramaters:1094 * seconds - ç§1095 */1096 UIATarget.localTarget().delay(seconds);1097 },1098 'uia.target.get_element_tree' : function(cmd_id) {1099 /**1100 * ä»é¡¶å±å¼å§è·åUIæ ï¼è¾åºçJSONå符串æ°æ®éè¦URL解ç ï¼1101 * Returns1102 * JSON String - UIæ 1103 */1104 var dict = UIATarget.localTarget().getElementTree();1105 var result = encodeURIComponent($.str.objectToString(dict, true));1106 $.log("TORPC: " + $.str.objectToString({1107 'id' : cmd_id,1108 'result' : result1109 }));1110 return api.DoNotReturn;1111 },1112 'uia.target.log_element_tree_ext' : function(cmd_id) {1113 /**1114 * ä»é¡¶å±å¼å§è·åUIæ ï¼è¾åºçJSONå符串æ°æ®éè¦URL解ç ï¼1115 * Returns1116 * JSON String - UIæ 1117 */1118 var dict = UIATarget.localTarget().logElementTreeExt();1119 var result = encodeURIComponent($.str.objectToString(dict, true));1120 $.log("TORPC: " + $.str.objectToString({1121 'id' : cmd_id,1122 'result' : result1123 }));1124 return api.DoNotReturn;1125 },1126 'uia.target.click_volume_down' : function(cmd_id) {1127 /**1128 * æä¸ä¸æ¬¡åå°é³éæé®1129 */1130 UIATarget.localTarget().clickVolumeDown();1131 },1132 'uia.target.click_volume_up' : function(cmd_id) {1133 /**1134 * æä¸ä¸æ¬¡å¢å é³éæé®1135 */1136 UIATarget.localTarget().clickVolumeUp();1137 },1138 'uia.target.hold_volume_down' : function(cmd_id, seconds) {1139 /**1140 * æç»æä½åå°é³éæé®1141 * * Paramaters:1142 * seconds - ç§1143 */1144 var seconds = seconds ? seconds : 1;1145 UIATarget.localTarget().holdVolumeDown(seconds);1146 },1147 'uia.target.hold_volume_up' : function(cmd_id, seconds) {1148 /**1149 * æç»æä½å¢å é³éæé®1150 * * Paramaters:1151 * seconds - ç§1152 */1153 var seconds = seconds ? seconds : 1;1154 UIATarget.localTarget().holdVolumeUp(seconds);1155 },1156 'uia.target.deactivate_app_ror_duration' : function(cmd_id, seconds) {1157 /**1158 * å°Appç½®äºåå°ä¸å®æ¶é´1159 * Paramaters:1160 * seconds - ç§1161 * Returns1162 * Boolean1163 */1164 var seconds = seconds ? seconds : 3;1165 return UIATarget.localTarget().deactivateAppForDuration(seconds);1166 },1167 'uia.target.get_device_orientation' : function(cmd_id) {1168 /**1169 * è·å设å¤çæ¹å1170 * Returns1171 * Number1172 * UIA_DEVICE_ORIENTATION_UNKNOWN1173 * UIA_DEVICE_ORIENTATION_PORTRAIT1174 * UIA_DEVICE_ORIENTATION_PORTRAIT_UPSIDEDOWN1175 * UIA_DEVICE_ORIENTATION_LANDSCAPELEFT1176 * UIA_DEVICE_ORIENTATION_LANDSCAPERIGHT1177 * UIA_DEVICE_ORIENTATION_FACEUP1178 * UIA_DEVICE_ORIENTATION_FACEDOWN1179 */1180 return UIATarget.localTarget().deviceOrientation();1181 },1182 'uia.target.tap' : function(cmd_id, point) {1183 /**1184 * åå»1185 * Paramaters:1186 * point - { x: 0.5, y: 0.5 }1187 */1188 var _rect = UIATarget.localTarget().rect();1189 var _point = point ? point : {};1190 _point.x = _point.x ? _rect.size.width * _point.x : _rect.size.width * 0.5;1191 _point.y = _point.y ? _rect.size.height * _point.y : _rect.size.height * 0.5;1192 UIATarget.localTarget().tap(_point);1193 },1194 'uia.target.double_tap' : function(cmd_id, point) {1195 /**1196 * åå»1197 * Paramaters:1198 * point - { x: 100, y: 100 }1199 */1200 var _rect = UIATarget.localTarget().rect();1201 var _point = point ? point : {};1202 _point.x = _point.x ? _point.x : _rect.size.width * 0.5;1203 _point.y = _point.y ? _point.y : _rect.size.height * 0.5;1204 UIATarget.localTarget().doubleTap(_point);1205 },1206 'uia.target.tap_with_options' : function(cmd_id, point, options) {1207 /**1208 * åå»1209 * Paramaters:1210 * point - { x: 100, y: 100 }1211 * options - {1212 * tapCount : 1, å 次ï¼é»è®¤1次1213 * touchCount : 1, å ç¹ï¼é»è®¤1个ç¹ï¼ä¾å¦ä¸¤ä¸ªææå为2ï¼1214 * duration : 0 æä½çæ¶é´ï¼é»è®¤æ¯01215 * }1216 */1217 UIATarget.localTarget().tapWithOptions(point, options);1218 },1219 'uia.target.touch_and_hold' : function(cmd_id, point, duration) {1220 /**1221 * åå»1222 * Paramaters:1223 * point - { x: 100, y: 100 }1224 * duration - æä½å¤å°ç§1225 */1226 UIATarget.localTarget().touchAndHold(point, duration);1227 },1228 'uia.target.drag_from_to_for_duration' : function(cmd_id, from_point, to_point, duration, repeat, interval) {1229 /**1230 * ææ½1231 * Paramaters:1232 * from_point - { x: 0.5, y: 0.9 } // å移ç¾åæ¯1233 * to_point - { x: 0.5, y: 0.1 } // å移ç¾åæ¯1234 * duration - æç»æ¶é´ï¼ç§ï¼1235 * repeat - éå¤è¯¥æä½1236 * interval - éå¤è¯¥æä½çé´éæ¶é´ï¼ç§ï¼1237 */1238 var rect = UIATarget.localTarget().rect();1239 var from_point = {1240 x : Math.floor(rect.size.width * from_point.x),1241 y : Math.floor(rect.size.height * from_point.y)1242 };1243 var to_point = {1244 x : Math.floor(rect.size.width * to_point.x),1245 y : Math.floor(rect.size.height * to_point.y)1246 };1247 var duration = duration ? duration : 0.5;1248 var repeat = repeat ? repeat : 1;1249 var interval = interval ? interval : 0;1250 for (var i = 0; i < repeat; i++) {1251 UIATarget.localTarget().dragFromToForDuration(from_point, to_point, duration);1252 if (repeat > 1 && interval > 0) {1253 UIATarget.localTarget().delay(interval);1254 };1255 };1256 },1257 'uia.target.drag_right_to_left' : function(cmd_id) {1258 /**1259 * å±å¹ä¸å¤®ä»å³åå·¦ææ½ï¼åé¿å±å¹è¾¹ç¼ï¼1260 */1261 var _from_point = {1262 x : 0.5,1263 y : 0.51264 };1265 var _to_point = {1266 x : 0.1,1267 y : 0.51268 };1269 api['uia.target.drag_from_to_for_duration'](cmd_id, _from_point, _to_point);1270 },1271 'uia.target.drag_left_to_right' : function(cmd_id) {1272 /**1273 * å±å¹ä¸å¤®ä»å·¦åå³ææ½ï¼åé¿å±å¹è¾¹ç¼ï¼1274 */1275 var _from_point = {1276 x : 0.5,1277 y : 0.51278 };1279 var _to_point = {1280 x : 0.9,1281 y : 0.51282 };1283 api['uia.target.drag_from_to_for_duration'](cmd_id, _from_point, _to_point);1284 },1285 'uia.target.drag_up_to_down' : function(cmd_id) {1286 /**1287 * å±å¹ä¸å¤®ä»ä¸åä¸ææ½ï¼åé¿å±å¹è¾¹ç¼ï¼1288 */1289 var _from_point = {1290 x : 0.5,1291 y : 0.51292 };1293 var _to_point = {1294 x : 0.5,1295 y : 0.91296 };1297 api['uia.target.drag_from_to_for_duration'](cmd_id, _from_point, _to_point);1298 },1299 'uia.target.drag_down_to_up' : function(cmd_id) {1300 /**1301 * å±å¹ä¸å¤®ä»ä¸åä¸ææ½ï¼åé¿å±å¹è¾¹ç¼ï¼1302 */1303 var _from_point = {1304 x : 0.5,1305 y : 0.51306 };1307 var _to_point = {1308 x : 0.5,1309 y : 0.11310 };1311 api['uia.target.drag_from_to_for_duration'](cmd_id, _from_point, _to_point);1312 },1313 'uia.target.flick_from_to' : function(cmd_id, from_point, to_point, repeat, interval) {1314 /**1315 * å¼¹å»/æå»1316 * Paramaters:1317 * from_point - { x: 0.5, y: 0.9 } // å移ç¾åæ¯1318 * to_point - { x: 0.5, y: 0.1 } // å移ç¾åæ¯1319 * repeat - éå¤è¯¥æä½1320 * interval - éå¤è¯¥æä½çé´éæ¶é´ï¼ç§ï¼1321 */1322 var rect = UIATarget.localTarget().rect();1323 var from_point = {1324 x : Math.floor(rect.size.width * from_point.x),1325 y : Math.floor(rect.size.height * from_point.y)1326 };1327 var to_point = {1328 x : Math.floor(rect.size.width * to_point.x),1329 y : Math.floor(rect.size.height * to_point.y)1330 };1331 var repeat = repeat ? repeat : 1;1332 var interval = interval ? interval : 0;1333 for (var i = 0; i < repeat; i++) {1334 UIATarget.localTarget().flickFromTo(from_point, to_point);1335 if (repeat > 1 && interval > 0) {1336 UIATarget.localTarget().delay(interval);1337 };1338 };1339 },1340 'uia.target.flick_right_to_left' : function(cmd_id) {1341 /**1342 * å±å¹ä¸å¤®ä»å³å左弹å»/æå»1343 */1344 var _from_point = {1345 x : 0.5,1346 y : 0.51347 };1348 var _to_point = {1349 x : 0.1,1350 y : 0.51351 };1352 api['uia.target.flick_from_to'](cmd_id, _from_point, _to_point);1353 },1354 'uia.target.flick_left_to_right' : function(cmd_id) {1355 /**1356 * å±å¹ä¸å¤®ä»å·¦åå³å¼¹å»/æå»1357 */1358 var _from_point = {1359 x : 0.5,1360 y : 0.51361 };1362 var _to_point = {1363 x : 0.9,1364 y : 0.51365 };1366 api['uia.target.flick_from_to'](cmd_id, _from_point, _to_point);1367 },1368 'uia.target.flick_up_to_down' : function(cmd_id) {1369 /**1370 * å±å¹ä¸å¤®ä»ä¸åä¸å¼¹å»/æå»1371 */1372 var _from_point = {1373 x : 0.5,1374 y : 0.51375 };1376 var _to_point = {1377 x : 0.5,1378 y : 0.91379 };1380 api['uia.target.flick_from_to'](cmd_id, _from_point, _to_point);1381 },1382 'uia.target.flick_down_to_up' : function(cmd_id) {1383 /**1384 * å±å¹ä¸å¤®ä»ä¸åä¸å¼¹å»/æå»1385 */1386 var _from_point = {1387 x : 0.5,1388 y : 0.51389 };1390 var _to_point = {1391 x : 0.5,1392 y : 0.11393 };1394 api['uia.target.flick_from_to'](cmd_id, _from_point, _to_point);1395 },1396 'uia.target.lock_for_duration' : function(cmd_id, duration) {1397 /**1398 * æç»éå®ä¸æ®µæ¶é´1399 * Paramaters:1400 * duration - æç»å¤ä¹
ï¼ç§ï¼1401 */1402 UIATarget.localTarget().lockForDuration(duration);1403 },1404 'uia.target.pinch_close_from_to_for_duration' : function(cmd_id, from_point, to_point, duration) {1405 /**1406 * æå1407 * Paramaters:1408 * from_point - { x: 100, y: 100 }1409 * to_point - { x: 200, y: 200 }1410 * duration - ä»èµ·ç¹è³ç»ç¹æ¶èçæ¶é´ï¼æ§å¶å¿«æ
¢ï¼1411 */1412 UIATarget.localTarget().pinchCloseFromToForDuration(from_point, to_point, duration);1413 },1414 'uia.target.pinch_open_from_to_for_duration' : function(cmd_id, from_point, to_point, duration) {1415 /**1416 * å±å¼1417 * Paramaters:1418 * from_point - { x: 100, y: 100 }1419 * to_point - { x: 200, y: 200 }1420 * duration - ä»èµ·ç¹è³ç»ç¹æ¶èçæ¶é´ï¼æ§å¶å¿«æ
¢ï¼1421 */1422 UIATarget.localTarget().pinchOpenFromToForDuration(from_point, to_point, duration);1423 },1424 'uia.target.rotate_with_options' : function(cmd_id, location, options) {1425 /**1426 * æ转1427 * Paramaters:1428 * location - { x: 100, y: 100 } ä¸å¿ç¹1429 * options - {1430 * duration : 1, æç»çæ¶é´ï¼ç§ï¼1431 * radius : 50, åå¾1432 * rotation : 100, åå¨ï¼é»è®¤æ¯åå¨çPI1433 * touchCount : 2 触æ¸ç¹æ°é 2 - 51434 * }1435 */1436 UIATarget.localTarget().rotateWithOptions(location, options);1437 },1438 'uia.target.set_device_orientation' : function(cmd_id, orientation) {1439 /**1440 * 设置设å¤çæ¹å1441 * Paramaters:1442 * orientation - 代表æ¹åçæ°å¼1443 * UIA_DEVICE_ORIENTATION_UNKNOWN1444 * UIA_DEVICE_ORIENTATION_PORTRAIT1445 * UIA_DEVICE_ORIENTATION_PORTRAIT_UPSIDEDOWN1446 * UIA_DEVICE_ORIENTATION_LANDSCAPELEFT1447 * UIA_DEVICE_ORIENTATION_LANDSCAPERIGHT1448 * UIA_DEVICE_ORIENTATION_FACEUP1449 * UIA_DEVICE_ORIENTATION_FACEDOWN1450 */1451 UIATarget.localTarget().setDeviceOrientation(orientation);1452 },1453 'uia.target.set_location' : function(cmd_id, coordinates) {1454 /**1455 * 设置设å¤çGPSåæ 1456 * Paramaters:1457 * coordinates - {1458 * latitude : 100, // 以度为åä½ç纬度ãæ£å¼è¡¨ç¤ºçº¬åº¦èµ¤é以åãè´å¼è¡¨ç¤ºçº¬åº¦èµ¤é以åã1459 * longitude : 100 // 以度为åä½çç»åº¦ãæµéæ¯ç¸å¯¹äºé¶åå线ï¼ç¨æ£å¼åä¸å»¶ä¼¸çç»ç»åç»ç»çè´å¼è¥¿ä¾§å»¶ä¼¸ã1460 * }1461 */1462 UIATarget.localTarget().setLocation(orientation);1463 },1464 'uia.target.set_location_with_options' : function(cmd_id, coordinates, options) {1465 /**1466 * 设置设å¤çGPSåæ 1467 * Paramaters:1468 * coordinates - {1469 * latitude : 100, // 以度为åä½ç纬度ãæ£å¼è¡¨ç¤ºçº¬åº¦èµ¤é以åãè´å¼è¡¨ç¤ºçº¬åº¦èµ¤é以åã1470 * longitude : 100 // 以度为åä½çç»åº¦ãæµéæ¯ç¸å¯¹äºé¶åå线ï¼ç¨æ£å¼åä¸å»¶ä¼¸çç»ç»åç»ç»çè´å¼è¥¿ä¾§å»¶ä¼¸ã1471 * }1472 * options - {1473 * altitude : 50, // æµ·æé«åº¦ï¼ä»¥ç±³ä¸ºåä½ï¼ç¸å¯¹äºæµ·å¹³é¢ãæ£å¼è¡¨ç¤ºæµ·æé«åº¦ãè´å¼è¡¨ç¤ºä½äºæµ·å¹³é¢çé«åº¦ã1474 * horizontalAccuracy : 10, // æ°´å¹³åå¾ï¼ä¸ç¡®ä½ç½®æ¶çèå´å
ï¼ä»¥ç±³ä¸ºåä½ãè´çå¼æ¯æ æçã1475 * verticalAccuracy : 10, // åç´åå¾ï¼ä¸ç¡®ä½ç½®æ¶çèå´å
ï¼ä»¥ç±³ä¸ºåä½ãè´çå¼æ¯æ æçã1476 * course : 1, // 设å¤æ¯ç§»å¨çï¼ä¸ç¡®å®ç§»å¨æ¹å1477 * speed : 1 // 移å¨é度ï¼ç±³/ç§ï¼1478 * }1479 */1480 UIATarget.localTarget().setLocationWithOptions(orientation, options);1481 },1482 'uia.target.shake' : function(cmd_id) {1483 /**1484 * ææ设å¤1485 */1486 UIATarget.localTarget().shake();1487 },1488 'uia.target.unlock' : function(cmd_id) {1489 /**1490 * 解é设å¤1491 */1492 UIATarget.localTarget().unlock();1493 },1494 'uia.target.lock' : function(cmd_id) {1495 /**1496 * éå®è®¾å¤1497 */1498 UIATarget.localTarget().lock();1499 },1500 'uia.keyboard.sent_keys' : function(cmd_id, keys) {1501 /**1502 * é®çè¾å
¥1503 */1504 UIATarget.localTarget().frontMostApp().keyboard().typeString(keys);1505 },1506 };...
testdriver-extra.js
Source:testdriver-extra.js
1"use strict";2(function() {3 const is_test_context = window.__wptrunner_message_queue !== undefined;4 const pending = new Map();5 let result = null;6 let ctx_cmd_id = 0;7 let testharness_context = null;8 window.addEventListener("message", function(event) {9 const data = event.data;10 if (typeof data !== "object" && data !== null) {11 return;12 }13 if (is_test_context && data.type === "testdriver-command") {14 const command = data.message;15 const ctx_id = command.cmd_id;16 delete command.cmd_id;17 const cmd_id = window.__wptrunner_message_queue.push(command);18 let on_success = (data) => {19 data.type = "testdriver-complete";20 data.cmd_id = ctx_id;21 event.source.postMessage(data, "*");22 };23 let on_failure = (data) => {24 data.type = "testdriver-complete";25 data.cmd_id = ctx_id;26 event.source.postMessage(data, "*");27 };28 pending.set(cmd_id, [on_success, on_failure]);29 } else if (data.type === "testdriver-complete") {30 const cmd_id = data.cmd_id;31 const [on_success, on_failure] = pending.get(cmd_id);32 pending.delete(cmd_id);33 const resolver = data.status === "success" ? on_success : on_failure;34 resolver(data);35 if (is_test_context) {36 window.__wptrunner_process_next_event();37 }38 }39 });40 // Code copied from /common/utils.js41 function rand_int(bits) {42 if (bits < 1 || bits > 53) {43 throw new TypeError();44 } else {45 if (bits >= 1 && bits <= 30) {46 return 0 | ((1 << bits) * Math.random());47 } else {48 var high = (0 | ((1 << (bits - 30)) * Math.random())) * (1 << 30);49 var low = 0 | ((1 << 30) * Math.random());50 return high + low;51 }52 }53 }54 function to_hex(x, length) {55 var rv = x.toString(16);56 while (rv.length < length) {57 rv = "0" + rv;58 }59 return rv;60 }61 function get_window_id(win) {62 if (win == window && is_test_context) {63 return null;64 }65 if (!win.__wptrunner_id) {66 // generate a uuid67 win.__wptrunner_id = [to_hex(rand_int(32), 8),68 to_hex(rand_int(16), 4),69 to_hex(0x4000 | rand_int(12), 4),70 to_hex(0x8000 | rand_int(14), 4),71 to_hex(rand_int(48), 12)].join("-");72 }73 return win.__wptrunner_id;74 }75 const get_context = function(element) {76 if (!element) {77 return null;78 }79 let elementWindow = element.ownerDocument.defaultView;80 if (!elementWindow) {81 throw new Error("Browsing context for element was detached");82 }83 return elementWindow;84 };85 const get_selector = function(element) {86 let selector;87 if (element.id) {88 const id = element.id;89 selector = "#";90 // escape everything, because it's easy to implement91 for (let i = 0, len = id.length; i < len; i++) {92 selector += '\\' + id.charCodeAt(i).toString(16) + ' ';93 }94 } else {95 // push and then reverse to avoid O(n) unshift in the loop96 let segments = [];97 for (let node = element;98 node.parentElement;99 node = node.parentElement) {100 let segment = "*|" + node.localName;101 let nth = Array.prototype.indexOf.call(node.parentElement.children, node) + 1;102 segments.push(segment + ":nth-child(" + nth + ")");103 }104 segments.push(":root");105 segments.reverse();106 selector = segments.join(" > ");107 }108 return selector;109 };110 const create_action = function(name, props) {111 let cmd_id;112 const action_msg = {type: "action",113 action: name,114 ...props};115 if (action_msg.context) {116 action_msg.context = get_window_id(action_msg.context);117 }118 if (is_test_context) {119 cmd_id = window.__wptrunner_message_queue.push(action_msg);120 } else {121 if (testharness_context === null) {122 throw new Error("Tried to run in a non-testharness window without a call to set_test_context");123 }124 if (action_msg.context === null) {125 action_msg.context = get_window_id(window);126 }127 cmd_id = ctx_cmd_id++;128 action_msg.cmd_id = cmd_id;129 window.test_driver.message_test({type: "testdriver-command",130 message: action_msg});131 }132 const pending_promise = new Promise(function(resolve, reject) {133 const on_success = data => {134 result = JSON.parse(data.message).result;135 resolve(result);136 };137 const on_failure = data => {138 reject(`${data.status}: ${data.message}`);139 };140 pending.set(cmd_id, [on_success, on_failure]);141 });142 return pending_promise;143 };144 window.test_driver_internal.in_automation = true;145 window.test_driver_internal.set_test_context = function(context) {146 if (window.__wptrunner_message_queue) {147 throw new Error("Tried to set testharness context in a window containing testharness.js");148 }149 testharness_context = context;150 };151 window.test_driver_internal.click = function(element) {152 const selector = get_selector(element);153 const context = get_context(element);154 return create_action("click", {selector, context});155 };156 window.test_driver_internal.delete_all_cookies = function(context=null) {157 return create_action("delete_all_cookies", {context});158 };159 window.test_driver_internal.minimize_window = function(context=null) {160 return create_action("minimize_window", {context});161 };162 window.test_driver_internal.set_window_rect = function(rect, context=null) {163 return create_action("set_window_rect", {rect, context});164 };165 window.test_driver_internal.send_keys = function(element, keys) {166 const selector = get_selector(element);167 const context = get_context(element);168 return create_action("send_keys", {selector, keys, context});169 };170 window.test_driver_internal.action_sequence = function(actions, context=null) {171 for (let actionSequence of actions) {172 if (actionSequence.type == "pointer") {173 for (let action of actionSequence.actions) {174 // The origin of each action can only be an element or a string of a value "viewport" or "pointer".175 if (action.type == "pointerMove" && typeof(action.origin) != 'string') {176 let action_context = get_context(action.origin);177 action.origin = {selector: get_selector(action.origin)};178 if (context !== null && action_context !== context) {179 throw new Error("Actions must be in a single context");180 }181 context = action_context;182 }183 }184 }185 }186 return create_action("action_sequence", {actions, context});187 };188 window.test_driver_internal.generate_test_report = function(message, context=null) {189 return create_action("generate_test_report", {message, context});190 };191 window.test_driver_internal.set_permission = function(permission_params, context=null) {192 return create_action("set_permission", {permission_params, context});193 };194 window.test_driver_internal.add_virtual_authenticator = function(config, context=null) {195 return create_action("add_virtual_authenticator", {config, context});196 };197 window.test_driver_internal.remove_virtual_authenticator = function(authenticator_id, context=null) {198 return create_action("remove_virtual_authenticator", {authenticator_id, context});199 };200 window.test_driver_internal.add_credential = function(authenticator_id, credential, context=null) {201 return create_action("add_credential", {authenticator_id, credential, context});202 };203 window.test_driver_internal.get_credentials = function(authenticator_id, context=null) {204 return create_action("get_credentials", {authenticator_id, context});205 };206 window.test_driver_internal.remove_credential = function(authenticator_id, credential_id, context=null) {207 return create_action("remove_credential", {authenticator_id, credential_id, context});208 };209 window.test_driver_internal.remove_all_credentials = function(authenticator_id, context=null) {210 return create_action("remove_all_credentials", {authenticator_id, context});211 };212 window.test_driver_internal.set_user_verified = function(authenticator_id, uv, context=null) {213 return create_action("set_user_verified", {authenticator_id, uv, context});214 };215 window.test_driver_internal.set_spc_transaction_mode = function(mode, context = null) {216 return create_action("set_spc_transaction_mode", {mode, context});217 };...
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) return console.error(err);4 console.log(data);5});6var wpt = require('webpagetest');7var wpt = new WebPageTest('www.webpagetest.org');8 if (err) return console.error(err);9 console.log(data);10});11var wpt = require('webpagetest');12var wpt = new WebPageTest('www.webpagetest.org');13 if (err) return console.error(err);14 console.log(data);15});
Using AI Code Generation
1var wptools = require('wptools');2var page = wptools.page('Albert Einstein');3page.cmd_id('infobox').then(function(result) {4 console.log(result);5});6var wptools = require('wptools');7var page = wptools.page('Albert Einstein');8page.cmd_id('infobox').then(function(result) {9 console.log(result);10});11var wptools = require('wptools');12var page = wptools.page('Albert Einstein');13page.cmd_id('infobox').then(function(result) {14 console.log(result);15});16var wptools = require('wptools');17var page = wptools.page('Albert Einstein');18page.cmd_id('infobox').then(function(result) {19 console.log(result);20});21var wptools = require('wptools');22var page = wptools.page('Albert Einstein');23page.cmd_id('infobox').then(function(result) {24 console.log(result);25});26var wptools = require('wptools');27var page = wptools.page('Albert Einstein');28page.cmd_id('infobox').then(function(result) {29 console.log(result);30});31var wptools = require('wptools');32var page = wptools.page('Albert Einstein');33page.cmd_id('infobox').then(function(result) {34 console.log(result);35});36var wptools = require('wptools');37var page = wptools.page('Albert Einstein');38page.cmd_id('infobox').then(function(result) {39 console.log(result);40});41### wptools.page( title, options )42* `options` - Optional options object. See [Options](#options
Using AI Code Generation
1var wpt = require('./wpt.js');2wpt.cmd_id('test', 1000, function(data) {3 console.log(data);4});5var http = require('http');6exports.cmd_id = function(cmd, id, callback) {7 var options = {8 };9 var req = http.get(options, function(res) {10 var body = '';11 res.on('data', function(chunk) {12 body += chunk;13 });14 res.on('end', function() {15 var data = JSON.parse(body);16 callback(data);17 });18 });19 req.on('error', function(e) {20 console.log('error: ' + e.message);21 });22};
Using AI Code Generation
1var wpt = require('webpagetest');2var options = {3};4var test = wpt('www.webpagetest.org', options);5test.runTest(url, function(err, data) {6 var testId = data.data.testId;7 test.getTestResults(testId, function(err, data) {8 console.log(data.data.median.firstView.SpeedIndex);9 });10});
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!