Hopefully fix HasCharacter + show char in profile

This commit is contained in:
SELEKCJONER
2024-09-26 16:08:23 +02:00
parent 899a56eac5
commit 3c2080f393
2 changed files with 19 additions and 4 deletions

View File

@@ -293,10 +293,24 @@ namespace EpinelPS.Database
} }
} }
public bool HasCharacter(int c) public bool HasCharacter(int c)
{ {
return Characters.Any(x => c <= x.Tid && x.Tid <= c + 12); // Step 1: Get the 'name_code' of the input character with Tid 'c'
} if (GameData.Instance.characterTable.TryGetValue(c, out var inputCharacterRecord))
{
int targetNameCode = inputCharacterRecord.name_code;
// Step 2: Find all character IDs in 'characterTable' that have the same 'name_code'
var matchingCharacterIds = GameData.Instance.characterTable.Where(kvp => kvp.Value.name_code == targetNameCode).Select(kvp => kvp.Key).ToHashSet();
// Step 3: Check if any of your owned characters have a 'Tid' in the set of matching IDs
return Characters.Any(ownedCharacter => matchingCharacterIds.Contains(ownedCharacter.Tid));
}
else
// The character with Tid 'c' does not exist in 'characterTable'
return false;
}
}
public Character? GetCharacterBySerialNumber(long value) public Character? GetCharacterBySerialNumber(long value)
{ {

View File

@@ -12,6 +12,7 @@ namespace EpinelPS.LobbyServer.Msgs.User
var r = new ResProfileCardDecorationLayout(); var r = new ResProfileCardDecorationLayout();
r.Layout = new ProfileCardDecorationLayout(); r.Layout = new ProfileCardDecorationLayout();
r.Layout.BackgroundId = 101002; r.Layout.BackgroundId = 101002;
r.Layout.ShowCharacterSpine = true;
await WriteDataAsync(r); await WriteDataAsync(r);
} }
} }