Skip to content

Commit

Permalink
Welcome fixes
Browse files Browse the repository at this point in the history
- Capitalize player names
- Ignore overwriting main character class ID
- Ensure other players are added to map state repository
  • Loading branch information
ethanmoffat committed May 31, 2024
1 parent 3b2bbf3 commit 341cad2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion EOLib/Domain/Character/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static Character FromNearby(CharacterMapInfo characterMapInfo)
{
return new Builder
{
Name = characterMapInfo.Name,
Name = char.ToUpper(characterMapInfo.Name[0]) + characterMapInfo.Name.Substring(1),
ID = characterMapInfo.PlayerId,
ClassID = characterMapInfo.ClassId,
MapID = characterMapInfo.MapId,
Expand Down
13 changes: 8 additions & 5 deletions EOLib/Domain/Login/LoginActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public async Task<int> RequestCharacterLogin(Character.Character character)

_characterRepository.MainCharacter = character
.WithID(data.CharacterId)
.WithName(data.Name)
.WithName(char.ToUpper(data.Name[0]) + data.Name.Substring(1))
.WithTitle(data.Title)
.WithGuildName(data.GuildName)
.WithGuildRank(data.GuildRankName)
Expand All @@ -111,7 +111,7 @@ public async Task<int> RequestCharacterLogin(Character.Character character)
_currentMapStateRepository.JailMapID = data.Settings.JailMap;

_paperdollRepository.VisibleCharacterPaperdolls[data.SessionId] = new PaperdollData()
.WithName(data.Name)
.WithName(char.ToUpper(data.Name[0]) + data.Name.Substring(1))
.WithTitle(data.Title)
.WithGuild(data.GuildName)
.WithRank(data.GuildRankName)
Expand Down Expand Up @@ -168,10 +168,11 @@ public async Task<WelcomeCode> CompleteCharacterLogin(int sessionID)

_characterRepository.MainCharacter = _characterRepository.MainCharacter
.WithID(_playerInfoRepository.PlayerID)
.WithName(mainCharacter.Name)
.WithName(char.ToUpper(mainCharacter.Name[0]) + mainCharacter.Name.Substring(1))
.WithMapID(mainCharacter.MapId)
.WithGuildTag(mainCharacter.GuildTag)
.WithClassID(mainCharacter.ClassId)
// classId is sent in the "enter game" data but eoserv hard-codes this to 6 (with no apparent impact on game function for main player)
//.WithClassID(mainCharacter.ClassId)
.WithStats(stats)
.WithRenderProperties(CharacterRenderProperties.FromCharacterMapInfo(mainCharacter));

Expand All @@ -181,7 +182,9 @@ public async Task<WelcomeCode> CompleteCharacterLogin(int sessionID)
_currentMapStateRepository.Characters = new MapEntityCollectionHashSet<Character.Character>(
c => c.ID,
c => new MapCoordinate(c.X, c.Y),
data.Nearby.Characters.Except(new[] { mainCharacter }).Where(x => x.ByteSize >= 42).Select(Character.Character.FromNearby)
data.Nearby.Characters
.Where(x => x.ByteSize >= 42 && x.PlayerId != mainCharacter.PlayerId)
.Select(Character.Character.FromNearby)
);
_currentMapStateRepository.NPCs = new MapEntityCollectionHashSet<NPC.NPC>(
n => n.Index,
Expand Down

0 comments on commit 341cad2

Please sign in to comment.