服务器离线充值系统

By Msure    2019/02/15

服务器离线充值系统,玩家充值后,op无需上线手动给钱,仅需计算序列号告诉玩家,玩家即可完成充值。

我的世界服务器离线充值系统

如图:服主输入金额,excel自动生成序列号。

我的世界服务器离线充值系统

序列号告诉玩家后,玩家自己充值。

我的世界服务器离线充值系统

玩家蒙对序列号的几率很小。



原理

整个序列码由九位数组成,前三位是玩家充值的金额,中间三位是此次交易的编号,最后三位是由前六位计算所得的密匙。

假设金额是ABC,编号是DEF,则密匙GHI的计算过程如下:

D=Dx7%10E=(E+5)%10F=(Fx3)%10GHI=Fx100+Dx10+E+ABC

玩家输入整个序列号后,游戏内使用记分板运算玩家输入的金额和编号是否和密匙之间有正确的对应关系,若有则此序列号正确,之后再验证此序列号是否被使用过。这里将DEF分别和XYZ三个坐标对应,在(1,1,1)到(10,10,10)之间有一个10x10x10的区域专门用来验证。每次玩家成功使用序列号之后,通过二分法tp一个marker,在对应的位置放置一个石头,使用序列号时,判断对应的位置是石头还是空气,若是空气则没有被使用过。

同时为了防止有玩家真的蒙对了序列号,玩家充值的金额会被记录到check记分板上,服主可以通过/scoreboard objectives setdisplay sidebar check显示到侧边栏查看,并通过/scoreboard players reset <玩家名字> check消除相应玩家的记录。金额会被充值到topup这个记分板上,发现异常服主可清楚相应玩家topup的记分板分数。



代码

初始化:

  1. /scoreboard objectives add code trigger
  2. /scoreboard objectives add abc dummy
  3. /scoreboard objectives add d dummy
  4. /scoreboard objectives add e dummy
  5. /scoreboard objectives add f dummy
  6. /scoreboard objectives add ghi dummy
  7. /scoreboard objectives add abcdef dummy
  8. /scoreboard objectives add check dummy
  9. /scoreboard objectives add topup dummy
  10. /scoreboard objectives add auth dummy
  11. /scoreboard objectives add dummynumber dummy
  12. /summon minecraft:armor_stand ~ ~1 ~ {CustomName:"codemarker",CustomNameVisible:1b,NoGravity:1,Invisible:1}
  13. /scoreboard players set dummy3 dummynumber 3
  14. /scoreboard players set dummy5 dummynumber 5
  15. /scoreboard players set dummy7 dummynumber 7
  16. /scoreboard players set dummy10 dummynumber 10
  17. /scoreboard players set dummy100 dummynumber 100
  18. /scoreboard players set dummy1000 dummynumber 1000

高频循环加连锁:

  1. scoreboard players enable @a code
  2. scoreboard players set @a[score_code_min=1] auth 0
  3. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s ghi = @s code
  4. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s ghi %= dummy1000 dummynumber
  5. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s abcdef = @s code
  6. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s abcdef /= dummy1000 dummynumber
  7. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s f = @s abcdef
  8. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s f %= dummy10 dummynumber
  9. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s abcdef /= dummy10 dummynumber
  10. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s e = @s abcdef
  11. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s e %= dummy10 dummynumber
  12. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s abcdef /= dummy10 dummynumber
  13. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s d = @s abcdef
  14. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s d %= dummy10 dummynumber
  15. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s abcdef /= dummy10 dummynumber
  16. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @e[type=armor_stand,name=codemarker] d = @s d
  17. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @e[type=armor_stand,name=codemarker] e = @s e
  18. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @e[type=armor_stand,name=codemarker] f = @s f
  19. #二分法tp
  20. execute @a[score_code_min=1] ~ ~ ~ tp @e[type=armor_stand,name=codemarker] 1 1 1
  21. tp @e[type=armor_stand,name=codemarker,score_d_min=8] ~8 ~ ~
  22. scoreboard players remove @e[type=armor_stand,name=codemarker,score_d_min=8] d 8
  23. tp @e[type=armor_stand,name=codemarker,score_d_min=4,score_d=7] ~4 ~ ~
  24. scoreboard players remove @e[type=armor_stand,name=codemarker,score_d_min=4,score_d=7] d 4
  25. tp @e[type=armor_stand,name=codemarker,score_d_min=2,score_d=3] ~2 ~ ~
  26. scoreboard players remove @e[type=armor_stand,name=codemarker,score_d_min=2,score_d=3] d 2
  27. tp @e[type=armor_stand,name=codemarker,score_d_min=1,score_d=1] ~1 ~ ~
  28. scoreboard players remove @e[type=armor_stand,name=codemarker,score_d_min=1,score_d=1] d 1
  29. tp @e[type=armor_stand,name=codemarker,score_e_min=8] ~ ~8 ~
  30. scoreboard players remove @e[type=armor_stand,name=codemarker,score_e_min=8] e 8
  31. tp @e[type=armor_stand,name=codemarker,score_e_min=4,score_e=7] ~ ~4 ~
  32. scoreboard players remove @e[type=armor_stand,name=codemarker,score_e_min=4,score_e=7] e 4
  33. tp @e[type=armor_stand,name=codemarker,score_e_min=2,score_e=3] ~ ~2 ~
  34. scoreboard players remove @e[type=armor_stand,name=codemarker,score_e_min=2,score_e=3] e 2
  35. tp @e[type=armor_stand,name=codemarker,score_e_min=1,score_e=1] ~ ~1 ~
  36. scoreboard players remove @e[type=armor_stand,name=codemarker,score_e_min=1,score_e=1] e 1
  37. tp @e[type=armor_stand,name=codemarker,score_f_min=8] ~ ~ ~8
  38. scoreboard players remove @e[type=armor_stand,name=codemarker,score_f_min=8] f 8
  39. tp @e[type=armor_stand,name=codemarker,score_f_min=4,score_f=7] ~ ~ ~4
  40. scoreboard players remove @e[type=armor_stand,name=codemarker,score_f_min=4,score_f=7] f 4
  41. tp @e[type=armor_stand,name=codemarker,score_f_min=2,score_f=3] ~ ~ ~2
  42. scoreboard players remove @e[type=armor_stand,name=codemarker,score_f_min=2,score_f=3] f 2
  43. tp @e[type=armor_stand,name=codemarker,score_f_min=1,score_f=1] ~ ~ ~1
  44. scoreboard players remove @e[type=armor_stand,name=codemarker,score_f_min=1,score_f=1] f 1
  45. #此时abc=abcdef
  46. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s d *= dummy7 dummynumber
  47. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s d %= dummy10 dummynumber
  48. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s e += dummy5 dummynumber
  49. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s e %= dummy10 dummynumber
  50. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s f *= dummy3 dummynumber
  51. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s f %= dummy10 dummynumber
  52. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s d *= dummy10 dummynumber
  53. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s f *= dummy100 dummynumber
  54. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s auth += @s d
  55. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s auth += @s e
  56. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s auth += @s f
  57. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s auth += @s abcdef
  58. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s auth %= dummy1000 dummynumber
  59. execute @a[score_code_min=1] ~ ~ ~ scoreboard players operation @s auth -= @s ghi
  60. execute @e[type=armor_stand,name=codemarker] ~ ~ ~ detect ~ ~ ~ stone -1 tellraw @a[score_code_min=1,score_auth_min=0,score_auth=0] [{"text":"此序列号已经被使用过了!","color":"red"}]
  61. execute @e[type=armor_stand,name=codemarker] ~ ~ ~ detect ~ ~ ~ air -1 tellraw @a[score_code_min=1,score_auth_min=1] [{"text":"序列号错误!","color":"red"}]
  62. execute @e[type=armor_stand,name=codemarker] ~ ~ ~ detect ~ ~ ~ air -1 tellraw @a[score_code_min=1,score_auth=-1] [{"text":"序列号错误!","color":"red"}]
  63. execute @e[type=armor_stand,name=codemarker] ~ ~ ~ detect ~ ~ ~ air -1 execute @a[score_code_min=1,score_auth_min=0,score_auth=0] ~ ~ ~ scoreboard players operation @s topup += @s abcdef
  64. execute @e[type=armor_stand,name=codemarker] ~ ~ ~ detect ~ ~ ~ air -1 execute @a[score_code_min=1,score_auth_min=0,score_auth=0] ~ ~ ~ scoreboard players operation @s check += @s abcdef
  65. execute @e[type=armor_stand,name=codemarker] ~ ~ ~ detect ~ ~ ~ air -1 execute @a[score_code_min=1,score_auth_min=0,score_auth=0] ~ ~ ~ tellraw @s [{"text":"充值成功!本次充值:","color":"green"},{"score":{"name":"@s","objective":"abcdef"},"color":"gold"},{"text":"元","color":"green"}]
  66. execute @a[score_code_min=1,score_auth_min=0,score_auth=0] ~ ~ ~ execute @e[type=armor_stand,name=codemarker] ~ ~ ~ detect ~ ~ ~ air -1 setblock ~ ~ ~ minecraft:stone
  67. scoreboard players set @a[score_code_min=1] code 0

表格下载:20190215000.xlsx

由于此教程中已经将算法摆了出来,若直接搬运到服务器,会被同样看过这个教程的人轻易破解而来给自己充值,所以使用时需要自行更改算法,或者联系Msure进行定制(有偿)QQ:2948473938





LOADING | 此框架正在加载中
QQ群:771363745