Class TrinketTinkerEffect
- Namespace
- TrinketTinker.Effects
- Assembly
- TrinketTinker.dll
Base class for TrinketTinker trinkets, allows extensible companions with extensible abilities.
public class TrinketTinkerEffect : TrinketEffect
- Inheritance
-
TrinketEffectTrinketTinkerEffect
- Inherited Members
-
TrinketEffect.TrinketTrinketEffect.GeneralStatTrinketEffect.Companion
Remarks
Constructor
Constructors
TrinketTinkerEffect(Trinket)
Base class for TrinketTinker trinkets, allows extensible companions with extensible abilities.
public TrinketTinkerEffect(Trinket trinket)
Parameters
trinket
Trinket
Remarks
Constructor
Fields
IN_COMBAT_CD
Miliseconds
public const double IN_COMBAT_CD = 10000
Field Value
ModData_Enabled
ModData inventory guid
public static readonly string ModData_Enabled
Field Value
ModData_Inventory
ModData inventory guid
public static readonly string ModData_Inventory
Field Value
ModData_Level
ModData variant key
public static readonly string ModData_Level
Field Value
ModData_Variant
ModData variant key
public static readonly string ModData_Variant
Field Value
Properties
CompanionAnchor
Anchor position of companion.
public Vector2? CompanionAnchor { get; }
Property Value
- Vector2?
CompanionBoundingBox
Companion bounding box.
public Rectangle CompanionBoundingBox { get; }
Property Value
- Rectangle
CompanionOwnerDrawLayer
Draw layer of owner.
public float CompanionOwnerDrawLayer { get; }
Property Value
CompanionPosOff
Position of companion with offset.
public Vector2? CompanionPosOff { get; }
Property Value
- Vector2?
CompanionPosition
Position of companion without offset.
public Vector2? CompanionPosition { get; }
Property Value
- Vector2?
CompanionSpeaker
Companion bounding box.
public ChatterSpeaker? CompanionSpeaker { get; }
Property Value
FullInventoryId
Full ID, including mod id item id and guid
public string? FullInventoryId { get; }
Property Value
InventoryId
Inventory Id, for use in TrinketTinker.Extras.GlobalInventoryHandler
public string? InventoryId { get; }
Property Value
Level
Level is GeneralStat
public int Level { get; }
Property Value
MaxLevel
Number of ability levels
public int MaxLevel { get; }
Property Value
MaxVariant
Number of variant levels
public int MaxVariant { get; }
Property Value
Variant
Variant is tracked by mod data as string, parse it here
public int Variant { get; }
Property Value
Methods
AddItemToInventory(Item)
public Item? AddItemToInventory(Item item)
Parameters
item
Item
Returns
- Item
Apply(Farmer)
Spawn the companion, and activate all abilities
public override void Apply(Farmer farmer)
Parameters
farmer
Farmer
CanAcceptThisItem(Item)
public bool CanAcceptThisItem(Item item)
Parameters
item
Item
Returns
CompanionIsFacing(Vector2)
Companion is facing a particl.
public bool CompanionIsFacing(Vector2 pos)
Parameters
pos
Vector2
Returns
GenerateRandomStats(Trinket)
For some reason random stats here get rolled again whenever the sprite is reloaded, prefer not to do that.
public override bool GenerateRandomStats(Trinket trinket)
Parameters
trinket
Trinket
Returns
GetInventory()
Get inventory of trinket, if there is one
public Inventory? GetInventory()
Returns
- Inventory
GetMaxUnlockedLevel(Trinket)
Get max unlocked level by GSQ
public int GetMaxUnlockedLevel(Trinket trinket)
Parameters
trinket
Trinket
Returns
GetMaxUnlockedVariant(Trinket)
Get max unlocked variant by GSQ
public int GetMaxUnlockedVariant(Trinket trinket)
Parameters
trinket
Trinket
Returns
OnDamageMonster(Farmer, Monster, int, bool, bool)
Handle the player dealing damage to a monster.
public override void OnDamageMonster(Farmer farmer, Monster monster, int damageAmount, bool isBomb, bool isCriticalHit)
Parameters
farmer
FarmerThe player with the trinket equipped.
monster
MonsterThe monster which was damaged.
damageAmount
intThe amount of damage that was dealt.
isBomb
boolWhether the damage is from a bomb.
isCriticalHit
boolWhether the attack which caused the damage was a critical hit.
OnFootstep(Farmer)
Handle the player having taken a step.
public override void OnFootstep(Farmer farmer)
Parameters
farmer
FarmerThe player with the trinket equipped.
OnInteract(Farmer)
public virtual void OnInteract(Farmer farmer)
Parameters
farmer
Farmer
OnPlayerWarped(Farmer, GameLocation, GameLocation)
public virtual void OnPlayerWarped(Farmer farmer, GameLocation oldLocation, GameLocation newLocation)
Parameters
farmer
FarmeroldLocation
GameLocationnewLocation
GameLocation
OnReceiveDamage(Farmer, int)
Handle the player having received damage.
public override void OnReceiveDamage(Farmer farmer, int damageAmount)
Parameters
farmer
FarmerThe player with the trinket equipped.
damageAmount
intThe amount of damage that was taken.
OnTrigger(Farmer, string[], TriggerActionContext)
Handle the trigger.
public virtual void OnTrigger(Farmer farmer, string[] args, TriggerActionContext context)
Parameters
farmer
Farmerargs
string[]context
TriggerActionContext
OnUse(Farmer)
Handle the player performing a use action on the trinket.
public override void OnUse(Farmer farmer)
Parameters
farmer
FarmerThe player using the trinket.
RerollLevel(Trinket, int)
Randomize this trinket's ability level through anvil, return true if the level is rerolled. Will not roll the same level.
public virtual bool RerollLevel(Trinket trinket, int previous)
Parameters
trinket
Trinketprevious
int
Returns
RerollVariant(Trinket, int)
Randomize this trinket's variant through trinket colorizer, return true if the variant is rerolled. Will not roll the same variant.
public virtual bool RerollVariant(Trinket trinket, int previous)
Parameters
trinket
Trinketprevious
int
Returns
ResetVariant(Trinket)
Reset trinket variant icon to modData value
public void ResetVariant(Trinket trinket)
Parameters
trinket
Trinket
SetAltVariant(string)
public void SetAltVariant(string altVariantKey)
Parameters
altVariantKey
string
SetLevel(Trinket, int)
Set level
public bool SetLevel(Trinket trinket, int generalStat)
Parameters
trinket
TrinketgeneralStat
int
Returns
SetOneshotClip(string?)
public void SetOneshotClip(string? clipKey)
Parameters
clipKey
string
SetSpeechBubble(string)
public void SetSpeechBubble(string speechBubbleKey)
Parameters
speechBubbleKey
string
SetVariant(Trinket, int)
Set trinket variant
public bool SetVariant(Trinket trinket, int variant)
Parameters
trinket
Trinketvariant
int
Returns
Unapply(Farmer)
Remove the companion, and deactivate all abilities
public override void Unapply(Farmer farmer)
Parameters
farmer
Farmer
Update(Farmer, GameTime, GameLocation)
Update every tick. Not an event because this happens for every ability regardless of ProcOn.
public override void Update(Farmer farmer, GameTime time, GameLocation location)
Parameters
farmer
Farmertime
GameTimelocation
GameLocation