-
-
Notifications
You must be signed in to change notification settings - Fork 78
feat(family): a character's family is loaded, named, and described #2283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
denislauri1999
wants to merge
9
commits into
NosCoreIO:master
Choose a base branch
from
denislauri1999:pr/family-membership
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
35103a1
feat(family): a character's family is loaded, named, and described
denislauri1999 f54ed82
chore: address review — drop the narrative comments, translate the fa…
denislauri1999 6b1ac77
chore: let the serializer escape the family tag
denislauri1999 55fc7a8
feat(family): the tag over the head, and the curve from the library
denislauri1999 147ecdd
refactor(family): follow the ECS conventions, and read the tag in the…
denislauri1999 3f90f7c
refactor(family): drop the FamilyCharacter game object
denislauri1999 9e14fc8
test(family): pin gidx on the wire, not just on the object
denislauri1999 b678c32
fix(family): the gidx broadcast was in one reader's language
denislauri1999 ee8dc17
chore(family): cut the comments, match master's BOMs
denislauri1999 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -574,4 +574,16 @@ | |
| <data name="UNHANDLED_UPGRADE_TYPE" xml:space="preserve"> | ||
| <value>Tipo di potenziamento non gestito: {0}</value> | ||
| </data> | ||
| <data name="FAMILY_AUTHORITY_HEAD" xml:space="preserve"> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all those are not translated we shouldnt add a value and not translate them |
||
| <value>Capofamiglia</value> | ||
| </data> | ||
| <data name="FAMILY_AUTHORITY_ASSISTANT" xml:space="preserve"> | ||
| <value>Assistente</value> | ||
| </data> | ||
| <data name="FAMILY_AUTHORITY_MANAGER" xml:space="preserve"> | ||
| <value>Gestore</value> | ||
| </data> | ||
| <data name="FAMILY_AUTHORITY_MEMBER" xml:space="preserve"> | ||
| <value>Membro</value> | ||
| </data> | ||
| </root> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| // __ _ __ __ ___ __ ___ ___ | ||
| // | \| |/__\ /' _/ / _//__\| _ \ __| | ||
| // | | ' | \/ |`._`.| \_| \/ | v / _| | ||
| // |_|\__|\__/ |___/ \__/\__/|_|_\___| | ||
| // | ||
|
|
||
| using NosCore.Algorithm.FamilyExperienceService; | ||
| using NosCore.Core.I18N; | ||
| using NosCore.Data.Enumerations.Family; | ||
| using NosCore.Data.Enumerations.I18N; | ||
| using NosCore.Packets.ServerPackets.Families; | ||
| using NosCore.Shared.Enumerations; | ||
| using System.Linq; | ||
|
|
||
| namespace NosCore.GameObject.Ecs.Extensions; | ||
|
|
||
| public static class FamilyExtensions | ||
| { | ||
| /// <summary> | ||
| /// The family tag over a character's head, in the reader's language. | ||
| /// gidx 1 521919 5083 [NDM](Gardien) 3 | ||
| /// gidx 1 741328 -1 - 0 | ||
| /// </summary> | ||
| public static GidxPacket GenerateGidx(this PlayerComponentBundle player, | ||
| IGameLanguageLocalizer localizer, RegionType viewerLanguage) | ||
| { | ||
| var family = player.Family; | ||
| if (family == null) | ||
| { | ||
| return new GidxPacket | ||
| { | ||
| VisualType = VisualType.Player, | ||
| VisualId = player.VisualId, | ||
| FamilyId = null, | ||
| FamilyName = null, | ||
| FamilyLevel = 0 | ||
| }; | ||
| } | ||
|
|
||
| return new GidxPacket | ||
| { | ||
| VisualType = VisualType.Player, | ||
| VisualId = player.VisualId, | ||
| FamilyId = family.FamilyId, | ||
| FamilyName = FamilyTag(family, player.CharacterId, localizer, viewerLanguage), | ||
| FamilyLevel = family.FamilyLevel | ||
| }; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// The family window, field by field from a capture: | ||
| /// ginfo -Nemesis- Yzigor 0 7 130000 640000 68 70 3 1 1 1 1 2 1 2 coin^afk^go^rush | ||
| /// </summary> | ||
| public static GInfoPacket? GenerateGInfo(this PlayerComponentBundle player, | ||
| IFamilyExperienceService familyExperienceService) | ||
| { | ||
| var family = player.Family; | ||
| if (family == null) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| return new GInfoPacket | ||
| { | ||
| FamilyName = family.Name, | ||
| CharacterName = family.HeadCharacterName, | ||
| FamilyHeadGenderType = family.FamilyHeadGender, | ||
| FamilyLevel = family.FamilyLevel, | ||
| FamilyXp = family.FamilyExperience, | ||
| MaxFamilyXp = familyExperienceService.GetFamilyExperience(family.FamilyLevel), | ||
| MembersCount = (ushort)family.Members.Count, | ||
| MembersCapacity = family.MaxSize, | ||
| CharacterFamilyAuthority = (Packets.Enumerations.FamilyAuthority)family.AuthorityOf(player.CharacterId), | ||
| FamilyManagerCanInvit = family.ManagerCanInvite, | ||
| FamilyManagerCanNotice = family.ManagerCanNotice, | ||
| FamilyManagerCanShout = family.ManagerCanShout, | ||
| FamilyManagerCanGetHistory = family.ManagerCanGetHistory, | ||
| FamilyManagerAuthorityType = family.ManagerAuthorityType, | ||
| FamilyMemberCanGetHistory = family.MemberCanGetHistory, | ||
| FamilyMemberAuthorityType = family.MemberAuthorityType, | ||
| FamilyMessage = family.FamilyMessage | ||
| }; | ||
| } | ||
|
|
||
| /// <summary>"Name(Rank)", e.g. [NDM](Gardien) - the brackets belong to the name.</summary> | ||
| private static string FamilyTag(Services.FamilyService.Family family, long characterId, | ||
| IGameLanguageLocalizer localizer, RegionType viewerLanguage) | ||
| { | ||
| var rank = family.AuthorityOf(characterId) switch | ||
| { | ||
| FamilyAuthority.Head => LanguageKey.FAMILY_AUTHORITY_HEAD, | ||
| FamilyAuthority.Assistant => LanguageKey.FAMILY_AUTHORITY_ASSISTANT, | ||
| FamilyAuthority.Manager => LanguageKey.FAMILY_AUTHORITY_MANAGER, | ||
| _ => LanguageKey.FAMILY_AUTHORITY_MEMBER | ||
| }; | ||
|
|
||
| return $"{family.Name}({localizer[rank, viewerLanguage]})"; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // __ _ __ __ ___ __ ___ ___ | ||
| // | \| |/__\ /' _/ / _//__\| _ \ __| | ||
| // | | ' | \/ |`._`.| \_| \/ | v / _| | ||
| // |_|\__|\__/ |___/ \__/\__/|_|_\___| | ||
| // | ||
|
|
||
| using NosCore.Data.Dto; | ||
| using NosCore.Data.Enumerations.Family; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
|
|
||
| namespace NosCore.GameObject.Services.FamilyService | ||
| { | ||
| public class Family : FamilyDto | ||
| { | ||
| public IReadOnlyList<FamilyCharacterDto> Members { get; set; } = []; | ||
|
|
||
| /// <summary>The head's name, kept here because the head is usually offline.</summary> | ||
| public string HeadCharacterName { get; set; } = string.Empty; | ||
|
|
||
| /// <summary>Not in the member list means Member: the packet cannot say "none".</summary> | ||
| public FamilyAuthority AuthorityOf(long characterId) => | ||
| Members.FirstOrDefault(s => s.CharacterId == characterId)?.Authority | ||
| ?? FamilyAuthority.Member; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.