login.tin 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. #var login[session] {};
  2. #var login[user] {};
  3. #var login[autoexec] {};
  4. #alias {login} {
  5. #var login[session] {%1};
  6. #var login[user] {%2};
  7. #var login[autoexec] {%3};
  8. #session {$session[name]} {$session[host]} {$session[port]};
  9. };
  10. #event {SESSION CONNECTED} {
  11. #if { "%0" !== "$login[session][name]" } {
  12. #return;
  13. };
  14. login.auto-login;
  15. };
  16. #alias {login.auto-login} {
  17. #class login.auto-login open;
  18. #config {IAC GA} {OFF};
  19. #nop 如果角色设置了 GMCP 支持,则积极回应服务器的 GMCP 协商请求。;
  20. #if { "$user[GMCP]" == "true" } {
  21. load-lib gmcp;
  22. gmcp.Enable;
  23. };
  24. #if { "$session[UTF8]" == "true" } {
  25. #config {charset} {UTF-8};
  26. };
  27. #else {
  28. #config {charset} {GBK1TOUTF8};
  29. };
  30. #line oneshot #action {^北大侠客行已经执行了%*。$} {
  31. #local uptime {@time.ParseDoC{%%1}};
  32. };
  33. #line oneshot #action {^Input 1 for GBK, 2 for UTF8, 3 for BIG5$} {
  34. #nop;
  35. };
  36. #line oneshot #action {^您的英文名字(要注册新人物请输入new。):$} {
  37. #if { "$session[UTF8]" == "false" } {
  38. #delay 0 #send {2};
  39. };
  40. #config {charset} {UTF-8};
  41. #if { "$login[user][id]" != "" } {
  42. xtt.Answer {$login[user][id]};
  43. };
  44. #else {
  45. #line oneshot #macro {\n} {
  46. #cursor get {login[user][id]};
  47. #cursor clear;
  48. #if { "$login[user][id]" == "#%*" } {
  49. #var login[user][id] {};
  50. };
  51. #if { "$login[user][id]" != "" } {
  52. xtt.Answer {$login[user][id]};
  53. };
  54. };
  55. };
  56. };
  57. #line oneshot #action {^此ID档案已存在,请输入密码:$} {
  58. #if { "$login[user][passwd]" != "" } {
  59. xtt.Answer {$login[user][passwd]};
  60. #delay {login.check} {look} 1;
  61. };
  62. #else {
  63. #cursor flag echo on;
  64. #line oneshot #macro {\n} {
  65. #cursor get {login[user][passwd]};
  66. #cursor clear;
  67. #if { "$login[user][passwd]" != "" } {
  68. xtt.Answer {$login[user][passwd]};
  69. };
  70. };
  71. };
  72. };
  73. #line oneshot #action {^您要将另一个连线中的相同人物赶出去,取而代之吗?(y/n)$} {
  74. xtt.Answer y;
  75. };
  76. #line oneshot #action {^%s欢迎来到北大侠客行!%s$} {
  77. #delay {login.auto-login.success} {login.auto-login.success 重新登录} 0;
  78. };
  79. #line oneshot #action {^%s目前权限:(player)%s$} {
  80. #delay {login.auto-login.success} {login.auto-login.success} 1;
  81. };
  82. #line oneshot #action {^如果同意请用agree %w命令签署确认这些条款。$} {
  83. #if { @isTrue{$user[AGREE]} } {
  84. #send {agree %%1};
  85. };
  86. #else {
  87. #undelay {login.auto-login.success};
  88. #undelay {login.check};
  89. warnLog 请在十秒内输入 agree %%1 命令以继续游戏。;
  90. #delay {login.agree.fail} {#zap} 10;
  91. };
  92. };
  93. #line oneshot #action {^感谢您同意北侠玩家要约,现在可以正常进入游戏。$} {
  94. #undelay {login.agree.fail};
  95. };
  96. #line oneshot #action {^重新连线完毕。$} {
  97. #delay {login.auto-login.success} {login.auto-login.success 断线重连} 0;
  98. };
  99. #alias {login.auto-login.success} {
  100. #local type {%%1};
  101. #showme 登录成功。;
  102. #if { @isTrue{$login[user][manual]} } {
  103. login.write-id-file;
  104. login.init-game;
  105. };
  106. #local handler $login[autoexec];
  107. #class login.auto-login kill;
  108. #undelay login.auto-login.success;
  109. kill-module login;
  110. $handler;
  111. #if { "$user[GMCP]" == "true" } {
  112. #delay 1 {
  113. load-module gmcp;
  114. gmcp.pkuxkx.Enable;
  115. };
  116. };
  117. };
  118. #class login.auto-login close;
  119. };
  120. #alias {login.init-game} {
  121. #if { "$login[user][id]" == "" || "$user[id]" != "" } {
  122. #return;
  123. };
  124. #var user[id] {$login[user][id]};
  125. #var user[passwd] {$login[user][passwd]};
  126. #gts #var user[id] {$login[user][id]};
  127. #gts #var user[passwd] {$login[user][passwd]};
  128. #local path {$user[id]};
  129. #if { "$session[log_path]" != "" } {
  130. #local path {$session[log_path]};
  131. };
  132. #if { !@InitLog{$path} } {
  133. #echo {<119>创建日志目录 $gLog[PATH]/$path 时遇到错误。<299>};
  134. #echo {<139>请检查你的安装环境,或者参考使用手册重新安装本软件。<299>};
  135. #return;
  136. };
  137. log.Open;
  138. #screen set title GAME-$user[id];
  139. NOTE 启动配置文件已生成,下次你可以直接 start $login[user][id] 进入游戏。;
  140. };
  141. #alias {login.write-id-file} {
  142. #if { "$login[user][id]" == "" || "$user[id]" != "" } {
  143. #return;
  144. };
  145. #local id-file {ids/$login[user][id]};
  146. #local output {};
  147. #script output {test -d var/ids && echo true || echo false};
  148. #if { "$output[1]" == "true" } {
  149. #local id-file {var/$id-file};
  150. };
  151. #if { @existsFile{$id-file} } {
  152. #return;
  153. };
  154. #script output {cp ids/pkuxkx $id-file};
  155. #script output {sed -i.bak 's/^#var user\[id\] {.*};$/#var user[id] {$login[user][id]};/' $id-file};
  156. #script output {sed -i.bak 's/^#var user\[name\] {.*};$/#var user[name] {};/' $id-file};
  157. #script output {sed -i.bak 's/^#var user\[passwd\] {.*};$/#var user[passwd] {$login[user][passwd]};/' $id-file};
  158. #script output {sed -i.bak '/^#nop 上面三处修改完毕之后,请删除下面这行文字:;$/d' $id-file};
  159. #script output {sed -i.bak '/^#var user\[manual\] {true};$/d' $id-file};
  160. #script output {rm ${id-file}.bak};
  161. };