Skip to content

Commit 7e89fc7

Browse files
[ApacheNet/WebAPIUtils] - Implements support for the Sodium Blimp API.
This also includes the Sodium One objectives since this was needed for the Blimp to work. Also fixup some OHS code accordingly.
1 parent 70edc2a commit 7e89fc7

File tree

5 files changed

+1702
-7
lines changed

5 files changed

+1702
-7
lines changed

AuxiliaryServices/WebAPIService/OHS/User.cs

+21-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Text;
1111
using NetworkLibrary.HTTP;
1212
using static WebAPIService.OHS.UserCounter;
13+
using NetworkLibrary.Extension;
1314

1415
namespace WebAPIService.OHS
1516
{
@@ -465,8 +466,12 @@ public static string Get(byte[] PostData, string ContentType, string directorypa
465466

466467
if (!string.IsNullOrEmpty(ohsUserName))
467468
{
469+
bool keyFound = false;
470+
468471
if (directorypath.EndsWith("/SCEA/WorldDomination"))
469472
{
473+
keyFound = true;
474+
470475
string leaderboardPath = directorypath + $"/Leaderboards/{ohsKey}.luatable";
471476

472477
if (File.Exists(leaderboardPath))
@@ -491,14 +496,25 @@ public static string Get(byte[] PostData, string ContentType, string directorypa
491496
if (jsonObject.TryGetValue("key", out JToken keyValueToken) && keyValueToken.Type == JTokenType.Object)
492497
{
493498
if (((JObject)keyValueToken).TryGetValue(ohsKey, out JToken wishlistToken))
499+
{
500+
keyFound = true;
494501
output = LuaUtils.ConvertJTokenToLuaTable(wishlistToken, true);
502+
}
495503
}
496504
}
497505
}
498-
else
506+
if (!keyFound)
499507
{
500508
switch (ohsKey)
501509
{
510+
case "last_logon":
511+
if (directorypath.Contains("sodium_blimp"))
512+
output = "\"" + DateTimeUtils.GetCurrentUnixTimestampAsString() + "\"";
513+
break;
514+
case "reward_count":
515+
if (directorypath.Contains("sodium_blimp"))
516+
output = "0";
517+
break;
502518
case "timestamp":
503519
if (directorypath.Contains("Ooblag"))
504520
output = DateTime.Now.ToString("yyyyMMdd");
@@ -562,6 +578,10 @@ public static string Get(byte[] PostData, string ContentType, string directorypa
562578
{
563579
switch (ohsKey)
564580
{
581+
case "cp_urls":
582+
if (directorypath.Contains("sodium_blimp"))
583+
output = "{SCEA='Lockwood_Showcase_6663_C388/A/CPALOCKSHOW00.xml',SCEE='Lockwood_Showcase_6663_C388/E/CPELockwood00.xml',SCEJ='Sodium_Main_1864_A357/J/CPJSodium00.xml',SCEAsia='Sodium_Main_1864_A357/H/CPHSodium00.xml'}";
584+
break;
565585
case "vickie_version":
566586
output = "7";
567587
break;

BackendServices/NetworkLibrary/Extension/DateTimeUtils.cs

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public static DateTime ToUtcDateTime(this uint unixTime)
3535
return new DateTime(1970, 1, 1) + TimeSpan.FromSeconds(unixTime);
3636
}
3737

38+
public static string GetCurrentUnixTimestampAsString()
39+
{
40+
return DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
41+
}
42+
3843
#endregion
3944
}
4045
}

0 commit comments

Comments
 (0)