Table of Contents

Class PetSlotRules

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

How many pets a character may keep out, and which one a new summon replaces. Pure.

public static class PetSlotRules
Inheritance
PetSlotRules
Inherited Members

Remarks

Two limits apply. A character has the pet slots its Pet Slots character attribute gives it (PetSlots: one unless an archetype, an item or a buff raises it), and each summon spell carries its own maximum (MaxPets): a spell that may raise three wolves still raises one for a character with one slot.

A summon past either limit replaces the oldest pet in its way rather than failing: past the spell's limit, the oldest pet of that spell; past the slots, the oldest pet of any kind. That is what a summon did when a character could only have one pet.

A pet keeps the slot it was given for as long as it is out, and the database stores each pet under its slot. A slot is not a list position: when the first of two pets dies the second stays in slot 1.

Fields

AttributeName

The character attribute that holds a character's pet slots. Its asset starts at DefaultSlots, so an archetype, an item or a buff grants slots the way it moves any other attribute.

public const string AttributeName = "Pet Slots"

Field Value

string

DefaultAttributeID

The template ID of the AttributeName asset, which a pet controller uses unless its prefab names another.

public static readonly int DefaultAttributeID

Field Value

int

DefaultSlots

Pet slots a character has unless an archetype grants more.

public const int DefaultSlots = 1

Field Value

int

MaxSlots

The most slots anything may grant. Bounds what the server accepts and the database stores.

public const int MaxSlots = 8

Field Value

int

Methods

AnyPastSlots(IReadOnlyList<int>, int)

True when a pet holds a slot at or past slots: the slots fell under it and it must go.

public static bool AnyPastSlots(IReadOnlyList<int> usedSlots, int slots)

Parameters

usedSlots IReadOnlyList<int>

The slot of each pet out.

slots int

The character's pet slots now.

Returns

bool

ClampSlots(int)

The character's slot count, clamped to 1..MaxSlots.

public static int ClampSlots(int slots)

Parameters

slots int

Returns

int

IndexToReplace(IReadOnlyList<int>, int, int, int)

Which pet a new summon must replace, or -1 when it fits.

public static int IndexToReplace(IReadOnlyList<int> petTemplateIDs, int templateID, int spellMax, int slots)

Parameters

petTemplateIDs IReadOnlyList<int>

The template of each pet out, oldest first.

templateID int

The template being summoned.

spellMax int

The summon spell's own maximum.

slots int

The character's pet slots.

Returns

int

The index into petTemplateIDs of the pet to dismiss, or -1.

LowestFreeSlot(IReadOnlyList<int>, int)

The lowest slot no pet holds, or -1 when all slots are taken.

public static int LowestFreeSlot(IReadOnlyList<int> usedSlots, int slots)

Parameters

usedSlots IReadOnlyList<int>

The slot of each pet out.

slots int

The character's pet slots.

Returns

int

SlotsFrom(bool, int)

A character's pet slots from its Pet Slots attribute: the attribute's final value, clamped, or DefaultSlots when the character has no such attribute.

public static int SlotsFrom(bool hasAttribute, int finalValue)

Parameters

hasAttribute bool
finalValue int

Returns

int

SpellCap(int, int)

The most pets of one spell a character can have out: the smaller of the spell's own maximum and the character's slots, never less than one.

public static int SpellCap(int spellMax, int slots)

Parameters

spellMax int
slots int

Returns

int