forked from PGR/ascnet
1
0
Fork 0

moar example and drop lil change

This commit is contained in:
rfi 2023-12-07 07:49:17 +07:00
parent d6511d1088
commit 85f22630f9
2 changed files with 37 additions and 8 deletions

View File

@ -134,7 +134,35 @@ namespace AscNet.GameServer.Handlers.Drops
TemplateId = equip.Id,
Count = 1,
Level = 1,
Quality = equip.Quality
Quality = equip.Quality,
Type = RewardType.Equip
});
NotifyEquipDataList notifyEquipData = new();
notifyEquipData.EquipDataList.Add(session.character.AddEquip((uint)equip.Id));
session.SendPush(notifyEquipData);
}
return rets;
}
// 2★ Memory Drop
[DropHandler(TwoStarMemoryDrop)]
public static IEnumerable<DropHandlerRet> TwoStarMemoryDropHandler(Session session, int count)
{
List<DropHandlerRet> rets = new();
EquipTable[] memoryPool = TableReaderV2.Parse<EquipTable>().Where(x => x.Type == 0 && x.Quality == 2).ToArray();
if (GetProgressiveChance((int)session.player.PlayerData.Level, 2))
{
EquipTable equip = memoryPool[Random.Shared.Next(0, memoryPool.Length)];
rets.Add(new()
{
TemplateId = equip.Id,
Count = 1,
Level = 1,
Quality = equip.Quality,
Type = RewardType.Equip
});
NotifyEquipDataList notifyEquipData = new();
@ -211,9 +239,10 @@ namespace AscNet.GameServer.Handlers.Drops
public struct DropHandlerRet
{
public int TemplateId;
public int Count;
public int Level;
public int Quality;
public int TemplateId { get; set; }
public int Count { get; set;}
public int Level { get; set;}
public int Quality { get; set;}
public RewardType Type { get; set;}
}
}

View File

@ -12,7 +12,7 @@ namespace AscNet.GameServer.Handlers
{
#region MsgPackScheme
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
enum RewardType
public enum RewardType
{
Item = 1,
Character = 2,
@ -270,7 +270,7 @@ namespace AscNet.GameServer.Handlers
TemplateId = x.TemplateId,
Count = x.Count,
Level = x.Level,
RewardType = (int)MathF.Floor(x.TemplateId / 1000000) + 1,
RewardType = (int)x.Type,
Quality = x.Quality
}));
continue;
@ -340,7 +340,7 @@ namespace AscNet.GameServer.Handlers
RewardGoodsList = rewards,
MultiRewardGoodsList = { rewards },
NpcHpInfo = req.Result.NpcHpInfo,
ChallengeCount = req.Result.RebootCount
ChallengeCount = 1
}
};