Skip to content

Commit 9f4cb8f

Browse files
committed
Implement MainPawnLostRate, interpreted as a % chance to avoid losing a pawn to the void. At the current values in the tree, this is 41% at max rate.
1 parent f90837d commit 9f4cb8f

3 files changed

Lines changed: 10 additions & 25 deletions

File tree

Arrowgene.Ddon.GameServer/Characters/OrbUnlockManager.cs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,10 @@ private PacketQueue UpdateExtendedParamData(GameClient client, CharacterCommon c
123123
obj.MainPawnSlot += (ushort)upgrade.Amount;
124124
// When the player unlocks this, the total number will be increased to 3.
125125
client.Character.MyPawnSlotNum += (byte)upgrade.Amount;
126-
_Server.Database.UpdateMyPawnSlot(client.Character.CharacterId, client.Character.MyPawnSlotNum, connectionIn);
127126
break;
128127
case OrbGainParamType.SupportPawnSlot:
129128
obj.SupportPawnSlot += (ushort)upgrade.Amount;
130129
client.Character.RentalPawnSlotNum += (byte)upgrade.Amount;
131-
_Server.Database.UpdateRentalPawnSlot(client.Character.CharacterId, client.Character.RentalPawnSlotNum, connectionIn);
132130
break;
133131
case OrbGainParamType.UseItemSlot:
134132
obj.UseItemSlot += (ushort)upgrade.Amount;
@@ -145,6 +143,7 @@ private PacketQueue UpdateExtendedParamData(GameClient client, CharacterCommon c
145143
case OrbGainParamType.PawnCraftNum:
146144
// TODO: OrbGainParamType.MainPawnLostRate
147145
case OrbGainParamType.MainPawnLostRate:
146+
obj.MainPawnLostRate += (ushort)upgrade.Amount;
148147
break;
149148
case OrbGainParamType.SecretAbility:
150149
queue.Enqueue(client, _Server.JobManager.UnlockSecretAbility(client, character, upgrade.SecretAbility, connectionIn));
@@ -303,20 +302,6 @@ public PacketQueue UnlockDragonForceAugmentationUpgrade(GameClient client, Chara
303302

304303
DragonForceUpgrade upgrade = common is Character arisen ? GetPlayerUpgrade(elementId) : GetPawnUpgrade(elementId);
305304

306-
if (character is Character)
307-
{
308-
upgrade = GetPlayerUpgrade(client, (Character)character, elementId);
309-
}
310-
else
311-
{
312-
upgrade = GetPawnUpgrade(client, (Pawn)character, elementId);
313-
}
314-
315-
if (upgrade == null)
316-
{
317-
throw new ResponseErrorException(ErrorCode.ERROR_CODE_ORB_DEVOTE_INVALID_ELEMENT_ID);
318-
}
319-
320305
// Check for Valid Conditions before continuing
321306
if (upgrade.IsRestrictedByTotalLevels())
322307
{
@@ -515,12 +500,6 @@ private Category GroupNo2Category(GroupNo GroupNo)
515500
GroupNo.Group5 => Category.Other,
516501
_ => Category.None,
517502
};
518-
return Category.Combat;
519-
case GroupNo.Group5:
520-
return Category.Other;
521-
}
522-
523-
return Category.None;
524503
}
525504
}
526505

Arrowgene.Ddon.GameServer/Handler/PawnPawnLostHandler.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Arrowgene.Ddon.Shared.Entity.PacketStructure;
44
using Arrowgene.Ddon.Shared.Model;
55
using Arrowgene.Logging;
6+
using System;
67

78
namespace Arrowgene.Ddon.GameServer.Handler
89
{
@@ -20,18 +21,20 @@ public override PacketQueue Handle(GameClient client, C2SPawnPawnLostReq request
2021

2122
Pawn pawn = client.Character.PawnById(request.PawnId, PawnType.Main);
2223

24+
bool isLost = Random.Shared.NextDouble() > (client.Character.ExtendedParams.MainPawnLostRate / 100.0);
25+
2326
client.Enqueue(new S2CPawnPawnLostRes()
2427
{
2528
PawnId = pawn.PawnId,
2629
PawnName = pawn.Name,
27-
IsLost = true
30+
IsLost = isLost
2831
}, queue);
2932

3033
S2CPawnPawnLostNtc ntc = new S2CPawnPawnLostNtc()
3134
{
3235
PawnId = pawn.PawnId,
3336
PawnName = pawn.Name,
34-
IsLost = true
37+
IsLost = isLost
3538
};
3639
client.Party.EnqueueToAllExcept(ntc, queue, client);
3740

@@ -48,7 +51,7 @@ public override PacketQueue Handle(GameClient client, C2SPawnPawnLostReq request
4851
}, queue);
4952
}
5053

51-
pawn.PawnState = PawnState.Lost;
54+
pawn.PawnState = isLost ? PawnState.Lost : PawnState.None;
5255
Server.Database.UpdatePawnBaseInfo(pawn);
5356

5457
return queue;

Arrowgene.Ddon.Shared/Entity/Structure/CDataOrbGainExtendParam.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public class CDataOrbGainExtendParam
1818
public ushort MainPawnSlot { get; set; }
1919
public ushort SupportPawnSlot { get; set; }
2020

21+
// Not serialized but stored here for convenience.
22+
public ushort MainPawnLostRate { get; set; }
23+
2124
public static CDataOrbGainExtendParam operator +(CDataOrbGainExtendParam a, CDataOrbGainExtendParam b)
2225
{
2326
return new CDataOrbGainExtendParam()

0 commit comments

Comments
 (0)