Compare commits

...

2 Commits

Author SHA1 Message Date
5129f68dad fix web login 2024-07-09 02:23:49 +08:00
8e3535ecf6 add 43经典 2024-07-05 16:32:50 +08:00
4 changed files with 51 additions and 36 deletions

View File

@ -170,6 +170,7 @@ namespace Zerolauncher.Manager
private void Handle(object sender, DataReceivedEventArgs e) private void Handle(object sender, DataReceivedEventArgs e)
{ {
Trace.WriteLine($"from client:{e.Data}");
var lines = e.Data == null? [""] : e.Data.Split(" ", 2); // 切成两半 var lines = e.Data == null? [""] : e.Data.Split(" ", 2); // 切成两半
switch (lines[0]) switch (lines[0])
{ {

View File

@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System.Diagnostics;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
@ -70,8 +71,9 @@ namespace Zerolauncher.Manager
game.Send($"{StaticHandleS.HintText} 尝试登玩家{game.account.nickName}到{ServicesStaticInfo.ServicesName[game.account.providerId]}的{game.account.serverId}服"); game.Send($"{StaticHandleS.HintText} 尝试登玩家{game.account.nickName}到{ServicesStaticInfo.ServicesName[game.account.providerId]}的{game.account.serverId}服");
switch (game.account.providerId) switch (game.account.providerId)
{ {
case 3:
case 0: case 0:
need_web = $"http://web.4399.com/stat/togame.php?target=ddt&server_id=S{game.account.serverId}"; need_web = $"http://web.4399.com/stat/togame.php?target={(game.account.providerId == 3? "ddts":"ddt")}&server_id=S{game.account.serverId}";
{ {
var values = new Dictionary<string, string> var values = new Dictionary<string, string>
{ {
@ -101,11 +103,12 @@ namespace Zerolauncher.Manager
if (!game.Send($"{StaticHandleS.HintText} 登录成功,开始解析iframe")) return; if (!game.Send($"{StaticHandleS.HintText} 登录成功,开始解析iframe")) return;
} }
{ {
var responseString = await AssetNet(client, game, $"http://web.4399.com/stat/togame.php?target=ddt&server_id=S{game.account.serverId}"); var responseString = await AssetNet(client, game, need_web);
if (responseString == null) break; if (responseString == null) break;
if (!responseString.Contains("name=\"game_box\"")) if (!responseString.Contains("name=\"game_box\""))
{ {
game.Send($"{StaticHandleS.HintText} 解析异常:服务器返回数据不正确"); game.Send($"{StaticHandleS.HintText} 解析异常:服务器返回数据不正确");
Trace.WriteLine(responseString);
if (responseString.Contains("维护")) game.Send($"{StaticHandleS.HintText} 检测到服务器在维护中,请耐心等候官方开服"); if (responseString.Contains("维护")) game.Send($"{StaticHandleS.HintText} 检测到服务器在维护中,请耐心等候官方开服");
break; break;
} }
@ -120,9 +123,15 @@ namespace Zerolauncher.Manager
game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name.Replace(" ", "_")},消息:{ex.Message.Replace(" ", "_")}"); game.Send($"{StaticHandleS.HintText} 网络发生错误,类型:{ex.GetType().Name.Replace(" ", "_")},消息:{ex.Message.Replace(" ", "_")}");
break; break;
} }
responseString = await response.Content.ReadAsStringAsync(); responseString = await response.Content.ReadAsStringAsync();
if (game.account.providerId == 3)
{
responseString = responseString.Split("\"movie\" value='")[1].Split("'", 2)[0];
}else
{
responseString = "http://" + response.RequestMessage.RequestUri.ToString().Split("/")[2] + "/" + responseString.Split("movie\" value='")[1].Split("'")[0]; responseString = "http://" + response.RequestMessage.RequestUri.ToString().Split("/")[2] + "/" + responseString.Split("movie\" value='")[1].Split("'")[0];
//Trace.WriteLine(responseString); }
game.Send($"{StaticHandleS.GameSa} {responseString}"); game.Send($"{StaticHandleS.GameSa} {responseString}");
} }
need_web = null ; need_web = null ;
@ -171,6 +180,9 @@ namespace Zerolauncher.Manager
case 2: case 2:
need_web = $"http://www.wan.com/game/play/id/{game.account.serverId}"; need_web = $"http://www.wan.com/game/play/id/{game.account.serverId}";
break; break;
// case 3:
//need_web = $"https://web.4399.com/stat/togame.php?target=ddts&server_id=S{game.account.serverId}";
// break;
default: default:
game.Send($"{StaticHandleS.HintText} 错误。未适配的运营商:{game.account.serverId}"); game.Send($"{StaticHandleS.HintText} 错误。未适配的运营商:{game.account.serverId}");
break; break;
@ -182,7 +194,7 @@ namespace Zerolauncher.Manager
await Task.Delay(1000); await Task.Delay(1000);
if (!game.Send($"{StaticHandleS.HintText} 自动登录失败,将在{i}后启用网页登录,关闭窗口取消")) { return; } if (!game.Send($"{StaticHandleS.HintText} 自动登录失败,将在{i}后启用网页登录,关闭窗口取消")) { return; }
} }
game.Send($"{StaticHandleS.UseBrowser} {need_web}"); game.Send($"{StaticHandleS.UseBrowser} {need_web} {game.account.providerId + 1} {game.account.serverId} {game.account.userName} {game.account.userPWD}");
} }
} }
} }

View File

@ -2,7 +2,7 @@
{ {
class ServicesStaticInfo class ServicesStaticInfo
{ {
public static string[] ServicesName = ["4399大区", "7k7k大区", "第七大道"]; public static string[] ServicesName = ["4399大区", "7k7k大区", "第七大道", "4399经典"];
public static string[] ServicesShortName = ["43", "7k", "7d"]; public static string[] ServicesShortName = ["43", "7k", "7d", "典"];
} }
} }

View File

@ -10,6 +10,7 @@
public const string GameSa = "f0"; public const string GameSa = "f0";
public const string CloseGame = "g0"; public const string CloseGame = "g0";
public const string UpdateInfo = "h0"; public const string UpdateInfo = "h0";
public const string VerifyDone = "i0";
} }
class StaticHandleC class StaticHandleC
@ -21,6 +22,7 @@
public const string GameDone = "0e"; public const string GameDone = "0e";
public const string Version = "0f"; public const string Version = "0f";
public const string DownloadDone = "0g"; public const string DownloadDone = "0g";
public const string TakeVerify = "0i";
} }
class StaticHandleA class StaticHandleA