Skip to content

Seed default potion hotkeys for new characters#805

Open
nolt wants to merge 1 commit into
MUnique:masterfrom
nolt:fix-new-character-potion-hotkeys
Open

Seed default potion hotkeys for new characters#805
nolt wants to merge 1 commit into
MUnique:masterfrom
nolt:fix-new-character-potion-hotkeys

Conversation

@nolt

@nolt nolt commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Seed default potion hotkeys for new characters

Problem

A freshly created character has all four potion quick-slots (Q, W, E, R) behaving as health potions. Every slot consumes/displays the HP potion; the mana slot never works as a mana slot.

Root cause

CreateCharacterAction initializes a new character with an all-zero key configuration:

character.KeyConfiguration = new byte[30];

KeyConfiguration is an opaque blob that is interpreted by the game client (the server stores and echoes it verbatim via ApplyKeyConfigurationPlugIn). Within that blob the client reads the four potion quick-slots as offsets into the potion item group:

  • byte 21 → Q, byte 22 → W, byte 23 → E, byte 25 → R

A value of 0 resolves to potion-group offset 0, which is the apple. The client treats the apple as a healing item (it falls in the apple … large healing potion range), so with an all-zero configuration all four slots bind to a health potion. The intended default (Q = healing potion, W = mana potion) is never set.

Fix

Seed a sensible default key configuration on character creation instead of an all-zero array:

  • Q → small healing potion (offset 1)
  • W → small mana potion (offset 4)
  • E and R → unbound (0xFF)

This is a data-only change — no packet, serialization, or client change. The client already renders a slot only when a matching item is present in the inventory, so the slots still appear empty until the player actually picks up a potion; they simply now light up under the correct key (HP under Q, mana under W) instead of HP under all four.

character.KeyConfiguration = CreateDefaultKeyConfiguration();

// ...

private static byte[] CreateDefaultKeyConfiguration()
{
    const byte healingPotion = 1;
    const byte manaPotion = 4;
    const byte unbound = 0xFF;

    var keyConfiguration = new byte[30];
    keyConfiguration[21] = healingPotion; // Q
    keyConfiguration[22] = manaPotion; // W
    keyConfiguration[23] = unbound; // E
    keyConfiguration[25] = unbound; // R
    return keyConfiguration;
}

Scope

  • Affects newly created characters only. Existing characters keep their stored configuration; they were already able to rebind manually.

Testing

  • Builds cleanly (dotnet publish -c Release -p:ci=true), no new analyzer warnings on the changed file.
  • New character: Q binds the healing potion, W binds the mana potion, E/R stay unbound; slots remain empty until the matching potion is in the inventory.

Notes

  • The byte offsets (21/22/23/25) and values follow the layout the client uses when it sends the configuration back (KeyQWE[0..2] and KeyR, each as an offset from the potion item group); they are documented in the method's <remarks>.
  • A migration for existing all-zero characters could be added separately as a configuration update if desired, but is intentionally out of scope here.

A newly created character received an all-zero KeyConfiguration. The game
client maps the four potion quick-slots (Q/W/E/R) from that blob, and a zero
value binds the apple (potion group offset 0, which the client treats as a
healing item) to every slot, so all four act as a health potion.

Seed a sensible default instead: Q -> healing potion, W -> mana potion,
E and R unbound.
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where newly created characters were incorrectly defaulting all potion quick-slots to health potions due to an uninitialized key configuration blob. By introducing a sensible default configuration during character creation, the game now correctly maps healing and mana potions to their respective keys, improving the initial player experience.

Highlights

  • Default Key Configuration: Implemented a new method to seed default potion hotkeys for newly created characters, replacing the previous all-zero configuration.
  • Potion Slot Mapping: Configured Q to bind to the healing potion and W to the mana potion, while leaving E and R unbound to prevent incorrect default behavior.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a default key configuration for newly created characters in CreateCharacterAction.cs. Instead of initializing character.KeyConfiguration with an empty 30-byte array, it now calls CreateDefaultKeyConfiguration(), which sets up default bindings for potion quick-slots (Q and W) and leaves others unbound (E and R) to prevent the client from defaulting all slots to health potions. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

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.

1 participant