Skip to content

feat: Job Emblems#831

Merged
pacampbell merged 2 commits into
sebastian-heinz:developfrom
pacampbell:job_emblems
May 24, 2025
Merged

feat: Job Emblems#831
pacampbell merged 2 commits into
sebastian-heinz:developfrom
pacampbell:job_emblems

Conversation

@pacampbell

@pacampbell pacampbell commented May 19, 2025

Copy link
Copy Markdown
Collaborator
  • Added support for job emblems using the menus at Renton.
  • Created new handlers and packets for the new menus.
  • Created new personal quests to unlock emblems.

Checklist:

  • The project compiles
  • The PR targets develop branch

@pacampbell pacampbell force-pushed the job_emblems branch 8 times, most recently from 19816d3 to 14fc966 Compare May 23, 2025 00:54
@pacampbell pacampbell marked this pull request as ready for review May 23, 2025 00:54
Comment thread Arrowgene.Ddon.Database/Sql/Core/DdonSqlDbCharacterCommon.cs Outdated
{
S2CContextGetLobbyPlayerContextNtc ntc1 = new S2CContextGetLobbyPlayerContextNtc();
GameStructure.S2CContextGetLobbyPlayerContextNtc(ntc1, (Character) characterCommon);
GameStructure.S2CContextGetLobbyPlayerContextNtc(Server, ntc1, (Character) characterCommon);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we were gonna pull these out and make them methods of the Character object? public S2CContextGetLobbyPlayerContextNtc ToLobbyPlayerContextNtc(DdonGameServer server) or something.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This thing is a lot harder to do because it's used in enough places. We should do it in a followup PR.

Comment thread Arrowgene.Ddon.GameServer/Characters/JobEmblemManager.cs Outdated
client.Send(RemovePlayPoint2(client, jobId.Value, removedPoints, type));
}

public S2CJobUpdatePlayPointNtc RemovePlayPoint2(GameClient client, JobId jobId, uint amount, byte type = 0, DbConnection? connectionIn = null)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we have two RemovePlayPoints? We should probably just have the single instance that returns the packet and send it from the call site (seemingly just JobJobValueShopBuyItemHandler prior to this), rather than being unclear about which one sends and which doesn't.

While we're at it, we can move JobJobValueShopBuyItemHandler into a transaction.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to not change so many things.

Comment thread Arrowgene.Ddon.Server/Settings/EmblemSettings.cs Outdated
Comment thread Arrowgene.Ddon.Database/DdonDatabaseBuilder.cs
VALUES ({BuildQueryInsert(JobEmblemFields)})
ON CONFLICT (character_id, job_id)
DO UPDATE SET {BuildQueryUpdate(JobEmblemFields)};
""";

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this query compatible with both PSQL and SQLite?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be considering I copied it from a query Sam made recently.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: For an optimized ON CONFLICT UPDATE you want to separate the key from non-key fields and add the "EXCLUDED." prefix for the non-key fields.

For example in the DdonSqlDbPawnCraftProgress:

    private readonly string SqlUpsertPawnCraftProgress =
        $"""
         INSERT INTO "ddon_equipment_limit_break" ({BuildQueryField(PawnCraftProgressFields)}) 
                        VALUES ({BuildQueryInsert(PawnCraftProgressFields)}) 
                        ON CONFLICT ("craft_character_id", "craft_lead_pawn_id") 
                        DO UPDATE SET {BuildQueryUpdateWithPrefix("EXCLUDED.", PawnCraftProgressNonKeyFields)};
         """;

result.StatLevels[EquipStatId.IceResist] = GetByte(reader, "ice_resist");
result.StatLevels[EquipStatId.ThunderResist] = GetByte(reader, "thunder_resist");
result.StatLevels[EquipStatId.HolyResist] = GetByte(reader, "holy_resist");
result.StatLevels[EquipStatId.DarkResist] = GetByte(reader, "dark_resist");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should StatLevels really be a dictionary when it gets written and read into a table with non nullable columns?

@pacampbell pacampbell May 23, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I have stored in the DB is not what is used in the actual packets. I need some way to take the level of the stat, then look up the value in another config table and calculate the final value.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What i mean is, can it not be a regular field? StatLevels.IceResist = GetByte(reader, "ice_resist")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't loop over those fields without doing reflection though.

var packets = new PacketQueue();
var itemUpdateNtc = new S2CItemUpdateCharacterItemNtc()
{
UpdateType = ItemNoticeType.GatherEquipItem

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this right? Or is this one of the cases where the update type doesn't matter

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When nothing works, this update type always fixes everything. Maybe it needs a better name but not sure what it is. It's needed for equipping items from BBM chests, otherwise it hangs. The limit break and emblem also don't show unless I use this type.

Comment thread Arrowgene.Ddon.GameServer/Handler/JobEmblemUpdateParamLevel.cs
Comment thread Arrowgene.Ddon.Shared/Entity/Structure/CDataTimeGainQuestUnk2.cs Outdated
Comment thread Arrowgene.Ddon.Shared/Entity/Structure/CDataItemEmbodyCostParam.cs Outdated
@pacampbell pacampbell force-pushed the job_emblems branch 3 times, most recently from e86fc62 to 82e6d87 Compare May 24, 2025 01:32
- Added support for job emblems
- Created new personal quests to unlock emblems.
- Added support for emblems using the menus at Renton.
- Created new handlers and packets for the new menus.
- Fix typo Inheritence -> Inheritance.
- Remove 50 HP added to all items in CharacterCommon query.
@pacampbell pacampbell merged commit f895012 into sebastian-heinz:develop May 24, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants