mirror of
https://github.com/sebastian-heinz/Arrowgene.DragonsDogmaOnline
synced 2026-08-03 11:12:41 -04:00
Fix double pawn lost announcement; adjust lost pawn wallet revive handler to be a bit more secure against failure. Additional logging for investigating connection counts. Fix exception thrown when shutting down the server. Prevent Quick Chats from spamming globally; they default to party, plus other nearby players if you're in a hub area. Refactor server list so that it hotloads properly and can handle downed servers without breaking. Fix party state mangling associated with invitations failing due to timeout, rejection, and cancellation. Deprecate naive lobby handling and remove the associated setting. Add catch and logging for missing job info for CharacterCommon. Adjust ClientItemInfo.SubCategory to more cleanly handle items without a subtype. More logging for failures to find pawns by pawnId or slot index.
52 lines
2.2 KiB
C#
52 lines
2.2 KiB
C#
#nullable enable
|
|
using Arrowgene.Ddon.Server;
|
|
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
|
|
using Arrowgene.Ddon.Shared.Entity.Structure;
|
|
using Arrowgene.Ddon.Shared.Model;
|
|
using Arrowgene.Ddon.Shared.Network;
|
|
using Arrowgene.Logging;
|
|
|
|
namespace Arrowgene.Ddon.GameServer.Handler
|
|
{
|
|
public class CraftResetCraftpointHandler : GameRequestPacketHandler<C2SCraftResetCraftpointReq, S2CCraftResetCraftpointRes>
|
|
{
|
|
private static readonly ServerLogger Logger = LogProvider.Logger<ServerLogger>(typeof(CraftResetCraftpointHandler));
|
|
|
|
public CraftResetCraftpointHandler(DdonGameServer server) : base(server)
|
|
{
|
|
}
|
|
|
|
public override S2CCraftResetCraftpointRes Handle(GameClient client, C2SCraftResetCraftpointReq request)
|
|
{
|
|
S2CCraftResetCraftpointRes craftResetCraftpointRes = new S2CCraftResetCraftpointRes
|
|
{
|
|
PawnID = request.PawnID
|
|
};
|
|
|
|
Pawn pawn = client.Character.Pawns.Find(p => p.PawnId == request.PawnID)
|
|
?? throw new ResponseErrorException(ErrorCode.ERROR_CODE_PAWN_NOT_FOUNDED,
|
|
$"Couldn't find pawn ID {request.PawnID}.");
|
|
pawn.CraftData.CraftPoint = pawn.CraftData.CraftRank - 1;
|
|
foreach (CDataPawnCraftSkill skill in pawn.CraftData.PawnCraftSkillList)
|
|
{
|
|
skill.Level = 0;
|
|
}
|
|
|
|
craftResetCraftpointRes.CraftPoint = pawn.CraftData.CraftPoint;
|
|
craftResetCraftpointRes.CraftSkillList = pawn.CraftData.PawnCraftSkillList;
|
|
Server.Database.UpdatePawnBaseInfo(pawn);
|
|
|
|
var updateWalletPoint = Server.WalletManager.RemoveFromWallet(
|
|
client.Character,
|
|
WalletType.ResetCraftSkills,
|
|
1
|
|
) ?? throw new ResponseErrorException(ErrorCode.ERROR_CODE_CRAFT_SKILL_RESET_ZERO_POINT);
|
|
|
|
S2CItemUpdateCharacterItemNtc itemUpdateNtc = new S2CItemUpdateCharacterItemNtc();
|
|
itemUpdateNtc.UpdateType = ItemNoticeType.ResetCraftpoint;
|
|
itemUpdateNtc.UpdateWalletList.Add(updateWalletPoint);
|
|
client.Send(itemUpdateNtc);
|
|
return craftResetCraftpointRes;
|
|
}
|
|
}
|
|
}
|