[go: up one dir, main page]

Menu

[4fe084]: / specarmor.h  Maximize  Restore  History

Download this file

114 lines (94 with data), 4.4 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**********************************************************************************
* Copyright 2020-2022 Michael McBride
*
* This file is part of PF2 Character Manager
*
* PF2 Character Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
**********************************************************************************/
#ifndef SPECARMOR_H
#define SPECARMOR_H
#include <QObject>
#include <QVector>
#include <QVariant>
#include <QDebug>
// This should match the DB schema
struct SpecArmorItem
{
QVariant id; // A unique ID for each base armor type
QString Name; // The name of the base armor type
QVariant Synonym; // Alternate names of the item
QVariant Level; // The level characters should be given access to an armor type
QString Description; // Some descriptive text for the base armor type
QVariant Category; // SpecArmor category code (U=unarmored, L=Light, M=Medium, H=Heavy)
QVariant Price; // Price in silver pieces for base armor of this type
QVariant ACBonus; // Item bonus to AC for this base armor type
QVariant DEXCap; // Maximum Dexterity modifer Cap for base armor type
QVariant CheckPenality; // SpecArmor Check Penalty for base armor type
QVariant SpeedPenality; // Penalty to Speed when encumbered by this armor
QVariant Strength; // Strengh score you need to eliminated SpecArmor Check Penalty and Speed Penalty
QVariant Bulk; // Bulk of SpecArmor (L=light, 1=1 bulk, 2=2 bulk, etc)
QVariant Group; // Integer of armor group this base armor type belongs. This is a lookup for "SpecArmorGroup" table
QVariant Source; // Source book code that armor type was introduced in
QVariant Page; // Page that armor type was introduced in
QVariant CatType; // Set to "SA" for SpecArmor, "SS" for Specific Shields
QVariant BaseID;
QVariant Potency; // Potency Runes
QVariant Rarity;
};
struct SpecArmorGroup
{
QVariant id; // Unique ID (used by "SpecArmor" table)
QVariant Name; // Name of armor group
QVariant SpecializationEffect; // Text describing effect if character has armor specialization with this type of armor
};
class SpecArmor : public QObject
{
Q_OBJECT
Q_PROPERTY(QVariant specArmorfilter WRITE setStatus NOTIFY statusChanged)
public:
explicit SpecArmor(QObject *parent = nullptr);
void setStatus(QVariant i);
bool showShields();
Q_INVOKABLE void setShowShields(QObject *A, bool newVle);
bool showSpecArmor();
Q_INVOKABLE void setShowSpecArmor(QObject *A, bool newVle);
void statusChanged();
QVector<SpecArmorItem> items() const;
QVector<SpecArmorGroup> groups() const;
Q_INVOKABLE void sortCol(QObject *A, int sorton);
static QVariant groupToTxt(QVariant id); // Takes Group ID String from SpecArmor and returns String Info
// static QVariant traitToTxt(QVariant trait); // Takes Trait value and returns string info
// bool setItemAt(int index, const SpecArmorItem &item);
enum {
UNARMORED = 1,
LIGHT = 1 << 1,
MEDIUM = 1 << 2,
HEAVY = 1 << 3,
};
signals:
void preSpecArmorAppended();
void postSpecArmorAppended();
void listChanged();
private:
QVector<SpecArmorItem> mItems; // Items to show in model
QVector<SpecArmorItem> allItems; // All Items loaded from Rules.db
QVector<SpecArmorGroup> mGroups;
int filter;
bool sShields=true;
bool sSpecArmor=true;
void updateList();
int defColSort=0;
QStringList sList; // Holds a list of source codes for sorting
};
#endif // SPECARMOR_H