Skip to content
This repository has been archived by the owner on Dec 30, 2024. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Chasmical authored Jun 18, 2020
1 parent 0640c72 commit ad3d19e
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 9 deletions.
14 changes: 13 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,26 @@

1. [Main page](https://github.com/Abbysssal/RogueLibs/blob/master/README.md)
2. [RogueLibs](https://github.com/Abbysssal/RogueLibs/blob/master/RogueLibs.md)
3. [Mutators](https://github.com/Abbysssal/RogueLibs/blob/master/Mutators.md)
3. [CustomMutators](https://github.com/Abbysssal/RogueLibs/blob/master/CustomMutators.md)
4. [CustomNames](https://github.com/Abbysssal/RogueLibs/blob/master/CustomNames.md)
5. [Extras](https://github.com/Abbysssal/RogueLibs/blob/master/Extras.md)
6. **RogueLibs Changelog**

## Changelog ##
Here you will find all updates on RogueLibs, so you can specify your RogueLibs' version dependency better.

#### RogueLibs v1.2 ####
* Added RogueUtilities.CrossConflict(params CustomMutator[] mutators) method;
* Added RogueUtilities.EachConflict(IEnumerable<string> conflicts, params CustomMutator[] mutators) method;
* Added CustomMutator.OnChangedState event;
* Added CustomMutator.SortingOrder and CustomMutator.SortingIndex properties;
* Added a small class RogueChat, more info [here](https://github.com/Abbysssal/RogueLibs/blob/master/Extras.md#roguechat);
* Fixed a bug, when custom mutators replaced original mutators in the Mutator Menu;
* Fixed a bug, when OnEnabled and OnDisabled weren't triggered;

#### RogueLibs v1.1.2 ####
* Fixed configuration loading errors;

#### RogueLibs v1.1 ####
* **Renamed Mutator class to CustomMutator!**;
* **Removed MutatorInfo class, use CustomNameInfo instead!**;
Expand Down
136 changes: 136 additions & 0 deletions CustomMutators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
## [Contents](https://github.com/Abbysssal/RogueLibs) ##

1. [Main page](https://github.com/Abbysssal/RogueLibs/blob/master/README.md)
2. [RogueLibs](https://github.com/Abbysssal/RogueLibs/blob/master/RogueLibs.md)
3. **CustomMutators**
4. [CustomNames](https://github.com/Abbysssal/RogueLibs/blob/master/CustomNames.md)
5. [Extras](https://github.com/Abbysssal/RogueLibs/blob/master/Extras.md)
6. [RogueLibs Changelog](https://github.com/Abbysssal/RogueLibs/blob/master/Changelog.md)

## Creating CustomMutators ##
```cs
public static CustomMutator SetMutator(string id, bool unlockedFromStart, CustomNameInfo name, CustomNameInfo description);
```
```cs
CustomMutator myMutator = RogueLibs.SetMutator("RocketBullets", true,
new CustomNameInfo("english name", "schinese", null, null, null, null, null, null),
new CustomNameInfo("description", null, null, null, null, null, null, null));

// null strings will default to english.
// After doing that your mutator will appear in Mutator Menu at Home Base.
```
## Deleting CustomMutators ##
You can delete your custom CustomMutators:
```cs
public static bool DeleteMutator(CustomMutator mutator);
public static bool DeleteMutator(string id);
```
You can use these in case you rename your mutator:
```cs
CustomMutator newMutator = RogueLibs.CreateMutator(...);
CustomMutator oldMutator = RogueLibs.GetMutator("oldName");
if (oldMutator.Unlocked)
newMutator.Unlocked = true;
RogueLibs.DeleteMutator("oldName");
// This will delete oldMutator's state from RogueLibs config file.
```
If the removal of a CustomMutator was successful, methods return true, otherwise - false.
## Using CustomMutators ##
You can get your CustomMutator's Id:
```cs
public string Id { get; }
```
```cs
string myId = myMutator.Id;
```
You can get/set IsActive property of the CustomMutator:
```cs
public bool IsActive { get; set; }
```
```cs
if (myMutator.IsActive)
DoYourMutatorStuff();

myMutator.IsActive = true;
// This will add your mutator to the active mutators list.
```
You can get/set Unlocked property of the CustomMutator:
```cs
public bool Unlocked { get; set; }
```
```cs
if (!myMutator.Unlocked)
Logger.LogInfo("The mutator is not unlocked yet!");

...
myMutator.Unlocked = true;
// This state will be saved in RogueLibs config file,
// so the next time the game is loaded, this mutator will be already unlocked.
Logger.LogInfo("Player unlocked the mutator!");
```
You can also get/set ShowInMenu property of the CustomMutator:
```cs
public bool ShowInMenu { get; set; }
```
```cs
myMutator.ShowInMenu = false;
// Your mutator won't show in Mutator Menu at Home Base.
if (!myMutator.ShowInMenu)
Logger.LogWarning("The mutator is not shown in the menu!");
```
You can also set your custom sorting order for CustomMutators:
```cs
firstMutator.SortingOrder = 60;
secondMutator.SortingOrder = 70;
thirdMutator.SortingOrder = 80;
```
If SortingOrder values are the same for two mutators, then SortingIndex values are used instead:
```cs
firstMutator.SortingOrder = 5;
firstMutator.SortingIndex = 1;
secondMutator.SortingOrder = 5;
secondMutator.SortingIndex = 2;
thirdMutator.SortingOrder = 5;
thirdMutator.SortingIndex = 3;
```
## Conflicting Mutators ##
You can add Conflicting mutators - mutators, that when enabled will automatically disable your mutator, and will be automatically disabled when your mutator is enabled.
<br/>Basically, you won't be able to enable both of them at the same time:
```cs
public void AddConflicting(params string[] conflictingMutators);
public void AddConflicting(params CustomMutator[] conflictingMutators);
```
```cs
rocketBulletsMutator.AddConflicting(waterBulletsMutator, noBulletsMutator);
rocketBulletsMutator.AddConflicting("NoGuns", "GorillaTown");
// This way you won't be able to enable both RocketBullets and WaterBullets or NoGuns and RocketBullets,
// but you WILL be able to enable both WaterBullets and NoBullets mutators.
```
And of course, you can remove these Conflicting Mutators:
```cs
public void RemoveConflicting(params string[] conflictingMutators);
public void RemoveConflicting(params CustomMutator[] conflictingMutators);
```
## CustomNames ##
You can access your Mutator's CustomNames:
```cs
public CustomName Name { get; set; }
public CustomName Description { get; set; }
```
```cs
myMutator.Name.English = "My new Name";
myMutator.Description = new CustomName(...);
```
## Events ##
There are three events that you can listen to:
```cs
public event OnChangeState OnEnabled; // delegate void OnChangeState();
public event OnChangeState OnDisabled; // delegate void OnChangeState();
public event OnState OnChangedState; // delegate void OnState(bool newState);
```
```cs
myMutator.OnEnabled += MyListener;
myMutator.OnDisabled += MyListener2;
myMutator.OnChangedState += MyListener3;
```
2 changes: 1 addition & 1 deletion CustomNames.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

1. [Main page](https://github.com/Abbysssal/RogueLibs/blob/master/README.md)
2. [RogueLibs](https://github.com/Abbysssal/RogueLibs/blob/master/RogueLibs.md)
3. [Mutators](https://github.com/Abbysssal/RogueLibs/blob/master/Mutators.md)
3. [CustomMutators](https://github.com/Abbysssal/RogueLibs/blob/master/CustomMutators.md)
4. **CustomNames**
5. [Extras](https://github.com/Abbysssal/RogueLibs/blob/master/Extras.md)
6. [RogueLibs Changelog](https://github.com/Abbysssal/RogueLibs/blob/master/Changelog.md)
Expand Down
53 changes: 50 additions & 3 deletions Extras.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

1. [Main page](https://github.com/Abbysssal/RogueLibs/blob/master/README.md)
2. [RogueLibs](https://github.com/Abbysssal/RogueLibs/blob/master/RogueLibs.md)
3. [Mutators](https://github.com/Abbysssal/RogueLibs/blob/master/Mutators.md)
3. [CustomMutators](https://github.com/Abbysssal/RogueLibs/blob/master/CustomMutators.md)
4. [CustomNames](https://github.com/Abbysssal/RogueLibs/blob/master/CustomNames.md)
5. **Extras**
6. [RogueLibs Changelog](https://github.com/Abbysssal/RogueLibs/blob/master/Changelog.md)
Expand All @@ -19,14 +19,61 @@ Sprite sprite = RogueUtilities.ConvertToSprite("D:\Images\MyImage.png");
byte[] data = File.ReadAllBytes("D:\Images\MyImage.png");
Sprite sprite2 = RogueUtilities.ConvertToSprite(data);
```
And convert .mp3, .ogg, .wav, .aiff files into Audioclips:
And convert .mp3, .ogg, .wav, .aiff files into Audioclips. It is recommended to use .ogg, because other formats might not load properly:
```cs
public static AudioClip ConvertToAudioClip(string filePath);
```
```cs
AudioClip clip = RogueUtilities.ConvertToAudioClip("D:\Sounds\MySound.ogg");
```
It is recommended to use .ogg, because other formats might not load properly.
You can also use this method to add conflicting CustomMutators:
```cs
public static void CrossConflict(params CustomMutator[] mutators);
```
```cs
CrossConflict(rocketBulletsMutator, waterBulletsMutator, lavaBulletsMutator);
// It's a shortcut for:
// rocketBulletsMutator.AddConflicting(waterBulletsMutator, lavaBulletsMutator);
// waterBulletsMutator.AddConflicting(rocketBulletsMutator, lavaBulletsMutator);
// lavaBulletsMutator.AddConflicting(rocketBulletsMutator, waterBulletsMutator);
```
And this to add conflicting original mutators to your CustomMutators:
```cs
public static void EachConflict(IEnumerable<string> conflicts, params CustomMutator[] mutators);
```
```cs
List<string> list = new List<string>() { "NoGuns", "InfiniteAmmo" };
EachConflict(list, rocketBulletsMutator, waterBulletsMutator, lavaBulletsMutator);
// It's a shortcut for:
// rocketBulletsMutator.AddConflicting(list.ToArray());
// waterBulletsMutator.AddConflicting(list.ToArray());
// lavaBulletsMutator.AddConflicting(list.ToArray());
```
## RogueChat ##
This class has OnCommand event, that is triggered every time a player enters a command (message starting with a slash '/'):
```cs
public static event OnMessageEvent OnCommand; // delegate void OnMessageEvent(MessageArgs a);
```
```cs
RogueChat.OnCommand += MyListener;
```
MessageArgs class consists only of one property:
```cs
public string Text { get; set; }
```
```cs
public void MyListener(MessageArgs e)
{
if (e.Text.StartsWith("/spawn-npc "))
{
...
}
else if (e.Text == "/heal")
{
...
}
}
```
## RoguePatcher ##
This class allows you to further simplify this code:
```cs
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,30 @@

1. **Main page**
2. [RogueLibs](https://github.com/Abbysssal/RogueLibs/blob/master/RogueLibs.md)
3. [Mutators](https://github.com/Abbysssal/RogueLibs/blob/master/Mutators.md)
3. [CustomMutators](https://github.com/Abbysssal/RogueLibs/blob/master/CustomMutators.md)
4. [CustomNames](https://github.com/Abbysssal/RogueLibs/blob/master/CustomNames.md)
5. [Extras](https://github.com/Abbysssal/RogueLibs/blob/master/Extras.md)
6. [RogueLibs Changelog](https://github.com/Abbysssal/RogueLibs/blob/master/Changelog.md)

## Links ##
* [RogueLibs on GitHub](https://github.com/Abbysssal/RogueLibs)
* [Download RogueLibs](https://github.com/Abbysssal/RogueLibs/releases)
* [Steam guide on modding with BepInEx](https://steamcommunity.com/sharedfiles/filedetails/?id=2106187116)

## Mods using RogueLibs ##

* **Ammo and Durability (AaD) Mutators** and **More Throwable Weapons (MTW) Mutators** - more info in the official Streets of Rogue Discord server (channel #modding-gallery): https://discord.com/invite/streetsofrogue
* **a Ton of Mutators (aToM)** - *work-in-progress*

# RogueLibs v1.1 #
# RogueLibs v1.2 #
This modding library allows you to easily add custom mutators and localization lines, plus it has some extra functions that you might need.

## How to use RogueLibs in your mods ##
You can find instructions on how to do that here (9. Modding Libraries, RogueLibs):
https://steamcommunity.com/sharedfiles/filedetails/?id=2106187116

## Plugin Example ##
You can find more examples here (after 10.):
https://steamcommunity.com/sharedfiles/filedetails/?id=2106187116
```cs
using System;
using BepInEx;
Expand Down
2 changes: 1 addition & 1 deletion RogueLibs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

1. [Main page](https://github.com/Abbysssal/RogueLibs/blob/master/README.md)
2. **RogueLibs**
3. [Mutators](https://github.com/Abbysssal/RogueLibs/blob/master/Mutators.md)
3. [CustomMutators](https://github.com/Abbysssal/RogueLibs/blob/master/CustomMutators.md)
4. [CustomNames](https://github.com/Abbysssal/RogueLibs/blob/master/CustomNames.md)
5. [Extras](https://github.com/Abbysssal/RogueLibs/blob/master/Extras.md)
6. [RogueLibs Changelog](https://github.com/Abbysssal/RogueLibs/blob/master/Changelog.md)
Expand Down

0 comments on commit ad3d19e

Please sign in to comment.