REPO_JP-PerfectExtractionBonus icon

PerfectExtractionBonus

【Host Only MOD】Gives a bonus when all starting valuables are extracted. レベル開始時点の全貴重品を納品するとボーナスを付与します

By REPO_JP
Last updated 2 weeks ago
Total downloads 4394
Total rating 5 
Categories Mods Valuables Server-side
Dependency string REPO_JP-PerfectExtractionBonus-1.3.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

PerfectExtractionBonus

PerfectExtractionBonus is a host-only mod for R.E.P.O.

This mod grants a money bonus when every valuable that existed at the start of the level is successfully extracted before the level is cleared.

It also supports an extra no-loss bonus when every tracked starting valuable is extracted without any value loss at any point during the level.

In v1.2.0, the mod can now also send a public forced chat announcement to all players after the final extraction result is confirmed. A regular perfect extraction and a no-loss perfect extraction can each use their own separate configurable chat message.

Overview

This mod has three main reward layers.

  1. Regular perfect extraction bonus
    If every valuable that existed at level start is extracted, a bonus is granted based on current run currency

  2. Extra no-loss bonus
    If every tracked starting valuable is extracted and none of them ever dropped below its original value, an extra bonus is granted on top of the regular one

  3. Public bonus chat announcement
    After the final reward result is confirmed, the mod can send a forced public chat message to all players showing the rewarded bonus amount

The regular perfect extraction bonus does not require valuables to remain undamaged. A valuable still counts for the regular bonus even if its value dropped due to damage, as long as that same original object is eventually extracted.

Only valuables that existed at the beginning of the level are tracked. Valuables created later during the level are ignored for both bonus conditions.

Features

  • Host-only behavior
  • Grants a regular bonus based on current run currency after a perfect extraction clear
  • Grants an additional no-loss bonus when all tracked starting valuables are extracted without any value loss
  • Supports streak bonus scaling for consecutive perfect extractions
  • Tracks only the valuables that existed at level start
  • Regular perfect extraction accepts damaged valuables as valid as long as they are extracted
  • No-loss bonus is disabled if any tracked starting valuable drops below its original value during the level
  • Ignores valuables that appear after the initial snapshot
  • Prevents duplicate level-result processing
  • Optional bonus UI
  • Detailed bonus logging enabled by default
  • Sends a public forced chat message to all players after a regular perfect extraction bonus
  • Sends a separate public forced chat message to all players after a no-loss perfect extraction bonus
  • Supports dynamic 〇〇k$ placeholder replacement with the actual bonus amount in chat messages

How it works

The mod waits until level generation is complete, then takes a snapshot of all valuables that currently exist in the level.

Each of those valuables is tracked by object identity. When a valuable is successfully destroyed by extraction processing, that original object is marked as delivered.

At the same time, the mod also records each tracked valuable's original value. During the level, if any tracked starting valuable ever drops below that original value, the extra no-loss bonus condition is permanently disabled for that level.

At level completion, the mod checks whether every valuable from the initial snapshot was delivered.

If yes:

  • regular perfect extraction bonus is granted
  • streak increases by 1
  • extra no-loss bonus is also granted if no tracked starting valuable ever lost value
  • a public forced chat message is sent to all players after the final reward result is confirmed

If no:

  • no bonus is granted
  • no public bonus chat is sent
  • streak can be reset depending on config

Public chat announcement behavior

The v1.2.0 public chat feature is designed for visibility to the whole lobby.

When a regular perfect extraction succeeds, the mod sends the configured regular perfect bonus message to public chat.

When a no-loss perfect extraction succeeds, the mod sends the configured no-loss perfect bonus message to public chat instead.

Both chat message templates support the text token:

〇〇k$

That token is automatically replaced with the actual granted total bonus amount before the chat message is sent.

Example:

Config text: Perfect Extraction Bonus 〇〇k$

Possible actual chat output: Perfect Extraction Bonus 2500k$

Config text: Wow!!! Super No-loss Perfect Extraction Bonus 〇〇k$

Possible actual chat output: Wow!!! Super No-loss Perfect Extraction Bonus 2500k$

The replacement is automatic. You only need to include 〇〇k$ anywhere in the message template where you want the dynamic amount to appear.

Important behavior

This mod checks the valuables that existed at the start of the level, not every valuable that may ever exist later.

For the regular perfect extraction bonus, a valuable is still considered valid even if:

  • it was damaged
  • its price was reduced
  • it was partially broken in value terms

It only needs to be successfully extracted as the same tracked object.

For the extra no-loss bonus, every tracked starting valuable must stay at or above its original value for the entire level. If even one tracked starting valuable drops below its original value once, the extra no-loss bonus is lost for that level.

A valuable does not count if:

  • it was part of the initial set but never extracted
  • it disappeared by some other method without going through extraction tracking
  • it was replaced by some other object later

Host only

Only the host needs to install this mod.

The host performs all tracking, eligibility checks, streak handling, currency bonus logic, and public chat sending. Clients do not need the mod for the effect to work.

Bonus calculation

Base regular formula:

regular bonus = current currency × regular bonus percent

Extra no-loss formula:

no-loss extra bonus = current currency × no-loss extra bonus percent

Total granted bonus:

total bonus = regular bonus + no-loss extra bonus

The default regular behavior is:

  • first perfect extraction clear: 10%
  • second consecutive perfect extraction clear: 15%
  • third consecutive perfect extraction clear: 20%

This happens because streak bonus is enabled by default.

With the default extra no-loss bonus setting:

  • no-loss extra bonus: 10%

Example with defaults:

  • current currency: 10000
  • regular perfect extraction streak bonus result: 15%
  • no-loss extra bonus: 10%
  • total bonus: 1500 + 1000 = 2500

Logging

Detailed bonus logs are enabled by default.

When logging is enabled, the mod outputs:

  • whether the bonus was granted
  • whether the no-loss extra bonus was granted
  • current streak count
  • regular bonus rate calculation
  • no-loss extra bonus rate calculation
  • bonus amount calculation formulas
  • total bonus amount calculation
  • current currency before and after bonus
  • no-loss disqualification reason when applicable
  • which public bonus chat message was selected

Configuration

ModEnabled

  • Description: Enables or disables the mod
  • Default: true
  • Minimum: false
  • Maximum: true

BaseBonusPercent

  • Description: Base bonus percent for a perfect extraction clear
  • Default: 10
  • Minimum: 0
  • Maximum: 100

EnableStreakBonus

  • Description: Enables extra bonus percent for consecutive perfect extractions
  • Default: true
  • Minimum: false
  • Maximum: true

StreakAddPercent

  • Description: Additional percent added for each consecutive perfect clear after the first
  • Default: 5
  • Minimum: 0
  • Maximum: 100

MaxBonusPercent

  • Description: Maximum total regular bonus percent
  • Default: 50
  • Minimum: 0
  • Maximum: 100

NoLossExtraBonusPercent

  • Description: Extra bonus percent granted when all tracked starting valuables are extracted without any value loss
  • Default: 10
  • Minimum: 0
  • Maximum: 100

ResetStreakOnNonPerfectClear

  • Description: Resets streak when the level is cleared without a perfect extraction
  • Default: true
  • Minimum: false
  • Maximum: true

ResetStreakOnLevelFail

  • Description: Resets streak when the level fails
  • Default: true
  • Minimum: false
  • Maximum: true

ShowBonusUI

  • Description: Shows a bonus UI popup when the reward is granted
  • Default: true
  • Minimum: false
  • Maximum: true

InitialSnapshotDelaySeconds

  • Description: Delay after level generation before locking the initial valuable snapshot
  • Default: 0.75
  • Minimum: 0
  • Maximum: 10

LogEnabled

  • Description: Enables detailed debug logging
  • Default: true
  • Minimum: false
  • Maximum: true

PerfectBonusPublicChatMessage

  • Description: Public forced chat message used when a regular perfect extraction bonus is granted
  • Default: Perfect Extraction Bonus 〇〇k$
  • Minimum: Any text
  • Maximum: Any text

NoLossPerfectBonusPublicChatMessage

  • Description: Public forced chat message used when a no-loss perfect extraction bonus is granted
  • Default: Wow!!! Super No-loss Perfect Extraction Bonus 〇〇k$
  • Minimum: Any text
  • Maximum: Any text

Technical notes

This mod tracks the initial valuables by object identity, using PhotonView IDs when available and falling back to Unity instance IDs otherwise.

Extraction completion is tracked by patching extraction destruction methods and recording which tracked valuables were actually consumed by extraction.

The extra no-loss bonus tracks each starting valuable's original value and continuously checks whether any tracked starting valuable falls below that value during the level.

Level completion is processed only once per level to avoid duplicate streak resets or duplicate bonus grants.

Bonus percentage configs are integer values only. All percentage configs are limited to a range of 0 to 100.

Public bonus chat is sent after the reward result is finalized and uses the configured chat template with automatic 〇〇k$ replacement.

If you used an older config file from a previous version that stored percentage values as floats, you may need to delete and regenerate the config file after updating.

Compatibility notes

This mod should work well with mods that:

  • change valuable value
  • damage valuables
  • modify extraction rewards separately
  • add UI elements related to reward display

Potential incompatibility can happen with mods that:

  • replace valuables with entirely new objects after level start
  • remove initial valuables without normal extraction processing
  • heavily rewrite extraction internals
  • alter original and current valuable value behavior in a non-standard way
  • replace or heavily rewrite public chat handling

PerfectExtractionBonus

PerfectExtractionBonus は R.E.P.O. 向けのホストオンリーMODです

このMODは、レベル開始時点で存在していた全ての貴重品を納品してからクリアした場合に、現在の所持金に応じたボーナスを付与します

さらに、追跡対象の初期貴重品すべてをレベル中に一度も減額させずに納品した場合は、通常ボーナスに加えて無減額追加ボーナスも付与します

そして v1.2.0 では、最終的な納品結果確定後に、全プレイヤーへ公開強制チャットを送る機能も追加されています
通常のパーフェクト納品と、無減額パーフェクト納品で、それぞれ別のチャット文言を Config から設定できます

概要

このMODの報酬要素は大きく3段階です

  1. 通常の完全納品ボーナス
    レベル開始時点の全貴重品を納品すると、現在所持金に応じたボーナスを付与します

  2. 無減額追加ボーナス
    追跡対象の初期貴重品すべてを納品し、かつレベル中に一度も初期価値を下回らなかった場合、通常ボーナスに加えて追加ボーナスを付与します

  3. 公開ボーナスチャット
    最終的な報酬結果が確定した後、そのボーナス額を含む公開強制チャットを全プレイヤーへ送信します

通常の完全納品ボーナスについては、貴重品が無傷である必要はありません
傷が付いて価値が下がっていても、その同じ元の個体が最終的に納品されれば達成扱いです

追跡対象はレベル開始時点で存在していた貴重品だけです
レベル途中で新たに出現した貴重品は、どちらのボーナス条件にも含みません

機能

  • ホストオンリー動作
  • 完全納品クリア時に現在所持金ベースの通常ボーナス付与
  • 初期貴重品を一度も減額させずに全納品した場合の追加ボーナス付与
  • 連続完全納品による通常ボーナス上昇対応
  • レベル開始時点の貴重品だけを追跡
  • 通常の完全納品は傷付きで価値が下がった貴重品でも納品できれば達成扱い
  • 初期貴重品のどれか1つでも価値が初期値を下回ると、そのレベルの追加ボーナス対象外
  • 初期スナップショット後に出た貴重品は無視
  • レベル結果処理の多重実行防止
  • 任意のボーナスUI表示
  • 詳細ボーナスログをデフォルトで有効化
  • 通常のパーフェクト納品成功時に全プレイヤーへ公開強制チャット送信
  • 無減額パーフェクト納品成功時に全プレイヤーへ別文言の公開強制チャット送信
  • チャット文言内の 〇〇k$ を実際のボーナス額へ自動置換

仕組み

レベル生成完了後、少し待ってから、その時点で存在する全ての貴重品を初期スナップショットとして確定します

その後は、その初期個体だけをオブジェクト単位で追跡します
納品処理で実際に消費されたとき、その元の個体を納品済みとして記録します

同時に、各初期貴重品の初期価値も記録します
そしてレベル中に、追跡対象の初期貴重品のどれか1つでもその初期価値を下回った場合、そのレベルでは無減額追加ボーナス条件を永久に失います

レベルクリア時に、初期スナップショット内の全貴重品が納品済みかどうかを判定します

達成時

  • 通常の完全納品ボーナス付与
  • 連続回数を1増加
  • さらに一度も減額していなければ追加ボーナスも付与
  • 最終結果確定後に公開強制チャット送信

未達成時

  • ボーナスなし
  • 公開ボーナスチャットなし
  • Config に応じて連続回数リセット

公開チャット機能

v1.2.0 で追加された公開チャット機能は、ロビー全体にボーナス結果を見せるための機能です

通常のパーフェクト納品成功時は、通常用の公開チャット文言を送信します

無減額パーフェクト納品成功時は、無減額用の公開チャット文言を送信します

どちらの文言テンプレートでも、以下の文字列を使えます

〇〇k$

この部分は、実際に付与された最終ボーナス額へ自動置換されたうえでチャット送信されます

Config 文言 Perfect Extraction Bonus 〇〇k$

実際のチャット例 Perfect Extraction Bonus 2500k$

Config 文言 Wow!!! Super No-loss Perfect Extraction Bonus 〇〇k$

実際のチャット例 Wow!!! Super No-loss Perfect Extraction Bonus 2500k$

置換は自動です
金額を表示したい位置に 〇〇k$ を書いておくだけで使えます

重要な仕様

このMODが見ているのは、レベル開始時点に存在していた貴重品です
その後に追加で出現した貴重品は対象外です

通常の完全納品ボーナスについては、以下でも達成扱いです

  • 傷が付いている
  • 価格が下がっている
  • 価値が減っている

必要なのは、最初に存在していた同じ個体が最終的に納品されることです

追加の無減額ボーナスについては、追跡対象の初期貴重品すべてがレベル中ずっと初期価値以上を維持している必要があります
どれか1つでも一度でも初期価値を下回った時点で、そのレベルの追加ボーナスは失われます

以下は未達成扱いです

  • 初期対象だったが最後まで納品されなかった
  • 納品ではない別処理で消えた
  • 後から別オブジェクトに置き換わった

ホストオンリー

このMODはホストだけ導入すれば動作します

追跡処理、条件判定、連続回数処理、所持金ボーナス処理、公開チャット送信はすべてホスト側で行われます
参加者側は未導入でも効果自体は動作します

ボーナス計算

通常ボーナス基本式

通常ボーナス = 現在所持金 × 通常ボーナス率

無減額追加ボーナス式

無減額追加ボーナス = 現在所持金 × 無減額追加ボーナス率

最終付与ボーナス

最終付与ボーナス = 通常ボーナス + 無減額追加ボーナス

デフォルト設定の通常ボーナスでは

  • 1回目の完全納品クリア: 10%
  • 2回連続の完全納品クリア: 15%
  • 3回連続の完全納品クリア: 20%

となります

これは連続ボーナスがデフォルトで有効だからです

さらにデフォルト設定の無減額追加ボーナスは

  • 10%

です

デフォルト値での例

  • 現在所持金: 10000
  • 通常の完全納品ボーナス結果: 15%
  • 無減額追加ボーナス: 10%
  • 最終ボーナス: 1500 + 1000 = 2500

ログ出力

詳細ボーナスログはデフォルトで有効です

ログ有効時は以下を出力します

  • ボーナスが付与されたか
  • 無減額追加ボーナスが付与されたか
  • 現在の連続回数
  • 通常ボーナス率の計算過程
  • 無減額追加ボーナス率の計算
  • ボーナス金額の計算式
  • 合計ボーナス金額の計算
  • ボーナス前後の所持金
  • 無減額条件を失った理由
  • どの公開ボーナスチャット文言が選ばれたか

設定項目

ModEnabled

  • 設定内容: MOD自体の有効無効
  • 初期値: true
  • 設定可能最小値: false
  • 設定可能最大値: true

BaseBonusPercent

  • 設定内容: 完全納品クリア時の基本ボーナス率
  • 初期値: 10
  • 設定可能最小値: 0
  • 設定可能最大値: 100

EnableStreakBonus

  • 設定内容: 連続完全納品時の追加ボーナス率の有効無効
  • 初期値: true
  • 設定可能最小値: false
  • 設定可能最大値: true

StreakAddPercent

  • 設定内容: 2連続目以降に1回ごと加算するボーナス率
  • 初期値: 5
  • 設定可能最小値: 0
  • 設定可能最大値: 100

MaxBonusPercent

  • 設定内容: 通常ボーナス率の上限
  • 初期値: 50
  • 設定可能最小値: 0
  • 設定可能最大値: 100

NoLossExtraBonusPercent

  • 設定内容: 初期貴重品を一度も減額させずに全納品した場合の追加ボーナス率
  • 初期値: 10
  • 設定可能最小値: 0
  • 設定可能最大値: 100

ResetStreakOnNonPerfectClear

  • 設定内容: 通常クリアだが完全納品でない場合に連続回数をリセットするか
  • 初期値: true
  • 設定可能最小値: false
  • 設定可能最大値: true

ResetStreakOnLevelFail

  • 設定内容: レベル失敗時に連続回数をリセットするか
  • 初期値: true
  • 設定可能最小値: false
  • 設定可能最大値: true

ShowBonusUI

  • 設定内容: ボーナス付与時にUI表示を行うか
  • 初期値: true
  • 設定可能最小値: false
  • 設定可能最大値: true

InitialSnapshotDelaySeconds

  • 設定内容: レベル生成後に初期貴重品スナップショットを確定するまでの待機秒数
  • 初期値: 0.75
  • 設定可能最小値: 0
  • 設定可能最大値: 10

LogEnabled

  • 設定内容: 詳細デバッグログの出力有無
  • 初期値: true
  • 設定可能最小値: false
  • 設定可能最大値: true

PerfectBonusPublicChatMessage

  • 設定内容: 通常のパーフェクト納品成功時に使用する公開強制チャット文言
  • 初期値: Perfect Extraction Bonus 〇〇k$
  • 設定可能最小値: 任意文字列
  • 設定可能最大値: 任意文字列

NoLossPerfectBonusPublicChatMessage

  • 設定内容: 無減額パーフェクト納品成功時に使用する公開強制チャット文言
  • 初期値: Wow!!! Super No-loss Perfect Extraction Bonus 〇〇k$
  • 設定可能最小値: 任意文字列
  • 設定可能最大値: 任意文字列

技術メモ

このMODは、初期貴重品をオブジェクト単位で追跡します
PhotonView ID が使える場合はそれを優先し、使えない場合は Unity の Instance ID を使います

納品達成は、納品処理で実際に消費された貴重品だけを extraction patch から記録して判定しています

無減額追加ボーナスは、各初期貴重品の初期価値を記録し、レベル中にその値を下回ったかどうかを継続監視して判定しています

レベル結果処理は1レベル1回だけ通すようにしており、二重ボーナスや二重リセットを防いでいます

ボーナス率系Configはすべて整数値です
すべてのパーセンテージConfigは 0 から 100 の範囲に制限されています

公開ボーナスチャットは報酬結果確定後に送信され、設定された文言テンプレート内の 〇〇k$ は自動で実際のボーナス額へ置換されます

旧バージョンの cfg に小数型のパーセンテージ設定が残っている場合は、更新後に cfg を削除して再生成が必要になることがあります

互換性メモ

以下のようなMODとは相性が良いです

  • 貴重品の価値変更
  • 貴重品へのダメージ追加
  • 納品報酬変更
  • 報酬表示系のUI追加

以下のようなMODとは競合可能性があります

  • レベル開始後に初期貴重品を別オブジェクトへ差し替える
  • 通常の納品処理を通さずに初期貴重品を削除する
  • 納品内部処理を大きく作り変える
  • 初期価値や現在価値の扱いを大きく変更する
  • 公開チャット処理を大きく置き換える