MV SDJB_ConditionalBranch

PluginName: SDJB_ConditionalBranch
Author: ShadowDragon

Spoiler: How it works
Code:
Introduction
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 ConditionalBranch+ by mjshi is completely rewritten from scratch.
 and make conditional checks easier to use, and far easier to extend.

 The parameter "Name Check" defaults to "GameCheck", used as GameCheck.has(...).
 If it conflicts with another global name, rename it for safety.

 The usages is to use "1" type of check as follows:
 
 GameCheck.has(type, ids, options = {})
   → type: "item" | "weapon" | "armor" | "var" | "variable" | "sw" | "switch" | "gold".
   → ids: single ID or array of IDs (for switches, items, variables).
   → options: object with type-specific checks.

 Examples:
 GameCheck.has("item", [1, 2, 3]);                  =>  has all items 1,2,3
 GameCheck.has("item", [1, 2, 3], {any: true});     =>  has any of 1,2,3
 GameCheck.has("var", [5], {equal: 10});            =>  variable 5 == 10
 GameCheck.has("var", [5, 6], {greater: 50});       =>  vars ≥ 50
 GameCheck.has("switch", [7], {state: true});       =>  switch 7 is ON
 GameCheck.has("gold", 0, {min: 1000});             =>  ≥ 1000 gold


 Item, Weapon, Armor
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 Items has 3 kind of types, "item", "weapon" and "armor".
 default for boolean "any" is true, equipped is false.

 any: boolean             =>  true = passes if any item matches, false = all must match
 more: number             =>  must have ≥ this many of each item
 less: number             =>  must have ≤ this many of each item
 between: [min,max]       =>  must have between min and max of each item
 equipped: boolean        =>  true = must be equipped, false = must NOT be equipped

 Examples:
 GameCheck.has("item", [1,2,3]);                     =>  has all items 1,2,3
 GameCheck.has("weapon", [5], {equipped: true});     =>  weapon 5 equipped
 GameCheck.has("armor", [2,3], {more: 2});           =>  at least 2 of armor 2 & 3
 GameCheck.has("item", [1,2], {between: [1,3]});     =>  between 1 and 3 of items 1 & 2


 Variables
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 To check variables, you can use "var" or "variable", default booleans are true.
 The following objects are available:
 
 equal: number|string|array     =>  variable must equal this (or any in array)
 not: number|string|array       =>  variable must NOT equal this (or any in array)
 greater: number                =>  variable ≥ this
 less: number                   =>  variable ≤ this
 between: [min, max]            =>  variable between min and max inclusive
 range: [startId, endId]        =>  dynamically check variables from startId ~ endId inclusive
 any: boolean                   =>  true = passes if any variable matches, false = all must match

 Examples:
 GameCheck.has("var", [5,6], {equal: [10,12]});            =>  variable 5 or 6 = 10 or 12
 GameCheck.has("var", [6], {equal: ["opt","dir"]});        =>  variable 6 = "opt" or "dir"
 GameCheck.has("var", [5,6], {greater: 50, any: false});   =>  both variables ≥ 50
 GameCheck.has("var", [], {range: [3,6], equal: 5});       =>  variables 3,4,5,6 equal 5
 GameCheck.has("var", [5], {between: [4,10]});             =>  variable 5 between 4 and 10


 Switches
 ͞ ͞ ͞ ͞ ͞ ͞ ͞ ͞
 Switch checks are used by "sw" or "switch".
 Default booleans are true.

 state: boolean              =>  true = ON, false = OFF
 any: boolean                =>  true = passes if any switch matches, false = all must match
 range: [startId,endId]      =>  check range of switches from startId ~ endId inclusive

 Examples:
 GameCheck.has("switch", [4,5], {state: true});                        => switches 4 & 5 ON
 GameCheck.has("switch", [], {range: [3,6], state: false, any: true}); => any of switches 3~6 OFF


 Gold
 ͞ ͞ ͞ ͞
 min: number               =>  must have ≥ this amount
 max: number               =>  must have ≤ this amount
 between: [min,max]        =>  must have gold ≥ min AND ≤ max

 Examples:
 GameCheck.has("gold", 500);                       =>  ≥ 500 gold
 GameCheck.has("gold", 0, {min: 100});             =>  ≥ 100 gold
 GameCheck.has("gold", 0, {max: 100});             =>  ≤ 100 gold
 GameCheck.has("gold", 0, {between: [300,600]});   =>  gold between 300 & 600

=== TERMS OF USE ===
Free for Non-Commercial and Commercial use when credit is given.
credit one of the following:
ShadowDragon
ShadowDragonJB


=== WARNING ===
YOU ARE NOT ALLOWED TO:
* MODIFY without permission
* EXTEND without permission
* TAKE CODE without permission
* CLAIM AS YOU MADE IT
* REDISTRIBUTE but link back to the forum or itch.io
* SELL this product as standalone.
* DO NOT REMOVE THE HEADER.

Download on itch.io (as it require my SDJB_Base (main or mini))
Plugin is released, not in the help file yet is the use of the checks
for || or && for multiple checks.
if you have any suggestions, feedback, bugs, let me know, I did just
a quick test on each method so it works, so if it may collide, let it know.

if you have other idea's, drop it in as well and I see what I can do.

I can't test MZ, so if you have it, see if it works as it doesn't have the tag
on it, but it make your conditional checks user friendly easy to use,
no complication as it is readable ^^

as I did like ConditionalBranch+ by mjshi, it has so many checks,
so I rewrote the entire plugin from scratch in a more unified form.

Enjoy the plugin, hope it is of use for you all =)

Original thread: https://forums.rpgmakerweb.com/threads/sdjb_conditionalbranch.180767/