Skip to content

Commit 7acd4fa

Browse files
committed
Additional guard for giving partner pawns presents when they wouldn't benefit from it.
1 parent 43007cb commit 7acd4fa

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

Arrowgene.Ddon.GameServer/Handler/PartnerPawnPresentForPartnerPawnHandler.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
using Arrowgene.Ddon.Database.Model;
12
using Arrowgene.Ddon.GameServer.Characters;
23
using Arrowgene.Ddon.Server;
34
using Arrowgene.Ddon.Server.Network;
45
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
56
using Arrowgene.Ddon.Shared.Entity.Structure;
67
using Arrowgene.Ddon.Shared.Model;
78
using Arrowgene.Logging;
9+
using System;
810
using System.Collections.Generic;
911
using System.Xml.Linq;
1012

@@ -24,8 +26,14 @@ public override PacketQueue Handle(GameClient client, C2SPartnerPawnPresentForPa
2426
var packets = new PacketQueue();
2527

2628
List<CDataItemUpdateResult> itemUpdateResults = new List<CDataItemUpdateResult>();
29+
2730
Server.Database.ExecuteInTransaction(connection =>
2831
{
32+
if (Server.Database.HasPartnerPawnLastAffectionIncreaseRecord(client.Character.CharacterId, client.Character.PartnerPawnId, PartnerPawnAffectionAction.Gift, connection))
33+
{
34+
throw new ResponseErrorException(ErrorCode.ERROR_CODE_PAWN_ALREADY_GIFTED);
35+
}
36+
2937
foreach (var item in request.ItemUIDList)
3038
{
3139
uint itemId = client.Character.Storage.FindItemByUIdInStorage(ItemManager.AllItemStorages, item.ItemUID)?.Item2.Item2.ItemId

Arrowgene.Ddon.Shared/Files/Assets/ClientErrorCodes.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,9 @@
138138
{
139139
"code": "ERROR_CODE_BLACK_LIST_TARGET_INVALID",
140140
"en": "The target could not be added to your blacklist; either they are already on it, or they are a Game Master or Moderator."
141+
},
142+
{
143+
"code": "ERROR_CODE_PAWN_ALREADY_GIFTED",
144+
"en": "Your pawn politely refuses additional gifts until tomorrow."
141145
}
142146
]

Arrowgene.Ddon.Shared/Model/ErrorCode.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ public enum ErrorCode : uint
161161
ERROR_CODE_PAWN_FAVORITE_SERACH_NOT_SUPPORTED = 0x2B12,
162162
ERROR_CODE_PAWN_CANNOT_REVIVE = 0x2B13,
163163
ERROR_CODE_PAWN_CANNOT_DELETE_PARTNER = 0x2B14,
164+
ERROR_CODE_PAWN_ALREADY_GIFTED = 0x2B15,
164165
ERROR_CODE_QUEST_INTERNAL_ERROR = 0x2EE0,
165166
ERROR_CODE_QUEST_ALREADY_ORDER = 0x2EE1,
166167
ERROR_CODE_QUEST_NOT_ORDER = 0x2EE2,

0 commit comments

Comments
 (0)