clean up code

This commit is contained in:
Mikhail
2024-07-05 14:08:05 -04:00
parent 5036097c9d
commit d08c293cd4
31 changed files with 105 additions and 337 deletions

View File

@@ -1,55 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace nksrv.StaticInfo
{
public static class StageCompletionReward
{
// <Stage ID, Reward data>
public static readonly Dictionary<int, NetRewardData> RewardData =
new() {
// Chapter 0
{ 6000001, new NetRewardData() { Currency = {
new NetCurrencyData() { Type = (int)CurrencyType.Gold, Value = 500 },
new NetCurrencyData() { Type = (int)CurrencyType.CharacterExp , Value = 600 }
} }
},
{ 6000002, new NetRewardData() { Currency = {
new NetCurrencyData() { Type = (int)CurrencyType.Gold, Value = 500 },
new NetCurrencyData() { Type = (int)CurrencyType.CharacterExp , Value = 600 }
} }
},
{ 6000003, new NetRewardData() { Currency = {
new NetCurrencyData() { Type = (int)CurrencyType.Gold, Value = 500 },
new NetCurrencyData() { Type = (int)CurrencyType.CharacterExp , Value = 600 }
} }
},
// Chapter 1
{ 6001001, new NetRewardData() { Currency = {
new NetCurrencyData() { Type = (int)CurrencyType.Gold, Value = 1000 },
new NetCurrencyData() { Type = (int)CurrencyType.CharacterExp , Value = 1200 }
} }
},
{ 6001002, new NetRewardData() { Currency = {
new NetCurrencyData() { Type = (int)CurrencyType.Gold, Value = 1000 },
new NetCurrencyData() { Type = (int)CurrencyType.CharacterExp , Value = 1200 }
} }
},
{ 6001003, new NetRewardData() { Currency = {
new NetCurrencyData() { Type = (int)CurrencyType.Gold, Value = 1000 },
new NetCurrencyData() { Type = (int)CurrencyType.CharacterExp , Value = 1200 }
} }
},
{ 6001004, new NetRewardData() { Currency = {
new NetCurrencyData() { Type = (int)CurrencyType.Gold, Value = 1000 },
new NetCurrencyData() { Type = (int)CurrencyType.CharacterExp , Value = 1200 }
// todo include the other items
} }
},
};
}
}

View File

@@ -175,12 +175,13 @@ namespace nksrv.StaticInfo
{
string targetFile = Program.GetCachePathForPath(StaticDataUrl.Replace("https://cloud.nikke-kr.com", ""));
var targetDir = Path.GetDirectoryName(targetFile);
if (targetDir == null) throw new Exception("directory name is null for path " + targetDir);
Directory.CreateDirectory(targetDir);
if (!File.Exists(targetFile))
{
// TODO: Ip might change
// TODO: IP might change
var requestUri = new Uri("https://43.132.66.200/" + StaticDataUrl.Replace("https://cloud.nikke-kr.com", ""));
using var request = new HttpRequestMessage(HttpMethod.Get, requestUri);
request.Headers.TryAddWithoutValidation("host", "cloud.nikke-kr.com");
@@ -346,7 +347,7 @@ namespace nksrv.StaticInfo
throw new Exception("expected id field in reward data");
}
string value = id.ToObject<string>();
string? value = id.ToObject<string>();
if (value == field)
{
var chapter = item["chapter"];