feat: Job Emblems#831
Conversation
19816d3 to
14fc966
Compare
| { | ||
| S2CContextGetLobbyPlayerContextNtc ntc1 = new S2CContextGetLobbyPlayerContextNtc(); | ||
| GameStructure.S2CContextGetLobbyPlayerContextNtc(ntc1, (Character) characterCommon); | ||
| GameStructure.S2CContextGetLobbyPlayerContextNtc(Server, ntc1, (Character) characterCommon); |
There was a problem hiding this comment.
I thought we were gonna pull these out and make them methods of the Character object? public S2CContextGetLobbyPlayerContextNtc ToLobbyPlayerContextNtc(DdonGameServer server) or something.
There was a problem hiding this comment.
This thing is a lot harder to do because it's used in enough places. We should do it in a followup PR.
| client.Send(RemovePlayPoint2(client, jobId.Value, removedPoints, type)); | ||
| } | ||
|
|
||
| public S2CJobUpdatePlayPointNtc RemovePlayPoint2(GameClient client, JobId jobId, uint amount, byte type = 0, DbConnection? connectionIn = null) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I'm trying to not change so many things.
| VALUES ({BuildQueryInsert(JobEmblemFields)}) | ||
| ON CONFLICT (character_id, job_id) | ||
| DO UPDATE SET {BuildQueryUpdate(JobEmblemFields)}; | ||
| """; |
There was a problem hiding this comment.
Is this query compatible with both PSQL and SQLite?
There was a problem hiding this comment.
It should be considering I copied it from a query Sam made recently.
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
Should StatLevels really be a dictionary when it gets written and read into a table with non nullable columns?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
What i mean is, can it not be a regular field? StatLevels.IceResist = GetByte(reader, "ice_resist")
There was a problem hiding this comment.
I can't loop over those fields without doing reflection though.
| var packets = new PacketQueue(); | ||
| var itemUpdateNtc = new S2CItemUpdateCharacterItemNtc() | ||
| { | ||
| UpdateType = ItemNoticeType.GatherEquipItem |
There was a problem hiding this comment.
Is this right? Or is this one of the cases where the update type doesn't matter
There was a problem hiding this comment.
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.
e86fc62 to
82e6d87
Compare
- 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.
Checklist:
developbranch