fix loading screen hang, only allow gacha tutorial once

This commit is contained in:
Mikhail
2024-07-04 08:25:23 -04:00
parent 40f78db301
commit 400ab96fc1
7 changed files with 21 additions and 12 deletions

1
.gitignore vendored
View File

@@ -456,3 +456,4 @@ $RECYCLE.BIN/
# Allow pregenerated ssl cert
!nksrv/site.pfx
!ServerSelector/myCA.pfx
!ServerSelector/sodium.dll

View File

@@ -1,5 +1,5 @@
# nikke-server
Private/local server for Nikke. NOTE: This project is in a very early state.
Private/local server for Nikke. NOTE: This project is in a very early state so many features in the game do not work.
## Usage
Download the latest release/GitHub actions build, and run ServerSelector.Desktop.exe as administrator (to modify DNS hosts file and install a CA cert). Make sure to close the game and launcher first. Select Local server, and then click save.
@@ -10,7 +10,7 @@ You should be able to register an new account in the launcher (you can enter any
If the game does not get past the title screen, open an issue and send %appdata%\..\LocalLow\com.proximabeta\NIKKE\player.log file.
Note that this was tested with the latest version (122.8.20c)
## Progress
Stage, character, and story information is saved and works, as well as player nickname.

View File

@@ -25,6 +25,8 @@ namespace nksrv.IntlServer
if (item.Username == ep.account && item.Password == ep.password)
{
var tok = IntlHandler.CreateLauncherTokenForUser(item);
item.LastLogin = DateTime.UtcNow;
JsonDb.Save();
WriteJsonString("{\"expire\":" + tok.ExpirationTime + ",\"is_login\":true,\"msg\":\"Success\",\"register_time\":" + item.RegisterTime + ",\"ret\":0,\"seq\":\"" + Seq + "\",\"token\":\"" + tok.Token + "\",\"uid\":\"" + item.ID + "\"}");
return;

View File

@@ -19,19 +19,24 @@ namespace nksrv.LobbyServer.Msgs.Gacha
var response = new ResExecuteGacha();
// TODO: Pick random character that player does not have unless it supports limit break.
// TODO: Write character to user info.
// TODO implement
// TODO implement reward
response.Reward = new NetRewardData();
if (user.GachaTutorialPlayCount == 0)
{
foreach (var c in StaticDataParser.Instance.GetAllCharacterTids())
{
response.Gacha.Add(new NetGachaEntityData() { Corporation = 0, PieceCount = 1, CurrencyValue = 5, Sn = 130201, Tid = c, Type = 1 });
user.Characters.Add(new Utils.Character() { CostumeId = 0, Csn = c, Grade = 0, Level = 1, Skill1Lvl = 1, Skill2Lvl= 1, Tid = c, UltimateLevel = 1 });
user.Characters.Add(new Utils.Character() { CostumeId = 0, Csn = c, Grade = 0, Level = 1, Skill1Lvl = 1, Skill2Lvl = 1, Tid = c, UltimateLevel = 1 });
// response.Characters.Add(new NetUserCharacterDefaultData() { Lv = 1, Skill1Lv = 1, Grade = 0, Csn = 1, Tid = 130201 });
}
user.GachaTutorialPlayCount++;
}
JsonDb.Save();

View File

@@ -22,7 +22,7 @@ namespace nksrv.LobbyServer.Msgs.Outpost
var response = new ResGetOutpostData
{
OutpostBattleLevel = new NetOutpostBattleLevel() { Level = 1 },
CommanderBgm = new NetUserJukeboxDataV2(),
CommanderBgm = new NetUserJukeboxDataV2() { CommandBgm = new() { Type = NetJukeboxBgmType.JukeboxTableId, JukeboxTableId = 3012 } },
BattleTime = 864000000000, Jukebox = new(), MaxBattleTime = 864000000000
};

View File

@@ -30,6 +30,7 @@ namespace nksrv.LobbyServer.Msgs.User
}
response.MaxGachaCount = 10;
// todo tutorial playcount of gacha
response.TutorialGachaPlayCount = user.GachaTutorialPlayCount;
WriteData(response);
}

View File

@@ -87,6 +87,7 @@ namespace nksrv.Utils
public DateTime BattleTime = DateTime.UtcNow;
public NetOutpostBattleLevel OutpostBattleLevel = new() { Level = 1 };
public int GachaTutorialPlayCount = 0;
public void SetQuest(int tid, bool recieved)
{
@@ -107,14 +108,13 @@ namespace nksrv.Utils
public List<AccessToken> LauncherAccessTokens = [];
public Dictionary<string, GameClientInfo> GameClientTokens = [];
}
internal class JsonDb
{
public static CoreInfo Instance { get; internal set; }
public static byte[] ServerPrivateKey = Convert.FromBase64String("FSUY8Ohd942n5LWAfxn6slK3YGwc8OqmyJoJup9nNos=");
public static byte[] ServerPublicKey = Convert.FromBase64String("04hFDd1e/BOEF2h4b0MdkX2h6W5REeqyW+0r9+eSeh0=");
public static byte[] ServerPublicKey = Convert.FromBase64String("04hFDd1e/BOEF2h4b0MdkX2h6W5REeqyW+0r9+eSeh0="); // Note: change this in sodium
static JsonDb()
{