224 lines
8.1 KiB
C#
224 lines
8.1 KiB
C#
using ServerCore;
|
|
using ServerCommon;
|
|
using Nettention.Proud;
|
|
|
|
|
|
|
|
|
|
|
|
namespace GameServer;
|
|
|
|
|
|
[ChatCommandAttribute("questreset", typeof(ChatCommandQuestReset), AuthAdminLevelType.Developer, AuthAdminLevelType.GmNormal, AuthAdminLevelType.GmSuper)]
|
|
internal class ChatCommandQuestReset : ChatCommandBase
|
|
{
|
|
|
|
public override async Task invoke(Player player, string token, string[] args)
|
|
{
|
|
var quest_action = player.getEntityAction<QuestAction>();
|
|
await quest_action.cheatResetAllQuests();
|
|
}
|
|
}
|
|
|
|
|
|
[ChatCommandAttribute("questaccept", typeof(ChatCommandQuestAccept), AuthAdminLevelType.Developer, AuthAdminLevelType.GmNormal, AuthAdminLevelType.GmSuper)]
|
|
internal class ChatCommandQuestAccept : ChatCommandBase
|
|
{
|
|
public override async Task invoke(Player player, string token, string[] args)
|
|
{
|
|
if (args.Length < 1)
|
|
{
|
|
Log.getLogger().error($"Invalid Argument");
|
|
return;
|
|
}
|
|
if (false == uint.TryParse(args[0], out var questId))
|
|
{
|
|
Log.getLogger().error($"HandleQuestAccept param parsing Error args : {args[0]}");
|
|
return;
|
|
}
|
|
|
|
var quest_action = player.getEntityAction<QuestAction>();
|
|
await quest_action.cheatAcceptQuest(questId);
|
|
|
|
}
|
|
}
|
|
|
|
[ChatCommandAttribute("questcomplete", typeof(ChatCommandQuestComplete), AuthAdminLevelType.Developer, AuthAdminLevelType.GmNormal, AuthAdminLevelType.GmSuper)]
|
|
internal class ChatCommandQuestComplete : ChatCommandBase
|
|
{
|
|
public override async Task invoke(Player player, string token, string[] args)
|
|
{
|
|
if (args.Length < 1)
|
|
{
|
|
Log.getLogger().error($"Invalid Argument");
|
|
return;
|
|
}
|
|
|
|
if (!uint.TryParse(args[0], out var questId))
|
|
{
|
|
Log.getLogger().error($"questcomplete param parsing Error args : {args[0]}");
|
|
return;
|
|
}
|
|
|
|
var quest_action = player.getEntityAction<QuestAction>();
|
|
|
|
await quest_action.questComplete(questId);
|
|
}
|
|
}
|
|
|
|
[ChatCommandAttribute("questmailsend", typeof(ChatCommandQuestMailSend), AuthAdminLevelType.Developer, AuthAdminLevelType.GmNormal, AuthAdminLevelType.GmSuper)]
|
|
internal class ChatCommandQuestMailSend : ChatCommandBase
|
|
{
|
|
public override async Task invoke(Player player, string token, string[] args)
|
|
{
|
|
if (args.Length < 1)
|
|
{
|
|
Log.getLogger().error($"Invalid Argument");
|
|
return;
|
|
}
|
|
|
|
if (!uint.TryParse(args[0], out var questId))
|
|
{
|
|
Log.getLogger().error($"questmailsend param parsing Error args : {args[0]}");
|
|
return;
|
|
}
|
|
|
|
var quest_mail_action = player.getEntityAction<QuestCheatAction>();
|
|
await quest_mail_action.cheatSendQuestMail(questId);
|
|
|
|
}
|
|
}
|
|
|
|
[ChatCommandAttribute("methodtest", typeof(ChatCommandMethodTest), AuthAdminLevelType.Developer)]
|
|
internal class ChatCommandMethodTest : ChatCommandBase
|
|
{
|
|
public override async Task invoke(Player player, string token, string[] args)
|
|
{
|
|
|
|
var arg = args[0];
|
|
|
|
var id = int.Parse(args[0]);
|
|
|
|
if (id == 1)
|
|
{
|
|
|
|
// foreach (var room in BattleInstanceManager.It.getBattleInstanceRooms().Values)
|
|
// {
|
|
// var p2p_group_id = room.m_instance_room.getMap().getP2PGroupId();
|
|
// room.m_host_migrator.defineHost(p2p_group_id);
|
|
// var host_id = room.m_host_migrator.getHostUserGuid();
|
|
// Log.getLogger().warn($"{host_id}");
|
|
// }
|
|
|
|
|
|
|
|
// var packet = new ClientToGame();
|
|
// packet.Request = new ClientToGameReq();
|
|
// var req_msg = new ClientToGameReq.Types.C2GS_REQ_JOIN_BATTLE_INSTANCE();
|
|
// packet.Request.ReqJoinBattleInstance = req_msg;
|
|
//
|
|
// packet.Request.ReqJoinBattleInstance.EventId = 13;
|
|
|
|
|
|
// var packet = new ClientToGame();
|
|
// packet.Request = new ClientToGameReq();
|
|
// var req_msg = new ClientToGameReq.Types.C2GS_REQ_BATTLE_PLAYER_DEATH();
|
|
// packet.Request.ReqBattlePlayerDeath = req_msg;
|
|
//
|
|
// packet.Request.ReqBattlePlayerDeath.KillerGuid = 13;
|
|
//
|
|
// var result = await GameServerApp.getServerLogic().onCallProtocolHandler(player, packet);
|
|
// if (result.isFail())
|
|
// {
|
|
// //err_msg = $"Failed to onCallProtocolHandler() !!! : {result.toBasicString()} - {player.toBasicString()}";
|
|
// //Log.getLogger().error(err_msg);
|
|
// return;
|
|
// }
|
|
}
|
|
else if (id == 2)
|
|
{
|
|
var host_a = int.Parse(args[1]);
|
|
var host_b = int.Parse(args[2]);
|
|
player.getSessionId().toHostID();
|
|
var roomId = player.getCurrentInstanceRoomId();
|
|
|
|
if (false == GameModeManager.It.tryGetGameMode(roomId, out var gameMode)) return;
|
|
|
|
|
|
var ping = GameServerApp.getServerLogic().getProudNetListener().getNetServer().GetP2PRecentPingMs((HostID)host_a, (HostID)host_b);
|
|
int cc = 0;
|
|
Log.getLogger().info($"{cc}");
|
|
}
|
|
else if (id == 3)
|
|
{
|
|
// var server_logic = GameServerApp.getServerLogic();
|
|
// var cToG_req = new ClientToGame();
|
|
// cToG_req.Request = new();
|
|
// cToG_req.Request.ChatReq = new();
|
|
//
|
|
//
|
|
// cToG_req.Request.ChatReq.Message = "AAAAAAAAABBBBBBBBCCCCCCCCCCCCDDDDDDD";
|
|
// cToG_req.Request.ChatReq.Type = ChatType.Normal;
|
|
// cToG_req.Request.ChatReq.ToNickName = "khlee103";
|
|
//
|
|
// ClientToGameReq.Types.ChatReq req_temp = new();
|
|
//
|
|
// //여기서 쪼개서 테스트
|
|
// var byte_string = cToG_req.ToByteString();
|
|
// byte[] byteArray = byte_string.ToByteArray();
|
|
//
|
|
// int chunkSize = 14;
|
|
// int numberOfChunks = (int)Math.Ceiling((double)byteArray.Length / chunkSize);
|
|
//
|
|
// var uid = KeyGeneration.GenerateRandomKey(20);
|
|
// var otp_encoding_by_base32 = Base32Encoding.ToString(uid);
|
|
// List<IMessage> msgs = new();
|
|
// for (int i = 0; i < numberOfChunks; i++)
|
|
// {
|
|
// int startIndex = i * chunkSize;
|
|
// int length = Math.Min(chunkSize, byteArray.Length - startIndex);
|
|
//
|
|
// byte[] chunk = new byte[length];
|
|
// Array.Copy(byteArray, startIndex, chunk, 0, length);
|
|
//
|
|
// ByteString chunkByteString = ByteString.CopyFrom(chunk);
|
|
//
|
|
// var cToG = new ClientToGame();
|
|
// cToG.Request = new();
|
|
// cToG.Request.ReqLargePacket = new();
|
|
//
|
|
// cToG.Request.ReqLargePacket.PacketIndex = i;
|
|
// cToG.Request.ReqLargePacket.Uid = otp_encoding_by_base32;
|
|
// cToG.Request.ReqLargePacket.Data = chunkByteString;
|
|
// cToG.Request.ReqLargePacket.TotalPacketCount = numberOfChunks;
|
|
// var chunk_msg = cToG as IMessage;
|
|
// msgs.Add(chunk_msg);
|
|
// }
|
|
//
|
|
// foreach (var msg in msgs)
|
|
// {
|
|
// await server_logic.onCallLargeSizeProtocolHandler(player, msg);
|
|
//}
|
|
}
|
|
else if (id == 4)
|
|
{
|
|
//13번 숍
|
|
var server_logic = GameServerApp.getServerLogic();
|
|
var cToG_req = new ClientToGame();
|
|
cToG_req.Request = new();
|
|
cToG_req.Request.GetShopProductListReq = new();
|
|
cToG_req.Request.GetShopProductListReq.ShopID = 13;
|
|
await server_logic.onCallProtocolHandler(player, cToG_req);
|
|
|
|
// var cToG_req_renewal = new ClientToGame();
|
|
// cToG_req_renewal.Request = new();
|
|
// cToG_req_renewal.Request.ReqRenewalShopProducts = new();
|
|
//
|
|
//
|
|
// cToG_req_renewal.Request.ReqRenewalShopProducts.ShopID = 13;
|
|
// await server_logic.onCallProtocolHandler(player, cToG_req_renewal);
|
|
|
|
}
|
|
}
|
|
}
|