-
-
Notifications
You must be signed in to change notification settings - Fork 78
The Adventurer's skill list, and the rows a class change leaves behind #2302
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
Merged
erwan-joly
merged 3 commits into
NosCoreIO:master
from
denislauri1999:pr/class-skill-list
Aug 26, 2026
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
08740a6
fix(skills): the Adventurer's list, and the rows a class change left …
denislauri1999 bd526ca
fix(skills): the class change also fixes the rows, not only the next …
denislauri1999 6d4ce37
fix(skills): 209 is the Adventurer's Capture, and the job level is pa…
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
131 changes: 131 additions & 0 deletions
131
test/NosCore.GameObject.Tests/Services/SkillService/ClassSkillLearningTests.cs
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,131 @@ | ||
| // __ _ __ __ ___ __ ___ ___ | ||
| // | \| |/__\ /' _/ / _//__\| _ \ __| | ||
| // | | ' | \/ |`._`.| \_| \/ | v / _| | ||
| // |_|\__|\__/ |___/ \__/\__/|_|_\___| | ||
| // | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
| using Moq; | ||
| using NosCore.Dao.Interfaces; | ||
| using NosCore.Data.Dto; | ||
| using NosCore.Data.StaticEntities; | ||
| using NosCore.GameObject.Networking.ClientSession; | ||
| using NosCore.Shared.Enumerations; | ||
| using NosCore.Tests.Shared; | ||
|
|
||
| namespace NosCore.GameObject.Tests.Services.SkillService | ||
| { | ||
| // This table's trap: **class 0 does not mean "Adventurer"**. It is the scrap | ||
| // container where 193 entries end up - passives, monster skills, things with no cost and no cast. | ||
| // | ||
| // Filtering by class as is done for the other jobs, an Adventurer got all of them: | ||
| // the bar filled with icons the client will not cast. Trying it with the client in hand the | ||
| // symptom was "the skills arrive but do not work", and it was exactly this. | ||
| [TestClass] | ||
| public class ClassSkillLearningTests | ||
| { | ||
| private NosCore.GameObject.Services.SkillService.SkillService _service = null!; | ||
| private ClientSession _session = null!; | ||
|
|
||
| private static readonly List<SkillDto> Catalog = new() | ||
| { | ||
| // the Adventurer's real skills, listed one by one from the original game | ||
| new SkillDto { SkillVNum = 200, Class = 0, LevelMinimum = 0, CastId = 0 }, | ||
| new SkillDto { SkillVNum = 201, Class = 0, LevelMinimum = 0, CastId = 1 }, | ||
| new SkillDto { SkillVNum = 208, Class = 0, LevelMinimum = 0, CastId = 8 }, | ||
| new SkillDto { SkillVNum = 210, Class = 0, LevelMinimum = 0, CastId = 10 }, | ||
| // 209 does NOT exist as an Adventurer skill | ||
| new SkillDto { SkillVNum = 209, Class = 0, LevelMinimum = 0, CastId = 9 }, | ||
| // scrap: the same class 0, but they are passives and monster skills | ||
| new SkillDto { SkillVNum = 1, Class = 0, LevelMinimum = 0, CastId = 4, SkillType = 3 }, | ||
| new SkillDto { SkillVNum = 17, Class = 0, LevelMinimum = 0, CastId = 0, SkillType = 3 }, | ||
| new SkillDto { SkillVNum = 999, Class = 0, LevelMinimum = 0, CastId = 4, SkillType = 3 }, | ||
| // a real job's skill | ||
| new SkillDto { SkillVNum = 220, Class = 1, LevelMinimum = 0, CastId = 0 }, | ||
| new SkillDto { SkillVNum = 221, Class = 1, LevelMinimum = 5, CastId = 1 }, | ||
| new SkillDto { SkillVNum = 222, Class = 1, LevelMinimum = 50, CastId = 2 }, | ||
| }; | ||
|
|
||
| [TestInitialize] | ||
| public async Task SetupAsync() | ||
| { | ||
| await TestHelpers.ResetAsync(); | ||
| _session = await TestHelpers.Instance.GenerateSessionAsync(); | ||
| _service = new NosCore.GameObject.Services.SkillService.SkillService( | ||
| new Mock<IDao<CharacterSkillDto, Guid>>().Object, Catalog); | ||
| } | ||
|
|
||
| [TestMethod] | ||
| public async Task AdventurerGetsOnlyItsOwnSkills() | ||
| { | ||
| _session.Character.Class = CharacterClassType.Adventurer; | ||
| _session.Character.JobLevel = 20; | ||
|
|
||
| await _service.LearnClassSkillsAsync(_session.Character); | ||
|
|
||
| var learned = _session.Character.Skills.Keys.ToList(); | ||
| CollectionAssert.Contains(learned, (short)200); | ||
| CollectionAssert.Contains(learned, (short)210); | ||
| } | ||
|
|
||
| [TestMethod] | ||
| public async Task AdventurerDoesNotGetTheJunkBucket() | ||
| { | ||
| // It is the heart of the defect: 193 scrap entries share class 0. | ||
| _session.Character.Class = CharacterClassType.Adventurer; | ||
| _session.Character.JobLevel = 20; | ||
|
|
||
| await _service.LearnClassSkillsAsync(_session.Character); | ||
|
|
||
| var learned = _session.Character.Skills.Keys.ToList(); | ||
| CollectionAssert.DoesNotContain(learned, (short)1); | ||
| CollectionAssert.DoesNotContain(learned, (short)17); | ||
| CollectionAssert.DoesNotContain(learned, (short)999); | ||
| } | ||
|
|
||
| [TestMethod] | ||
| public async Task TwoHundredAndNineIsNotAnAdventurerSkill() | ||
| { | ||
| // A hole in the numbering that the original game skips explicitly. The | ||
| // test character had it, because the class filter did not exclude it. | ||
| _session.Character.Class = CharacterClassType.Adventurer; | ||
| _session.Character.JobLevel = 20; | ||
|
|
||
| await _service.LearnClassSkillsAsync(_session.Character); | ||
|
|
||
| CollectionAssert.DoesNotContain(_session.Character.Skills.Keys.ToList(), (short)209); | ||
| } | ||
|
|
||
| [TestMethod] | ||
| public async Task OtherClassesStillFilterByClass() | ||
| { | ||
| _session.Character.Class = CharacterClassType.Swordsman; | ||
| _session.Character.JobLevel = 10; | ||
|
|
||
| await _service.LearnClassSkillsAsync(_session.Character); | ||
|
|
||
| var learned = _session.Character.Skills.Keys.ToList(); | ||
| CollectionAssert.Contains(learned, (short)220); | ||
| CollectionAssert.Contains(learned, (short)221); | ||
| CollectionAssert.DoesNotContain(learned, (short)222); // oltre il livello di lavoro | ||
| CollectionAssert.DoesNotContain(learned, (short)200); // e niente roba di classe 0 | ||
| } | ||
|
|
||
| [TestMethod] | ||
| public async Task LearningTwiceDoesNotDuplicate() | ||
| { | ||
| _session.Character.Class = CharacterClassType.Swordsman; | ||
| _session.Character.JobLevel = 10; | ||
|
|
||
| await _service.LearnClassSkillsAsync(_session.Character); | ||
| var afterFirst = _session.Character.Skills.Count; | ||
| await _service.LearnClassSkillsAsync(_session.Character); | ||
|
|
||
| Assert.AreEqual(afterFirst, _session.Character.Skills.Count); | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| } | ||
| } | ||
| } | ||
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
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.