ddon-server/Arrowgene.Ddon.GameServer/Handler/ConnectionMoveInServerHandler.cs

79 lines
2.8 KiB
C#
Raw Permalink Normal View History

using Arrowgene.Ddon.Database.Model;
2022-01-18 11:04:07 +08:00
using Arrowgene.Ddon.Server;
2022-01-18 15:28:26 +08:00
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
using Arrowgene.Ddon.Shared.Model;
2022-01-10 15:47:42 +08:00
using Arrowgene.Logging;
using System;
2022-01-10 15:47:42 +08:00
namespace Arrowgene.Ddon.GameServer.Handler
{
public class ConnectionMoveInServerHandler : GameRequestPacketHandler<C2SConnectionMoveInServerReq, S2CConnectionMoveInServerRes>
2022-01-10 15:47:42 +08:00
{
2022-01-18 11:04:07 +08:00
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(typeof(ConnectionMoveInServerHandler));
2022-01-10 15:47:42 +08:00
public ConnectionMoveInServerHandler(DdonGameServer server) : base(server)
{
}
public override S2CConnectionMoveInServerRes Handle(GameClient client, C2SConnectionMoveInServerReq request)
2022-01-10 15:47:42 +08:00
{
Logger.Debug(client, $"Received SessionKey:{request.SessionKey}");
GameToken token = Database.SelectToken(request.SessionKey);
2022-01-18 15:28:26 +08:00
if (token == null)
{
Logger.Error(client, $"SessionKey:{request.SessionKey} not found");
2022-01-18 15:28:26 +08:00
// TODO reply error
// return;
}
Database.DeleteTokenByAccountId(token.AccountId);
Account account = Database.SelectAccountById(token.AccountId);
if (account == null)
{
Logger.Error(client, $"AccountId:{token.AccountId} not found");
throw new ResponseErrorException(ErrorCode.ERROR_CODE_FAIL);
2022-01-18 15:28:26 +08:00
}
client.Account = account;
2022-01-18 15:28:26 +08:00
Fix: General Bugfixes, April 2026 (#1031) * Fix bug where appraising certain items in BBM while you had a copy of that item in your regular character's storage chest would throw an error. Fix bugs where SQLite would occasionally have a DB lock conflict due to poor connection management. * Be more aggressive when clearing out invalid priority quests. * Fix bug where the Beauty Shop would sometimes complain about PRICE_NO_MATCH when trying to pay with Silver Tickets. * Fix bugs where pawn search wouldn't display craft levels, and didn't support filtering by craft level. * Migrate 58 > 59. Store character_id in the connections table so we can use it for player tracking. Adjust player tracking to be driven by the DB. * Fix bugs where bazaar processes could sometimes delete items if the storage was full. * Add feature where you can sell special items (like PP crystals) to consume them, instead of having to spam use them. * Fix bug where deleting pawns would badly mangle the equipment entries of other pawns owned by the same character. * Add support for LightQuestRepeatsPerDay, limiting the number of times a board quest can be offered to a single player per day. * Research for EquipStatId. * Maybe fix bug where base game augments were secretly applying even in BBM? Maybe fix bug where certain alt-pallet skills wouldn't work in multiplayer due to missing context information. * Update database migration version. * Automatically promote localhost players to admin when running in debug mode. Adjust /finishquesttype to clear progress when finishing quests. * Fix bug where hired pawns wearing job emblems weren't benefiting from the stats on them. Hired pawns now reflect the hiring character's job emblems entirely.
2026-04-30 21:28:52 -07:00
#if DEBUG
if (client.Identity.Contains("127.0.0.1"))
{
client.Account.State = AccountStateType.GameMaster;
}
#endif
Character character = Server.CharacterManager.SelectCharacter(client, token.CharacterId);
2022-01-18 15:28:26 +08:00
if (character == null)
{
Logger.Error(client, $"CharacterId:{token.CharacterId} not found");
throw new ResponseErrorException(ErrorCode.ERROR_CODE_CHARACTER_DATA_INVALID_CHARACTER_ID);
}
2022-01-18 15:28:26 +08:00
Logger.Info(client, "Moved Into GameServer");
2022-01-13 13:21:04 +08:00
// NTC
2022-03-05 23:17:11 +01:00
client.Send(new S2CItemExtendItemSlotNtc());
2022-01-18 15:28:26 +08:00
// client.Send(GameFull.Dump_5);
// client.Send(GameFull.Dump_6);
2022-01-13 13:21:04 +08:00
ulong now = (ulong)DateTimeOffset.UtcNow.ToUnixTimeSeconds();
foreach (var (id, course) in Server.AssetRepository.GPCourseInfoAsset.ValidCourses)
{
if (now >= course.StartTime && now <= course.EndTime)
{
S2CGPCourseExtendNtc courseExtendNtc = new S2CGPCourseExtendNtc()
{
CourseID = course.Id,
ExpiryTimestamp = course.EndTime
};
client.Send(courseExtendNtc);
}
}
return new S2CConnectionMoveInServerRes();
2022-01-10 15:47:42 +08:00
}
}
}