Пример #1
0
    /// <summary>
    /// Checks to see if the <see cref="StorageSlotSource"/> prevents the corresponding slot from being overwritten.
    /// </summary>
    /// <param name="value">Flag value</param>
    /// <returns>True if write protected</returns>
    public static bool IsOverwriteProtected(this StorageSlotSource value)
    {
        if (value.HasFlagFast(StorageSlotSource.Locked))
        {
            return(true);
        }

        if (value.HasFlagFast(StorageSlotSource.Starter))
        {
            return(true);
        }

        return(value.IsBattleTeam() >= 0);
    }
Пример #2
0
    /// <summary>
    /// Gets the Party Slot Index the <see cref="value"/> belongs to
    /// </summary>
    /// <param name="value">Flag value</param>
    /// <returns>[0,5] if valid, -1 otherwise.</returns>
    public static int IsParty(this StorageSlotSource value)
    {
        if (value.HasFlagFast(StorageSlotSource.Party1))
        {
            return(0);
        }
        if (value.HasFlagFast(StorageSlotSource.Party2))
        {
            return(1);
        }
        if (value.HasFlagFast(StorageSlotSource.Party3))
        {
            return(2);
        }
        if (value.HasFlagFast(StorageSlotSource.Party4))
        {
            return(3);
        }
        if (value.HasFlagFast(StorageSlotSource.Party5))
        {
            return(4);
        }
        if (value.HasFlagFast(StorageSlotSource.Party6))
        {
            return(5);
        }

        return(-1);
    }
Пример #3
0
    /// <summary>
    /// Gets the Battle Team ID the <see cref="value"/> belongs to
    /// </summary>
    /// <param name="value">Flag value</param>
    /// <returns>Battle Team ID if valid, -1 otherwise.</returns>
    public static int IsBattleTeam(this StorageSlotSource value)
    {
        if (value.HasFlagFast(StorageSlotSource.BattleTeam1))
        {
            return(0);
        }
        if (value.HasFlagFast(StorageSlotSource.BattleTeam2))
        {
            return(1);
        }
        if (value.HasFlagFast(StorageSlotSource.BattleTeam3))
        {
            return(2);
        }
        if (value.HasFlagFast(StorageSlotSource.BattleTeam4))
        {
            return(3);
        }
        if (value.HasFlagFast(StorageSlotSource.BattleTeam5))
        {
            return(4);
        }
        if (value.HasFlagFast(StorageSlotSource.BattleTeam6))
        {
            return(5);
        }

        return(-1);
    }