Skip to content

Commit c5b5aaa

Browse files
committed
v1.3.2.6 API
1 parent d26436d commit c5b5aaa

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

ClickerCompat.cs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal class ClickerCompat : ModSystem
2323

2424
//This is the version of the calls that are used for the mod.
2525
//If Clicker Class updates, it will keep working on the outdated calls, but new features might not be available
26-
internal static readonly Version apiVersion = new Version(1, 3, 2);
26+
internal static readonly Version apiVersion = new Version(1, 3, 2, 6);
2727

2828
internal static string versionString;
2929

@@ -332,6 +332,16 @@ internal static void SetDust(Item item, int type)
332332
ClickerClass?.Call("SetDust", versionString, item, type);
333333
}
334334

335+
/// <summary>
336+
/// Call in <see cref="ModItem.SetDefaults"/> for a clicker item to assign it an accessory type, so that items with that accessory type cannot be equipped together. Supported types:
337+
/// ClickingGlove
338+
/// </summary>
339+
/// <param name="item">The clicker class item</param>
340+
internal static void SetAccessoryType(Item item, string accessoryType)
341+
{
342+
ClickerClass?.Call("SetAccessoryType", versionString, item, accessoryType);
343+
}
344+
335345
/// <summary>
336346
/// Call in <see cref="ModItem.SetDefaults"/> for a clicker item to make it display total click count in the tooltip
337347
/// </summary>
@@ -402,7 +412,7 @@ internal static bool GetArmorSet(Player player, string set)
402412

403413
/// <summary>
404414
/// Call to check if a specific accessory effect is enabled (i.e. "Gamer Crate" will have multiple effects enabled). Supported accessories:
405-
/// ChocolateChip, EnchantedLED, EnchantedLED2, HandCream, StickyKeychain, GlassOfMilk, CookieVisual, CookieVisual2, ClickingGlove, AncientClickingGlove, RegalClickingGlove, GoldenTicket, PortableParticleAccelerator, IcePack, MouseTrap, HotKeychain, TriggerFinger, ButtonMasher, AimAssistModule, AimbotModule.
415+
/// ChocolateChip, EnchantedLED, EnchantedLED2, StickyKeychain, GlassOfMilk, CookieVisual, CookieVisual2, ClickingGlove, AncientClickingGlove, RegalClickingGlove, GoldenTicket, PortableParticleAccelerator, MouseTrap, HotKeychain, TriggerFinger, ButtonMasher, AimAssistModule, AimbotModule.
406416
/// </summary>
407417
/// <param name="player">The player</param>
408418
internal static bool GetAccessory(Player player, string accessory)
@@ -412,7 +422,7 @@ internal static bool GetAccessory(Player player, string accessory)
412422

413423
/// <summary>
414424
/// Call to set a specific player accessory effect (i.e. to emulate "Gamer Crate" you need to have set multiple effects). Supported accessories:
415-
/// ChocolateChip, EnchantedLED, EnchantedLED2, HandCream, StickyKeychain, GlassOfMilk, CookieVisual, CookieVisual2, ClickingGlove, AncientClickingGlove, RegalClickingGlove, GoldenTicket, PortableParticleAccelerator, IcePack, MouseTrap, HotKeychain, TriggerFinger, ButtonMasher, AimAssistModule, AimbotModule.
425+
/// ChocolateChip, EnchantedLED, EnchantedLED2, StickyKeychain, GlassOfMilk, CookieVisual, CookieVisual2, ClickingGlove, AncientClickingGlove, RegalClickingGlove, GoldenTicket, PortableParticleAccelerator, MouseTrap, HotKeychain, TriggerFinger, ButtonMasher, AimAssistModule, AimbotModule.
416426
/// </summary>
417427
/// <param name="player">The player</param>
418428
internal static void SetAccessory(Player player, string accessory)
@@ -532,6 +542,18 @@ internal static bool HasClickEffect(Player player, string effect)
532542
{
533543
return ClickerClass?.Call("HasClickEffect", versionString, player, effect) as bool? ?? false;
534544
}
545+
546+
/// <summary>
547+
/// Sets an auto-reuse effect to be applied to the player. Will apply the fastest one onto the player (if there are multiple active ones)
548+
/// </summary>
549+
/// <param name="player">The player</param>
550+
/// <param name="speedFactor">The multiplier to use time of 1 when this effect is active. Rounds down the result, minimum is 2 (game limitation). Example: 6f -> effective use time = 1 * 6f -> 60 / 6f -> 10 cps</param>
551+
/// <param name="controlledByKeyBind">This effect will only be active if the player toggles it using the keybind from Clicker Class dedicated to it</param>
552+
/// <param name="preventsClickEffects">This effect will not activate Click Effects while active</param>
553+
internal static void SetAutoReuseEffect(Player player, float speedFactor, bool controlledByKeyBind = false, bool preventsClickEffects = false)
554+
{
555+
ClickerClass?.Call("SetAutoReuseEffect", versionString, player, speedFactor, controlledByKeyBind, preventsClickEffects);
556+
}
535557
#endregion
536558
}
537559
}

Items/Accessories/ExampleClickerAccessory.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ public override void SetStaticDefaults()
2525
"Reduces the amount of clicks required for a click effect by 1" + "\n" +
2626
"Gain up to 15% clicker damage based on your amount of clicks within a second" + "\n" +
2727
"Every 15 clicks releases a burst of damaging chocolate" + "\n" +
28-
"Makes the radius pulsate up to 50% of the default radius");
28+
"Makes the radius pulsate up to 50% of the default radius" + "\n" +
29+
"Pressing the '{$Mods.ClickerClass.Hotkeys.ClickerAccessory}' key will toggle auto click on all Clickers" + "\n" +
30+
"While auto click is enabled, click rates are moderately decreased");
2931
}
3032

3133
public override void SetDefaults()
3234
{
35+
//To prevent this accessory from being equippable with similar ones of the same archetype (if it exists in the base mod), use this:
36+
//ClickerCompat.SetAccessoryType(Item, "ClickingGlove");
3337
Item.width = 28;
3438
Item.height = 20;
3539
Item.value = 100000;
@@ -52,10 +56,14 @@ public override void UpdateAccessory(Player player, bool hideVisual)
5256
//ClickerCompat.SetAccessoryItem(player, "Cookie", Item);
5357
//ClickerCompat.SetAccessory(player, "CookieVisual");
5458

55-
//Enabled the click effect given by Chocolate Chip
59+
//Enables the click effect given by Chocolate Chip
5660
//You can use Clicker Classes base effects (you can find them in the source code), or your own ones
5761
ClickerCompat.EnableClickEffect(player, "ClickerClass:ChocolateChip");
5862

63+
//Sets an auto-reuse effect to be applied to the player for all clickers
64+
//In this case, it will make the clickers have a use time of 5 (resulting in 12 cps), and it will only work if the player uses the Clicker Class hotkey for toggling auto-reuse
65+
ClickerCompat.SetAutoReuseEffect(player, 5f, true, false);
66+
5967
//How to check if an effect is enabled for the player
6068
bool hasChocolateChip = ClickerCompat.HasClickEffect(player, "ClickerClass:ChocolateChip");
6169

0 commit comments

Comments
 (0)