[go: up one dir, main page]

Menu

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

Download this file

125 lines (104 with data), 4.8 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
114
115
116
117
118
119
120
121
122
123
124
/**********************************************************************************
* 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 ARMORLIST_H
#define ARMORLIST_H
#include <QObject>
#include <QVector>
#include <QVariant>
#include <QDebug>
// This should match the DB schema
struct ArmorItem
{
QVariant id; // A unique ID for each base armor type
QString Name; // The name of the base armor type
QString Description; // Some descriptive text for the base armor type
QVariant Level; // The level characters should be given access to an armor type
QVariant Category; // Armor 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; // Armor Check Penalty for base armor type
QVariant SpeedPenality; // Penalty to Speed when encumbered by this armor
QVariant Strength; // Strengh score you need to eliminated Armor Check Penalty and Speed Penalty
QVariant Bulk; // Bulk of Armor (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 "ArmorGroup" table
QVariant Traits; // List of traits separated by "/" for armor type
QVariant Hardness; // Hardness value of armor type
QVariant HP; // Hit ponits of armor type
QVariant BT; // Broken Threasholed for armor type
QVariant Source; // Source book code that armor type was introduced in
QVariant Page; // Page that armor type was introduced in
QVariant AON; // Archives of Nethys link info
QVariant CatType; // Set to "A" for Armor, "S" for Shields
};
struct ArmorGroup
{
QVariant id; // Unique ID (used by "Armor" table)
QVariant Name; // Name of armor group
QVariant SpecializationEffect; // Text describing effect if character has armor specialization with this type of armor
};
class Armor : public QObject
{
Q_OBJECT
Q_PROPERTY(QVariant armorfilter WRITE setStatus NOTIFY statusChanged)
public:
explicit Armor(QObject *parent = nullptr);
void setStatus(QVariant i);
bool showShields();
Q_INVOKABLE void setShowShields(QObject *A, bool newVle);
bool showArmor();
Q_INVOKABLE void setShowArmor(QObject *A, bool newVle);
void statusChanged();
QVector<ArmorItem> items() const;
QVector<ArmorGroup> groups() const;
Q_INVOKABLE void sortCol(QObject *A, int sorton);
static QVariant groupToTxt(QVariant id); // Takes Group ID String from Armor and returns String Info
static QVariant traitToTxt(QVariant trait); // Takes Trait value and returns string info
bool setItemAt(int index, const ArmorItem &item);
enum {
UNARMORED = 1,
LIGHT = 1 << 1,
MEDIUM = 1 << 2,
HEAVY = 1 << 3,
};
Q_INVOKABLE void setUnarmored(bool vle);
Q_INVOKABLE void setLight(bool vle);
Q_INVOKABLE void setMedium(bool vle);
Q_INVOKABLE void setHeavy(bool vle);
signals:
void preArmorAppended();
void postArmorAppended();
void listChanged();
private:
QVector<ArmorItem> mItems; // Items to show in model
QVector<ArmorItem> allItems; // All Items loaded from Rules.db
QVector<ArmorGroup> mGroups;
int filter;
bool sShields=true;
bool sArmor=true;
bool unarmored=true;
bool light=true;
bool medium=true;
bool heavy=true;
void updateList();
int defColSort=0;
QStringList sList; // Holds a list of source codes for sorting
};
//Whatever::~Whatever(){}
#endif // ARMORLIST_H