basic 1.9 support

This commit is contained in:
winter 2023-01-08 00:25:32 +09:00
parent 7692564938
commit fb9bc588b8
11 changed files with 106 additions and 11 deletions

View File

@ -30,3 +30,7 @@ CrystalGauntlet.endpoints["/uploadGJComment21.php"] = ->(context : HTTP::Server:
}
CrystalGauntlet.endpoints["/uploadGJComment20.php"] = CrystalGauntlet.endpoints["/uploadGJComment21.php"]
CrystalGauntlet.endpoints["/uploadGJComment19.php"] = ->(context : HTTP::Server::Context): String {
"-1"
}

View File

@ -21,3 +21,7 @@ CrystalGauntlet.endpoints["/deleteGJComment20.php"] = ->(context : HTTP::Server:
return "1"
}
CrystalGauntlet.endpoints["/deleteGJComment19.php"] = ->(context : HTTP::Server::Context): String {
"-1"
}

View File

@ -37,10 +37,14 @@ CrystalGauntlet.endpoints["/getGJComments21.php"] = ->(context : HTTP::Server::C
special = rs.read(Int32)
if Versions.parse(params["gameVersion"]) >= Versions::V2_1
if (params["gameVersion"]? || "19").to_i32 >= 20
comment = Base64.urlsafe_encode(comment)
end
if Versions.parse(params["gameVersion"] || "19") >= Versions::V2_1
comments_str << [
Format.fmt_comment({
2 => Base64.urlsafe_encode(comment),
2 => comment,
3 => user_id,
4 => likes,
5 => 0,
@ -64,7 +68,7 @@ CrystalGauntlet.endpoints["/getGJComments21.php"] = ->(context : HTTP::Server::C
].join(":")
else
comments_str << Format.fmt_comment({
2 => Base64.urlsafe_encode(comment),
2 => comment,
3 => user_id,
4 => likes,
5 => 0,
@ -93,3 +97,4 @@ CrystalGauntlet.endpoints["/getGJComments21.php"] = ->(context : HTTP::Server::C
}
CrystalGauntlet.endpoints["/getGJComments20.php"] = CrystalGauntlet.endpoints["/getGJComments21.php"]
CrystalGauntlet.endpoints["/getGJComments19.php"] = CrystalGauntlet.endpoints["/getGJComments21.php"]

View File

@ -80,8 +80,9 @@ CrystalGauntlet.endpoints["/downloadGJLevel22.php"] = ->(context : HTTP::Server:
xor_pass = "0"
if !password
password = "0"
elsif Versions.parse(params["gameVersion"]) >= Versions::V2_0
elsif Versions.parse(params["gameVersion"]? || "19") >= Versions::V2_0
xor_pass = Base64.urlsafe_encode(XorCrypt.encrypt_string(password, "26364"))
description = Base64.urlsafe_encode(description)
else
xor_pass = password
end
@ -92,7 +93,7 @@ CrystalGauntlet.endpoints["/downloadGJLevel22.php"] = ->(context : HTTP::Server:
response << CrystalGauntlet::Format.fmt_hash({
1 => id,
2 => name,
3 => Base64.urlsafe_encode(description),
3 => description,
4 => level_data,
5 => version,
6 => user_id,
@ -159,3 +160,4 @@ CrystalGauntlet.endpoints["/downloadGJLevel22.php"] = ->(context : HTTP::Server:
}
CrystalGauntlet.endpoints["/downloadGJLevel20.php"] = CrystalGauntlet.endpoints["/downloadGJLevel22.php"]
CrystalGauntlet.endpoints["/downloadGJLevel19.php"] = CrystalGauntlet.endpoints["/downloadGJLevel22.php"]

View File

@ -278,4 +278,5 @@ CrystalGauntlet.endpoints["/getGJLevels21.php"] = ->(context : HTTP::Server::Con
}
CrystalGauntlet.endpoints["/getGJLevels20.php"] = CrystalGauntlet.endpoints["/getGJLevels21.php"]
CrystalGauntlet.endpoints["/getGJLevels19.php"] = CrystalGauntlet.endpoints["/getGJLevels21.php"]

View File

@ -86,3 +86,12 @@ CrystalGauntlet.endpoints["/rateGJDemon21.php"] = ->(context : HTTP::Server::Con
}
CrystalGauntlet.endpoints["/rateGJStars20.php"] = CrystalGauntlet.endpoints["/rateGJStars211.php"]
CrystalGauntlet.endpoints["/rateGJStars.php"] = ->(context : HTTP::Server::Context): String {
"-1"
}
CrystalGauntlet.endpoints["/rateGJLevel.php"] = ->(context : HTTP::Server::Context): String {
"-1"
}

View File

@ -143,3 +143,7 @@ CrystalGauntlet.endpoints["/uploadGJLevel21.php"] = ->(context : HTTP::Server::C
}
CrystalGauntlet.endpoints["/uploadGJLevel20.php"] = CrystalGauntlet.endpoints["/uploadGJLevel21.php"]
CrystalGauntlet.endpoints["/uploadGJLevel19.php"] = ->(context : HTTP::Server::Context): String {
"-1"
}

View File

@ -37,3 +37,7 @@ CrystalGauntlet.endpoints["/likeGJItem211.php"] = ->(context : HTTP::Server::Con
}
CrystalGauntlet.endpoints["/likeGJItem20.php"] = CrystalGauntlet.endpoints["/likeGJItem211.php"]
CrystalGauntlet.endpoints["/likeGJItem.php"] = ->(context : HTTP::Server::Context): String {
"-1"
}

View File

@ -79,3 +79,4 @@ CrystalGauntlet.endpoints["/getGJMapPacks21.php"] = ->(context : HTTP::Server::C
}
CrystalGauntlet.endpoints["/getGJMapPacks20.php"] = CrystalGauntlet.endpoints["/getGJMapPacks21.php"]
CrystalGauntlet.endpoints["/getGJMapPacks.php"] = CrystalGauntlet.endpoints["/getGJMapPacks21.php"]

View File

@ -12,20 +12,22 @@ CrystalGauntlet.endpoints["/getGJScores20.php"] = ->(context : HTTP::Server::Con
offset = 0
filter = ""
case params["type"]
when "top"
when "top", "week"
sort = "stars desc"
offset = 0
when "creators"
sort = "creator_points desc"
offset = 0
when "relative"
user_id, account_id = Accounts.auth(params)
if !(user_id && account_id)
return "-1"
sort = "stars desc"
stars = 0
if params.has_key?("accountID")
stars = DATABASE.scalar("select stars from users where account_id = ?", params["accountID"].to_i).as(Int64)
else
stars = DATABASE.scalar("select stars from users where udid = ?", params["udid"]).as(Int64)
end
sort = "stars desc"
stars = DATABASE.scalar("select stars from users where account_id = ?", account_id).as(Int64)
offset = DATABASE.scalar("select count(*) from users where stars > ?", stars).as(Int64)
offset = Math.max(offset - 10, 0)
when "friends"
@ -84,3 +86,55 @@ CrystalGauntlet.endpoints["/getGJScores20.php"] = ->(context : HTTP::Server::Con
results.join("|")
}
CrystalGauntlet.endpoints["/getGJScores19.php"] = CrystalGauntlet.endpoints["/getGJScores20.php"]
CrystalGauntlet.endpoints["/getGJCreators19.php"] = ->(context : HTTP::Server::Context): String {
params = URI::Params.parse(context.request.body.not_nil!.gets_to_end)
LOG.debug { params.inspect }
count = Clean.clean_number(params["count"]).to_i32
results = [] of String
DATABASE.query("select username, id, coins, user_coins, icon_type, cube, ship, ball, ufo, wave, robot, spider, color1, color2, special, udid, account_id, stars, creator_points, demons, diamonds from users order by creator_points desc limit #{count}") do |rs|
rank = 0
rs.each do
username = rs.read(String)
id = rs.read(Int32)
coins = rs.read(Int32)
user_coins = rs.read(Int32)
icon_type = rs.read(Int32)
icon_value = [rs.read(Int32), rs.read(Int32), rs.read(Int32), rs.read(Int32), rs.read(Int32), rs.read(Int32), rs.read(Int32)][icon_type]
color1 = rs.read(Int32)
color2 = rs.read(Int32)
special = rs.read(Int32)
udid = rs.read(String | Nil)
account_id = rs.read(Int32 | Nil)
stars = rs.read(Int32)
creator_points = rs.read(Int32)
demons = rs.read(Int32)
diamonds = rs.read(Int32)
rank += 1
results << Format.fmt_hash({
1 => username,
2 => id,
3 => stars,
4 => demons,
6 => rank,
7 => account_id || udid,
8 => creator_points,
9 => icon_value,
10 => color1,
11 => color2,
13 => coins,
14 => icon_type,
15 => special,
16 => account_id || udid,
17 => user_coins,
46 => diamonds
})
end
end
results.join("|")
}

View File

@ -32,3 +32,10 @@ CrystalGauntlet.endpoints["/updateGJUserScore22.php"] = ->(context : HTTP::Serve
}
CrystalGauntlet.endpoints["/updateGJUserScore20.php"] = CrystalGauntlet.endpoints["/updateGJUserScore22.php"]
CrystalGauntlet.endpoints["/updateGJUserScore19.php"] = ->(context : HTTP::Server::Context): String {
params = URI::Params.parse(context.request.body.not_nil!.gets_to_end)
LOG.debug { params.inspect }
DATABASE.scalar("select id from users where account_id = ?", params["accountID"].to_i).as(Int64).to_s
}