Peglin Relic Library

版本 v2.0.2·更新於 2022-06-26

A Library for creating Relics in Peglin

模組介紹 作者原文

Peglin Relic Lib

A Library for creating Relics in Peglin

How to Use:

Create a Regular BepinEx Plugin and add

[BepinDependency("io.github.crazyjackel.RelicLib")]

on top of your Plugin and add a reference to your Project.

Create the Model

To Create A Relic, create a Data Model for Relics

Make sure to call SetAssemblyPath.

Make sure you set GUID for your Relic.

RelicDataModel model = new RelicDataModel()

{

Rarity = RelicRarity.COMMON,

BundlePath = "relic",

SpriteName = "knife",

LocalKey = "knifeCrit",

GUID = "io.github.crazyjackel.criticalknife",

};

model.SetAssemblyPath(this);

Register the Model

Once your Model is created, it is time to register it.

bool success = RelicRegister.RegisterRelic(model, out RelicEffect myEffect);

Your RelicEffect is your assigned Relic Enum, there is no guarentee of it being a specific value.

You can also access your Relic Effect via:

RelicRegister.TryGetCustomRelicEffect("myGUID", out RelicEffect myEffect);

GUIDs are guarenteed to get the same value after registration.

Patch with the Effect

You can now make patches wherein you check whether the relicEffect is active according to the RelicManager. You are responsible for getting your own Relic Manager Instances.

if (relicManager.RelicEffectActive(effect){

//Do Something

}

Other Registers

RelicRegister is one of many Registers to deal with various Enums throughout the game.

The Following Registers also Help:

  • PegTypeRegister: Register New Peg Types and Add Support for various Pegs

Support Localization

To Add Localization for your Relics, use the built-in LocalizationRegister.

Your Model will include Name and Description Terms, just fill in the blanks and the rest will be taken care of.

LocalizationHelper.ImportTerm(new TermDataModel(model.NameTerm)

{

English = "Critical Knife",

French = "Dague Pointue"

});

Save Gameplay Information

During the Game, you might want to save certain data as a part of your Save run, such as whether certain relics should have additional special properties.

Or whether certain events were completed to upgrade your relics.

Unfortunately, the Game's native solution for saving gets recognized by Steam as corrupting your Save Path.

Instead, Try Using the ModdedDataSerializer:

Loading Data:

if (ModdedDataSerializer.HasKey("io.github.crazyjackel.eventLifeLost"))

{

int eventLifeLost = ModdedDataSerializer.Load>("io.github.crazyjackel.eventLifeLost");

return eventLifeLost;

}

Saving Data:

ModdedDataSerializer.Save("io.github.crazyjackel.eventLifeLost", eventLifeLost);

Roadmap

  • Relic Countdowns. (2.1.0)
  • Bug Squashing. (2.1.0)
  • Localization from CSV File. (2.1.0)
  • Better Code Commenting (2.1.0)

Links:

安裝與使用 安裝:按包內說明操作

  1. 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
  2. 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
  3. 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
  4. 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。

不同模組的安裝位置差異較大,包內說明是最可靠的依據。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

BepInEx-BepInExPack_Peglin

檔案與校驗

檔案名稱
Peglin_Relic_Library-2.0.2.zip
檔案大小
22.3 KiB