Skip to content

Commit

Permalink
Merge pull request #71 from Exanthiax/master
Browse files Browse the repository at this point in the history
Added math & more
  • Loading branch information
WillFP authored Aug 27, 2024
2 parents 18f7666 + bd9f576 commit 900feee
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/all-plugins/custom-entity-ai/_category_.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"label": "Custom Entity AI",
"position": 8
"position": 11
}
2 changes: 1 addition & 1 deletion docs/all-plugins/custom-gui-slots.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Custom GUI Slots
sidebar_position: 8
sidebar_position: 9
---

## What are custom GUI slots?
Expand Down
2 changes: 1 addition & 1 deletion docs/all-plugins/data-migration-guide.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Data Migration Guide
sidebar_position: 9
sidebar_position: 10
---

This is a guide for changing data handler (e.g. yaml -> mysql), or for updating eco from a version before 6.74.0.
Expand Down
30 changes: 30 additions & 0 deletions docs/all-plugins/math.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: Math Expressions
sidebar_position: 6
---
## Math in eco plugins
Throughout the eco plugins and effects system, you can use math expressions almost anywhere. Most of the time you will use them within effects, such as in chances, cooldowns, levelling and progression, or in multipliers. However, you can also use them in descriptions, lore and messages using the math placeholders: `{{expression}}` and `{^{expression}}` to format the answer nicely.

You can also use placeholders within math. Some eco plugins come with their own numerical placeholders, such as `%level%` which can be used to create scaling effects based on a job, skill, pet or enchantment level. External placeholders are also supported, as long as they provide a numerical result.
## Common Syntax
These are the most commonly used mathematical expressions within eco plugins. To see all math syntax's available, visit [here](https://github.com/boxbeam/Crunch?tab=readme-ov-file#operations-and-syntax).

| Syntax | Description |
| ----------------- | ----------------------------------------------------------------------- |
| `()` | Create a parenthetical expression to be evaluated first (`3 * (4 + 1)`) |
| `+` | Add two numbers (`1 + 1`) |
| `-` | Subtract two numbers (`2 - 1`), or negate one (`-3`) |
| `/` | Divide two numbers (`3 / 4`) |
| `*` | Multiply two numbers (`5 * 2`) |
| `^` | Raise one number to the power of another (`3^2`) |
| `round` | Round a number to the nearest integer (`round(1.30)` returns 1) |
| `ceil` | Round a number up to the nearest integer (`ceil(1.20)` returns `2`) |
| `floor` | Round a number down to the nearest integer (`floor(1.80)` returns `1`) |
| `random(min,max)` | Selects a random number between two bounds (`random(1,10)`) |
| `min` | Returns the lowest value (`min(10,2 * 10)` returns `10`) |
| `max` | Returns the highest value (`min(10,2 * 10)` returns `20`) |
## Examples

In EcoSkills, you might want to provide players with a mining speed multiplier, capping it at 3.0x: `multiplier: 'max(3, (%level% * 0.1))'`. This ensures that the player gains a 0.10x mining speed boost per level, up to a maximum of 3.0x.

In EcoQuests, you might want players to collect a random amount of Coal Ore to complete the task: `xp: 'random(32,128)'` would randomise the task requirements between 32 ores and 128 ores.
2 changes: 1 addition & 1 deletion docs/all-plugins/pages.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: GUI Pages
sidebar_position: 7
sidebar_position: 8
---

## Custom Pages
Expand Down
5 changes: 3 additions & 2 deletions docs/all-plugins/prices.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Prices
sidebar_position: 6
sidebar_position: 7
---

## What are Prices?
Expand All @@ -9,7 +9,7 @@ Lots of servers have lots of different types of economies. Maybe you have a stan
item-based economy, maybe you're using [points](https://plugins.auxilor.io/effects/points), or something else entirely.

To simplify this, there's a unified way to handle all of this: the price system.

For price values, you can use [math](https://plugins.auxilor.io/all-plugins/math) to create adaptive/versatile pricing systems.
## Types

`$`, `coins`: Standard economy, this is what you'll use if you have an economy plugin installed
Expand Down Expand Up @@ -54,6 +54,7 @@ price-display:
This will override any per-price formatting, which should make your life much easier to achieve consistency
between different prices.

You can display prices in two ways, using `%value%` which will return the number unformatted (e.g. `$1234567.89`), or you can use `%value_commas%` to format the price with commas (e.g. `$1,234,567.89`).
## Config Examples

```yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/effects/all-effects/potion_effect.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `potion_effect`
#### Triggered Effect

Gives a potion effect
Gives a [potion](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/potion/PotionEffectType.html) effect

# Example Config
```yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/effects/all-effects/shoot.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `shoot`
#### Triggered Effect

Shoots a projectile
Shoots a [projectile](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Projectile.html)

# Example Config
```yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/effects/all-effects/spawn_entity.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `spawn_entity`
#### Triggered Effect

Spawns an entity
Spawns an [entity](https://plugins.auxilor.io/all-plugins/the-entity-lookup-system)

# Example Config
```yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/effects/all-effects/spawn_mobs.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `spawn_mobs`
#### Triggered Effect

Spawns mobs to help you
Spawns [mobs](https://plugins.auxilor.io/all-plugins/the-entity-lookup-system) to help you

# Example Config
```yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/effects/all-effects/spawn_particle.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `spawn_particle`
#### Triggered Effect

Spawns a particle
Spawns a [particle](https://plugins.auxilor.io/all-plugins/the-particle-lookup-system)

# Example Config
```yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/effects/all-effects/spawn_potion_cloud.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `spawn_potion_cloud`
#### Triggered Effect

Spawns a potion cloud
Spawns a [potion](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/potion/PotionEffectType.html) cloud

# Example Config
```yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/effects/all-filters/entities.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `entities`

The list of entities that the effect should activate against
The list of [entities](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/EntityType.html) that the effect should activate against

# Example Config
```yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/effects/all-filters/items.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `items`

Requires the item(s) provided to be in a certain set of items
Requires the [item(s)](https://plugins.auxilor.io/all-plugins/the-item-lookup-system) provided to be in a certain set of items

# Example Config
```yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/effects/all-filters/projectiles.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `projectiles`

The list of projectiles that the effect should activate with
The list of [projectiles](https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Projectile.html) that the effect should activate with

# Example Config
```yaml
Expand Down
2 changes: 1 addition & 1 deletion docs/effects/all-filters/spawner_entity.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `spawner_entity`

The list of the types of mobs within a spawner that the effect should activate on
The list of the types of [mobs](https://plugins.auxilor.io/all-plugins/the-entity-lookup-system) within a spawner that the effect should activate on

# Example Config
```yaml
Expand Down

0 comments on commit 900feee

Please sign in to comment.