Skip to content

Commit db3f6ee

Browse files
committed
1.2.1 API update
1 parent 176e076 commit db3f6ee

2 files changed

Lines changed: 40 additions & 5 deletions

File tree

ClickerCompat.cs

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,18 +227,50 @@ public static float GetClickerRadius(Player player)
227227
/// Call to get the players' click amount (how many clicks done)
228228
/// </summary>
229229
/// <param name="player">The player</param>
230-
public static float GetClickAmount(Player player)
230+
public static int GetClickAmount(Player player)
231231
{
232-
return ClickerClass?.Call("GetPlayerStat", versionString, player, "clickAmount") as float? ?? 0;
232+
return ClickerClass?.Call("GetPlayerStat", versionString, player, "clickAmount") as int? ?? 0;
233233
}
234234

235235
/// <summary>
236236
/// Call to get the players' total clicks required for the next effect to trigger
237237
/// </summary>
238238
/// <param name="player">The player</param>
239-
public static float GetClickerAmountTotal(Player player)
239+
public static int GetClickerAmountTotal(Player player)
240240
{
241-
return ClickerClass?.Call("GetPlayerStat", versionString, player, "clickerAmountTotal") as float? ?? 1;
241+
return ClickerClass?.Call("GetPlayerStat", versionString, player, "clickerAmountTotal") as int? ?? 1;
242+
}
243+
244+
/// <summary>
245+
/// Call to check if the player is wearing a specific set. Supported sets:
246+
/// Motherboard, Overclock, Precursor, Mice
247+
/// </summary>
248+
/// <param name="player">The player</param>
249+
public static bool GetArmorSet(Player player, string set)
250+
{
251+
return ClickerClass?.Call("GetArmorSet", versionString, player, set) as bool? ?? false;
252+
}
253+
254+
/// <summary>
255+
/// Call to check if a specific accessory effect is enabled (i.e. "Gamer Crate" will have multiple effects enabled). Supported accessories:
256+
/// ChocolateChip, EnchantedLED, HandCream, StickyKeychain, GlassOfMilk, Cookie, ClickingGlove, AncientClickingGlove, RegalClickingGlove.
257+
/// Visual variants (i.e. EnchantedLED2) are not gettable
258+
/// </summary>
259+
/// <param name="player">The player</param>
260+
public static bool GetAccessory(Player player, string accessory)
261+
{
262+
return ClickerClass?.Call("GetAccessory", versionString, player, accessory) as bool? ?? false;
263+
}
264+
265+
/// <summary>
266+
/// Call to set a specific player accessory effect (i.e. to emulate "Gamer Crate" you need to have set multiple effects). Supported accessories:
267+
/// ChocolateChip, EnchantedLED, HandCream, StickyKeychain, GlassOfMilk, Cookie, ClickingGlove, AncientClickingGlove, RegalClickingGlove.
268+
/// EnchantedLED and Cookie have a variant with "2" added to them that is a visual variation.
269+
/// </summary>
270+
/// <param name="player">The player</param>
271+
public static void SetAccessory(Player player, string accessory)
272+
{
273+
ClickerClass?.Call("SetAccessory", versionString, player, accessory);
242274
}
243275

244276
/// <summary>

Items/Accessories/ExampleClickerAccessory.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace ClickerClassExampleMod.Items.Accessories
88
//Sample code for a clicker related item
99
public class ExampleClickerAccessory : ModItem
1010
{
11-
//Optional, if you only want this item to exist only when Clicker Class is enabled
11+
//Optional, if you want this item to exist only when Clicker Class is enabled
1212
public override bool Autoload(ref string name)
1313
{
1414
return ClickerCompat.ClickerClass != null;
@@ -43,6 +43,9 @@ public override void UpdateAccessory(Player player, bool hideVisual)
4343
ClickerCompat.SetDamageAdd(player, 0.2f);
4444
ClickerCompat.SetClickerBonusAdd(player, 1);
4545

46+
//Enables the special effect of the "Glass Of Milk" accessory
47+
ClickerCompat.SetAccessory(player, "GlassOfMilk");
48+
4649
//Makes the radius go in a wave motion from 0 to 100 additional pixels
4750
float fluct = 1f + (float)Math.Sin(2 * Math.PI * (Main.GameUpdateCount % 60) / 60f);
4851
ClickerCompat.SetClickerRadiusAdd(player, fluct / 2);

0 commit comments

Comments
 (0)