· 9 years ago · Oct 18, 2016, 10:49 PM
1--NewShit
2local function InitAccountTable_New()
3 local Dat = {
4 "PlayerID BIGINT NOT NULL PRIMARY KEY",
5 "PlayerName TEXT",
6 "CurrentShip TINYTEXT",
7 "FactionName TINYTEXT",
8 "Money BIGINT UNSIGNED",
9 "Rank TINYINT UNSIGNED",
10 }
11
12 return "CREATE TABLE IF NOT EXISTS Accounts_2015 ("..table.concat(Dat,",")..");"
13end
14
15local function InitAccountTable_Inventory_New()
16 local Dat = {
17 "PlayerID BIGINT NOT NULL",
18 "ItemSeed INT UNSIGNED",
19 "TechLevel INT UNSIGNED",
20 "Class TINYTEXT",
21 "ShipClass TINYTEXT",
22 "Slot TINYINT UNSIGNED NOT NULL",
23 "Quantity INT UNSIGNED",
24 "PRIMARY KEY(PlayerID,Slot)",
25 }
26
27 return "CREATE TABLE IF NOT EXISTS Accounts_Inventory_2015 ("..table.concat(Dat,",")..");"
28end
29
30local function InitAccountTable_Skills_New()
31 local Dat = {
32 "PlayerID BIGINT NOT NULL",
33 "SkillName VARCHAR(255)",
34 "Level INT UNSIGNED",
35 "XP BIGINT UNSIGNED",
36 "PRIMARY KEY(PlayerID,SkillName)",
37 }
38
39 return "CREATE TABLE IF NOT EXISTS Accounts_Skills_2015 ("..table.concat(Dat,",")..");"
40end
41
42local function InitAccountTable_Equipment_New()
43 local Dat = {
44 "PlayerID BIGINT NOT NULL",
45 "ItemSeed INT UNSIGNED",
46 "TechLevel INT UNSIGNED",
47 "Class TINYTEXT",
48 "ShipClass TINYTEXT",
49 "Slot TINYINT UNSIGNED",
50 "PRIMARY KEY(PlayerID,Slot)",
51 }
52
53 return "CREATE TABLE IF NOT EXISTS Accounts_Equipment_2015 ("..table.concat(Dat,",")..");"
54end
55
56local function InitAccountTable_Bank_New()
57 local Dat = {
58 "PlayerID BIGINT NOT NULL",
59 "ItemSeed INT UNSIGNED",
60 "TechLevel INT UNSIGNED",
61 "Class TINYTEXT",
62 "ShipClass TINYTEXT",
63 "Slot TINYINT UNSIGNED",
64 "Quantity INT UNSIGNED",
65 "PRIMARY KEY(PlayerID,Slot)",
66 }
67
68 return "CREATE TABLE IF NOT EXISTS Accounts_Bank_2015 ("..table.concat(Dat,",")..");"
69end
70
71local function InitAccountTable_Market_New()
72 local Dat = {
73 "id INT UNSIGNED NOT NULL AUTO_INCREMENT",
74 "PlayerID BIGINT NOT NULL",
75 "ItemSeed INT UNSIGNED",
76 "TechLevel INT UNSIGNED",
77 "Class TINYTEXT",
78 "ShipClass TINYTEXT",
79 "Quantity INT UNSIGNED",
80 "Price BIGINT UNSIGNED",
81 "PRIMARY KEY(id)",
82 }
83
84 return "CREATE TABLE IF NOT EXISTS Accounts_Market_2015 ("..table.concat(Dat,",")..");"
85end
86
87local function InitAccountTable_Positions_New()
88 local Dat = {
89 "PlayerID BIGINT NOT NULL PRIMARY KEY",
90 "posx BIGINT",
91 "posy BIGINT",
92 "posz BIGINT",
93 "detx INT",
94 "dety INT",
95 "detz INT",
96 }
97
98 return "CREATE TABLE IF NOT EXISTS Accounts_Positions_2015 ("..table.concat(Dat,",")..");"
99end
100
101local function InitAccountTable_Ships_New()
102 local Dat = {
103 "PlayerID BIGINT NOT NULL",
104 "Ship VARCHAR(255)",
105 "PRIMARY KEY(PlayerID,Ship)",
106 }
107
108 return "CREATE TABLE IF NOT EXISTS Accounts_Ships_2015 ("..table.concat(Dat,",")..");"
109end
110
111local function InitAccountTable_Factions_New()
112 local Dat = {
113 "FactionName VARCHAR(255) NOT NULL",
114 "FactionPassword TINYTEXT",
115 "FactionLeader BIGINT",
116 "Members INT UNSIGNED NOT NULL",
117 "PRIMARY KEY(FactionName)",
118 }
119
120 return "CREATE TABLE IF NOT EXISTS Accounts_Factions_2015 ("..table.concat(Dat,",")..");"
121end
122
123local function InitAccountTable_Mails_New()
124 local Dat = {
125 "id INT UNSIGNED NOT NULL AUTO_INCREMENT",
126 "SentPlayerID BIGINT NOT NULL",
127 "ReceivePlayerID BIGINT NOT NULL",
128 "Message TEXT",
129 "PRIMARY KEY(id)",
130 }
131
132 return "CREATE TABLE IF NOT EXISTS Accounts_Mails_2015 ("..table.concat(Dat,",")..");"
133end
134
135local function InitAccountTable_FactionWars_New()
136 local Dat = {
137 "SystemID INT UNSIGNED NOT NULL PRIMARY KEY",
138 "Ticker INT UNSIGNED NOT NULL",
139 "DefenderFaction VARCHAR(255)",
140 "AttackerFaction VARCHAR(255)",
141 "BalancingPoints INT UNSIGNED",
142 }
143
144 return "CREATE TABLE IF NOT EXISTS Accounts_FactionWars_2015 ("..table.concat(Dat,",")..");"
145end
146
147local function InitAccountTable_FactionControl_New()
148 local Dat = {
149 "SystemID INT UNSIGNED NOT NULL",
150 "Faction VARCHAR(255) NOT NULL",
151 "PRIMARY KEY(SystemID,Faction)",
152 }
153
154 return "CREATE TABLE IF NOT EXISTS Accounts_FactionControl_2015 ("..table.concat(Dat,",")..");"
155end
156
157local function InitAccountTable_Factions_Ranks_New()
158 local Dat = {
159 "id INT UNSIGNED NOT NULL AUTO_INCREMENT",
160 "FactionName VARCHAR(255) NOT NULL",
161 "FactionRank VARCHAR(255) NOT NULL",
162 "PRIMARY KEY(id)",
163 }
164
165 return "CREATE TABLE IF NOT EXISTS Accounts_Factions_Ranks_2015 ("..table.concat(Dat,",")..");"
166end
167
168local function InitAccountTable_Factions_Structures_New()
169 local Dat = {
170 "id INT UNSIGNED NOT NULL AUTO_INCREMENT",
171 "SystemID INT UNSIGNED",
172 "FactionName VARCHAR(255) NOT NULL",
173 "FactionStructure TINYTEXT",
174 "posx BIGINT",
175 "posy BIGINT",
176 "posz BIGINT",
177 "detx INT",
178 "dety INT",
179 "detz INT",
180 "PRIMARY KEY(id)",
181 }
182
183 return "CREATE TABLE IF NOT EXISTS Accounts_Factions_Structures_2015 ("..table.concat(Dat,",")..");"
184end
185
186function InitGameTables()
187 local Q = InitAccountTable_New()
188 Q = Q..InitAccountTable_Inventory_New()
189 Q = Q..InitAccountTable_Bank_New()
190 Q = Q..InitAccountTable_Market_New()
191 Q = Q..InitAccountTable_Positions_New()
192 Q = Q..InitAccountTable_Equipment_New()
193 Q = Q..InitAccountTable_Ships_New()
194 Q = Q..InitAccountTable_Skills_New()
195 Q = Q..InitAccountTable_Factions_New()
196 Q = Q..InitAccountTable_Mails_New()
197 Q = Q..InitAccountTable_FactionWars_New()
198 Q = Q..InitAccountTable_FactionControl_New()
199 Q = Q..InitAccountTable_Factions_Ranks_New()
200 Q = Q..InitAccountTable_Factions_Structures_New()
201
202 local a = mysql:Query(Q,GAMEMODE.Database )
203
204 function a.onSuccess(Q,Data,ResultID)
205 print("GameTable "..ResultID.." was created!")
206 end
207end