Skip to content

Implement Rate Modifier System + fixes#93

Open
Bia10 wants to merge 6 commits intoKaioru:devfrom
Bia10:dev
Open

Implement Rate Modifier System + fixes#93
Bia10 wants to merge 6 commits intoKaioru:devfrom
Bia10:dev

Conversation

@Bia10
Copy link
Copy Markdown
Contributor

@Bia10 Bia10 commented Feb 3, 2026

PR Summary: Implement Rate Modifier System

Overview

This PR introduces a composable rate system for EXP, Meso, and Drop rates. It supports multiple modifier sources—such as base configurations, active buffs, and guild bonuses—enabling a modular, extensible, and transparent approach to gameplay reward calculation.


Architecture Flow

  • IRateModifierSource
    Independent providers of rate changes (e.g., config, buffs, guild skills).

  • IRateModifierManager
    Aggregates all active modifier sources and calculates the final multiplier.

  • Final Rate
    Applied directly to gameplay rewards (mobs, quests, NPC rewards, etc.).


New Files

Protocol Layer

src/protocol/Edelstein.Protocol.Gameplay.Game/Rates/

  • RateType.cs
    Enum defining supported rate types:

    • Exp
    • Meso
    • Drop
  • IRateModifier.cs
    Interface defining:

    • Source
    • Multiplier
    • Priority
  • IRateModifierSource.cs
    Interface for providers of rate modifiers.

  • IRateModifierManager.cs
    Aggregates active modifiers and calculates the final rate.

  • IRateContext.cs
    Context for rate calculations (e.g., specific user, field, or options).


Implementation Layer

src/common/Edelstein.Common.Gameplay.Game/Rates/

  • RateModifier.cs
    Standard modifier implementation, including an Apply() helper.

  • RateModifierManager.cs
    Core logic to multiply all active modifiers and produce the final rate.

  • RateContext.cs
    Record-based implementation of IRateContext.

  • StageOptionsRateModifierSource.cs
    Provides base rates from configuration files.

  • TemporaryStatRateModifierSource.cs
    Handles buff-based rates (e.g., Holy Symbol, EXP coupons).

  • GuildRateModifierSource.cs
    Applies bonuses derived from guild skills.


Commands

src/plugin/Edelstein.Plugin.Rue/Commands/Admin/

  • RateCommand.cs
    Adds the /rate admin command to:

    • Inspect all active rate modifiers
    • View final calculated EXP, Meso, and Drop rates

Modified Files

Configuration & Dependency Injection

  • ProgramConfigStageGame.cs / IGameStageOptions.cs
    Added:

    • ExpRate
    • MesoRate
    • DropRate
  • appsettings.json
    Added default rate configuration values.

  • ProgramHost.cs
    Registered:

    • IRateModifierManager
    • All rate modifier sources in the DI container

Rate Integration (Logic Hooks)

  • GameContextManagers.cs
    Exposed IRateModifierManager via Rates.

  • MobRewardPoolManager.cs
    Applies drop rate multipliers to reward probabilities.

  • FieldDropMoney.cs
    Applies the meso rate during currency pickup.

  • FieldMob.cs
    Calculates and grants EXP using the modified rate on mob death.

  • QuestManager.cs
    Integrates rate modifiers into quest completion rewards.

  • ConversationSpeakerUser.cs
    Applies rates to rewards triggered via NPC conversations.


Plugin Registration

  • PluginRueGamePlugin.cs
    Registers the new RateCommand. For debugging purposes display all active rate modifiers and total.

Beyond rate system

  • Fixed rue plugin not outputting the Trie .dll causing exception on load, this is important because current configuration presupposes the existence of plugin if "plugins" (from appsettings.json) is removed the launch hangs without error.

  • Add temp file Serilog sink

Things which have not been taken into consideration:

  • The appsettings define a default value of 1.0 for all rates, if by some event these settings were somehow omitted, the C# default of double property is 0.0 therefore 0% rates. This is intended but makes the properties in appsettings kind of too important, but on other side if these defaults of 1.0 were hardcoded in code it would make code fugly violating separations of config/data/code.
  • The problems of composability has not been investigated or taken into account, we assume that rates simply aggregate together without any issues, so problems like exclusivity, overwriting are not considered.
  • The problems of effect granularity has not been investigated or taken into account, currently we support only levels of Stage (all of those on given stage/gateway), Character(having temp buff), Guild(all chars belonging to guild, affected by guild skill), Event(all of those participating in event), however its clear that Server wide or account wide level of granularity should also exist.
  • The problems of type granularity when we say EXP is 6x what do we actually mean? the Mob exp reward 6x ? Quest exp reward 6x, Guild exp? profession exp? pet exp? etc... its not clear how fine the settings should be, in my opinion having at least Quest and Professions rates would be good.
  • The hard/softcapping of drop rate and its overflow is also not investigated we assume that overflow of 100% drop chance on given item is simply discarded and 1 item of such id will drop, technically there can be many modes of what should happen beside just simple hardcapping.

Bia10 added 6 commits February 3, 2026 11:35
…at project

New modules:
- ClientAnalysis: memory R/W, singleton resolution, field access, process handle,
  remote function calling (x86 shellcode), login step monitoring, native types
  (ZArray<T>, ZXString), runtime function chain dumper (Iced x86 disassembly)
- V95ClientStructs: addresses, offsets, singletons, field registry for CLogin,
  CWvsContext, CWvsApp, CUIWorldSelect, CUIChannelSelect, CQuestMan, WorldItem,
  ChannelItem
- Diagnostics: crash analyzer, login diagnostics/timeline, memory snapshots, hex
  formatter
- Login/WorldSelect: strategy pattern (direct function call vs manual memory write)
- New plugs: diagnostics plug for packet inspection

Changes to existing code:
- Autologin plugs rewritten to use ClientAnalysis module for robust world/channel
  selection and character auto-select
- Auto-register plug enhanced with client memory integration
- Added Iced and System.IO.Hashing package references
- Config expanded with client memory and binding settings
- Formatting/style cleanup across Commands, Configs, Plugs
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