Finish randomizer plumbing.
parent
90d65a9ee3
commit
bdf7e91242
|
@ -111,5 +111,9 @@ enum Skill {
|
||||||
#define JOB_COUNT 20
|
#define JOB_COUNT 20
|
||||||
|
|
||||||
const int tier1_jobs[] = {9, 10, 11, 12, 16, 17, 18};
|
const int tier1_jobs[] = {9, 10, 11, 12, 16, 17, 18};
|
||||||
const int tier2_jobs[] = {2, 13, 14, 13, 1, 19};
|
const int tier2_jobs[] = {1, 2, 13, 14, 15, 19};
|
||||||
const int tier3_jobs[] = {0, 3, 4, 5, 8, 7, 15};
|
const int tier3_jobs[] = {0, 3, 4, 5, 7, 8, 15};
|
||||||
|
|
||||||
|
const int job_tier[] = {
|
||||||
|
3, 2, 2, 3, 3, 3, 0, 3, 3, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2
|
||||||
|
};
|
||||||
|
|
|
@ -258,12 +258,8 @@ void Randomizer::randomizeSkills(void) {
|
||||||
QVector<Skill> *l_tier4 = new QVector<Skill>(*tier4);
|
QVector<Skill> *l_tier4 = new QVector<Skill>(*tier4);
|
||||||
QVector<Skill> *l_tier5 = new QVector<Skill>(*tier5);
|
QVector<Skill> *l_tier5 = new QVector<Skill>(*tier5);
|
||||||
QVector<Skill> *l_tier6 = new QVector<Skill>(*tier6);
|
QVector<Skill> *l_tier6 = new QVector<Skill>(*tier6);
|
||||||
QVector<int> *jobs1 = new QVector<int>(*tier1_jobs);
|
actions = new QVector<Skill>();
|
||||||
QVector<int> *jobs2 = new QVector<int>(*tier2_jobs);
|
|
||||||
QVector<int> *jobs3 = new QVector<int>(*tier3_jobs);
|
|
||||||
actions = new QVector<Skill>(*l_tier6);
|
|
||||||
QVector<Skill> *skills[6];
|
QVector<Skill> *skills[6];
|
||||||
commands = new QVector<Skill>(JOB_COUNT);
|
|
||||||
int tierpos = 0;
|
int tierpos = 0;
|
||||||
|
|
||||||
std::shuffle(l_tier1->begin(), l_tier1->end(), rng);
|
std::shuffle(l_tier1->begin(), l_tier1->end(), rng);
|
||||||
|
@ -279,11 +275,15 @@ void Randomizer::randomizeSkills(void) {
|
||||||
skills[3] = new QVector<Skill>(*l_tier4);
|
skills[3] = new QVector<Skill>(*l_tier4);
|
||||||
skills[4] = new QVector<Skill>(*l_tier5);
|
skills[4] = new QVector<Skill>(*l_tier5);
|
||||||
skills[5] = new QVector<Skill>(*l_tier6);
|
skills[5] = new QVector<Skill>(*l_tier6);
|
||||||
std::shuffle(l_tier6->begin(), l_tier6->end(), rng);
|
QVector<Skill> *act1 = new QVector<Skill>(*magic6 + *action3);
|
||||||
std::shuffle(l_tier4->begin(), l_tier4->end(), rng);
|
QVector<Skill> *act2 = new QVector<Skill>(*magic4 + *action2);
|
||||||
std::shuffle(l_tier2->begin(), l_tier2->end(), rng);
|
QVector<Skill> *act3 = new QVector<Skill>(*magic2 + *action1);
|
||||||
actions->append(*l_tier4);
|
std::shuffle(act1->begin(), act1->end(), rng);
|
||||||
actions->append(*l_tier2);
|
std::shuffle(act2->begin(), act2->end(), rng);
|
||||||
|
std::shuffle(act3->begin(), act3->end(), rng);
|
||||||
|
actions->append(*act1);
|
||||||
|
actions->append(*act2);
|
||||||
|
actions->append(*act3);
|
||||||
|
|
||||||
for (int i = 0; i < 20; i++) {
|
for (int i = 0; i < 20; i++) {
|
||||||
jobs[i] = new QVector<Skill>();
|
jobs[i] = new QVector<Skill>();
|
||||||
|
@ -315,28 +315,17 @@ void Randomizer::randomizeSkills(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shuffle(jobs1->begin(), jobs1->end(), rng);
|
commands[6] = Berserk;
|
||||||
std::shuffle(jobs2->begin(), jobs2->end(), rng);
|
QVector<int> *jobs4 = new QVector<int>({
|
||||||
std::shuffle(jobs3->begin(), jobs3->end(), rng);
|
9, 10, 11, 12, 16, 17, 18,
|
||||||
|
1, 2, 13, 14, 15, 19,
|
||||||
commands->insert(6, Berserk);
|
0, 3, 4, 5, 7, 8, 15
|
||||||
for (int i = 0; i < jobs1->count(); i++) {
|
});
|
||||||
int job = jobs1->at(i);
|
for (int i = 0; i < jobs4->count(); i++) {
|
||||||
|
int job = jobs4->at(i);
|
||||||
Skill temp = actions->first();
|
Skill temp = actions->first();
|
||||||
actions->removeFirst();
|
actions->removeFirst();
|
||||||
commands->insert(job, temp);
|
commands[job] = temp;
|
||||||
}
|
|
||||||
for (int i = 0; i < jobs2->count(); i++) {
|
|
||||||
int job = jobs2->at(i);
|
|
||||||
Skill temp = actions->first();
|
|
||||||
actions->removeFirst();
|
|
||||||
commands->insert(job, temp);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < jobs3->count(); i++) {
|
|
||||||
int job = jobs3->at(i);
|
|
||||||
Skill temp = actions->first();
|
|
||||||
actions->removeFirst();
|
|
||||||
commands->insert(job, temp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,6 +336,13 @@ QByteArray be24(int num) {
|
||||||
temp.append(num & 0xFF);
|
temp.append(num & 0xFF);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
QByteArray le24(int num) {
|
||||||
|
QByteArray temp;
|
||||||
|
temp.append(num & 0xFF);
|
||||||
|
temp.append((num >> 8) & 0xFF);
|
||||||
|
temp.append((num >> 16) & 0xFF);
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
QBuffer *Randomizer::writePatch(void) {
|
QBuffer *Randomizer::writePatch(void) {
|
||||||
QBuffer *patch = new QBuffer();
|
QBuffer *patch = new QBuffer();
|
||||||
|
@ -360,11 +356,12 @@ QBuffer *Randomizer::writePatch(void) {
|
||||||
if (i == 6) {
|
if (i == 6) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
char temp[2];
|
||||||
|
temp[0] = commands[i] & 0xFF;
|
||||||
|
temp[1] = '\0';
|
||||||
patch->write(be24(0x15616c + (i * 4) + 1));
|
patch->write(be24(0x15616c + (i * 4) + 1));
|
||||||
patch->write("\x00\x01", 2);
|
patch->write("\x00\x01", 2);
|
||||||
QByteArray temp;
|
patch->write(temp, 1);
|
||||||
temp.append(commands->at(i) & 0xFF);
|
|
||||||
patch->write(temp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ability counts
|
// ability counts
|
||||||
|
@ -379,7 +376,9 @@ QBuffer *Randomizer::writePatch(void) {
|
||||||
patch->write(be24(0x155484));
|
patch->write(be24(0x155484));
|
||||||
patch->write("\x00\x50", 2);
|
patch->write("\x00\x50", 2);
|
||||||
for (int i = 0; i < JOB_COUNT; i++) {
|
for (int i = 0; i < JOB_COUNT; i++) {
|
||||||
patch->write("\xe8\x54\x15\x08", 4);
|
QByteArray temp = le24(0x1554e8 + (i * 4*5));
|
||||||
|
temp.append('\x08');
|
||||||
|
patch->write(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ability lists
|
// ability lists
|
||||||
|
|
|
@ -47,7 +47,7 @@ private:
|
||||||
// final results
|
// final results
|
||||||
QVector<Skill> *jobs[JOB_COUNT];
|
QVector<Skill> *jobs[JOB_COUNT];
|
||||||
QVector<int> *costs[JOB_COUNT];
|
QVector<int> *costs[JOB_COUNT];
|
||||||
QVector<Skill> *commands;
|
Skill commands[JOB_COUNT];
|
||||||
QVector<Skill> *actions;
|
QVector<Skill> *actions;
|
||||||
|
|
||||||
QByteArray int2byte(int num);
|
QByteArray int2byte(int num);
|
||||||
|
|
Loading…
Reference in New Issue