mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-22 20:04:45 +01:00
Probably handles increased chance in pickup gacha
And fixes command addallmaterials to actually work with ammount argument increased chance needs testing but doesnt seem to break anything
This commit is contained in:
@@ -11,9 +11,9 @@ namespace EpinelPS
|
||||
CharacterExp2 = 3000,
|
||||
FriendshipPoint = 4000,
|
||||
ArenaChip = 5000,
|
||||
CharPremiumTicket = 5100,
|
||||
CharCustomizeTicket = 5200,
|
||||
CharCorporationTicket = 5300,
|
||||
CharPremiumTicket = 5100, //normal cards
|
||||
CharCustomizeTicket = 5200, //spec cards
|
||||
CharCorporationTicket = 5300, //unused
|
||||
ArenaTicket = 6001,
|
||||
_2NdArenaTicket = 6002,
|
||||
InterceptTicket2 = 6003,
|
||||
|
||||
@@ -137,6 +137,7 @@
|
||||
public int piece_id;
|
||||
public string original_rare = "";
|
||||
public string corporation = "";
|
||||
public string corporation_sub_type = "";
|
||||
public int grade_core_id;
|
||||
public int name_code;
|
||||
public int grow_grade;
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace EpinelPS.LobbyServer.Gacha
|
||||
protected override async Task HandleAsync()
|
||||
{
|
||||
var req = await ReadData<ReqExecuteGacha>();
|
||||
var IncreasedChanceCharacterID = req.Tid;
|
||||
|
||||
|
||||
// Count determines whether we select 1 or 10 characters
|
||||
int numberOfPulls = req.Count == 1 ? 1 : 10;
|
||||
@@ -39,7 +41,8 @@ namespace EpinelPS.LobbyServer.Gacha
|
||||
var srCharacters = allCharacterData.Where(c => c.original_rare == "SR").ToList();
|
||||
|
||||
// Separate Pilgrim SSRs and non-Pilgrim SSRs
|
||||
var pilgrimCharacters = allCharacterData.Where(c => c.original_rare == "SSR" && c.corporation == "PILGRIM").ToList();
|
||||
// treat overspec as pilgrim
|
||||
var pilgrimCharacters = allCharacterData.Where(c => (c.original_rare == "SSR" && c.corporation == "PILGRIM") || (c.original_rare == "SSR" && c.corporation_sub_type == "OVERSPEC")).ToList();
|
||||
var ssrCharacters = allCharacterData.Where(c => c.original_rare == "SSR" && c.corporation != "PILGRIM").ToList();
|
||||
|
||||
var selectedCharacters = new List<CharacterRecord>();
|
||||
@@ -55,7 +58,7 @@ namespace EpinelPS.LobbyServer.Gacha
|
||||
// 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 < numberOfPulls; i++)
|
||||
{
|
||||
var character = SelectRandomCharacter(rCharacters, srCharacters, ssrCharacters, pilgrimCharacters, normalPullsExclusionList);
|
||||
var character = SelectRandomCharacter(rCharacters, srCharacters, ssrCharacters, pilgrimCharacters, normalPullsExclusionList, IncreasedChanceCharacterID, allCharacterData);
|
||||
selectedCharacters.Add(character);
|
||||
}
|
||||
}
|
||||
@@ -245,7 +248,7 @@ namespace EpinelPS.LobbyServer.Gacha
|
||||
await WriteDataAsync(response);
|
||||
}
|
||||
|
||||
private static CharacterRecord SelectRandomCharacter(List<CharacterRecord> rCharacters, List<CharacterRecord> srCharacters, List<CharacterRecord> ssrCharacters, List<CharacterRecord> pilgrimCharacters, List<int> exclusionList)
|
||||
private static CharacterRecord SelectRandomCharacter(List<CharacterRecord> rCharacters,List<CharacterRecord> srCharacters,List<CharacterRecord> ssrCharacters,List<CharacterRecord> pilgrimCharacters,List<int> exclusionList,int increasedChanceCharacterID,List<CharacterRecord> allCharacterData)
|
||||
{
|
||||
// Remove excluded characters from each category
|
||||
var availableRCharacters = rCharacters.Where(c => !exclusionList.Contains(c.id)).ToList();
|
||||
@@ -253,7 +256,12 @@ namespace EpinelPS.LobbyServer.Gacha
|
||||
var availableSSRCharacters = ssrCharacters.Where(c => !exclusionList.Contains(c.id)).ToList();
|
||||
var availablePilgrimCharacters = pilgrimCharacters.Where(c => !exclusionList.Contains(c.id)).ToList();
|
||||
|
||||
// Each time we call this method, a new category will be selected for a single character
|
||||
// Find the IncreasedChanceCharacterID in the SSR list
|
||||
var increasedChanceCharacter = availableSSRCharacters.FirstOrDefault(c => c.id == increasedChanceCharacterID);
|
||||
bool isPilgrimOrOverspec = increasedChanceCharacter != null && (increasedChanceCharacter.corporation == "PILGRIM" || increasedChanceCharacter.corporation_sub_type == "OVERSPEC");
|
||||
|
||||
double increasedChance = increasedChanceCharacterID != 1 ? (isPilgrimOrOverspec ? 1.0 : 2.0): 0.0;
|
||||
|
||||
double roll = random.NextDouble() * 100; // Roll from 0 to 100
|
||||
|
||||
if (roll < 53 && availableRCharacters.Count != 0)
|
||||
@@ -271,6 +279,14 @@ namespace EpinelPS.LobbyServer.Gacha
|
||||
// SSR category
|
||||
double ssrRoll = random.NextDouble() * 100;
|
||||
|
||||
if (increasedChanceCharacter != null && ssrRoll < increasedChance)
|
||||
{
|
||||
// Increased Chance SSR
|
||||
return increasedChanceCharacter;
|
||||
}
|
||||
|
||||
ssrRoll -= increasedChance;
|
||||
|
||||
if (ssrRoll < 4.55 && availablePilgrimCharacters.Count != 0)
|
||||
{
|
||||
// PILGRIM SSR
|
||||
@@ -286,5 +302,6 @@ namespace EpinelPS.LobbyServer.Gacha
|
||||
// Fallback to a random R character if somehow no SSR characters are left after exclusion
|
||||
return availableRCharacters.Count != 0 ? availableRCharacters[random.Next(availableRCharacters.Count)] : throw new Exception("cannot find any characters");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -309,7 +309,7 @@ namespace EpinelPS
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (input == "addallmaterials")
|
||||
else if (input.StartsWith("addallmaterials"))
|
||||
{
|
||||
if (selectedUser == 0)
|
||||
{
|
||||
@@ -326,10 +326,10 @@ namespace EpinelPS
|
||||
}
|
||||
else
|
||||
{
|
||||
int amount = 1000000;
|
||||
if (args.Length >= 2)
|
||||
int amount = 1; // Default amount if not provided
|
||||
if (args.Length >= 2 && int.TryParse(args[1], out int parsedAmount))
|
||||
{
|
||||
int.TryParse(args[1], out amount);
|
||||
amount = parsedAmount;
|
||||
}
|
||||
|
||||
foreach (var tableItem in GameData.Instance.itemMaterialTable.Values)
|
||||
@@ -358,6 +358,7 @@ namespace EpinelPS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (input == "finishalltutorials")
|
||||
{
|
||||
if (selectedUser == 0)
|
||||
|
||||
Reference in New Issue
Block a user