Skip to content

Commit 305e383

Browse files
authored
fix db names in scripts (#1599)
* fix db names in scripts * change ver
1 parent a9e7c89 commit 305e383

File tree

4 files changed

+45
-46
lines changed

4 files changed

+45
-46
lines changed

mapper/localization.lua

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ amap.localization = amap.localization or {
44
}
55

66
amap.localization.db = db:create("roomdescriptions", {
7-
roomDescriptions = {
7+
roomdescriptions = {
88
room_id = -1,
99
short = "",
1010
exitDesc = "",
@@ -15,12 +15,12 @@ amap.localization.db = db:create("roomdescriptions", {
1515
})
1616

1717
function amap.localization:try_to_locate()
18-
local results = db:fetch(self.db.roomDescriptions, db:AND(
19-
db:eq(self.db.roomDescriptions.short, self.current_short),
20-
db:eq(self.db.roomDescriptions.exitDesc, self.current_exit)
18+
local results = db:fetch(self.db.roomdescriptions, db:AND(
19+
db:eq(self.db.roomdescriptions.short, self.current_short),
20+
db:eq(self.db.roomdescriptions.exitDesc, self.current_exit)
2121
))
2222
if #results == 1 then
2323
amap:set_position(results[1].room_id, true)
2424
return true
2525
end
26-
end
26+
end

skrypty.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
scripts = scripts or { ver = "4.88" }
1+
scripts = scripts or { ver = "4.89" }
22
scripts.event_handlers = scripts.event_handlers or {}
33

44
function alias_func_skrypty_help()
@@ -28,7 +28,7 @@ function alias_func_skrypty_fake_combat(s)
2828
text = enc(s .. "\n"),
2929
type = "combat.avatar"
3030
}
31-
}
31+
}
3232
raiseEvent("gmcp.gmcp_msgs", gmcp)
3333
echo("\n")
3434
end

skrypty/misc/counter.lua

+4-5
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ misc.counter["all_kills"] = misc.counter["all_kills"] or 0
66
misc.counter.killed_amount["JA"] = misc.counter.killed_amount["JA"] or 0
77

88
-- counter2
9-
misc.counter2["db_log"] = db:create("counter2log", {
10-
counter2_log = {
9+
misc.counter2["db_log"] = db:create("countertwolog", {
10+
countertwolog = {
1111
year = 0,
1212
month = 0,
1313
day = 0,
@@ -19,8 +19,8 @@ misc.counter2["db_log"] = db:create("counter2log", {
1919
}
2020
})
2121

22-
misc.counter2["db_daysum"] = db:create("counter2daysum", {
23-
counter2_daysum = {
22+
misc.counter2["db_daysum"] = db:create("countertwo_daysum", {
23+
countertwo_daysum = {
2424
year = 0,
2525
month = 0,
2626
day = 0,
@@ -56,4 +56,3 @@ function trigger_func_process_kill_for_teammate()
5656
scripts.ui:info_killed_update()
5757
end
5858
end
59-

skrypty/misc/counter/counter2.lua

+34-34
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function misc.counter2:add_item(original_text, item)
1111
end
1212

1313
function misc.counter2:add_log(original_text, year, month, day, hour)
14-
local ret = db:add(misc.counter2.db_log.counter2_log, {
14+
local ret = db:add(misc.counter2.db_log.countertwolog, {
1515
year = year,
1616
month = month,
1717
day = day,
@@ -28,18 +28,18 @@ end
2828

2929
function misc.counter2:add_sum(item, year, month, day, type)
3030
-- first, update for this type this date
31-
local retrieved = db:fetch(misc.counter2.db_daysum.counter2_daysum,
31+
local retrieved = db:fetch(misc.counter2.db_daysum.countertwo_daysum,
3232
{
33-
db:eq(misc.counter2.db_daysum.counter2_daysum.year, year),
34-
db:eq(misc.counter2.db_daysum.counter2_daysum.month, month),
35-
db:eq(misc.counter2.db_daysum.counter2_daysum.day, day),
36-
db:eq(misc.counter2.db_daysum.counter2_daysum.character, scripts.character_name),
37-
db:eq(misc.counter2.db_daysum.counter2_daysum.type, type)
33+
db:eq(misc.counter2.db_daysum.countertwo_daysum.year, year),
34+
db:eq(misc.counter2.db_daysum.countertwo_daysum.month, month),
35+
db:eq(misc.counter2.db_daysum.countertwo_daysum.day, day),
36+
db:eq(misc.counter2.db_daysum.countertwo_daysum.character, scripts.character_name),
37+
db:eq(misc.counter2.db_daysum.countertwo_daysum.type, type)
3838
})
3939

4040

4141
if not retrieved or table.size(retrieved) == 0 then
42-
local ret = db:add(misc.counter2.db_daysum.counter2_daysum, {
42+
local ret = db:add(misc.counter2.db_daysum.countertwo_daysum, {
4343
year = year,
4444
month = month,
4545
day = day,
@@ -51,29 +51,27 @@ function misc.counter2:add_sum(item, year, month, day, type)
5151
if not ret then
5252
scripts:print_log("Cos poszlo nie tak z zapisem do globalnych zabitych", true)
5353
end
54-
5554
elseif table.size(retrieved) == 1 then
5655
local update_item = retrieved[1]
5756
local count = tonumber(update_item["amount"])
5857
update_item["amount"] = count + 1
59-
db:update(misc.counter2.db_daysum.counter2_daysum, update_item)
60-
58+
db:update(misc.counter2.db_daysum.countertwo_daysum, update_item)
6159
else
6260
scripts:print_log("Cos poszlo nie tak z zapisem do globalnych zabitych", true)
6361
return
6462
end
6563

6664
-- now do 'all' (count for day)
67-
local retrieved = db:fetch(misc.counter2.db_daysum.counter2_daysum,
65+
local retrieved = db:fetch(misc.counter2.db_daysum.countertwo_daysum,
6866
{
69-
db:eq(misc.counter2.db_daysum.counter2_daysum.year, year),
70-
db:eq(misc.counter2.db_daysum.counter2_daysum.month, month),
71-
db:eq(misc.counter2.db_daysum.counter2_daysum.day, day),
72-
db:eq(misc.counter2.db_daysum.counter2_daysum.type, "all")
67+
db:eq(misc.counter2.db_daysum.countertwo_daysum.year, year),
68+
db:eq(misc.counter2.db_daysum.countertwo_daysum.month, month),
69+
db:eq(misc.counter2.db_daysum.countertwo_daysum.day, day),
70+
db:eq(misc.counter2.db_daysum.countertwo_daysum.type, "all")
7371
})
7472

7573
if not retrieved or table.size(retrieved) == 0 then
76-
local ret = db:add(misc.counter2.db_daysum.counter2_daysum, {
74+
local ret = db:add(misc.counter2.db_daysum.countertwo_daysum, {
7775
year = year,
7876
month = month,
7977
day = day,
@@ -89,22 +87,22 @@ function misc.counter2:add_sum(item, year, month, day, type)
8987
local update_item = retrieved[1]
9088
local count = tonumber(update_item["amount"])
9189
update_item["amount"] = count + 1
92-
db:update(misc.counter2.db_daysum.counter2_daysum, update_item)
90+
db:update(misc.counter2.db_daysum.countertwo_daysum, update_item)
9391
else
9492
scripts:print_log("Cos poszlo nie tak z zapisem do globalnych zabitych", true)
9593
return
9694
end
9795
end
9896

99-
10097
function misc.counter2:show_short()
10198
if not scripts.character_name then
10299
scripts:print_log("Korzystanie z bazy zabitych po ustawieniu 'scripts.character_name' w configu")
103100
return
104101
end
105102

106-
local sql_query = "SELECT * FROM counter2_daysum WHERE character=\"" .. scripts.character_name .. "\" AND type!=\"all\" ORDER BY _row_id ASC"
107-
local retrieved = db:fetch_sql(misc.counter2.db_daysum.counter2_daysum, sql_query)
103+
local sql_query = "SELECT * FROM countertwo_daysum WHERE character=\"" ..
104+
scripts.character_name .. "\" AND type!=\"all\" ORDER BY _row_id ASC"
105+
local retrieved = db:fetch_sql(misc.counter2.db_daysum.countertwo_daysum, sql_query)
108106

109107
local count_dict = {}
110108

@@ -148,8 +146,9 @@ function misc.counter2:show_long()
148146
return
149147
end
150148

151-
local sql_query = "SELECT * FROM counter2_daysum WHERE character=\"" .. scripts.character_name .. "\" AND type!=\"all\" ORDER BY _row_id ASC"
152-
local retrieved = db:fetch_sql(misc.counter2.db_daysum.counter2_daysum, sql_query)
149+
local sql_query = "SELECT * FROM countertwo_daysum WHERE character=\"" ..
150+
scripts.character_name .. "\" AND type!=\"all\" ORDER BY _row_id ASC"
151+
local retrieved = db:fetch_sql(misc.counter2.db_daysum.countertwo_daysum, sql_query)
153152

154153
cecho("<grey>+---------------------------------------------------------+\n")
155154
cecho("<grey>| |\n")
@@ -206,15 +205,15 @@ function misc.counter2:show_logs(year, month, day)
206205
return
207206
end
208207

209-
if( (year == '' or year == nil) and (month == '' or month == nil) and (day == '' or day == nil)) then
208+
if ((year == '' or year == nil) and (month == '' or month == nil) and (day == '' or day == nil)) then
210209
misc.counter2:show_short()
211210
return
212211
end
213212

214-
local date = ""..year
215-
local sql_query = "SELECT * FROM counter2_log WHERE character=\"" .. scripts.character_name ..
216-
"\" AND year=\"" .. year .. "\" "
217-
213+
local date = "" .. year
214+
local sql_query = "SELECT * FROM countertwolog WHERE character=\"" .. scripts.character_name ..
215+
"\" AND year=\"" .. year .. "\" "
216+
218217
if month ~= nil then
219218
date = date .. "/" .. month;
220219
sql_query = sql_query .. " AND month=\"" .. month .. "\" "
@@ -225,7 +224,7 @@ function misc.counter2:show_logs(year, month, day)
225224
end
226225
sql_query = sql_query .. " ORDER BY _row_id ASC"
227226

228-
local retrieved = db:fetch_sql(misc.counter2.db_log.counter2_log, sql_query)
227+
local retrieved = db:fetch_sql(misc.counter2.db_log.countertwolog, sql_query)
229228

230229
local date = string.sub(date .. " ", 1, 11)
231230

@@ -242,7 +241,7 @@ function misc.counter2:show_logs(year, month, day)
242241

243242
for k, v in pairs(retrieved) do
244243
local text = string.sub(v["text"] .. " ", 1, 46)
245-
244+
246245
local kill_date = "";
247246
if month == nil or day == nil then
248247
kill_date = v["month"] .. "/" .. v["day"] .. " " .. v["hour"]
@@ -252,7 +251,7 @@ function misc.counter2:show_logs(year, month, day)
252251

253252
local kill_date_str = string.sub(kill_date .. " ", 1, 14)
254253

255-
254+
256255
cecho("<grey>|<orange> " .. kill_date_str .. " <grey>" .. text .. "<grey>|\n")
257256
sum = sum + 1
258257
end
@@ -274,11 +273,12 @@ function misc.counter2:reset()
274273
scripts:print_log("Probujesz wykasowac cala baze zabitych, od tego nie ma odwrotu. Aby wykonac, powtorz komende")
275274
misc.counter2.retried = true
276275
else
277-
db:delete(misc.counter2.db_log.counter2_log, db:eq(misc.counter2.db_log.counter2_log.character, scripts.character_name))
278-
db:delete(misc.counter2.db_daysum.counter2_daysum, db:eq(misc.counter2.db_daysum.counter2_daysum.character, scripts.character_name))
276+
db:delete(misc.counter2.db_log.countertwolog,
277+
db:eq(misc.counter2.db_log.countertwolog.character, scripts.character_name))
278+
db:delete(misc.counter2.db_daysum.countertwo_daysum,
279+
db:eq(misc.counter2.db_daysum.countertwo_daysum.character, scripts.character_name))
279280
scripts:print_log("Ok")
280281
end
281282

282283
tempTimer(5, function() misc.counter2.retried = nil end)
283284
end
284-

0 commit comments

Comments
 (0)