Skip to content

Commit e00102b

Browse files
committed
Initial commit
0 parents  commit e00102b

17 files changed

+13004
-0
lines changed

HSC.pro

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
QT += core gui xml
2+
3+
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
4+
5+
CONFIG += c++17
6+
RC_ICONS = HeroSystem.ico
7+
8+
# You can make your code fail to compile if it uses deprecated APIs.
9+
# In order to do so, uncomment the following line.
10+
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
11+
12+
SOURCES += \
13+
character.cpp \
14+
main.cpp \
15+
mainwindow.cpp \
16+
setupdialog.cpp
17+
18+
HEADERS += \
19+
character.h \
20+
mainwindow.h \
21+
setupdialog.h
22+
23+
FORMS += \
24+
mainwindow.ui \
25+
setupdialog.ui
26+
27+
# Default rules for deployment.
28+
qnx: target.path = /tmp/$${TARGET}/bin
29+
else: unix:!android: target.path = /opt/$${TARGET}/bin
30+
!isEmpty(target.path): INSTALLS += target
31+
32+
DISTFILES += \
33+
../Installer/config/config.xml \
34+
../Installer/packages/com.vendor.product/meta/license.txt \
35+
../Installer/packages/com.vendor.product/meta/package.xml \
36+
android/AndroidManifest.xml \
37+
android/build.gradle \
38+
android/gradle.properties \
39+
android/gradle/wrapper/gradle-wrapper.jar \
40+
android/gradle/wrapper/gradle-wrapper.properties \
41+
android/gradlew \
42+
android/gradlew.bat \
43+
android/res/values/libs.xml \
44+
white_knight.dump
45+
46+
contains(ANDROID_TARGET_ARCH,arm64-v8a) {
47+
ANDROID_PACKAGE_SOURCE_DIR = \
48+
$$PWD/android
49+
}

HSC.pro.user

+284
Large diffs are not rendered by default.

HeroSystem.ico

115 KB
Binary file not shown.

HeroSystem.pdn

95.4 KB
Binary file not shown.

HeroSystem.png

32.8 KB
Loading

basicconfiguration.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#include "basicconfiguration.h"
2+
3+
BasicConfiguration::BasicConfiguration()
4+
{
5+
6+
}

basicconfiguration.h

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef BASICCONFIGURATION_H
2+
#define BASICCONFIGURATION_H
3+
4+
#include <QObject>
5+
6+
class BasicConfiguration
7+
{
8+
public:
9+
BasicConfiguration();
10+
11+
QString basePoints = "";
12+
QString experience = "";
13+
QString disadPpoints = "";
14+
};
15+
16+
#endif // BASICCONFIGURATION_H

character.cpp

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
#include "character.h"
2+
3+
Character::Character() {
4+
5+
}
6+
7+
void Character::load(QDomDocument& xml) {
8+
basicConfiguration.load(xml);
9+
characterInfo.load(xml);
10+
characteristics.load(xml);
11+
skills.list.load(xml, "SKILLS");
12+
perks.list.load(xml, "PERKS");
13+
talents.list.load(xml, "TALENTS");
14+
martialArts.list.load(xml, "MARTIALARTS", "MANEUVER");
15+
powers.load(xml);
16+
disadvantages.list.load(xml, "DISADVANTAGES", "DISAD");
17+
equipment.load(xml);
18+
image.load(xml);
19+
}
20+
21+
void Character::BasicConfiguration::load(QDomDocument& xml) {
22+
QDomElement chr = xml.firstChildElement("CHARACTER");
23+
QDomElement conf = chr.firstChildElement("BASIC_CONFIGURATION");
24+
25+
basePoints = conf.attribute("BASE_POINTS");
26+
experience = conf.attribute("EXPERIENCE");
27+
disadPoints = conf.attribute("DISAD_POINTS");
28+
}
29+
30+
void Character::CharacterInfo::load(QDomDocument& xml) {
31+
QDomElement chr = xml.firstChildElement("CHARACTER");
32+
QDomElement conf = chr.firstChildElement("CHARACTER_INFO");
33+
34+
background = conf.firstChildElement("BACKGROUND").text();
35+
personality = conf.firstChildElement("PERSONALITY").text();
36+
quote = conf.firstChildElement("QUOTE").text();
37+
tactics = conf.firstChildElement("TACTICS").text();
38+
campaignUse = conf.firstChildElement("CAMPAIGN_USE").text();
39+
appearance = conf.firstChildElement("APPEARANCE").text();
40+
41+
alternateIdentities = conf.attribute("ALTERNATE_IDENTITIES");
42+
hairColor = conf.attribute("HAIR_COLOR");
43+
playerName = conf.attribute("PLAYER_NAME");
44+
height = conf.attribute("HEIGHT");
45+
genre = conf.attribute("GENRE");
46+
characterName = conf.attribute("CHARACTER_NAME");
47+
eyeColor = conf.attribute("EYE_COLOR");
48+
gm = conf.attribute("GM");
49+
campaignName = conf.attribute("CAMPAIGN_NAME");
50+
weight = conf.attribute("WEIGHT");
51+
}
52+
53+
void Character::Base::load(QDomElement& e) {
54+
auto nodes = e.attributes();
55+
int count = nodes.count();
56+
for (int i = 0; i < count; ++i) {
57+
QDomAttr node = nodes.item(i).toAttr();
58+
if (node.isNull()) continue;
59+
attributes[node.name()] = node.value();
60+
}
61+
attributes["NOTES"] = e.firstChildElement("NOTES").text();
62+
}
63+
64+
int Character::getPrimary(const QString& stat) {
65+
QMap<QString, int> base {
66+
{ "STR", 10 }, { "DEX", 10 }, { "CON", 10 }, { "INT", 10 }, { "EGO", 10 }, { "PRE", 10 }, { "OCV", 3 }, { "DCV", 3 }, { "OMCV", 3 }, { "DMCV", 3 },
67+
{ "SPD", 2 }, { "PD", 2 }, { "ED", 2 }, { "REC", 4 }, { "END", 20 }, { "BODY", 10 }, { "STUN", 20 }, { "RUNNING", 12 }, { "SWIMMING", 4 }, { "LEAPING", 4 }
68+
};
69+
int level = base[stat] + characteristics.characteristics[stat].getLevels() + powers.getPrimaries(stat);
70+
if (stat == "PD" || stat == "ED") {
71+
level += talents.getPrimaries("COMBAT_LUCK");
72+
level += powers.getPrimaries("FORCEFIELD", stat);
73+
}
74+
return level;
75+
}
76+
77+
int Character::getSecondary(const QString& stat) {
78+
int level = powers.getSecondaries(stat);
79+
if (stat == "PD" || stat == "ED") {
80+
level += talents.getSecondaries("COMBAT_LUCK");
81+
level += powers.getSecondaries("FORCEFIELD", stat);
82+
}
83+
return level;
84+
}
85+
86+
int Character::getPrimaryResistant(const QString& stat) {
87+
int level = 0;
88+
level += talents.getPrimaries("COMBAT_LUCK");
89+
level += powers.getPrimaries("FORCEFIELD", stat);
90+
return level;
91+
}
92+
93+
int Character::getSecondaryResistant(const QString& stat) {
94+
int level = 0;
95+
level += talents.getSecondaries("COMBAT_LUCK");
96+
level += powers.getSecondaries("FORCEFIELD", stat);
97+
return level;
98+
}
99+
100+
int Character::Talents::getPrimaries(const QString& statName) {
101+
int primary = 0;
102+
for (const auto& talent: list) {
103+
if (talent.attributes["XMLID"] == statName) {
104+
if (talent.attributes["AFFECTS_TOTAL"] == "Yes" &&
105+
talent.attributes["AFFECTS_PRIMARY"] == "Yes") primary += talent.attributes["LEVELS"].toInt() * 3;
106+
}
107+
}
108+
return primary;
109+
}
110+
111+
int Character::Talents::getSecondaries(const QString& statName) {
112+
int secondary = 0;
113+
for (const auto& talent: list) {
114+
if (talent.attributes["XMLID"] == statName) {
115+
if (talent.attributes["AFFECTS_TOTAL"] == "Yes" &&
116+
talent.attributes["AFFECTS_PRIMARY"] == "No") secondary += talent.attributes["LEVELS"].toInt() * 3;
117+
}
118+
}
119+
return secondary;
120+
}
121+
122+
int Character::Powers::getPrimaries(const QString& statName) {
123+
int primary = 0;
124+
for (auto& power: items) {
125+
Stat* stat = std::get_if<Stat>(&power);
126+
if (stat == nullptr) continue;
127+
if (stat->attributes["XMLID"] == statName) {
128+
if (stat->attributes["AFFECTS_TOTAL"] == "Yes" &&
129+
stat->attributes["AFFECTS_PRIMARY"] == "Yes") primary += stat->attributes["LEVELS"].toInt();
130+
}
131+
}
132+
return primary;
133+
}
134+
135+
int Character::Powers::getSecondaries(const QString& statName) {
136+
int secondary = 0;
137+
for (auto& power: items) {
138+
Stat* stat = std::get_if<Stat>(&power);
139+
if (stat == nullptr) continue;
140+
if (stat->attributes["XMLID"] == statName) {
141+
if (stat->attributes["AFFECTS_TOTAL"] == "Yes" &&
142+
stat->attributes["AFFECTS_PRIMARY"] == "No") secondary += stat->attributes["LEVELS"].toInt();
143+
}
144+
}
145+
return secondary;
146+
}
147+
148+
int Character::Powers::getPrimaries(const QString& powerName, const QString& where) {
149+
int primary = 0;
150+
for (auto& power: items) {
151+
Power* pwr = std::get_if<Power>(&power);
152+
if (pwr == nullptr) continue;
153+
if (pwr->attributes["XMLID"] == powerName) {
154+
if (pwr->attributes["AFFECTS_TOTAL"] == "Yes" &&
155+
pwr->attributes["AFFECTS_PRIMARY"] == "Yes") primary += pwr->attributes[where + "LEVELS"].toInt();
156+
}
157+
}
158+
return primary;
159+
}
160+
161+
int Character::Powers::getSecondaries(const QString& powerName, const QString& where) {
162+
int secondary = 0;
163+
for (auto& power: items) {
164+
Power* pwr = std::get_if<Power>(&power);
165+
if (pwr == nullptr) continue;
166+
if (pwr->attributes["XMLID"] == powerName) {
167+
if (pwr->attributes["AFFECTS_TOTAL"] == "Yes" &&
168+
pwr->attributes["AFFECTS_PRIMARY"] == "No") secondary += pwr->attributes[where + "LEVELS"].toInt();
169+
}
170+
}
171+
return secondary;
172+
}

0 commit comments

Comments
 (0)