-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
177 lines (161 loc) · 3.71 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
package main
import "fmt"
import "math"
func HandleSeed(seed string) int {
var num, num2 = 0, 1
for c := 0; c < len(seed); c++ {
num += int(seed[c]) * num2
num2 += 29
}
return num
}
func HandleNum(num int, Mixer int, Isletter bool) string {
var mixer = int(math.Abs(float64(Mixer))) % 127
if mixer == 0 {
return ""
}
var seed = ""
var j = 0
for i := 1; num > 0; i += 29 {
num -= i * mixer
j = i
}
for k := j; k > 0; k -= 29 {
seed = string(rune(mixer+(num/k))) + seed
switch Isletter {
case true:
var chr = rune(mixer + (num / k))
if chr <= 64 || (chr >= 91 && chr <= 96) || chr >= 123 {
return ""
}
break
default:
if (mixer+(num/k)) <= 32 || (mixer+(num/k)) == 127 {
return ""
}
break
}
num %= k
}
if seed != "" {
return seed
} else {
return ""
}
}
func main() {
fmt.Println("Code written by: Suceru")
fmt.Println("Email: fidax@qq.com")
fmt.Println("Qq: 1246454212")
fmt.Println("Version: 082410ZA")
fmt.Println("=========================")
fmt.Println("Please enter the function number:[1]Num to Seed. [2]Seed to Num. [3]Show All Seed. [4]Show Help.")
var n int
fmt.Print("FunctionNum:")
fmt.Scanln(&n)
switch n {
case 1:
fmt.Println("Please enter the seed number!!!")
var num int
fmt.Print("SeedNum:")
fmt.Scanln(&num)
for i := 127; i > 0; i-- {
switch HandleNum(num, i, true) {
case "":
break
default:
switch num == HandleSeed(HandleNum(num, i, false)) {
case true:
fmt.Println("Seed Contents in [Example]!!!")
fmt.Println("[" + HandleNum(num, i, false) + "]")
fmt.Println("=========================")
fmt.Print("Press enter to exit!")
fmt.Scanln()
return
default:
fmt.Println("ERROR")
break
}
break
}
}
for i := 127; i > 0; i-- {
switch HandleNum(num, i, false) {
case "":
break
default:
switch num == HandleSeed(HandleNum(num, i, false)) {
case true:
fmt.Println("Seed Contents in [Example]!!!")
fmt.Println("[" + HandleNum(num, i, false) + "]")
fmt.Println("=========================")
fmt.Print("Press enter to exit!")
fmt.Scanln()
return
default:
fmt.Println("ERROR")
break
}
break
}
}
fmt.Println("Seed Number is ERROR!!!")
fmt.Println("=========================")
fmt.Print("Press enter to exit!")
fmt.Scanln()
break
case 2:
fmt.Println("Please enter the seed!!!")
var numx string
fmt.Print("SeedContent:")
fmt.Scanln(&numx)
fmt.Printf("Seed Number is:[%d]\n", HandleSeed(numx))
fmt.Println("=========================")
fmt.Print("Press enter to exit!")
fmt.Scanln()
return
case 3:
fmt.Println("Please enter the seed number!!!")
var numz int
fmt.Print("SeedNum:")
fmt.Scanln(&numz)
var numnull bool = true
for i := 127; i > 0; i-- {
switch HandleNum(numz, i, false) {
case "":
break
default:
switch numz == HandleSeed(HandleNum(numz, i, false)) {
case true:
if numnull == true {
fmt.Println("Seed Contents in [Example]!!!")
}
fmt.Println("[" + HandleNum(numz, i, false) + "]")
numnull = false
default:
fmt.Println("ERROR")
break
}
break
}
}
if numnull == true {
fmt.Println("Seed Number is ERROR!!!")
}
fmt.Println("=========================")
fmt.Print("Press enter to exit!")
fmt.Scanln()
break
case 4:
fmt.Println("[Help] You can find the value of \"WorldSeed\" in Project.xml by opening the .scworld file and use it to get the SeedNum.")
fmt.Println("=========================")
fmt.Print("Press enter to exit!")
fmt.Scanln()
default:
fmt.Println("Function is ERROR")
fmt.Println("=========================")
fmt.Print("Press enter to exit!")
fmt.Scanln()
break
}
}