mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-15 16:34:40 +01:00
add 1x pull support
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
using EpinelPS.StaticInfo;
|
using EpinelPS.StaticInfo;
|
||||||
using EpinelPS.Utils;
|
using EpinelPS.Utils;
|
||||||
|
|
||||||
|
|
||||||
namespace EpinelPS.LobbyServer.Msgs.Gacha
|
namespace EpinelPS.LobbyServer.Msgs.Gacha
|
||||||
{
|
{
|
||||||
[PacketPath("/gacha/execute")]
|
[PacketPath("/gacha/execute")]
|
||||||
@@ -17,6 +16,10 @@ namespace EpinelPS.LobbyServer.Msgs.Gacha
|
|||||||
protected override async Task HandleAsync()
|
protected override async Task HandleAsync()
|
||||||
{
|
{
|
||||||
var req = await ReadData<ReqExecuteGacha>();
|
var req = await ReadData<ReqExecuteGacha>();
|
||||||
|
|
||||||
|
// Count determines whether we select 1 or 10 characters
|
||||||
|
int numberOfPulls = req.Count == 1 ? 1 : 10;
|
||||||
|
|
||||||
var user = GetUser();
|
var user = GetUser();
|
||||||
var response = new ResExecuteGacha();
|
var response = new ResExecuteGacha();
|
||||||
|
|
||||||
@@ -35,17 +38,17 @@ namespace EpinelPS.LobbyServer.Msgs.Gacha
|
|||||||
// Check if user has 'sickpulls' set to true to use old method
|
// Check if user has 'sickpulls' set to true to use old method
|
||||||
if (user.sickpulls)
|
if (user.sickpulls)
|
||||||
{
|
{
|
||||||
// Old selection method: Randomly select 10 characters without rarity-based selection, excluding characters in the sickPullsExclusionList
|
// Old selection method: Randomly select characters based on req.Count value, excluding characters in the sickPullsExclusionList
|
||||||
selectedCharacters = allCharacterData
|
selectedCharacters = allCharacterData
|
||||||
.Where(c => !sickPullsExclusionList.Contains(c.id)) // Exclude characters based on the exclusion list for sick pulls
|
.Where(c => !sickPullsExclusionList.Contains(c.id)) // Exclude characters based on the exclusion list for sick pulls
|
||||||
.OrderBy(x => random.Next())
|
.OrderBy(x => random.Next())
|
||||||
.Take(10)
|
.Take(numberOfPulls)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// New method: Select 10 characters, with each character having its category determined independently, excluding characters in the normalPullsExclusionList
|
// New method: Select characters based on req.Count value, with each character having its category determined independently, excluding characters in the normalPullsExclusionList
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < numberOfPulls; i++)
|
||||||
{
|
{
|
||||||
var character = SelectRandomCharacter(rCharacters, srCharacters, ssrCharacters, pilgrimCharacters, normalPullsExclusionList);
|
var character = SelectRandomCharacter(rCharacters, srCharacters, ssrCharacters, pilgrimCharacters, normalPullsExclusionList);
|
||||||
selectedCharacters.Add(character);
|
selectedCharacters.Add(character);
|
||||||
|
|||||||
Reference in New Issue
Block a user