mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-12 15:04:36 +01:00
Revert "try to fix duplicate spare body entries"
This reverts commit 6587bb8b71.
This commit is contained in:
@@ -57,58 +57,33 @@ namespace EpinelPS.LobbyServer.Msgs.Gacha
|
||||
|
||||
var pieceIds = new List<Tuple<int, int>>(); // 2D array to store characterId and pieceId as Tuple
|
||||
// Add each character's item to user.Items if the character exists in user.Characters
|
||||
foreach (var characterData in selectedCharacters)
|
||||
{
|
||||
// Check if the item for this character already exists in user.Items based on ItemType
|
||||
var existingItem = user.Items.FirstOrDefault(item => item.ItemType == characterData.piece_id);
|
||||
|
||||
if (existingItem != null)
|
||||
{
|
||||
// If the item exists, increment the count
|
||||
existingItem.Count += 1;
|
||||
|
||||
// Send the updated item in the response
|
||||
response.Items.Add(new NetUserItemData()
|
||||
{
|
||||
Tid = existingItem.ItemType,
|
||||
Csn = existingItem.Csn,
|
||||
Count = existingItem.Count,
|
||||
Level = existingItem.Level,
|
||||
Exp = existingItem.Exp,
|
||||
Position = existingItem.Position,
|
||||
Isn = existingItem.Isn
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the item does not exist, create a new item entry
|
||||
var newItem = new ItemData()
|
||||
{
|
||||
ItemType = characterData.piece_id,
|
||||
Csn = 0,
|
||||
Count = 1, // or any relevant count
|
||||
Level = 0,
|
||||
Exp = 0,
|
||||
Position = 0,
|
||||
Corp = 0,
|
||||
Isn = user.GenerateUniqueItemId()
|
||||
};
|
||||
user.Items.Add(newItem);
|
||||
|
||||
// Add the new item to response
|
||||
response.Items.Add(new NetUserItemData()
|
||||
{
|
||||
Tid = newItem.ItemType,
|
||||
Csn = newItem.Csn,
|
||||
Count = newItem.Count,
|
||||
Level = newItem.Level,
|
||||
Exp = newItem.Exp,
|
||||
Position = newItem.Position,
|
||||
Isn = newItem.Isn
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var characterData in selectedCharacters)
|
||||
{
|
||||
if (user.Characters.Any(c => c.Tid == characterData.id))
|
||||
{
|
||||
user.Items.Add(new ItemData()
|
||||
{
|
||||
ItemType = characterData.piece_id, // Assuming item id corresponds to character id
|
||||
Csn = 0,
|
||||
Count = 1, // or any relevant count
|
||||
Level = 0,
|
||||
Exp = 0,
|
||||
Position = 0,
|
||||
Corp = 0,
|
||||
Isn = user.GenerateUniqueItemId()
|
||||
});
|
||||
response.Items.Add(new NetUserItemData()
|
||||
{
|
||||
Tid = characterData.piece_id, // Assuming item id corresponds to character id
|
||||
Csn = 0,
|
||||
Count = 1, // or any relevant count
|
||||
Level = 0,
|
||||
Exp = 0,
|
||||
Position = 0,
|
||||
Isn = user.GenerateUniqueItemId()
|
||||
});
|
||||
}
|
||||
}
|
||||
// Populate the 2D array with characterId and pieceId for each selected character
|
||||
foreach (var characterData in selectedCharacters)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user