Compare commits
3
Commits
abda2c1cda
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65db9fc365 | ||
|
|
275c7e5211 | ||
|
|
32831010c0 |
@@ -1,4 +1,5 @@
|
||||
# Local metadata and generated build output
|
||||
/build/
|
||||
.DS_Store
|
||||
._*
|
||||
__pycache__/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,217 @@
|
||||
1 3 0 71500 75 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
2 3 0 71501 149 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
3 3 0 71502 349 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
4 3 0 71503 75 0 0000-00-00 00:00:00 0000-00-00 00:00:00 3 0 0 -1
|
||||
5 3 0 71504 149 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
6 3 0 71505 349 0 0000-00-00 00:00:00 0000-00-00 00:00:00 7 0 0 -1
|
||||
7 3 0 71506 75 0 0000-00-00 00:00:00 0000-00-00 00:00:00 5 0 0 -1
|
||||
8 3 0 71507 149 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4 0 0 -1
|
||||
9 3 0 71508 349 0 0000-00-00 00:00:00 0000-00-00 00:00:00 12 0 0 -1
|
||||
10 3 0 71509 75 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
11 3 0 71510 149 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
12 3 0 71511 349 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4 0 0 -1
|
||||
13 3 2 53002 75 0 0000-00-00 00:00:00 0000-00-00 00:00:00 5 0 0 -1
|
||||
14 3 2 53003 149 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
15 3 2 53004 349 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
16 3 2 53005 75 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
17 3 2 53006 149 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
18 3 2 53007 349 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
19 3 2 53008 75 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4 0 0 -1
|
||||
20 3 2 53009 149 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
21 3 2 53010 349 0 0000-00-00 00:00:00 0000-00-00 00:00:00 9 0 0 -1
|
||||
22 3 2 53011 75 0 0000-00-00 00:00:00 0000-00-00 00:00:00 3 0 0 -1
|
||||
23 3 2 53012 149 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
24 3 2 53013 349 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
25 7 0 54706 69 0 0000-00-00 00:00:00 0000-00-00 00:00:00 12 0 0 -1
|
||||
26 7 0 54707 69 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
27 7 0 54708 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 38 0 0 -1
|
||||
28 7 0 54709 69 0 0000-00-00 00:00:00 0000-00-00 00:00:00 65 0 0 -1
|
||||
29 7 0 54710 49 0 0000-00-00 00:00:00 0000-00-00 00:00:00 29 0 0 -1
|
||||
30 7 0 54711 39 0 0000-00-00 00:00:00 0000-00-00 00:00:00 12 0 0 -1
|
||||
31 3 1 55402 140 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
32 3 1 55405 140 0 0000-00-00 00:00:00 0000-00-00 00:00:00 7 0 0 -1
|
||||
33 3 1 55407 140 0 0000-00-00 00:00:00 0000-00-00 00:00:00 5 0 0 -1
|
||||
34 1 0 55001 15 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
35 1 0 55036 20 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4 0 0 -1
|
||||
36 1 0 55034 39 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
37 1 0 55033 90 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
38 1 0 55009 10 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
39 4 0 25163 2 0 0000-00-00 00:00:00 0000-00-00 00:00:00 11 0 0 -1
|
||||
40 4 0 25164 4 0 0000-00-00 00:00:00 0000-00-00 00:00:00 11 0 0 -1
|
||||
41 4 0 25165 5 0 0000-00-00 00:00:00 0000-00-00 00:00:00 3 0 0 -1
|
||||
42 4 0 25166 6 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
43 4 0 25167 8 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
44 4 0 25168 8 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
45 4 0 25169 10 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
48 1 0 71035 4 0 0000-00-00 00:00:00 0000-00-00 00:00:00 6 0 0 -1
|
||||
49 1 0 30250 10 0 0000-00-00 00:00:00 0000-00-00 00:00:00 3 0 0 -1
|
||||
50 1 0 70028 90 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
51 2 1 41119 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
52 2 1 41120 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
53 2 1 41121 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4 0 0 -1
|
||||
54 2 1 41122 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
55 2 2 45005 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 3 0 0 -1
|
||||
56 2 2 45006 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
57 2 2 45057 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 6 0 0 -1
|
||||
58 2 2 45058 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
59 2 0 40129 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4 0 0 -1
|
||||
60 2 0 40130 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
61 2 0 40131 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
62 2 0 40132 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 5 0 0 -1
|
||||
63 2 0 40133 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
64 2 0 40134 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
65 2 0 40445 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 13 0 0 -1
|
||||
66 2 0 40446 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
67 2 0 40447 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
68 2 0 40448 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 6 0 0 -1
|
||||
69 2 0 40449 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
70 2 0 40450 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
71 1 0 72319 4 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
72 1 0 72320 2 0 0000-00-00 00:00:00 0000-00-00 00:00:00 7 0 0 -1
|
||||
73 1 0 53998 39 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
74 1 0 53999 69 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
75 6 0 71097 39 0 0000-00-00 00:00:00 0000-00-00 00:00:00 3 0 0 -1
|
||||
76 1 0 85009 40 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
77 1 0 71153 19 0 0000-00-00 00:00:00 0000-00-00 00:00:00 48 0 0 -1
|
||||
78 5 1 54003 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 9 0 0 -1
|
||||
79 5 1 54006 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
80 5 1 54009 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
81 5 1 54012 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
82 5 1 54015 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 6 0 0 -1
|
||||
83 5 1 54018 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
84 5 1 54021 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 11 0 0 -1
|
||||
85 5 1 54024 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 7 0 0 -1
|
||||
86 5 1 54027 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 3 0 0 -1
|
||||
87 5 2 54030 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
88 5 2 54033 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
89 5 2 54036 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
90 5 2 54039 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
91 5 2 54042 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
92 5 2 54045 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
93 5 2 54048 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
94 5 2 54051 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
95 5 2 54054 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 3 0 0 -1
|
||||
96 5 2 54057 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
97 5 2 54060 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
98 5 2 54063 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
99 5 2 54066 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
100 5 2 54069 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 11 0 0 -1
|
||||
101 5 2 54072 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
102 5 2 54075 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 11 0 0 -1
|
||||
103 5 2 54078 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 12 0 0 -1
|
||||
104 5 0 54081 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
105 5 0 54084 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
106 5 0 54087 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
107 5 0 54090 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
108 5 0 54093 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
109 5 0 54096 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
110 5 0 54099 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
111 5 0 54102 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 6 0 0 -1
|
||||
112 5 0 54105 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
113 5 0 54108 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
114 5 0 54111 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
115 5 0 54114 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 17 0 0 -1
|
||||
116 5 0 54117 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 33 0 0 -1
|
||||
117 5 0 54120 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 12 0 0 -1
|
||||
118 5 0 54123 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 27 0 0 -1
|
||||
123 0 1 54712 349 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4 0 0 -1
|
||||
124 0 1 54713 120 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
125 0 1 54714 549 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
126 0 1 54715 49 0 0000-00-00 00:00:00 0000-00-00 00:00:00 19 0 0 -1
|
||||
127 0 1 54716 79 0 0000-00-00 00:00:00 0000-00-00 00:00:00 3 0 0 -1
|
||||
128 0 1 54717 159 0 0000-00-00 00:00:00 0000-00-00 00:00:00 13 0 0 -1
|
||||
129 2 3 86004 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
130 2 3 86008 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 3 0 0 -1
|
||||
131 2 3 86014 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
132 2 3 86018 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
133 2 3 86024 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
134 2 3 86028 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
135 2 3 86034 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
136 2 3 86038 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
137 2 3 86044 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
138 2 3 86048 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
139 2 3 86054 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
140 2 3 86058 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
141 1 0 71221 39 0 2022-05-27 23:59:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
142 1 0 55008 49 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
143 1 0 55035 9 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
144 6 0 100001 9 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
145 6 0 100002 17 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
146 6 0 77913 69 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
147 6 0 77914 299 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
148 6 0 77915 549 0 0000-00-00 00:00:00 0000-00-00 00:00:00 5 0 0 -1
|
||||
149 6 0 100500 4 0 0000-00-00 00:00:00 0000-00-00 00:00:00 5 0 0 -1
|
||||
150 1 0 6884 8 0 0000-00-00 00:00:00 0000-00-00 00:00:00 534 0 0 -1
|
||||
153 1 0 70043 10 0 0000-00-00 00:00:00 0000-00-00 00:00:00 39 0 0 -1
|
||||
154 1 0 72067 5 0 0000-00-00 00:00:00 0000-00-00 00:00:00 6 0 0 -1
|
||||
155 1 0 72068 49 0 0000-00-00 00:00:00 0000-00-00 00:00:00 5 0 0 -1
|
||||
170 1 0 70002 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 12 0 0 -1
|
||||
171 2 4 71233 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
172 2 4 71234 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
173 2 4 71235 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
174 2 4 71236 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
175 2 4 71249 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
176 2 4 71248 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
177 2 4 71254 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
178 2 4 71255 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
179 2 4 71246 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
180 2 4 71247 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
181 2 4 71252 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
182 2 4 71253 99 0 0000-00-00 00:00:00 0000-00-00 00:00:00 3 0 0 -1
|
||||
183 5 3 54126 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
184 5 3 54129 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
185 5 3 54132 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
186 5 3 54135 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
187 5 3 54138 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
188 5 3 54141 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
189 5 3 54144 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
190 5 3 54147 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
191 5 3 54150 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
192 5 3 54153 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
193 5 3 54156 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 13 0 0 -1
|
||||
194 5 3 54159 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 16 0 0 -1
|
||||
195 5 3 54162 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 19 0 0 -1
|
||||
197 5 3 54168 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4 0 0 -1
|
||||
198 5 3 54171 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
199 5 3 54174 60 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4 0 0 -1
|
||||
200 0 2 71230 149 0 2022-09-30 23:59:00 0000-00-00 00:00:00 7 0 0 -1
|
||||
201 0 2 55406 149 0 2022-09-30 23:59:00 0000-00-00 00:00:00 8 0 0 -1
|
||||
202 5 4 54177 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4 0 0 -1
|
||||
203 5 4 54180 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 11 0 0 -1
|
||||
204 5 4 54183 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 13 0 0 -1
|
||||
205 5 4 54186 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
206 5 4 54189 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
207 5 4 54192 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
208 5 4 54195 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
209 5 4 54198 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
210 5 4 54201 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
211 5 4 54204 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
212 5 4 54207 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
213 5 4 54210 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
214 5 4 54213 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
215 5 4 54216 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 10 0 0 -1
|
||||
216 5 4 54219 50 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
217 5 5 54222 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
218 5 5 54225 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
219 5 5 54228 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4 0 0 -1
|
||||
220 5 5 54231 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
221 5 5 54234 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
222 5 5 54237 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
223 5 5 54240 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
224 5 5 54243 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 0 0 -1
|
||||
225 5 5 54246 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
226 5 5 54249 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
227 5 5 54252 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 3 0 0 -1
|
||||
228 5 5 54255 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
229 5 5 54258 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
230 5 5 54261 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
231 5 5 54264 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
232 5 5 54267 45 0 0000-00-00 00:00:00 0000-00-00 00:00:00 2 0 0 -1
|
||||
233 1 0 39063 19 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
234 1 0 39064 19 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
235 1 0 71136 29 0 0000-00-00 00:00:00 0000-00-00 00:00:00 12 0 0 -1
|
||||
236 0 0 25159 149 0 2022-10-25 23:59:59 0000-00-00 00:00:00 0 0 0 -1
|
||||
237 0 0 20059 149 0 2022-10-31 23:59:59 0000-00-00 00:00:00 0 0 0 -1
|
||||
240 1 0 77921 1 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
241 1 0 77922 2 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
242 1 0 77923 5 0 0000-00-00 00:00:00 0000-00-00 00:00:00 0 0 0 -1
|
||||
|
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"source_archive": "AVA2/2. Backup SF+SRC and SQL/MYSQL56.tgz",
|
||||
"archive_sha256": "0a578f4036fff69c36d0ad0d4d6692d267284be10689105a173ac30337ec0787",
|
||||
"source_table": "player.ishop_data",
|
||||
"format": "native MyISAM recovered in isolated reference schema; sorted by id; dates preserved",
|
||||
"rows": 217,
|
||||
"tsv_sha256": "7e2fc0ccb630168b0466d097eaa9b41858df1ea0e67ab7b7fad2ba17fc975276"
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
{
|
||||
"count": 49,
|
||||
"scope": "Existing implemented item systems only. Does not authorize production deployment.",
|
||||
"products": [
|
||||
{
|
||||
"id": 3,
|
||||
"vnum": 71502,
|
||||
"original_price": 349,
|
||||
"basis": "ported mount costume and mount skin; game/src/port_mount.cpp, client MountScript and staged model resources"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"vnum": 71505,
|
||||
"original_price": 349,
|
||||
"basis": "ported mount costume and mount skin; game/src/port_mount.cpp, client MountScript and staged model resources"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"vnum": 71508,
|
||||
"original_price": 349,
|
||||
"basis": "ported mount costume and mount skin; game/src/port_mount.cpp, client MountScript and staged model resources"
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"vnum": 71511,
|
||||
"original_price": 349,
|
||||
"basis": "ported mount costume and mount skin; game/src/port_mount.cpp, client MountScript and staged model resources"
|
||||
},
|
||||
{
|
||||
"id": 78,
|
||||
"vnum": 54003,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 79,
|
||||
"vnum": 54006,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 80,
|
||||
"vnum": 54009,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 81,
|
||||
"vnum": 54012,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 82,
|
||||
"vnum": 54015,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 83,
|
||||
"vnum": 54018,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 84,
|
||||
"vnum": 54021,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 85,
|
||||
"vnum": 54024,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 86,
|
||||
"vnum": 54027,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 87,
|
||||
"vnum": 54030,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 88,
|
||||
"vnum": 54033,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 89,
|
||||
"vnum": 54036,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 90,
|
||||
"vnum": 54039,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 91,
|
||||
"vnum": 54042,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 92,
|
||||
"vnum": 54045,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 93,
|
||||
"vnum": 54048,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 94,
|
||||
"vnum": 54051,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 95,
|
||||
"vnum": 54054,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 96,
|
||||
"vnum": 54057,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 97,
|
||||
"vnum": 54060,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 98,
|
||||
"vnum": 54063,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 99,
|
||||
"vnum": 54066,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 100,
|
||||
"vnum": 54069,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 101,
|
||||
"vnum": 54072,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 102,
|
||||
"vnum": 54075,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 103,
|
||||
"vnum": 54078,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 170,
|
||||
"vnum": 70002,
|
||||
"original_price": 99,
|
||||
"basis": "AVA2 third-hand pickup status; docs/AVA2-CHEST-PICKUP.md in metin2-client"
|
||||
},
|
||||
{
|
||||
"id": 172,
|
||||
"vnum": 71234,
|
||||
"original_price": 99,
|
||||
"basis": "ported mount costume and mount skin; game/src/port_mount.cpp, client MountScript and staged model resources"
|
||||
},
|
||||
{
|
||||
"id": 177,
|
||||
"vnum": 71254,
|
||||
"original_price": 99,
|
||||
"basis": "ported mount costume and mount skin; game/src/port_mount.cpp, client MountScript and staged model resources"
|
||||
},
|
||||
{
|
||||
"id": 183,
|
||||
"vnum": 54126,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 184,
|
||||
"vnum": 54129,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 185,
|
||||
"vnum": 54132,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 186,
|
||||
"vnum": 54135,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 187,
|
||||
"vnum": 54138,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 188,
|
||||
"vnum": 54141,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 189,
|
||||
"vnum": 54144,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 190,
|
||||
"vnum": 54147,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 191,
|
||||
"vnum": 54150,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 192,
|
||||
"vnum": 54153,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 193,
|
||||
"vnum": 54156,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 194,
|
||||
"vnum": 54159,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 195,
|
||||
"vnum": 54162,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 197,
|
||||
"vnum": 54168,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 198,
|
||||
"vnum": 54171,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
},
|
||||
{
|
||||
"id": 199,
|
||||
"vnum": 54174,
|
||||
"original_price": 60,
|
||||
"basis": "ported body/hair/mount-skin fixed enchants; game/src/port_costume_attr.cpp and make_items.ENCHANT_KEEP"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#pragma pack(push,1)
|
||||
struct Ava2ShopRequest {
|
||||
uint8_t operation; uint32_t account,player,product,count,expectedVnum; int64_t expectedTotal; char token[33],name[25],ip[16];
|
||||
};
|
||||
struct Ava2ShopReply { uint32_t account,player,size; };
|
||||
struct Ava2ShopProduct {
|
||||
uint32_t id,vnum; int64_t price; int32_t top; uint8_t discount;
|
||||
int32_t expiry,added; int64_t sold; int32_t weekly,monthly,stock;
|
||||
};
|
||||
struct Ava2ShopLog {
|
||||
uint32_t account; char name[25],date[21]; int32_t time; char ip[16];
|
||||
uint32_t product,vnum; int32_t count; int64_t price;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
static_assert(sizeof(Ava2ShopRequest)==103,"itemshop request");
|
||||
static_assert(sizeof(Ava2ShopProduct)==49,"native TIShopData");
|
||||
static_assert(sizeof(Ava2ShopLog)==90,"native TIShopLogData");
|
||||
|
||||
inline bool Ava2ShopTotal(int64_t unit,uint32_t count,uint8_t discount,int64_t& total) {
|
||||
if(unit<0 || unit>1000000000000LL || count<1 || count>20 || discount>100)return false;
|
||||
total=unit*int64_t(count)*(100-discount)/100;return true;
|
||||
}
|
||||
@@ -78,8 +78,12 @@ enum EItemTypes
|
||||
ITEM_BELT, //34 벨트
|
||||
ITEM_SHINING, //35 AVA2 shining (not ported, keeps the AVA2 numbering)
|
||||
ITEM_NEW_RINGS, //36 AVA2 new rings (port_rings.cpp), worn in WEAR_RINGS_1/2
|
||||
ITEM_PET, // PORT: AVA2 growable pets, explicit item type 37.
|
||||
};
|
||||
|
||||
enum EPetSubTypes { PET_LEVELABLE, PET_EGG, PET_TRANSPORTBOX, PET_PROTEIN, PET_CHANGE_NAME_ITEM, PET_DEW, PET_SKILL, PET_PRIMIUM_FEEDSTUFF, PET_ATTR_CHANGE, PET_ATTR_DETERMINE, PET_EXPFOOD_PER, PET_SKILL_DEL_BOOK, PET_SKILL_ALL_DEL_BOOK, PET_EXPFOOD, PET_FEEDSTUFF };
|
||||
enum EShiningSubTypes { SHINING_WEAPON, SHINING_ARMOR, SHINING_SPECIAL };
|
||||
|
||||
enum EMetinSubTypes
|
||||
{
|
||||
METIN_NORMAL,
|
||||
@@ -119,6 +123,9 @@ enum ECostumeSubTypes
|
||||
COSTUME_MOUNT = 2, // AVA2 mount costume (value0 = horse race)
|
||||
COSTUME_SASH = 3, // AVA2 sash (85001..85024)
|
||||
COSTUME_MOUNT_SKIN = 4, // AVA2 mount skin (value0 = horse race, needs COSTUME_MOUNT)
|
||||
COSTUME_WEAPON = 5, // PORT: preserve existing mount-skin subtype 4.
|
||||
COSTUME_NEW_SASH = 6,
|
||||
COSTUME_PET = 7,
|
||||
COSTUME_NUM_TYPES,
|
||||
};
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ enum EMisc
|
||||
DRAGON_SOUL_REFINE_GRID_SIZE = 15,
|
||||
MAX_AMOUNT_OF_MALL_BONUS = 20,
|
||||
|
||||
WEAR_MAX_NUM = 32,
|
||||
WEAR_MAX_NUM = 40, // PORT: shop costume/pet/shining equipment.
|
||||
|
||||
//LIMIT_GOLD
|
||||
GOLD_MAX = 2000000000,
|
||||
@@ -144,7 +144,14 @@ enum EWearPositions
|
||||
WEAR_RINGS_1, // 28 : AVA2 new ring (ITEM_NEW_RINGS)
|
||||
WEAR_RINGS_2, // 29 : AVA2 new ring
|
||||
|
||||
WEAR_MAX = 32 //
|
||||
WEAR_COSTUME_WEAPON = 30,
|
||||
WEAR_COSTUME_PET = 31,
|
||||
WEAR_PET = 32,
|
||||
WEAR_COSTUME_NEW_SASH = 33,
|
||||
WEAR_SHINING_WEAPON = 34,
|
||||
WEAR_SHINING_ARMOR = 35,
|
||||
WEAR_SHINING_SPECIAL = 36,
|
||||
WEAR_MAX = 40 // PORT: extended appearance equipment.
|
||||
};
|
||||
|
||||
enum EDragonSoulDeckType
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
// User-authorized extension. Chance uses basis points; zero disables that source.
|
||||
struct PortPointDropRule {
|
||||
int chance, minimum, maximum, minimumLevel, maximumOverlevel, dailyCap;
|
||||
bool valid() const {
|
||||
return chance >= 0 && chance <= 10000 && minimum >= 1 && maximum >= minimum &&
|
||||
maximum <= 1000000 && minimumLevel >= 0 && maximumOverlevel >= 0 && dailyCap >= 0;
|
||||
}
|
||||
bool eligible(int targetLevel, int playerLevel) const {
|
||||
return valid() && chance > 0 && targetLevel >= minimumLevel && playerLevel > 0 &&
|
||||
(!maximumOverlevel || playerLevel - targetLevel <= maximumOverlevel);
|
||||
}
|
||||
};
|
||||
|
||||
template<class Lookup> PortPointDropRule PortPointRule(Lookup flag, bool stone) {
|
||||
const std::string prefix = stone ? "points_stone_" : "points_mob_";
|
||||
const int minimum = flag(prefix + "min");
|
||||
const int maximum = flag(prefix + "max");
|
||||
return {flag(prefix + "chance"), minimum ? minimum : 1,
|
||||
maximum ? maximum : (minimum ? minimum : 1), flag("points_min_level"),
|
||||
flag("points_max_overlevel"), flag("points_daily_cap")};
|
||||
}
|
||||
|
||||
inline uint32_t PortPointDropAmount(uint32_t requested, uint64_t earned, uint32_t cap) {
|
||||
if (!cap) return requested;
|
||||
if (earned >= cap) return 0;
|
||||
return static_cast<uint32_t>(std::min<uint64_t>(requested, cap - earned));
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
// PORT: supplementary AVA2 pet/rarity state. Classic item packets retain 3 sockets / 7 attributes.
|
||||
#pragma pack(push,1)
|
||||
struct PortItemExtra {
|
||||
int32_t sockets[5];
|
||||
uint8_t types[8];
|
||||
int16_t values[8];
|
||||
char name[25];
|
||||
};
|
||||
#pragma pack(pop)
|
||||
static_assert(sizeof(PortItemExtra)==69,"extended item state");
|
||||
|
||||
inline std::string PortItemExtraHex(const PortItemExtra& extra) {
|
||||
static const char digits[]="0123456789abcdef";
|
||||
const auto p=reinterpret_cast<const unsigned char*>(&extra);
|
||||
std::string result(sizeof(extra)*2,'0');
|
||||
for(unsigned i=0;i<sizeof(extra);++i){result[2*i]=digits[p[i]>>4];result[2*i+1]=digits[p[i]&15];}
|
||||
return result;
|
||||
}
|
||||
inline bool PortItemExtraRead(const char* hex,PortItemExtra& extra) {
|
||||
std::memset(&extra,0,sizeof(extra));
|
||||
if(!hex || !*hex)return true;
|
||||
if(std::strlen(hex)!=sizeof(extra)*2)return false;
|
||||
auto nibble=[](char c){return c>='0' && c<='9'?c-'0':c>='A' && c<='F'?c-'A'+10:c>='a' && c<='f'?c-'a'+10:-1;};
|
||||
auto p=reinterpret_cast<unsigned char*>(&extra);
|
||||
for(unsigned i=0;i<sizeof(extra);++i){int a=nibble(hex[2*i]),b=nibble(hex[2*i+1]);if(a<0 || b<0){std::memset(&extra,0,sizeof(extra));return false;}p[i]=(a<<4)|b;}
|
||||
extra.name[24]=0;return true;
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
#include "port_item_extra.h"
|
||||
#ifndef __INC_TABLES_H__
|
||||
#define __INC_TABLES_H__
|
||||
|
||||
@@ -398,6 +399,7 @@ typedef struct SPlayerItem
|
||||
TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
|
||||
|
||||
DWORD owner;
|
||||
PortItemExtra extra; // PORT: internal game/db state, not a classic client packet.
|
||||
} TPlayerItem;
|
||||
|
||||
typedef struct SQuickslot
|
||||
|
||||
@@ -143,7 +143,7 @@ void AuctionManager::LoadAuctionItem()
|
||||
for (int i = 0; i < rows; ++i)
|
||||
{
|
||||
MYSQL_ROW row = mysql_fetch_row(res);
|
||||
TPlayerItem item;
|
||||
TPlayerItem item={};
|
||||
|
||||
int cur = 0;
|
||||
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
// AVA2 GC93 catalogue with transactional, replay-safe purchases.
|
||||
#include "stdafx.h"
|
||||
#include "ClientManager.h"
|
||||
#include "Config.h"
|
||||
#include "DBManager.h"
|
||||
#include "ItemAwardManager.h"
|
||||
#include "../../common/ava2_itemshop.h"
|
||||
#include "../../common/point_drop.h"
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
namespace {
|
||||
using Query=std::unique_ptr<SQLMsg>;
|
||||
Query query(const std::string& sql) { return Query(CDBManager::instance().DirectQuery(sql.c_str(),SQL_PLAYER)); }
|
||||
bool ok(const Query& q) { return q && !q->uiSQLErrno && q->Get(); }
|
||||
bool run(const std::string& sql) { auto q=query(sql);return ok(q); }
|
||||
std::string decimal(uint64_t n) { return std::to_string(n); }
|
||||
std::string escape(const char* text) { char out[513];size_t n=strnlen(text,255);CDBManager::instance().EscapeString(out,text,n);return std::string(out); }
|
||||
std::string accountDB() {
|
||||
char a[257]={},p[257]={};
|
||||
if (!CConfig::instance().GetValue("SQL_ACCOUNT",a,256) || !CConfig::instance().GetValue("SQL_PLAYER",p,256)) return "";
|
||||
std::string ah,ad,au,ap,ph,pd,pu,pp;int aport=3306,pport=3306;
|
||||
std::istringstream as(a),ps(p);as>>ah>>ad>>au>>ap>>aport;ps>>ph>>pd>>pu>>pp>>pport;
|
||||
if (ah!=ph || aport!=pport || ad.empty()) return ""; // One MySQL connection must own the whole transaction.
|
||||
for (auto c:ad) if (!std::isalnum(static_cast<unsigned char>(c)) && c!='_') return "";
|
||||
return "`"+ad+"`";
|
||||
}
|
||||
bool transactional(const std::string& account) {
|
||||
auto q=query("SELECT COUNT(*) FROM information_schema.tables WHERE ENGINE='InnoDB' AND ((TABLE_SCHEMA=DATABASE() AND TABLE_NAME IN ('ishop_data','port_itemshop_orders','item_award')) OR (TABLE_SCHEMA='"+account.substr(1,account.size()-2)+"' AND TABLE_NAME='account'))");
|
||||
if (!ok(q) || !q->Get()->uiNumRows)return false;
|
||||
return atoi(mysql_fetch_row(q->Get()->pSQLResult)[0])==4;
|
||||
}
|
||||
struct Transaction {
|
||||
bool active; MYSQL* connection; unsigned previousTimeout;
|
||||
Transaction():active(false),connection(CDBManager::instance().DirectHandle(SQL_PLAYER)),previousTimeout(50) {
|
||||
// A reconnect inside a transaction would silently resume subsequent statements in autocommit.
|
||||
my_bool reconnect=false;mysql_options(connection,MYSQL_OPT_RECONNECT,&reconnect);
|
||||
auto settings=query("SELECT @@session.innodb_lock_wait_timeout");
|
||||
if(!ok(settings) || settings->Get()->uiNumRows!=1)return;
|
||||
previousTimeout=strtoul(mysql_fetch_row(settings->Get()->pSQLResult)[0],0,10);
|
||||
active=run("SET SESSION innodb_lock_wait_timeout=3") && run("START TRANSACTION");
|
||||
}
|
||||
~Transaction(){
|
||||
if(mysql_errno(connection)!=CR_SERVER_LOST && mysql_errno(connection)!=CR_SERVER_GONE_ERROR) {
|
||||
if(active)run("ROLLBACK");
|
||||
if(mysql_errno(connection)!=CR_SERVER_LOST && mysql_errno(connection)!=CR_SERVER_GONE_ERROR)
|
||||
run("SET SESSION innodb_lock_wait_timeout="+decimal(previousTimeout));
|
||||
}
|
||||
my_bool reconnect=true;mysql_options(connection,MYSQL_OPT_RECONNECT,&reconnect);
|
||||
}
|
||||
bool commit(){if(!active || !run("COMMIT"))return false;active=false;return true;}
|
||||
};
|
||||
template<class T>void append(std::vector<char>& out,const T& value){const char* p=reinterpret_cast<const char*>(&value);out.insert(out.end(),p,p+sizeof(value));}
|
||||
void reply(CPeer* peer,DWORD handle,const Ava2ShopRequest& request,const std::vector<char>& out) {
|
||||
if (out.empty() || out.size()>32763)return;
|
||||
Ava2ShopReply h={request.account,request.player,uint32_t(out.size())};
|
||||
peer->EncodeHeader(76,handle,sizeof(h)+out.size());peer->Encode(&h,sizeof(h));peer->Encode(out.data(),out.size());
|
||||
}
|
||||
Ava2ShopProduct product(MYSQL_ROW r) {
|
||||
Ava2ShopProduct p={};p.id=strtoul(r[0],0,10);p.vnum=strtoul(r[1],0,10);p.price=strtoll(r[2],0,10);p.discount=atoi(r[3]);p.expiry=atoi(r[4]);p.added=atoi(r[5]);p.sold=strtoll(r[6],0,10);p.weekly=atoi(r[7]);p.monthly=atoi(r[8]);p.stock=atoi(r[9]);return p;
|
||||
}
|
||||
const char* fields="id,itemVnum,itemPrice,discount,IFNULL(UNIX_TIMESTAMP(offerTime),0),IFNULL(UNIX_TIMESTAMP(addedTime),0),sellCount,week_limit,month_limit,maxSellCount";
|
||||
bool valid(const Ava2ShopProduct& p) {return p.id && p.vnum && p.price>=0 && p.price<=1000000000000LL && p.discount<=100 && p.weekly>=0 && p.monthly>=0 && p.stock>=-1;}
|
||||
}
|
||||
void CClientManager::Ava2ItemShop(CPeer* peer,DWORD handle,const char* data,DWORD length) {
|
||||
if (length!=sizeof(Ava2ShopRequest))return;
|
||||
Ava2ShopRequest r;memcpy(&r,data,sizeof(r));
|
||||
if (r.operation>3 || !r.account || !r.player || r.token[32] || r.name[24] || r.ip[15])return;
|
||||
if(r.operation==3) {
|
||||
// This operation has no client command. Only an authenticated game peer may report a kill.
|
||||
if(!peer->GetChannel() || strlen(r.token)!=32 || r.count<1 || r.count>1000000 || !r.expectedVnum || r.expectedVnum>255)return;
|
||||
for(char c:std::string(r.token))if(!std::isxdigit(static_cast<unsigned char>(c)))return;
|
||||
const std::string adb=accountDB(),aid=decimal(r.account);
|
||||
uint8_t status=6;uint32_t granted=0;int64_t balance=0;
|
||||
auto mob=std::find_if(m_vec_mobTable.begin(),m_vec_mobTable.end(),[&](const TMobTable& m){return m.dwVnum==r.product;});
|
||||
const bool validMob=mob!=m_vec_mobTable.end() && (mob->bType==0 || mob->bType==2);
|
||||
const auto rule=PortPointRule([&](const std::string& key){auto it=m_map_lEventFlag.find(key);return it==m_map_lEventFlag.end()?0:int(it->second);},validMob && mob->bType==2);
|
||||
auto engine=query("SELECT COUNT(*) FROM information_schema.tables WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='port_point_rewards' AND ENGINE='InnoDB'");
|
||||
if(validMob && !adb.empty() && transactional(adb) && ok(engine) && engine->Get()->uiNumRows==1 && atoi(mysql_fetch_row(engine->Get()->pSQLResult)[0])==1) {
|
||||
Transaction tx;
|
||||
if(tx.active) {
|
||||
auto owner=query("SELECT account_id FROM player WHERE id="+decimal(r.player));
|
||||
auto wallet=query("SELECT coins FROM "+adb+".account WHERE id="+aid+" FOR UPDATE");
|
||||
if(ok(owner) && owner->Get()->uiNumRows==1 && strtoul(mysql_fetch_row(owner->Get()->pSQLResult)[0],0,10)==r.account && ok(wallet) && wallet->Get()->uiNumRows==1) {
|
||||
balance=strtoll(mysql_fetch_row(wallet->Get()->pSQLResult)[0],0,10);
|
||||
auto previous=query("SELECT account_id,vnum,requested,amount FROM port_point_rewards WHERE token='"+std::string(r.token)+"'");
|
||||
if(ok(previous) && previous->Get()->uiNumRows==1) {
|
||||
auto row=mysql_fetch_row(previous->Get()->pSQLResult);
|
||||
if(strtoul(row[0],0,10)==r.account && strtoul(row[1],0,10)==r.product && strtoul(row[2],0,10)==r.count){granted=strtoul(row[3],0,10);status=0;}else status=7;
|
||||
} else if(ok(previous)) {
|
||||
if(!rule.eligible(mob->bLevel,r.expectedVnum) || r.count<uint32_t(rule.minimum) || r.count>uint32_t(rule.maximum))status=1;
|
||||
else {
|
||||
auto earned=query("SELECT COALESCE(SUM(amount),0) FROM port_point_rewards WHERE account_id="+aid+" AND reward_day=CURDATE()");
|
||||
if(ok(earned) && earned->Get()->uiNumRows==1) {
|
||||
granted=PortPointDropAmount(r.count,strtoull(mysql_fetch_row(earned->Get()->pSQLResult)[0],0,10),rule.dailyCap);
|
||||
if(balance<0 || uint64_t(balance)>uint64_t(INT64_MAX)-granted){status=1;granted=0;}
|
||||
else {
|
||||
bool success=run("UPDATE "+adb+".account SET coins=coins+"+decimal(granted)+" WHERE id="+aid);
|
||||
success=success && run("INSERT INTO port_point_rewards(token,account_id,player_id,vnum,requested,amount,reward_day) VALUES('"+std::string(r.token)+"',"+aid+","+decimal(r.player)+","+decimal(r.product)+","+decimal(r.count)+","+decimal(granted)+",CURDATE())");
|
||||
if(success){if(tx.commit()){balance+=granted;status=0;}else status=8;}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::vector<char> out;append(out,uint8_t(9));append(out,status);out.insert(out.end(),r.token,r.token+32);append(out,granted);append(out,balance);
|
||||
reply(peer,handle,r,out);return;
|
||||
}
|
||||
auto login=GetLoginDataByAID(r.account);
|
||||
if (!login || !login->IsPlay() || login->GetConnectedPeerHandle()!=peer->GetHandle())return;
|
||||
bool owned=false;for (const auto& p:login->GetAccountRef().players)if(p.dwID==r.player)owned=true;
|
||||
if(!owned)return;
|
||||
std::vector<char> out;
|
||||
const std::string adb=accountDB(),aid=decimal(r.account);
|
||||
int64_t balance=0;
|
||||
auto wallet=adb.empty()?Query():query("SELECT coins FROM "+adb+".account WHERE id="+aid);
|
||||
if(!ok(wallet) || wallet->Get()->uiNumRows!=1) {
|
||||
append(out,uint8_t(8));reply(peer,handle,r,out);return;
|
||||
}
|
||||
balance=strtoll(mysql_fetch_row(wallet->Get()->pSQLResult)[0],0,10);
|
||||
if(r.operation==0) {
|
||||
auto rows=query(std::string("SELECT ")+fields+",categoryType,categorySubType FROM ishop_data WHERE enabled=1 ORDER BY categoryType,categorySubType,id LIMIT 511");
|
||||
if (!ok(rows) || rows->Get()->uiNumRows>510) {append(out,uint8_t(8));reply(peer,handle,r,out);return;}
|
||||
std::map<uint8_t,std::map<uint8_t,std::vector<Ava2ShopProduct>>> catalogue;
|
||||
MYSQL_ROW row;
|
||||
while((row=mysql_fetch_row(rows->Get()->pSQLResult))) {
|
||||
auto p=product(row);int cat=atoi(row[10]),sub=atoi(row[11]);
|
||||
if(!valid(p) || cat<0 || cat>7 || sub<0 || sub>9 || (!m_map_itemTableByVnum.count(p.vnum) || m_map_itemTableByVnum.at(p.vnum)->bType==ITEM_NONE))continue;
|
||||
catalogue[cat][sub].push_back(p);
|
||||
}
|
||||
std::vector<Ava2ShopProduct*> ranked;
|
||||
for(auto& cat:catalogue)for(auto& sub:cat.second)for(auto& p:sub.second)ranked.push_back(&p);
|
||||
std::sort(ranked.begin(),ranked.end(),[](const Ava2ShopProduct* a,const Ava2ShopProduct* b){return a->sold!=b->sold?a->sold>b->sold:a->id<b->id;});
|
||||
for(size_t i=0;i<ranked.size();++i)ranked[i]->top=int32_t(i+1);
|
||||
append(out,uint8_t(0));append(out,balance);append(out,int32_t(time(0)));append(out,int32_t(catalogue.size()));
|
||||
for (auto& cat:catalogue) {
|
||||
append(out,cat.first);append(out,uint8_t(cat.second.size()));
|
||||
for(auto& sub:cat.second) {
|
||||
if(sub.second.size()>255){out.clear();append(out,uint8_t(8));reply(peer,handle,r,out);return;}
|
||||
append(out,sub.first);append(out,uint8_t(sub.second.size()));for(auto& p:sub.second)append(out,p);
|
||||
}
|
||||
}
|
||||
} else if(r.operation==1) {
|
||||
auto rows=query("SELECT player_name,created_at,UNIX_TIMESTAMP(created_at),ip,product,vnum,quantity,paid FROM port_itemshop_orders WHERE account_id="+aid+" ORDER BY id DESC LIMIT 100");
|
||||
if(!ok(rows)){append(out,uint8_t(8));reply(peer,handle,r,out);return;}
|
||||
append(out,uint8_t(1));append(out,int32_t(rows->Get()->uiNumRows));MYSQL_ROW row;
|
||||
while((row=mysql_fetch_row(rows->Get()->pSQLResult))) {
|
||||
Ava2ShopLog log={};log.account=r.account;strlcpy(log.name,row[0],sizeof(log.name));strlcpy(log.date,row[1],sizeof(log.date));log.time=atoi(row[2]);strlcpy(log.ip,row[3],sizeof(log.ip));log.product=strtoul(row[4],0,10);log.vnum=strtoul(row[5],0,10);log.count=atoi(row[6]);log.price=strtoll(row[7],0,10);append(out,log);
|
||||
}
|
||||
} else {
|
||||
if (r.count<1 || r.count>20 || strlen(r.token)!=32)return;
|
||||
for(char c:std::string(r.token))if(!std::isxdigit(static_cast<unsigned char>(c)))return;
|
||||
uint8_t status=6; // unavailable; errors always leave balance/stock/awards untouched
|
||||
if(transactional(adb)) {
|
||||
Transaction tx;
|
||||
if(tx.active) {
|
||||
auto locked=query("SELECT coins FROM "+adb+".account WHERE id="+aid+" FOR UPDATE");
|
||||
if(ok(locked) && locked->Get()->uiNumRows==1) {
|
||||
balance=strtoll(mysql_fetch_row(locked->Get()->pSQLResult)[0],0,10);
|
||||
auto previous=query("SELECT product,quantity,paid,vnum FROM port_itemshop_orders WHERE account_id="+aid+" AND token='"+r.token+"'");
|
||||
if(ok(previous) && previous->Get()->uiNumRows) {
|
||||
auto row=mysql_fetch_row(previous->Get()->pSQLResult);
|
||||
status=(strtoul(row[0],0,10)==r.product && strtoul(row[1],0,10)==r.count && strtoll(row[2],0,10)==r.expectedTotal && strtoul(row[3],0,10)==r.expectedVnum)?0:7;
|
||||
} else if(ok(previous)) {
|
||||
auto rows=query(std::string("SELECT ")+fields+" FROM ishop_data WHERE enabled=1 AND id="+decimal(r.product)+" FOR UPDATE");
|
||||
if(ok(rows) && rows->Get()->uiNumRows==1) {
|
||||
auto p=product(mysql_fetch_row(rows->Get()->pSQLResult));
|
||||
auto proto=m_map_itemTableByVnum.find(p.vnum);
|
||||
if(valid(p) && proto!=m_map_itemTableByVnum.end() && proto->second->bType!=ITEM_NONE) {
|
||||
int64_t price=0;Ava2ShopTotal(p.price,r.count,p.discount,price);
|
||||
status=0;
|
||||
if(price!=r.expectedTotal || p.vnum!=r.expectedVnum)status=9;
|
||||
else if(balance<price || balance<0)status=1;
|
||||
else if(p.stock>=0 && uint32_t(p.stock)<r.count)status=4;
|
||||
else if(p.expiry && time(0)>p.expiry)status=5;
|
||||
if(!status && (p.weekly || p.monthly)) {
|
||||
auto limits=query("SELECT IFNULL(SUM(IF(created_at>=DATE_SUB(CURDATE(),INTERVAL WEEKDAY(CURDATE()) DAY),quantity,0)),0),IFNULL(SUM(quantity),0) FROM port_itemshop_orders WHERE account_id="+aid+" AND product="+decimal(p.id)+" AND created_at>=DATE_FORMAT(NOW(),'%Y-%m-01')-INTERVAL 7 DAY");
|
||||
// Month and week are computed independently across month boundaries.
|
||||
auto month=query("SELECT IFNULL(SUM(quantity),0) FROM port_itemshop_orders WHERE account_id="+aid+" AND product="+decimal(p.id)+" AND created_at>=DATE_FORMAT(NOW(),'%Y-%m-01')");
|
||||
if(!ok(limits)||!ok(month))status=6;
|
||||
else {auto a=mysql_fetch_row(limits->Get()->pSQLResult);auto b=mysql_fetch_row(month->Get()->pSQLResult);if(p.weekly && strtoull(a[0],0,10)+r.count>uint64_t(p.weekly))status=2;else if(p.monthly && strtoull(b[0],0,10)+r.count>uint64_t(p.monthly))status=3;}
|
||||
}
|
||||
if(!status) {
|
||||
bool success=run("UPDATE "+adb+".account SET coins=coins-"+decimal(price)+" WHERE id="+aid) && run("UPDATE ishop_data SET sellCount=sellCount+"+decimal(r.count)+",maxSellCount=IF(maxSellCount<0,-1,maxSellCount-"+decimal(r.count)+") WHERE id="+decimal(p.id));
|
||||
success=success && run("INSERT INTO port_itemshop_orders(account_id,token,product,vnum,quantity,paid,player_name,ip) VALUES("+aid+",'"+r.token+"',"+decimal(p.id)+","+decimal(p.vnum)+","+decimal(r.count)+","+decimal(price)+",'"+escape(r.name)+"','"+escape(login->GetIP())+"')");
|
||||
const bool stackable=(proto->second->dwFlags&ITEM_FLAG_STACKABLE)!=0;
|
||||
for(uint32_t left=r.count;success && left;) {
|
||||
uint32_t count=stackable?left:1;left-=count;
|
||||
success=run("INSERT INTO item_award(login,vnum,count,mall,why,given_time) VALUES('"+escape(login->GetAccountRef().login)+"',"+decimal(p.vnum)+","+decimal(count)+",1,'ISHOP:"+r.token+"',NOW())");
|
||||
}
|
||||
if(success){if(tx.commit())balance-=price;else status=8;}else status=6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
append(out,uint8_t(7));out.insert(out.end(),r.token,r.token+32);append(out,status);append(out,balance);
|
||||
}
|
||||
reply(peer,handle,r,out);
|
||||
}
|
||||
@@ -138,6 +138,9 @@ void CItemCache::OnFlush()
|
||||
p->aAttr[6].bType, p->aAttr[6].sValue);
|
||||
}
|
||||
|
||||
const std::string extraHex=PortItemExtraHex(p->extra);
|
||||
iLen += snprintf(szColumns+iLen,sizeof(szColumns)-iLen,", port_extra");
|
||||
iValueLen += snprintf(szValues+iValueLen,sizeof(szValues)-iValueLen,", X'%s'",extraHex.c_str());
|
||||
char szItemQuery[QUERY_MAX_LEN + QUERY_MAX_LEN];
|
||||
snprintf(szItemQuery, sizeof(szItemQuery), "REPLACE INTO item%s (%s) VALUES(%s)", GetTablePostfix(), szColumns, szValues);
|
||||
|
||||
|
||||
@@ -581,7 +581,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg)
|
||||
"attrtype3, attrvalue3, "
|
||||
"attrtype4, attrvalue4, "
|
||||
"attrtype5, attrvalue5, "
|
||||
"attrtype6, attrvalue6 "
|
||||
"attrtype6, attrvalue6, HEX(port_extra) "
|
||||
"FROM item%s WHERE owner_id=%d AND window='%s'",
|
||||
GetTablePostfix(), pi->account_id, pi->ip[0] == 0 ? "SAFEBOX" : "MALL");
|
||||
|
||||
@@ -673,7 +673,7 @@ void CClientManager::RESULT_SAFEBOX_LOAD(CPeer * pkPeer, SQLMsg * msg)
|
||||
if ((iPos = grid.FindBlank(1, it->second->bSize)) == -1)
|
||||
break;
|
||||
|
||||
TPlayerItem item;
|
||||
TPlayerItem item={};
|
||||
memset(&item, 0, sizeof(TPlayerItem));
|
||||
|
||||
// DWORD dwSocket2 = 0;
|
||||
@@ -1307,7 +1307,7 @@ void CClientManager::QUERY_ITEM_SAVE(CPeer * pkPeer, const char * c_pData)
|
||||
|
||||
delete c;
|
||||
}
|
||||
char szQuery[512];
|
||||
char szQuery[2048];
|
||||
|
||||
snprintf(szQuery, sizeof(szQuery),
|
||||
"REPLACE INTO item%s (id, owner_id, window, pos, count, vnum, socket0, socket1, socket2, "
|
||||
@@ -1317,8 +1317,8 @@ void CClientManager::QUERY_ITEM_SAVE(CPeer * pkPeer, const char * c_pData)
|
||||
"attrtype3, attrvalue3, "
|
||||
"attrtype4, attrvalue4, "
|
||||
"attrtype5, attrvalue5, "
|
||||
"attrtype6, attrvalue6) "
|
||||
"VALUES(%u, %u, %d, %d, %u, %u, %ld, %ld, %ld, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
|
||||
"attrtype6, attrvalue6, port_extra) "
|
||||
"VALUES(%u, %u, %d, %d, %u, %u, %ld, %ld, %ld, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, X'%s')",
|
||||
GetTablePostfix(),
|
||||
p->id,
|
||||
p->owner,
|
||||
@@ -1335,7 +1335,7 @@ void CClientManager::QUERY_ITEM_SAVE(CPeer * pkPeer, const char * c_pData)
|
||||
p->aAttr[3].bType, p->aAttr[3].sValue,
|
||||
p->aAttr[4].bType, p->aAttr[4].sValue,
|
||||
p->aAttr[5].bType, p->aAttr[5].sValue,
|
||||
p->aAttr[6].bType, p->aAttr[6].sValue);
|
||||
p->aAttr[6].bType, p->aAttr[6].sValue, PortItemExtraHex(p->extra).c_str());
|
||||
|
||||
CDBManager::instance().ReturnQuery(szQuery, QID_ITEM_SAVE, pkPeer->GetHandle(), NULL);
|
||||
}
|
||||
@@ -2327,7 +2327,9 @@ void CClientManager::ProcessPackets(CPeer * peer)
|
||||
|
||||
switch (header)
|
||||
{
|
||||
case HEADER_GD_BOOT:
|
||||
case 76:
|
||||
Ava2ItemShop(peer,dwHandle,data,dwLength);break;
|
||||
case HEADER_GD_BOOT:
|
||||
QUERY_BOOT(peer, (TPacketGDBoot *) data);
|
||||
break;
|
||||
|
||||
@@ -4709,7 +4711,7 @@ void CClientManager::AuctionGetAuctionedItem (CPeer * peer, DWORD actor_id, DWOR
|
||||
return;
|
||||
}
|
||||
|
||||
TPlayerItem item;
|
||||
TPlayerItem item={};
|
||||
result = AuctionManager::instance().GetAuctionedItem(actor_id, item_id, item);
|
||||
|
||||
if (result <= AUCTION_FAIL)
|
||||
@@ -4749,7 +4751,7 @@ void CClientManager::AuctionBuySoldItem (CPeer * peer, DWORD actor_id, DWORD ite
|
||||
return;
|
||||
}
|
||||
|
||||
TPlayerItem item;
|
||||
TPlayerItem item={};
|
||||
result = AuctionManager::instance().BuySoldItem(actor_id, item_id, item);
|
||||
|
||||
if (result <= AUCTION_FAIL)
|
||||
@@ -4789,7 +4791,7 @@ void CClientManager::AuctionCancelAuction (CPeer * peer, DWORD actor_id, DWORD i
|
||||
return;
|
||||
}
|
||||
|
||||
TPlayerItem item;
|
||||
TPlayerItem item={};
|
||||
result = AuctionManager::instance().CancelAuction(actor_id, item_id, item);
|
||||
|
||||
if (result <= AUCTION_FAIL)
|
||||
@@ -4829,7 +4831,7 @@ void CClientManager::AuctionCancelWish (CPeer * peer, DWORD actor_id, DWORD item
|
||||
return;
|
||||
}
|
||||
|
||||
TPlayerItem item;
|
||||
TPlayerItem item={};
|
||||
result = AuctionManager::instance().CancelWish(actor_id, item_num);
|
||||
|
||||
if (result <= AUCTION_FAIL)
|
||||
@@ -4868,7 +4870,7 @@ void CClientManager::AuctionCancelSale (CPeer * peer, DWORD actor_id, DWORD item
|
||||
return;
|
||||
}
|
||||
|
||||
TPlayerItem item;
|
||||
TPlayerItem item={};
|
||||
result = AuctionManager::instance().CancelSale(actor_id, item_id, item);
|
||||
|
||||
if (result <= AUCTION_FAIL)
|
||||
|
||||
@@ -200,6 +200,7 @@ class CClientManager : public CNetBase, public singleton<CClientManager>
|
||||
int Process();
|
||||
|
||||
void ProcessPackets(CPeer * peer);
|
||||
void Ava2ItemShop(CPeer* peer, DWORD handle, const char* data, DWORD length);
|
||||
|
||||
CLoginData * GetLoginData(DWORD dwKey);
|
||||
CLoginData * GetLoginDataByLogin(const char * c_pszLogin);
|
||||
|
||||
@@ -815,6 +815,8 @@ bool CClientManager::InitializeItemTable()
|
||||
// InitializeQuestItemTable();
|
||||
// END_OF_QUEST_ITEM_PROTO_DISABLE
|
||||
|
||||
// Build pointers only after sorting; otherwise each key can point to another prototype.
|
||||
sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());
|
||||
m_map_itemTableByVnum.clear();
|
||||
|
||||
itertype(m_vec_itemTable) it = m_vec_itemTable.begin();
|
||||
@@ -842,7 +844,6 @@ bool CClientManager::InitializeItemTable()
|
||||
|
||||
m_map_itemTableByVnum.insert(std::map<DWORD, TItemTable *>::value_type(item_table->dwVnum, item_table));
|
||||
}
|
||||
sort(m_vec_itemTable.begin(), m_vec_itemTable.end(), FCompareVnum());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ bool CreateItemTableFromRes(MYSQL_RES * res, std::vector<TPlayerItem> * pVec, DW
|
||||
str_to_number(item.aAttr[j].sValue, row[cur++]);
|
||||
}
|
||||
|
||||
PortItemExtraRead(mysql_num_fields(res)>unsigned(cur)?row[cur]:NULL,item.extra);
|
||||
item.owner = dwPID;
|
||||
}
|
||||
|
||||
@@ -321,7 +322,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad
|
||||
else
|
||||
{
|
||||
snprintf(szQuery, sizeof(szQuery),
|
||||
"SELECT id,window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6 "
|
||||
"SELECT id,window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6,HEX(port_extra) "
|
||||
"FROM item%s WHERE owner_id=%d AND (window < %d or window = %d or window = %d)",
|
||||
GetTablePostfix(), pTab->id, SAFEBOX, DRAGON_SOUL_INVENTORY, SWITCHBOT);
|
||||
|
||||
@@ -378,7 +379,7 @@ void CClientManager::QUERY_PLAYER_LOAD(CPeer * peer, DWORD dwHandle, TPlayerLoad
|
||||
// ¾ÆÀÌÅÛ °¡Á®¿À±â
|
||||
//--------------------------------------------------------------
|
||||
snprintf(queryStr, sizeof(queryStr),
|
||||
"SELECT id,window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6 "
|
||||
"SELECT id,window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6,HEX(port_extra) "
|
||||
"FROM item%s WHERE owner_id=%d AND (window < %d or window = %d or window = %d)",
|
||||
GetTablePostfix(), packet->player_id, SAFEBOX, DRAGON_SOUL_INVENTORY, SWITCHBOT);
|
||||
CDBManager::instance().ReturnQuery(queryStr, QID_ITEM, peer->GetHandle(), new ClientHandleInfo(dwHandle, packet->player_id));
|
||||
|
||||
@@ -46,6 +46,7 @@ class CDBManager : public singleton<CDBManager>
|
||||
|
||||
void ReturnQuery(const char * c_pszQuery, int iType, DWORD dwIdent, void * pvData, int iSlot = SQL_PLAYER);
|
||||
void AsyncQuery(const char * c_pszQuery, int iSlot = SQL_PLAYER);
|
||||
MYSQL* DirectHandle(int slot=SQL_PLAYER) { return m_directSQL[slot]->GetSQLHandle(); }
|
||||
SQLMsg * DirectQuery(const char * c_pszQuery, int iSlot = SQL_PLAYER);
|
||||
|
||||
SQLMsg * PopResult();
|
||||
|
||||
@@ -39,7 +39,7 @@ SRCS = Config.cpp NetBase.cpp Peer.cpp PeerBase.cpp Main.cpp Lock.cpp DBManager.
|
||||
ClientManagerBoot.cpp ClientManagerParty.cpp ClientManagerGuild.cpp GuildManager.cpp HB.cpp \
|
||||
PrivManager.cpp MoneyLog.cpp ItemAwardManager.cpp ClientManagerEventFlag.cpp Marriage.cpp \
|
||||
Monarch.cpp BlockCountry.cpp ItemIDRangeManager.cpp ClientManagerHorseName.cpp version.cpp \
|
||||
AuctionManager.cpp ProtoReader.cpp CsvReader.cpp
|
||||
AuctionManager.cpp ProtoReader.cpp CsvReader.cpp Ava2ItemShop.cpp
|
||||
|
||||
OBJS = $(SRCS:%.cpp=$(OBJDIR)/%.o)
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ int get_Item_Type_Value(string inputString)
|
||||
|
||||
"ITEM_RING",
|
||||
"ITEM_BELT", //35개 (EItemTypes 값으로 치면 34)
|
||||
"ITEM_SHINING", "ITEM_NEW_RINGS", // AVA2 35 (not ported), 36 new rings
|
||||
"ITEM_SHINING", "ITEM_NEW_RINGS", "ITEM_PET", // AVA2 35 (not ported), 36 new rings
|
||||
};
|
||||
|
||||
|
||||
@@ -123,8 +123,10 @@ int get_Item_SubType_Value(int type_value, string inputString)
|
||||
"RESOURCE_STONE", "RESOURCE_METIN", "RESOURCE_ORE" };
|
||||
static string arSub16[] = { "UNIQUE_NONE", "UNIQUE_BOOK", "UNIQUE_SPECIAL_RIDE", "UNIQUE_3", "UNIQUE_4", "UNIQUE_5",
|
||||
"UNIQUE_6", "UNIQUE_7", "UNIQUE_8", "UNIQUE_9", "USE_SPECIAL"};
|
||||
static string arSub28[] = { "COSTUME_BODY", "COSTUME_HAIR", "COSTUME_MOUNT", "COSTUME_SASH", "COSTUME_MOUNT_SKIN" };
|
||||
static string arSub28[] = { "COSTUME_BODY", "COSTUME_HAIR", "COSTUME_MOUNT", "COSTUME_SASH", "COSTUME_MOUNT_SKIN", "COSTUME_WEAPON", "COSTUME_NEW_SASH", "COSTUME_PET" };
|
||||
static string arSub29[] = { "DS_SLOT1", "DS_SLOT2", "DS_SLOT3", "DS_SLOT4", "DS_SLOT5", "DS_SLOT6" };
|
||||
static string arSub35[] = { "SHINING_WEAPON", "SHINING_ARMOR", "SHINING_SPECIAL" };
|
||||
static string arSub37[] = { "PET_LEVELABLE", "PET_EGG", "PET_TRANSPORTBOX", "PET_PROTEIN", "PET_CHANGE_NAME_ITEM", "PET_DEW", "PET_SKILL", "PET_PRIMIUM_FEEDSTUFF", "PET_ATTR_CHANGE", "PET_ATTR_DETERMINE", "PET_EXPFOOD_PER", "PET_SKILL_DEL_BOOK", "PET_SKILL_ALL_DEL_BOOK", "PET_EXPFOOD", "PET_FEEDSTUFF" };
|
||||
static string arSub31[] = { "EXTRACT_DRAGON_SOUL", "EXTRACT_DRAGON_HEART" };
|
||||
|
||||
static string* arSubType[] = {0, //0
|
||||
@@ -162,8 +164,9 @@ int get_Item_SubType_Value(int type_value, string inputString)
|
||||
0, //32
|
||||
0, //33 반지
|
||||
0, //34 벨트
|
||||
0, //35 ITEM_SHINING
|
||||
arSub35, //35 ITEM_SHINING
|
||||
0, //36 ITEM_NEW_RINGS
|
||||
arSub37, //37 ITEM_PET
|
||||
};
|
||||
static int arNumberOfSubtype[_countof(arSubType)] = {
|
||||
0,
|
||||
@@ -201,8 +204,9 @@ int get_Item_SubType_Value(int type_value, string inputString)
|
||||
0, // 32
|
||||
0, // 33 반지
|
||||
0, // 34 벨트
|
||||
0, // 35
|
||||
sizeof(arSub35)/sizeof(arSub35[0]), // 35
|
||||
0, // 36
|
||||
sizeof(arSub37)/sizeof(arSub37[0]), // 37
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ CPPFILE = BattleArena.cpp FSM.cpp MarkConvert.cpp MarkImage.cpp MarkManager.cpp
|
||||
desc_client.cpp desc_manager.cpp desc_p2p.cpp dev_log.cpp dungeon.cpp empire_text_convert.cpp entity.cpp\
|
||||
entity_view.cpp event.cpp event_queue.cpp exchange.cpp file_loader.cpp fishing.cpp gm.cpp guild.cpp\
|
||||
guild_manager.cpp guild_war.cpp horse_rider.cpp horsename_manager.cpp input.cpp input_auth.cpp input_db.cpp\
|
||||
input_login.cpp input_main.cpp input_p2p.cpp port_boss_track.cpp ava2_channel.cpp new_mob_timer.cpp ava2_track.cpp ava2_ticket_shop.cpp port_attr_lock.cpp port_sash.cpp port_mount.cpp port_costume_attr.cpp port_pendant.cpp port_rings.cpp port_switchbot.cpp port_ava2_dungeon.cpp input_teen.cpp input_udp.cpp ip_ban.cpp\
|
||||
input_login.cpp input_main.cpp input_p2p.cpp port_boss_track.cpp ava2_channel.cpp new_mob_timer.cpp ava2_track.cpp ava2_ticket_shop.cpp ava2_itemshop.cpp port_attr_lock.cpp port_sash.cpp port_mount.cpp port_costume_attr.cpp port_pendant.cpp port_rings.cpp port_switchbot.cpp port_ava2_dungeon.cpp input_teen.cpp input_udp.cpp ip_ban.cpp\
|
||||
item.cpp item_addon.cpp item_attribute.cpp item_manager.cpp item_manager_idrange.cpp locale.cpp\
|
||||
locale_service.cpp log.cpp login_data.cpp lzo_manager.cpp marriage.cpp matrix_card.cpp\
|
||||
messenger_manager.cpp mining.cpp mob_manager.cpp monarch.cpp motion.cpp over9refine.cpp p2p.cpp packet_info.cpp\
|
||||
|
||||
@@ -715,6 +715,7 @@ bool AuctionManager::InsertItem (TPlayerItem* player_item)
|
||||
}
|
||||
item->SetSockets(player_item->alSockets);
|
||||
item->SetAttributes(player_item->aAttr);
|
||||
item->SetPortExtra(player_item->extra);
|
||||
item->SetWindow(AUCTION);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
#include "stdafx.h"
|
||||
#include "utils.h"
|
||||
#include "char.h"
|
||||
#include "desc.h"
|
||||
#include "desc_client.h"
|
||||
#include "desc_manager.h"
|
||||
#include "packet.h"
|
||||
#include "cmd.h"
|
||||
#include "ava2_itemshop.h"
|
||||
#include "../../common/ava2_itemshop.h"
|
||||
#include <sstream>
|
||||
#include <cctype>
|
||||
#include <map>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include "char_manager.h"
|
||||
#include "questmanager.h"
|
||||
#include "config.h"
|
||||
#include "../../common/point_drop.h"
|
||||
|
||||
namespace {
|
||||
struct PendingPoints { Ava2ShopRequest request; unsigned handle; int attempts; time_t next; };
|
||||
std::map<std::string, PendingPoints> pendingPoints;
|
||||
LPEVENT pointRetryEvent = NULL;
|
||||
EVENTINFO(PointRetryInfo) {};
|
||||
EVENTFUNC(RetryPoints) {
|
||||
for(auto it=pendingPoints.begin();it!=pendingPoints.end();) {
|
||||
auto& p=it->second;
|
||||
if(get_global_time()<p.next){++it;continue;}
|
||||
if(p.attempts>=12) {
|
||||
sys_err("POINT_DROP: retry exhausted account=%u token=%s",p.request.account,p.request.token);
|
||||
it=pendingPoints.erase(it);continue;
|
||||
}
|
||||
db_clientdesc->DBPacket(76,p.handle,&p.request,sizeof(p.request));
|
||||
++p.attempts;p.next=get_global_time()+10;++it;
|
||||
}
|
||||
if(pendingPoints.empty()){pointRetryEvent=NULL;return 0;}
|
||||
return PASSES_PER_SEC(1);
|
||||
}
|
||||
bool PointReply(const Ava2ShopReply& reply,const char* data) {
|
||||
if(reply.size!=46 || uint8_t(data[0])!=9)return false;
|
||||
char token[33]={};memcpy(token,data+2,32);
|
||||
const auto found=pendingPoints.find(token);
|
||||
if(found==pendingPoints.end() || found->second.request.account!=reply.account || found->second.request.player!=reply.player)return true;
|
||||
const uint8_t status=uint8_t(data[1]);
|
||||
if(status==6 || status==8)return true; // Same durable token retries transaction/commit uncertainty.
|
||||
pendingPoints.erase(found);
|
||||
uint32_t amount=0;int64_t balance=0;memcpy(&amount,data+34,4);memcpy(&balance,data+38,8);
|
||||
auto ch=CHARACTER_MANAGER::instance().FindByPID(reply.player);
|
||||
if(status || !amount || balance<0 || !ch || !ch->GetDesc() || ch->GetDesc()->GetAccountTable().id!=reply.account)return true;
|
||||
const char* version=strstr(ch->GetDesc()->GetClientVersion(),"mt");
|
||||
if(version && atoi(version+2)>=20261021)
|
||||
ch->ChatPacket(CHAT_TYPE_COMMAND,"MTPOINTS %u %lld",amount,static_cast<long long>(balance));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void Ava2PointDrop(CHARACTER* ch,CHARACTER* victim) {
|
||||
if(!ch || !victim || !ch->IsPC() || !ch->GetDesc() || victim->IsPC() || victim->IsPet() ||
|
||||
(!victim->IsMonster() && !victim->IsStone()))return;
|
||||
const auto rule=PortPointRule([](const std::string& key){return quest::CQuestManager::instance().GetEventFlag(key);},victim->IsStone());
|
||||
if(!rule.eligible(victim->GetLevel(),ch->GetLevel()) || number(1,10000)>rule.chance)return;
|
||||
if(pendingPoints.size()>=4096){sys_err("POINT_DROP: pending queue full");return;}
|
||||
Ava2ShopRequest p={};p.operation=3;p.account=ch->GetDesc()->GetAccountTable().id;p.player=ch->GetPlayerID();
|
||||
p.product=victim->GetRaceNum();p.count=number(rule.minimum,rule.maximum);p.expectedVnum=ch->GetLevel();
|
||||
static const uint64_t boot=[](){timeval t;gettimeofday(&t,NULL);return (uint64_t(t.tv_sec)*1000000+t.tv_usec) ^ (uint64_t(getpid())<<32);}();
|
||||
static uint64_t serial=0;
|
||||
snprintf(p.token,sizeof(p.token),"%016llx%016llx",static_cast<unsigned long long>(boot),static_cast<unsigned long long>(++serial));
|
||||
strlcpy(p.name,ch->GetName(),sizeof(p.name));
|
||||
PendingPoints pending={p,ch->GetDesc()->GetHandle(),1,get_global_time()+10};pendingPoints.emplace(p.token,pending);
|
||||
db_clientdesc->DBPacket(76,pending.handle,&p,sizeof(p));
|
||||
if(!pointRetryEvent)pointRetryEvent=event_create(RetryPoints,AllocEventInfo<PointRetryInfo>(),PASSES_PER_SEC(1));
|
||||
}
|
||||
ACMD(do_ishop) {
|
||||
if(!ch || !ch->IsPC() || !ch->GetDesc() || ch->IsWarping() || ch->IsDead())return;
|
||||
const char* version=strstr(ch->GetDesc()->GetClientVersion(),"mt");
|
||||
if(!version || atoi(version+2)<20261020) {ch->ChatPacket(CHAT_TYPE_INFO,"Please update your client to use the item shop.");return;}
|
||||
std::istringstream input(argument);std::string op,extra;input>>op;
|
||||
Ava2ShopRequest p={};p.account=ch->GetDesc()->GetAccountTable().id;p.player=ch->GetPlayerID();
|
||||
strlcpy(p.name,ch->GetName(),sizeof(p.name));strlcpy(p.ip,ch->GetDesc()->GetHostName(),sizeof(p.ip));
|
||||
if(op=="data") {p.operation=0;int revision=-1;if(!(input>>revision))return;}
|
||||
else if(op=="log")p.operation=1;
|
||||
else if(op=="buy") {
|
||||
p.operation=2;std::string token;
|
||||
if(!(input>>p.product>>p.count>>token>>p.expectedTotal>>p.expectedVnum) || !p.product || p.count<1 || p.count>20 || token.size()!=32 || p.expectedTotal<0 || p.expectedTotal>20000000000000LL || !p.expectedVnum)return;
|
||||
for(char c:token)if(!std::isxdigit(static_cast<unsigned char>(c)))return;
|
||||
strlcpy(p.token,token.c_str(),sizeof(p.token));
|
||||
} else return;
|
||||
if(input>>extra)return;
|
||||
const std::string throttle="ishop."+op;
|
||||
if(ch->GetProtectTime(throttle)>get_global_time())return;
|
||||
ch->SetProtectTime(throttle,get_global_time()+1);
|
||||
db_clientdesc->DBPacket(76,ch->GetDesc()->GetHandle(),&p,sizeof(p));
|
||||
}
|
||||
void Ava2ItemShopReply(unsigned long handle,const char* data) {
|
||||
Ava2ShopReply r;memcpy(&r,data,sizeof(r));
|
||||
if(PointReply(r,data+sizeof(r)))return;
|
||||
auto d=DESC_MANAGER::instance().FindByHandle(handle);
|
||||
if(!d || !d->IsPhase(PHASE_GAME) || !d->GetCharacter() || d->GetAccountTable().id!=r.account || d->GetCharacter()->GetPlayerID()!=r.player)return;
|
||||
#pragma pack(push,1)
|
||||
struct Header {uint8_t header;uint32_t size;};
|
||||
#pragma pack(pop)
|
||||
Header h={93,uint32_t(sizeof(Header)+r.size)};
|
||||
d->BufferedPacket(&h,sizeof(h));d->Packet(data+sizeof(r),r.size);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
class CHARACTER;
|
||||
void Ava2ItemShopReply(unsigned long handle,const char* data);
|
||||
void Ava2PointDrop(CHARACTER* player, CHARACTER* victim);
|
||||
@@ -242,6 +242,7 @@ void CHARACTER::Initialize()
|
||||
m_dwLastDeadTime = get_dword_time()-180000;
|
||||
|
||||
m_bSkipSave = false;
|
||||
m_pointDropProcessed = false;
|
||||
|
||||
m_bItemLoaded = false;
|
||||
|
||||
@@ -5723,6 +5724,7 @@ void CHARACTER::LoadSafebox(int iSize, DWORD dwGold, int iItemCount, TPlayerItem
|
||||
item->SetSkipSave(true);
|
||||
item->SetSockets(pItems->alSockets);
|
||||
item->SetAttributes(pItems->aAttr);
|
||||
item->SetPortExtra(pItems->extra);
|
||||
|
||||
if (!m_pkSafebox->Add(pItems->pos, item))
|
||||
{
|
||||
@@ -5818,6 +5820,7 @@ void CHARACTER::LoadMall(int iItemCount, TPlayerItem * pItems)
|
||||
item->SetSkipSave(true);
|
||||
item->SetSockets(pItems->alSockets);
|
||||
item->SetAttributes(pItems->aAttr);
|
||||
item->SetPortExtra(pItems->extra);
|
||||
|
||||
if (!m_pkMall->Add(pItems->pos, item))
|
||||
M2_DESTROY_ITEM(item);
|
||||
|
||||
@@ -832,6 +832,7 @@ class CHARACTER : public CEntity, public CFSM, public CHorseRider
|
||||
DWORD m_dwPlayStartTime;
|
||||
BYTE m_bAddChrState;
|
||||
bool m_bSkipSave;
|
||||
bool m_pointDropProcessed; // PORT: one point-roll per defeated entity.
|
||||
std::string m_stMobile;
|
||||
char m_szMobileAuth[5];
|
||||
BYTE m_bChatCounter;
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "DragonLair.h"
|
||||
#include <random>
|
||||
#include "port_battlepass_hooks.h"
|
||||
#include "ava2_itemshop.h"
|
||||
#include <algorithm>
|
||||
DWORD AdjustExpByLevel(const LPCHARACTER ch, const DWORD exp)
|
||||
{
|
||||
@@ -739,6 +740,21 @@ void CHARACTER::RewardGold(LPCHARACTER pkAttacker)
|
||||
|
||||
void CHARACTER::Reward(bool bItemDrop)
|
||||
{
|
||||
// PORT: point ownership follows the highest present damage contributor even when EXP is zero.
|
||||
if(bItemDrop && !m_pointDropProcessed)
|
||||
{
|
||||
m_pointDropProcessed=true;
|
||||
LPCHARACTER pointOwner=NULL;int highestDamage=0;
|
||||
for(const auto& damage:m_map_kDamage)
|
||||
{
|
||||
LPCHARACTER attacker=CHARACTER_MANAGER::instance().Find(damage.first);
|
||||
if(!attacker || !attacker->IsPC() || attacker->GetMapIndex()!=GetMapIndex() ||
|
||||
DISTANCE_APPROX(GetX()-attacker->GetX(),GetY()-attacker->GetY())>5000)continue;
|
||||
if(damage.second.iTotalDamage>highestDamage){highestDamage=damage.second.iTotalDamage;pointOwner=attacker;}
|
||||
}
|
||||
Ava2PointDrop(pointOwner,this);
|
||||
}
|
||||
|
||||
if (GetRaceNum() == 5001) // 왜구는 돈을 무조건 드롭
|
||||
{
|
||||
PIXEL_POSITION pos;
|
||||
|
||||
@@ -495,6 +495,7 @@ void CHARACTER::SetItem(TItemPos Cell, LPITEM pItem)
|
||||
}
|
||||
}
|
||||
PortAttrLockSend(this,pItem,Cell.window_type,Cell.cell);
|
||||
if(pItem)PortItemExtraSend(this,pItem,Cell.window_type,Cell.cell);
|
||||
}
|
||||
|
||||
LPITEM CHARACTER::GetWear(BYTE bCell) const
|
||||
|
||||
@@ -294,9 +294,11 @@ ACMD (do_dragon_soul);
|
||||
ACMD (do_ds_list);
|
||||
ACMD (do_clear_affect);
|
||||
|
||||
ACMD(do_ishop);
|
||||
struct command_info cmd_info[] =
|
||||
{
|
||||
{ "!RESERVED!", NULL, 0, POS_DEAD, GM_IMPLEMENTOR }, /* 반드시 이 것이 처음이어야 한다. */
|
||||
{ "ishop", do_ishop, 0, POS_DEAD, GM_PLAYER },
|
||||
{ "autohunt_pull", do_autohunt_pull, 0, POS_FIGHTING, GM_PLAYER },
|
||||
{ "bio", do_port_biolog, 0, POS_DEAD, GM_PLAYER },
|
||||
{ "biolog", do_port_biolog, 0, POS_DEAD, GM_PLAYER },
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "ava2_itemshop.h"
|
||||
#include "../../common/ava2_itemshop.h"
|
||||
#include "new_mob_timer.h"
|
||||
#include "ava2_track.h"
|
||||
#include "constants.h"
|
||||
@@ -254,7 +256,7 @@ void CInputDB::PlayerCreateSuccess(LPDESC d, const char * data)
|
||||
d->Packet(&pack, sizeof(TPacketGCPlayerCreateSuccess));
|
||||
|
||||
// 기본 무기와 귀환부를 지급
|
||||
TPlayerItem t;
|
||||
TPlayerItem t={};
|
||||
memset(&t, 0, sizeof(t));
|
||||
|
||||
if (china_event_server)
|
||||
@@ -1571,6 +1573,7 @@ void CInputDB::ItemLoad(LPDESC d, const char * c_pData)
|
||||
item->SetSkipSave(true);
|
||||
item->SetSockets(p->alSockets);
|
||||
item->SetAttributes(p->aAttr);
|
||||
item->SetPortExtra(p->extra);
|
||||
|
||||
if ((p->window == INVENTORY && ch->GetInventoryItem(p->pos)) ||
|
||||
(p->window == EQUIPMENT && ch->GetWear(p->pos)))
|
||||
@@ -2285,7 +2288,9 @@ int CInputDB::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
|
||||
SafeboxChangePasswordAnswer(DESC_MANAGER::instance().FindByHandle(m_dwHandle), c_pData);
|
||||
break;
|
||||
|
||||
case HEADER_DG_MALL_LOAD:
|
||||
case 76:
|
||||
Ava2ItemShopReply(m_dwHandle,c_pData);break;
|
||||
case HEADER_DG_MALL_LOAD:
|
||||
MallLoad(DESC_MANAGER::instance().FindByHandle(m_dwHandle), c_pData);
|
||||
break;
|
||||
|
||||
@@ -2599,7 +2604,9 @@ bool CInputDB::Process(LPDESC d, const void * orig, int bytes, int & r_iBytesPro
|
||||
|
||||
const char * pRealData = (c_pData + 9);
|
||||
|
||||
if (Analyze(d, bHeader, pRealData) < 0)
|
||||
if (bHeader==76 && (iSize<int(sizeof(Ava2ShopReply))+1 || iSize>32775 || reinterpret_cast<const Ava2ShopReply*>(pRealData)->size!=iSize-sizeof(Ava2ShopReply))) { d->SetPhase(PHASE_CLOSE);return true; }
|
||||
|
||||
if (Analyze(d, bHeader, pRealData) < 0)
|
||||
{
|
||||
sys_err("in InputDB: UNKNOWN HEADER: %d, LAST HEADER: %d(%d), REMAIN BYTES: %d, DESC: %d",
|
||||
bHeader, bLastHeader, iLastPacketLen, m_iBufferLeft, d->GetSocket());
|
||||
|
||||
@@ -559,6 +559,13 @@ typedef struct SPacketGTLogin
|
||||
|
||||
void CInputLogin::Entergame(LPDESC d, const char * data)
|
||||
{
|
||||
// PORT: wear40 moves dragon-soul/belt cells; older clients must not enter this world.
|
||||
const char* revision=strstr(d->GetClientVersion(),"mt");
|
||||
if(!revision || atoi(revision+2)<20261022)
|
||||
{
|
||||
if(d->GetCharacter())d->GetCharacter()->ChatPacket(CHAT_TYPE_INFO,"Please update the client before entering the game.");
|
||||
d->DelayedDisconnect(1);return;
|
||||
}
|
||||
LPCHARACTER ch;
|
||||
|
||||
if (!(ch = d->GetCharacter()))
|
||||
|
||||
@@ -51,6 +51,7 @@ void CItem::Initialize()
|
||||
m_pProto = NULL;
|
||||
m_bExchanging = false;
|
||||
memset(&m_alSockets, 0, sizeof(m_alSockets));
|
||||
memset(&m_portExtra,0,sizeof(m_portExtra));
|
||||
memset(&m_aAttr, 0, sizeof(m_aAttr));
|
||||
m_portAttrLock = 0;
|
||||
m_portAttrLockLoaded = false;
|
||||
@@ -230,6 +231,7 @@ void CItem::UpdatePacket()
|
||||
sys_log(2, "UpdatePacket %s -> %s", GetName(), m_pOwner->GetName());
|
||||
m_pOwner->GetDesc()->Packet(&pack, sizeof(pack));
|
||||
PortAttrLockSend(m_pOwner,this,GetWindow(),GetCell());
|
||||
SendPortExtra();
|
||||
}
|
||||
|
||||
DWORD CItem::GetCount()
|
||||
@@ -1154,7 +1156,8 @@ void CItem::SetSockets(const long * c_al)
|
||||
|
||||
void CItem::SetSocket(int i, long v, bool bLog)
|
||||
{
|
||||
assert(i < ITEM_SOCKET_MAX_NUM);
|
||||
if(i>=3 && i<8){m_portExtra.sockets[i-3]=v;UpdatePacket();Save();return;}
|
||||
if(i<0 || i>=ITEM_SOCKET_MAX_NUM)return;
|
||||
m_alSockets[i] = v;
|
||||
UpdatePacket();
|
||||
Save();
|
||||
@@ -2249,4 +2252,30 @@ bool CItem::IsSameSpecialGroup(const LPITEM item) const
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
void PortItemExtraSend(CHARACTER* owner,CItem* item,BYTE window,WORD cell)
|
||||
{
|
||||
if(!owner || !item || !owner->GetDesc())return;
|
||||
const char* version=strstr(owner->GetDesc()->GetClientVersion(),"mt");
|
||||
if(!version || atoi(version+2)<20261022)return;
|
||||
#pragma pack(push,1)
|
||||
struct Packet { uint8_t header;uint32_t size;uint8_t op,window;uint16_t cell;uint32_t vnum,id;PortItemExtra extra; };
|
||||
#pragma pack(pop)
|
||||
Packet p={93,sizeof(Packet),10,window,cell,item->GetVnum(),item->GetID(),item->GetPortExtra()};
|
||||
owner->GetDesc()->Packet(&p,sizeof(p));
|
||||
}
|
||||
void CItem::SendPortExtra(){PortItemExtraSend(GetOwner(),this,GetWindow(),GetCell());}
|
||||
|
||||
|
||||
void CItem::SetPortAttribute(int index, BYTE type, short value)
|
||||
{
|
||||
if(index<0 || index>=15)return;
|
||||
if(index<7){SetForceAttribute(index,type,value);return;}
|
||||
m_portExtra.types[index-7]=type;m_portExtra.values[index-7]=value;
|
||||
UpdatePacket();Save();
|
||||
}
|
||||
void CItem::SetNewName(const char* name)
|
||||
{
|
||||
strlcpy(m_portExtra.name,name ? name : "",sizeof(m_portExtra.name));
|
||||
UpdatePacket();Save();
|
||||
}
|
||||
|
||||
@@ -108,10 +108,20 @@ class CItem : public CEntity
|
||||
|
||||
bool CreateSocket(BYTE bSlot, BYTE bGold);
|
||||
const long * GetSockets() { return &m_alSockets[0]; }
|
||||
long GetSocket(int i) { return m_alSockets[i]; }
|
||||
long GetSocket(int i) { return i>=0 && i<3 ? m_alSockets[i] : i>=3 && i<8 ? m_portExtra.sockets[i-3] : 0; }
|
||||
|
||||
void SetSockets(const long * al);
|
||||
void SetSocket(int i, long v, bool bLog = true);
|
||||
const PortItemExtra& GetPortExtra() const { return m_portExtra; }
|
||||
void SetPortExtra(const PortItemExtra& extra) { m_portExtra=extra; m_portExtra.name[24]=0; }
|
||||
void SendPortExtra();
|
||||
// PORT: AVA2 growth pets use fifteen skill slots; normal items retain seven.
|
||||
BYTE GetPortAttributeType(int i) const { return i>=0 && i<7 ? m_aAttr[i].bType : i>=7 && i<15 ? m_portExtra.types[i-7] : 0; }
|
||||
short GetPortAttributeValue(int i) const { return i>=0 && i<7 ? m_aAttr[i].sValue : i>=7 && i<15 ? m_portExtra.values[i-7] : 0; }
|
||||
void SetPortAttribute(int i, BYTE type, short value);
|
||||
const char* GetNewName() const { return m_portExtra.name; }
|
||||
void SetNewName(const char* name);
|
||||
|
||||
|
||||
int GetSocketCount();
|
||||
bool AddSocket();
|
||||
@@ -288,6 +298,7 @@ class CItem : public CEntity
|
||||
|
||||
bool m_bExchanging; ///< 현재 교환중 상태
|
||||
|
||||
PortItemExtra m_portExtra{};
|
||||
long m_alSockets[ITEM_SOCKET_MAX_NUM]; // 아이템 소캣
|
||||
TPlayerItemAttribute m_aAttr[ITEM_ATTRIBUTE_MAX_NUM];
|
||||
|
||||
@@ -346,3 +357,6 @@ int GetNewRingAttrMaxValue(BYTE bApply); // port_rings.cpp, 0 = not in the ring
|
||||
int GetPendantAttrMaxValue(BYTE bApply); // port_pendant.cpp, 0 = not in the talisman pool
|
||||
|
||||
#endif
|
||||
|
||||
// PORT: supplementary item metadata for AVA2 systems.
|
||||
void PortItemExtraSend(CHARACTER* owner,CItem* item,BYTE window,WORD cell);
|
||||
|
||||
@@ -454,7 +454,7 @@ void ITEM_MANAGER::SaveSingleItem(LPITEM item)
|
||||
|
||||
sys_log(1, "ITEM_SAVE %s:%d in %s window %d", item->GetName(), item->GetID(), item->GetOwner()->GetName(), item->GetWindow());
|
||||
|
||||
TPlayerItem t;
|
||||
TPlayerItem t={};
|
||||
|
||||
t.id = item->GetID();
|
||||
t.window = item->GetWindow();
|
||||
@@ -464,6 +464,7 @@ void ITEM_MANAGER::SaveSingleItem(LPITEM item)
|
||||
t.owner = (t.window == SAFEBOX || t.window == MALL) ? item->GetOwner()->GetDesc()->GetAccountTable().id : item->GetOwner()->GetPlayerID();
|
||||
thecore_memcpy(t.alSockets, item->GetSockets(), sizeof(t.alSockets));
|
||||
thecore_memcpy(t.aAttr, item->GetAttributes(), sizeof(t.aAttr));
|
||||
t.extra=item->GetPortExtra();
|
||||
|
||||
db_clientdesc->DBPacketHeader(HEADER_GD_ITEM_SAVE, 0, sizeof(TPlayerItem));
|
||||
db_clientdesc->Packet(&t, sizeof(TPlayerItem));
|
||||
|
||||
@@ -80,6 +80,7 @@ bool CSafebox::Add(DWORD dwPos, LPITEM pkItem)
|
||||
thecore_memcpy(pack.aAttr, pkItem->GetAttributes(), sizeof(pack.aAttr));
|
||||
|
||||
m_pkChrOwner->GetDesc()->Packet(&pack, sizeof(pack));
|
||||
PortItemExtraSend(m_pkChrOwner,pkItem,m_bWindowMode,dwPos);
|
||||
sys_log(1, "SAFEBOX: ADD %s %s count %d", m_pkChrOwner->GetName(), pkItem->GetName(), pkItem->GetCount());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
"""Exercise paid item state round trips and inventory migration boundaries."""
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
'extended_items', ROOT/'tools/ava2-itemshop/migrate_extended_items.py')
|
||||
migration = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(migration)
|
||||
|
||||
|
||||
class ExtendedItems(unittest.TestCase):
|
||||
def test_quickslot_boundaries(self):
|
||||
positions = [0, 224, 225, 256, 257, 268, 269, 286, 287, 302, 303, 65535]
|
||||
source = b''.join(bytes([1])+p.to_bytes(2, 'little') for p in positions)
|
||||
# Skill and emotion quickslots may contain the same numeric positions.
|
||||
source += bytes([2, 1, 1, 3, 31, 1]) + bytes(108-len(source)-6)
|
||||
result = migration.quickslots(source)
|
||||
expected = [0, 224, 225, 256, 265, 276, 269, 286, 295, 310, 303, 65535]
|
||||
self.assertEqual([int.from_bytes(result[i+1:i+3], 'little')
|
||||
for i in range(0, 36, 3)], expected)
|
||||
self.assertEqual(result[36:], source[36:])
|
||||
self.assertEqual(migration.quickslots(b''), b'')
|
||||
with self.assertRaises(ValueError):
|
||||
migration.quickslots(bytes(107))
|
||||
|
||||
def test_extra_round_trip_and_corruption(self):
|
||||
source = r'''
|
||||
#include "src/server/common/port_item_extra.h"
|
||||
#include <cassert>
|
||||
#include <limits>
|
||||
int main() {
|
||||
PortItemExtra source={},decoded={};
|
||||
source.sockets[0]=std::numeric_limits<int32_t>::min();
|
||||
source.sockets[4]=std::numeric_limits<int32_t>::max();
|
||||
source.types[0]=99;source.types[7]=255;
|
||||
source.values[0]=-32768;source.values[7]=32767;
|
||||
std::memcpy(source.name,"abcdefghijklmnopqrstuvwx",24);
|
||||
auto hex=PortItemExtraHex(source);
|
||||
assert(hex.size()==138);
|
||||
assert(PortItemExtraRead(hex.c_str(),decoded));
|
||||
assert(!std::memcmp(&source,&decoded,sizeof(source)));
|
||||
// Empty DB values are pre-migration items and must load as empty state.
|
||||
assert(PortItemExtraRead("",decoded));
|
||||
PortItemExtra zero={};assert(!std::memcmp(&zero,&decoded,sizeof(zero)));
|
||||
assert(!PortItemExtraRead("00",decoded));
|
||||
hex[137]='g';assert(!PortItemExtraRead(hex.c_str(),decoded));
|
||||
assert(!std::memcmp(&zero,&decoded,sizeof(zero)));
|
||||
hex=std::string(138,'f');assert(PortItemExtraRead(hex.c_str(),decoded));
|
||||
assert(decoded.name[24]==0);
|
||||
}
|
||||
'''
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
cpp, exe = Path(tmp)/'extra.cpp', Path(tmp)/'extra'
|
||||
cpp.write_text(source)
|
||||
subprocess.run(['c++', '-std=c++17', '-I'+str(ROOT), str(cpp), '-o', str(exe)], check=True)
|
||||
subprocess.run([str(exe)], check=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compile the production wire and total-price helper, including malformed bounds."""
|
||||
import subprocess,tempfile,unittest
|
||||
from pathlib import Path
|
||||
ROOT=Path(__file__).resolve().parents[2]
|
||||
class ItemShop(unittest.TestCase):
|
||||
def test_native_wire_and_integer_quantity_discount(self):
|
||||
source=r'''
|
||||
#include "src/server/common/ava2_itemshop.h"
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
int main(){
|
||||
static_assert(sizeof(Ava2ShopRequest)==103,"request");
|
||||
static_assert(sizeof(Ava2ShopProduct)==49,"native catalogue");
|
||||
static_assert(sizeof(Ava2ShopLog)==90,"native log");
|
||||
int64_t price=123;
|
||||
assert(Ava2ShopTotal(99,2,25,price) && price==148);
|
||||
assert(Ava2ShopTotal(1,1,99,price) && price==0);
|
||||
assert(Ava2ShopTotal(1000000000000LL,20,0,price) && price==20000000000000LL);
|
||||
assert(!Ava2ShopTotal(-1,1,0,price));assert(!Ava2ShopTotal(1000000000001LL,1,0,price));
|
||||
assert(!Ava2ShopTotal(1,0,0,price));assert(!Ava2ShopTotal(1,21,0,price));assert(!Ava2ShopTotal(1,1,101,price));
|
||||
Ava2ShopProduct p={};p.id=0x01020304;p.vnum=71084;p.price=99;p.discount=25;p.stock=-1;
|
||||
const unsigned char* bytes=reinterpret_cast<const unsigned char*>(&p);
|
||||
assert(bytes[0]==4 && bytes[3]==1 && bytes[20]==25 && bytes[45]==255);
|
||||
}
|
||||
'''
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
p=Path(d);(p/'test.cpp').write_text(source)
|
||||
subprocess.run(['c++','-std=c++17','-I'+str(ROOT),str(p/'test.cpp'),'-o',str(p/'test')],check=True);subprocess.run([str(p/'test')],check=True)
|
||||
def test_sorted_prototype_index_points_to_the_matching_item(self):
|
||||
source=(ROOT/'src/server/db/src/ClientManagerBoot.cpp').read_bytes().decode('latin1')
|
||||
body=source[source.index('bool CClientManager::InitializeItemTable()'):source.index('bool CClientManager::InitializeSkillTable()')]
|
||||
start=body.rindex('// END_OF_QUEST_ITEM_PROTO_DISABLE')
|
||||
tail=body[start:body.rfind('return true;')+len('return true;')]
|
||||
harness=r"""
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#define sys_log(...) ((void)0)
|
||||
#define itertype(c) decltype(c)::iterator
|
||||
using namespace std;
|
||||
using DWORD=unsigned;
|
||||
struct TItemTable { DWORD dwVnum;unsigned bType; };
|
||||
struct FCompareVnum { bool operator()(const TItemTable& a,const TItemTable& b)const {return a.dwVnum<b.dwVnum;} };
|
||||
struct Database {
|
||||
vector<TItemTable> m_vec_itemTable={{71084,3},{54051,3},{1,0},{71502,28}};
|
||||
map<DWORD,TItemTable*> m_map_itemTableByVnum;
|
||||
bool Build() { BODY }
|
||||
};
|
||||
int main(){ Database db;assert(db.Build());for(auto& row:db.m_map_itemTableByVnum)assert(row.first==row.second->dwVnum);assert(db.m_map_itemTableByVnum[54051]->bType==3);assert(db.m_map_itemTableByVnum[71502]->bType==28); }
|
||||
""".replace('BODY',tail)
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
p=Path(d);(p/'test.cpp').write_text(harness)
|
||||
subprocess.run(['c++','-std=c++17',str(p/'test.cpp'),'-o',str(p/'test')],check=True)
|
||||
subprocess.run([str(p/'test')],check=True)
|
||||
|
||||
if __name__=='__main__':unittest.main()
|
||||
@@ -0,0 +1,49 @@
|
||||
"""Compile the shipping eligibility/cap arithmetic, including boundary and overflow cases."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
class PointDrop(unittest.TestCase):
|
||||
def test_approved_rules_and_cap(self):
|
||||
flags = json.loads((ROOT/'tools/ava2-itemshop/points-wide.json').read_text())
|
||||
entries = ','.join('{"%s",%d}' % entry for entry in flags.items())
|
||||
source = r'''
|
||||
#include "src/server/common/point_drop.h"
|
||||
#include <map>
|
||||
#include <cassert>
|
||||
int main() {
|
||||
std::map<std::string,int> flags={ENTRIES};
|
||||
auto lookup=[&](const std::string& key){return flags[key];};
|
||||
auto mob=PortPointRule(lookup,false),stone=PortPointRule(lookup,true);
|
||||
assert(mob.chance==500 && mob.minimum==1 && mob.maximum==1);
|
||||
assert(stone.chance==10000 && stone.minimum==3 && stone.maximum==8);
|
||||
assert(mob.eligible(105,120));assert(!mob.eligible(104,120));
|
||||
assert(stone.eligible(120,1));assert(!stone.eligible(0,1));
|
||||
assert(!stone.eligible(120,0));
|
||||
assert(PortPointDropAmount(8,498,500)==2);
|
||||
assert(PortPointDropAmount(8,500,500)==0);
|
||||
assert(PortPointDropAmount(8,UINT64_MAX,500)==0);
|
||||
assert(PortPointDropAmount(8,UINT64_MAX,0)==8);
|
||||
flags["points_mob_chance"]=0;assert(!PortPointRule(lookup,false).eligible(105,120));
|
||||
flags["points_stone_chance"]=10001;assert(!PortPointRule(lookup,true).valid());
|
||||
flags["points_stone_chance"]=10000;flags["points_stone_min"]=-1;
|
||||
assert(!PortPointRule(lookup,true).valid());
|
||||
flags["points_stone_min"]=9;flags["points_stone_max"]=3;
|
||||
assert(!PortPointRule(lookup,true).valid());
|
||||
}
|
||||
'''.replace('ENTRIES', entries)
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
src = Path(tmp)/'test.cpp'
|
||||
exe = Path(tmp)/'test'
|
||||
src.write_text(source)
|
||||
subprocess.run(['c++', '-std=c++17', '-I'+str(ROOT), str(src), '-o', str(exe)], check=True)
|
||||
subprocess.run([str(exe)], check=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -103,8 +103,10 @@ if cpacket.is_file():
|
||||
assert 'static_assert(sizeof(TPacketCGSwitchbot) == 7 && sizeof(TPacketGCSwitchbot) == 7,' in client
|
||||
stream=(CLIENT/'PythonNetworkStreamPhaseGame.cpp').read_bytes().decode('latin1')
|
||||
# the EU branch (the one every locale.cfg build takes) keeps 1215955205 first for the atoi version check
|
||||
assert 'strncpy(kVersionPacket.timestamp, "1215955205 mt20261019", sizeof(kVersionPacket.timestamp)-1);' in stream
|
||||
assert 'strncpy(kVersionPacket.timestamp, "mt20261019", sizeof(kVersionPacket.timestamp)-1);' in stream
|
||||
modern=re.search(r'strncpy\(kVersionPacket.timestamp, "1215955205 mt(\d{8})"',stream)
|
||||
legacy=re.search(r'strncpy\(kVersionPacket.timestamp, "mt(\d{8})"',stream)
|
||||
assert modern and legacy and modern.group(1)==legacy.group(1)
|
||||
assert int(modern.group(1))>=20261016 # switchbot gate; newer features may advance this revision
|
||||
pyswitch=(CLIENT/'PythonSwitchbot.h').read_bytes().decode('latin1')
|
||||
ctable=pyswitch[pyswitch.index('struct TSwitchbotTable'):];ctable=ctable[:ctable.index('};')]
|
||||
assert re.findall(r'^\s*[A-Za-z_][\w:]*\s+(\w+)(?:\[[^;]*\])?;',ctable,re.M)==table,ctable
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
# Native AVA2 item shop
|
||||
|
||||
Active UI is `uiitemshopnew.py`. GC93 retains the native catalogue/log layouts;
|
||||
GD/DG76 transports authenticated account/character requests to the DB coordinator.
|
||||
Purchase requests add a durable random token and the confirmed item/total quote.
|
||||
|
||||
`data/ava2-itemshop/original-products.tsv` contains all 217 original offers recovered
|
||||
from the supplied MySQL56 archive. `source.json` records hashes. No prices are invented.
|
||||
`compatibility.json` records 55 absent prototypes, 55 ITEM_NONE placeholders and 107
|
||||
actual types needing item-system verification. `verified-products.json` selects 49
|
||||
existing implemented mount, mount-skin, fixed-enchant and third-hand products.
|
||||
|
||||
Generate migration SQL with explicit configured schema names, review it and back up
|
||||
account/award data before executing it:
|
||||
|
||||
```
|
||||
python3 tools/ava2-itemshop/migrate.py --player player_sb --account account_sb --output /tmp/itemshop.sql
|
||||
python3 tools/ava2-itemshop/enable_verified.py --player player_sb --output /tmp/itemshop-enable.sql
|
||||
```
|
||||
|
||||
The migration uses InnoDB for account, catalogue, orders and awards. Account/player SQL
|
||||
configurations must target the same MySQL host and port. Purchase failures leave all
|
||||
four unchanged. A transaction temporarily disables reconnect and caps lock waits at
|
||||
three seconds, restoring the original connection options afterwards. Unknown COMMIT
|
||||
outcomes retry the same order. Unique `(account_id,token)` orders survive process restarts.
|
||||
|
||||
The old prototype loader indexed vector pointers before sorting; it now sorts before building the index so lookup keys always match their templates.
|
||||
|
||||
Awards use the existing mall redemption path; non-stackable purchases create separate
|
||||
award rows. New clients use revision mt20261020. Legacy clients cannot request GC93.
|
||||
No web recharge service or wheel reward service is enabled.
|
||||
|
||||
Acceptance evidence: `metin2-client/docs/AVA2-ITEMSHOP.md` and
|
||||
`metin2-client/audit/evidence/itemshop/`.
|
||||
|
||||
## Production release, 2026-10-20 (server CEST)
|
||||
|
||||
203 now runs the verified sbtest game/db pair: game `56975b48aa2fd40389c57eab84d017b0a2518cf6e1b573d967bf239f4ae04aba`,
|
||||
db `dc940401fe6ccc3410c8d90ce98d2a5bad2e2c023279665bcd664c008d011699`.
|
||||
The deployment retains the existing native battle pass, wiki, calendar and other cumulative game changes.
|
||||
The release delta is the native shop, DB prototype-index fix, transactional schema and
|
||||
49 enabled original offers. The remaining 168 offers, recharge and wheel services stay disabled.
|
||||
Production 70002 was still ITEM_NONE; its text/SQL prototype is now ITEM_USE/USE_SPECIAL,
|
||||
matching the tested third-hand implementation. Other prototypes were not replaced with test data.
|
||||
|
||||
Deployment package: `/root/deploy-features/20261020-itemshop`.
|
||||
Backup: `/root/backup-itemshop/20261020-014955` (old binaries, original prototype,
|
||||
full account/player SQL dump and pre-deployment error-log offsets).
|
||||
`deploy.py` gracefully stops game/auth, then db; backs up SQL before migration; starts
|
||||
db first and then auth and all 13 production game cores. sbtest remains independent.
|
||||
|
||||
Read-only health check:
|
||||
```
|
||||
/usr/local/bin/python3.9 /root/deploy-features/20261020-itemshop/deploy.py check
|
||||
```
|
||||
Binary rollback:
|
||||
```
|
||||
/usr/local/bin/python3.9 /root/deploy-features/20261020-itemshop/deploy.py rollback --backup /root/backup-itemshop/20261020-014955
|
||||
```
|
||||
Rollback retains InnoDB, coins, orders, awards and the compatible third-hand prototype.
|
||||
Never restore the pre-release SQL dump over subsequent player purchases.
|
||||
|
||||
CH1 acceptance with a temporary ordinary account verified all 49 catalogue entries/icons,
|
||||
insufficient funds without an order, a 99-coin purchase, same-token replay without another
|
||||
charge/order, purchase history and mall redemption into inventory. Test account, character,
|
||||
coins, orders, awards and items were removed; its one test sale was subtracted without
|
||||
resetting other sales. Existing players received no test currency. db/auth/13 cores remained
|
||||
healthy after cleanup. macOS release bundle and connected Android client's APK/resources
|
||||
were updated; Android in-game purchase acceptance is not claimed by this release.
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build game/db without either Makefile's production installation default."""
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
|
||||
|
||||
def main():
|
||||
p = argparse.ArgumentParser(description=__doc__)
|
||||
p.add_argument('--source', type=Path, required=True, help='directory containing server/ and extern/')
|
||||
p.add_argument('--output', type=Path, required=True)
|
||||
p.add_argument('--target', choices=['game', 'db'], required=True)
|
||||
p.add_argument('--jobs', type=int, default=1)
|
||||
a = p.parse_args()
|
||||
source, output = a.source.resolve(), a.output.resolve()
|
||||
for destination in (output, (output/'bin').resolve(), (output/'work').resolve()):
|
||||
if destination == Path('/usr/metin2/server') or Path('/usr/metin2/server') in destination.parents:
|
||||
p.error('build outputs must not be inside the production server tree')
|
||||
for name in ('bin', 'work', 'obj-'+a.target):
|
||||
(output/name).mkdir(parents=True, exist_ok=True)
|
||||
# DB uses DBDIR, game uses GAMEDIR. Always override both, even when building one target.
|
||||
subprocess.run(['gmake', '-j%d' % max(1, a.jobs), 'BINDIR='+str(output/'work'),
|
||||
'GAMEDIR='+str(output/'bin'), 'DBDIR='+str(output/'bin'),
|
||||
'OBJDIR='+str(output/('obj-'+a.target))],
|
||||
cwd=source/'server'/a.target/'src', check=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,179 @@
|
||||
#!/usr/local/bin/python3.9
|
||||
"""Deploy the verified shop binaries and migration; retain economic rows on rollback."""
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import signal
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
ROOT = Path('/usr/metin2/server')
|
||||
PACKAGE = Path(__file__).resolve().parent
|
||||
CORES = [ROOT/'auth'] + [ROOT/('channel%d/%s' % (ch, part))
|
||||
for ch in range(1, 5) for part in ('first', 'game1', 'game2')] + [ROOT/'game99']
|
||||
DB = ROOT/'db'
|
||||
GAME_HASH = '56975b48aa2fd40389c57eab84d017b0a2518cf6e1b573d967bf239f4ae04aba'
|
||||
DB_HASH = 'dc940401fe6ccc3410c8d90ce98d2a5bad2e2c023279665bcd664c008d011699'
|
||||
|
||||
|
||||
def digest(path):
|
||||
return hashlib.sha256(path.read_bytes()).hexdigest()
|
||||
|
||||
|
||||
def pid(core):
|
||||
try:
|
||||
value = int((core/'pid').read_text().strip())
|
||||
os.kill(value, 0)
|
||||
except (OSError, ValueError):
|
||||
return 0
|
||||
details = subprocess.check_output(['procstat', '-f', str(value)]).decode()
|
||||
if not any(' cwd ' in line and str(core) in line for line in details.splitlines()):
|
||||
raise RuntimeError('Unexpected pid owner: ' + str(core))
|
||||
return value
|
||||
|
||||
|
||||
def stop(cores):
|
||||
pending = [pid(core) for core in cores]
|
||||
for value in pending:
|
||||
if value:
|
||||
os.kill(value, signal.SIGHUP)
|
||||
deadline = time.time() + 300
|
||||
while any(pid(core) for core in cores):
|
||||
if time.time() > deadline:
|
||||
raise RuntimeError('Graceful stop timeout; no forced termination')
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def listeners():
|
||||
return subprocess.check_output(['sockstat', '-4', '-l', '-P', 'tcp']).decode()
|
||||
|
||||
|
||||
def wait_for(cores, ports):
|
||||
deadline = time.time() + 180
|
||||
while True:
|
||||
active = listeners()
|
||||
if all(pid(c) for c in cores) and all(':%d ' % p in active for p in ports):
|
||||
return
|
||||
if time.time() > deadline:
|
||||
raise RuntimeError('Start health check timed out')
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def port(core):
|
||||
return int(next(line.split(':', 1)[1] for line in
|
||||
(core/'CONFIG').read_text().splitlines() if line.startswith('PORT:')))
|
||||
|
||||
|
||||
def start():
|
||||
if not pid(DB):
|
||||
subprocess.run(['daemon', '-f', '-o', str(DB/'itemshop-deploy.stdout'), './db'], cwd=DB, check=True)
|
||||
wait_for([DB], [15000])
|
||||
for core in CORES:
|
||||
if not pid(core):
|
||||
executable = './auth' if core.name == 'auth' else './game'
|
||||
subprocess.run(['daemon', '-f', '-o', str(core/'itemshop-deploy.stdout'), executable], cwd=core, check=True)
|
||||
time.sleep(.3)
|
||||
wait_for(CORES, [port(c) for c in CORES])
|
||||
|
||||
|
||||
def mysql(sql):
|
||||
return subprocess.check_output(['mysql', '-N'], input=sql.encode()).decode().strip()
|
||||
|
||||
|
||||
def replace(source, target):
|
||||
temporary = target.with_name(target.name + '.shop-new')
|
||||
shutil.copy2(source, temporary)
|
||||
temporary.chmod(0o755)
|
||||
temporary.replace(target)
|
||||
|
||||
|
||||
def report():
|
||||
return {'game_sha256': digest(ROOT/'share/bin/game'),
|
||||
'db_sha256': digest(ROOT/'share/bin/db'),
|
||||
'pids': {str(c.relative_to(ROOT)): pid(c) for c in [DB]+CORES},
|
||||
'enabled_products': mysql('SELECT COUNT(*) FROM player.ishop_data WHERE enabled=1;')}
|
||||
|
||||
|
||||
def rollback(backup):
|
||||
stop(CORES)
|
||||
stop([DB])
|
||||
replace(backup/'game', ROOT/'share/bin/game')
|
||||
replace(backup/'db', ROOT/'share/bin/db')
|
||||
# Keep InnoDB, coins, orders and awards. Reverting them could discard purchases.
|
||||
# Keep the compatible 70002 prototype so already delivered items remain usable.
|
||||
start()
|
||||
print(json.dumps({'rollback': str(backup), **report()}), flush=True)
|
||||
|
||||
|
||||
def deploy():
|
||||
candidate = Path('/root/deploy-features/20261018-ava2-parity/itemshop-build/bin')
|
||||
if digest(candidate/'game') != GAME_HASH or digest(candidate/'db') != DB_HASH:
|
||||
raise RuntimeError('Candidate binary hash mismatch')
|
||||
if not all(pid(c) for c in [DB]+CORES):
|
||||
raise RuntimeError('Production baseline is not healthy')
|
||||
backup = Path('/root/backup-itemshop')/time.strftime('%Y%m%d-%H%M%S')
|
||||
backup.mkdir(parents=True, mode=0o700)
|
||||
for name in ('game', 'db'):
|
||||
shutil.copy2(ROOT/'share/bin'/name, backup/name)
|
||||
meta = {'before': {n: digest(backup/n) for n in ('game', 'db')},
|
||||
'source_revision': '3283101',
|
||||
'syserr_offsets': {str(c.relative_to(ROOT)): (c/'syserr').stat().st_size
|
||||
if (c/'syserr').exists() else 0 for c in [DB]+CORES}}
|
||||
(backup/'metadata.json').write_text(json.dumps(meta, indent=2)+'\n')
|
||||
proto = (ROOT/'share/conf/item_proto.txt').resolve()
|
||||
shutil.copy2(proto, backup/'item_proto.txt')
|
||||
(PACKAGE/'LAST_BACKUP').write_text(str(backup)+'\n')
|
||||
print('backup=' + str(backup), flush=True)
|
||||
stop(CORES)
|
||||
print('game/auth stopped gracefully', flush=True)
|
||||
stop([DB])
|
||||
print('db stopped gracefully', flush=True)
|
||||
try:
|
||||
with (backup/'account-player.sql').open('wb') as out:
|
||||
subprocess.run(['mysqldump', '--lock-all-tables', '--routines', '--triggers',
|
||||
'--databases', 'account', 'player'], stdout=out, check=True)
|
||||
(backup/'account-player.sql').chmod(0o600)
|
||||
print('account/player backup complete', flush=True)
|
||||
lines = proto.read_bytes().splitlines(keepends=True)
|
||||
changed = 0
|
||||
for i, line in enumerate(lines):
|
||||
if line.startswith(b'70002\t'):
|
||||
row = line.rstrip(b'\r\n').split(b'\t')
|
||||
row[2], row[3], row[7] = b'ITEM_USE', b'USE_SPECIAL', b'NONE'
|
||||
lines[i] = b'\t'.join(row)+b'\n'
|
||||
changed += 1
|
||||
if changed != 1:
|
||||
raise RuntimeError('Expected exactly one 70002 prototype')
|
||||
proto.write_bytes(b''.join(lines))
|
||||
mysql('UPDATE player.item_proto SET type=3,subtype=10,wearflag=0 WHERE vnum=70002;')
|
||||
for name in ('migrate.sql', 'enable.sql'):
|
||||
mysql((PACKAGE/name).read_text())
|
||||
if mysql('SELECT COUNT(*) FROM player.ishop_data WHERE enabled=1;') != '49':
|
||||
raise RuntimeError('Expected 49 verified products')
|
||||
replace(candidate/'game', ROOT/'share/bin/game')
|
||||
replace(candidate/'db', ROOT/'share/bin/db')
|
||||
start()
|
||||
result = report()
|
||||
(backup/'DEPLOYED.json').write_text(json.dumps(result, indent=2)+'\n')
|
||||
print(json.dumps(result), flush=True)
|
||||
except Exception:
|
||||
rollback(backup)
|
||||
raise
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('action', choices=['deploy', 'check', 'rollback'])
|
||||
parser.add_argument('--backup', type=Path)
|
||||
args = parser.parse_args()
|
||||
if args.action == 'deploy':
|
||||
deploy()
|
||||
elif args.action == 'check':
|
||||
print(json.dumps(report()), flush=True)
|
||||
else:
|
||||
if not args.backup:
|
||||
parser.error('rollback requires --backup')
|
||||
rollback(args.backup)
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Emit SQL enabling original offers backed by implemented item systems. Never executes SQL."""
|
||||
import argparse,json,re
|
||||
from pathlib import Path
|
||||
p=argparse.ArgumentParser();p.add_argument('--player',required=True);p.add_argument('--output',type=Path,required=True);a=p.parse_args()
|
||||
if not re.fullmatch('[A-Za-z0-9_]+',a.player):p.error('invalid schema')
|
||||
root=Path(__file__).resolve().parents[2];rows=json.loads((root/'data/ava2-itemshop/verified-products.json').read_text())['products']
|
||||
sql='USE `'+a.player+'`;\n'
|
||||
for row in rows:
|
||||
sql+='UPDATE ishop_data s JOIN item_proto p ON p.vnum=s.itemVnum SET s.enabled=1 WHERE s.id=%d AND s.itemVnum=%d AND p.type<>0;\n'%(row['id'],row['vnum'])
|
||||
sql+='SELECT categoryType,categorySubType,COUNT(*) FROM ishop_data WHERE enabled=1 GROUP BY categoryType,categorySubType;\n'
|
||||
a.output.parent.mkdir(parents=True,exist_ok=True);a.output.write_text(sql);print('SQL generated for',len(rows),'verified original offers; original prices preserved')
|
||||
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Emit a reviewable migration for explicitly named isolated or production schemas.
|
||||
Run mysql separately after backup. Native products are disabled until compatibility review.
|
||||
"""
|
||||
import argparse,re
|
||||
from pathlib import Path
|
||||
p=argparse.ArgumentParser();p.add_argument('--player',required=True);p.add_argument('--account',required=True);p.add_argument('--output',type=Path,required=True);a=p.parse_args()
|
||||
for name in (a.player,a.account):
|
||||
if not re.fullmatch('[A-Za-z0-9_]+',name):p.error('invalid schema')
|
||||
sql=f'''USE `{a.player}`;
|
||||
CREATE TABLE IF NOT EXISTS ishop_data (
|
||||
id INT UNSIGNED PRIMARY KEY, categoryType INT NOT NULL, categorySubType INT NOT NULL,
|
||||
itemVnum INT UNSIGNED NOT NULL,itemPrice BIGINT UNSIGNED NOT NULL,discount INT NOT NULL DEFAULT 0,
|
||||
offerTime DATETIME NULL,addedTime DATETIME NULL,sellCount BIGINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
week_limit INT NOT NULL DEFAULT 0,month_limit INT NOT NULL DEFAULT 0,maxSellCount INT NOT NULL DEFAULT -1,
|
||||
enabled TINYINT NOT NULL DEFAULT 0
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE IF NOT EXISTS port_itemshop_orders (
|
||||
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,account_id INT UNSIGNED NOT NULL,
|
||||
token CHAR(32) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,product INT UNSIGNED NOT NULL,vnum INT UNSIGNED NOT NULL,
|
||||
quantity INT UNSIGNED NOT NULL,paid BIGINT UNSIGNED NOT NULL,player_name VARCHAR(24) NOT NULL,ip VARCHAR(45) NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE KEY request_once(account_id,token), KEY limits_by_account(account_id,product,created_at)
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE IF NOT EXISTS port_point_rewards (
|
||||
token CHAR(32) CHARACTER SET ascii COLLATE ascii_bin PRIMARY KEY,
|
||||
account_id INT UNSIGNED NOT NULL,player_id INT UNSIGNED NOT NULL,vnum INT UNSIGNED NOT NULL,
|
||||
requested INT UNSIGNED NOT NULL,amount INT UNSIGNED NOT NULL,reward_day DATE NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
KEY daily_account(account_id,reward_day)
|
||||
) ENGINE=InnoDB;
|
||||
ALTER TABLE ishop_data ENGINE=InnoDB;
|
||||
ALTER TABLE item_award ENGINE=InnoDB;
|
||||
ALTER TABLE `{a.account}`.account ENGINE=InnoDB;
|
||||
'''
|
||||
# Upgrade an existing native catalogue without replacing its products or sales history.
|
||||
sql+="""SET @enabled_exists=(SELECT COUNT(*) FROM information_schema.columns WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='ishop_data' AND COLUMN_NAME='enabled');
|
||||
SET @ddl=IF(@enabled_exists=0,'ALTER TABLE ishop_data ADD enabled TINYINT NOT NULL DEFAULT 0','SELECT 1');
|
||||
PREPARE shop_ddl FROM @ddl; EXECUTE shop_ddl; DEALLOCATE PREPARE shop_ddl;
|
||||
"""
|
||||
# Coins are added by a separate conditional step, since MySQL 5.6 lacks ADD IF NOT EXISTS.
|
||||
sql+=f'''SET @column_exists=(SELECT COUNT(*) FROM information_schema.columns WHERE TABLE_SCHEMA='{a.account}' AND TABLE_NAME='account' AND COLUMN_NAME='coins');
|
||||
SET @ddl=IF(@column_exists=0,'ALTER TABLE `{a.account}`.account ADD coins BIGINT UNSIGNED NOT NULL DEFAULT 0','SELECT 1');
|
||||
PREPARE shop_ddl FROM @ddl; EXECUTE shop_ddl; DEALLOCATE PREPARE shop_ddl;
|
||||
'''
|
||||
source=Path(__file__).resolve().parents[2]/'data/ava2-itemshop/original-products.tsv'
|
||||
for line in source.read_text().splitlines():
|
||||
row=line.split('\t');assert len(row)==12
|
||||
values=[str(int(v)) if i not in (6,7) else ('NULL' if v.startswith('0000') else "'"+v+"'") for i,v in enumerate(row)]
|
||||
sql+='INSERT IGNORE INTO ishop_data(id,categoryType,categorySubType,itemVnum,itemPrice,discount,offerTime,addedTime,sellCount,week_limit,month_limit,maxSellCount) VALUES('+','.join(values)+');\n'
|
||||
a.output.parent.mkdir(parents=True,exist_ok=True);a.output.write_text(sql)
|
||||
print('217 native products imported disabled; review compatibility before enabling')
|
||||
@@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Plan/apply the 32->40 wear-slot migration with cores/db stopped and a full backup.
|
||||
|
||||
The saved plan contains exact row IDs and before/after values. Reapplying that same plan
|
||||
is safe after interruption; never regenerate a plan from partially migrated data.
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
NAME = 'ava2-shop-wear-40'
|
||||
|
||||
|
||||
def quickslots(blob):
|
||||
if not blob:
|
||||
return blob
|
||||
if len(blob) != 108:
|
||||
raise ValueError('Expected 36 three-byte quick slots')
|
||||
output = bytearray(blob)
|
||||
for index in range(0, len(blob), 3):
|
||||
kind, lo, hi = blob[index:index+3]
|
||||
pos = lo | hi << 8
|
||||
if kind == 1 and (257 <= pos <= 268 or 287 <= pos <= 302):
|
||||
output[index+1:index+3] = (pos+8).to_bytes(2, 'little')
|
||||
return bytes(output)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--player', required=True)
|
||||
parser.add_argument('--plan', type=Path, required=True)
|
||||
parser.add_argument('--apply', action='store_true')
|
||||
args = parser.parse_args()
|
||||
if not re.fullmatch('[A-Za-z0-9_]+', args.player):
|
||||
parser.error('Invalid database name')
|
||||
|
||||
def sql(query):
|
||||
result = subprocess.run(['mysql', '-N', '-B', args.player], input=query,
|
||||
text=True, capture_output=True, check=True)
|
||||
return [line.split('\t') for line in result.stdout.splitlines()]
|
||||
|
||||
sql('CREATE TABLE IF NOT EXISTS mt_migration(name VARCHAR(64) PRIMARY KEY,done DATETIME);')
|
||||
if sql("SELECT name FROM mt_migration WHERE name='%s';" % NAME):
|
||||
print(NAME + ': already applied')
|
||||
return
|
||||
if args.plan.exists():
|
||||
plan = json.loads(args.plan.read_text())
|
||||
if plan['schema'] != args.player:
|
||||
raise RuntimeError('Plan belongs to another database')
|
||||
else:
|
||||
# Equipped DS cells are relative; belt cells in INVENTORY are absolute.
|
||||
bad = sql("SELECT i.id FROM item i LEFT JOIN item_proto p ON i.vnum=p.vnum "
|
||||
"WHERE i.window='EQUIPMENT' AND i.pos>=32 AND "
|
||||
"(i.pos>43 OR p.type IS NULL OR p.type NOT IN (29,30));")
|
||||
if bad:
|
||||
raise RuntimeError('Unexpected occupied extended equipment cells; inspect before migration')
|
||||
items = sql("SELECT id,pos FROM item WHERE (window='EQUIPMENT' AND pos BETWEEN 32 AND 43) "
|
||||
"OR (window='INVENTORY' AND pos BETWEEN 287 AND 302) ORDER BY pos DESC;")
|
||||
plan = {'schema': args.player, 'items': [[int(i), int(p), int(p)+8] for i, p in items],
|
||||
'quickslots': []}
|
||||
for table in ('player', 'player_deleted'):
|
||||
for pid, value in sql('SELECT id,HEX(quickslot) FROM `%s`;' % table):
|
||||
old = bytes.fromhex(value)
|
||||
new = quickslots(old)
|
||||
if old != new:
|
||||
plan['quickslots'].append([table, int(pid), old.hex(), new.hex()])
|
||||
args.plan.parent.mkdir(parents=True, exist_ok=True)
|
||||
args.plan.write_text(json.dumps(plan, indent=2)+'\n')
|
||||
args.plan.chmod(0o600)
|
||||
print('planned items=%d quickslots=%d' % (len(plan['items']), len(plan['quickslots'])))
|
||||
if not args.apply:
|
||||
return
|
||||
# Every update is conditional on its original value, allowing safe saved-plan replay.
|
||||
for item, old, new in plan['items']:
|
||||
row = sql('SELECT pos FROM item WHERE id=%d;' % item)
|
||||
if row not in ([[str(old)]], [[str(new)]]):
|
||||
raise RuntimeError('Item changed since planning; cores/db must stay stopped')
|
||||
sql('UPDATE item SET pos=%d WHERE id=%d AND pos=%d;' % (new, item, old))
|
||||
for table, pid, old, new in plan['quickslots']:
|
||||
row = sql('SELECT HEX(quickslot) FROM `%s` WHERE id=%d;' % (table, pid))
|
||||
if not row or row[0][0].lower() not in (old, new):
|
||||
raise RuntimeError('Quickslot changed since planning')
|
||||
sql("UPDATE `%s` SET quickslot=X'%s' WHERE id=%d AND HEX(quickslot)='%s';" %
|
||||
(table, new, pid, old.upper()))
|
||||
columns = sql("SELECT COLUMN_NAME FROM information_schema.columns WHERE TABLE_SCHEMA=DATABASE() "
|
||||
"AND TABLE_NAME='item' AND COLUMN_NAME='port_extra';")
|
||||
if not columns:
|
||||
sql("ALTER TABLE item ADD port_extra VARBINARY(69) NOT NULL DEFAULT ''; ")
|
||||
sql("INSERT INTO mt_migration(name,done) VALUES('%s',NOW());" % NAME)
|
||||
print(NAME + ': applied; retain the saved plan for recovery')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"points_mob_chance": 500,
|
||||
"points_mob_min": 1,
|
||||
"points_mob_max": 1,
|
||||
"points_stone_chance": 10000,
|
||||
"points_stone_min": 3,
|
||||
"points_stone_max": 8,
|
||||
"points_min_level": 1,
|
||||
"points_max_overlevel": 15,
|
||||
"points_daily_cap": 500
|
||||
}
|
||||
Reference in New Issue
Block a user