ddon-server/Arrowgene.Ddon.GameServer/Handler/ConnectionReserveServerHandler.cs
Ryan Yappert c8a28972aa
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

62 lines
2.7 KiB
C#

using Arrowgene.Ddon.Database.Model;
using Arrowgene.Ddon.Server;
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
using Arrowgene.Ddon.Shared.Model;
using Arrowgene.Logging;
using System;
namespace Arrowgene.Ddon.GameServer.Handler
{
public class ConnectionReserveServerHandler : GameRequestPacketHandler<C2SConnectionReserveServerReq, S2CConnectionReserveServerRes>
{
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(typeof(ConnectionReserveServerHandler));
public ConnectionReserveServerHandler(DdonGameServer server) : base(server)
{
}
public override S2CConnectionReserveServerRes Handle(GameClient client, C2SConnectionReserveServerReq request)
{
Connection reservedConnection = new Connection()
{
ServerId = request.GameServerUniqueID,
AccountId = client.Account.Id,
Type = ConnectionType.GameServer,
Created = DateTime.UtcNow,
CharacterId = client.Character?.CharacterId,
};
if (!Server.RpcManager.DoesGameServerExist(request.GameServerUniqueID))
{
throw new ResponseErrorException(ErrorCode.ERROR_CODE_NET_NOT_CONNECT_GAME_SERVER,
$"The requested server {request.GameServerUniqueID} does not exist.");
}
if (!Server.RpcManager.PingServer(request.GameServerUniqueID))
{
throw new ResponseErrorException(ErrorCode.ERROR_CODE_NET_NOT_CONNECT_GAME_SERVER,
$"The requested server {request.GameServerUniqueID} did not respond when pinged.");
}
var targetServerInfo = Server.RpcManager.ServerListInfo(request.GameServerUniqueID);
if (targetServerInfo.LoginNum >= targetServerInfo.MaxLoginNum)
{
throw new ResponseErrorException(ErrorCode.ERROR_CODE_LOBBY_JOIN_NUM_OVER,
$"Attempting to join server {request.GameServerUniqueID} that is over capacity ({targetServerInfo.LoginNum}/{targetServerInfo.MaxLoginNum})");
}
if (!Server.Database.InsertConnection(reservedConnection))
{
throw new ResponseErrorException(ErrorCode.ERROR_CODE_NET_NOT_CONNECT_GAME_SERVER,
$"Failed to reserve connection on server {request.GameServerUniqueID} for account {client.Account.Id}");
}
return new S2CConnectionReserveServerRes()
{
GameServerUniqueID = request.GameServerUniqueID,
ReserveInfoList = request.ReserveInfoList
};
}
}
}