augNames = [];
augCosts = [];
augFactions = [];
pFactions = getPlayer().factions;
pFactionLength = pFactions.length - 1;
//for (o = 0; o <= pFactionLength; o++) {
// tprint("The player is a member of " + pFactions[o]);
//}
pAugs = getOwnedAugmentations(true);
pAugsLength = pAugs.length - 1;
//for (o = 0; o <= pAugsLength; o++) {
// tprint("The player already has aug " + pAugs[o]);
//}
cost = 0;
nextAug = null;
tprint("Generating list.");
for (f = 0; f <= pFactionLength; f++) {
factionAugs = getAugmentationsFromFaction(pFactions[f]);
factionAugsLength = factionAugs.length - 1;
for (o = 0; o <= factionAugsLength; o++) {
tprint(pFactions[f] + " has aug " + factionAugs[o]);
}
for (o = 0; o <= factionAugsLength; o++) {
tprint(factionAugs[o] + ": " + pAugs.indexOf(factionAugs[o]) + " - " + getAugmentationRepReq(factionAugs[o]) + "/" + getFactionRep(pFactions[f]));
if (pAugs.indexOf(factionAugs[o]) == -1 && getFactionRep(pFactions[f]) >= getAugmentationRepReq(factionAugs[o])) {
//tempName = ;
//tempCost = ;
//tempFac = ;
//tprint(factionAugs[o]);
augNames.push(factionAugs[o]);
//tprint(augNames[o]);
augCosts.push(getAugmentationPrice(factionAugs[o]));
//tprint(augCosts[o]);
augFactions.push(pFactions[f]);
//tprint(augFactions[o]);
totalAugLength = augNames.length - 1;
tprint(o + "(" + totalAugLength + ") " + augNames[totalAugLength] + " " + augFactions[totalAugLength] + " " + augCosts[totalAugLength]);
totalAugLength = augNames.length - 1;
if (cost < totalAugLength) {
cost = augCosts[totalAugLength];
tprint("New highest cost is " + cost);
}
} else {
//tprint(factionAugs[o] + " doesn't meet criteria.");
augNames.push("Slug");
//tprint(augNames[o]);
augCosts.push(0);
//tprint(augCosts[o]);
augFactions.push("None");
//tprint(augFactions[o]);
totalAugLength = augNames.length - 1;
tprint(o + "(" + totalAugLength + ") " + augNames[totalAugLength] + " " + augFactions[totalAugLength] + " " + augCosts[totalAugLength]);
}
}
}
tprint("Removing slugs.");
slugAug = augNames.indexOf("Slug");
while (slugAug > -1) {
augNames.splice(slugAug, 1);
augCosts.splice(slugAug, 1);
augFactions.splice(slugAug, 1);
//tprint("Removed Slug entry(" + slugAug + ")");
slugAug = augNames.indexOf("Slug");
}
tprint("Augs in List;");
tempANCheck = augNames.length - 1;
for (o = 0; o <= tempANCheck; o++) {
tprint(augNames[o] + " " + augFactions[o] + " " + augCosts[o]);
}
tprint("Buying.");
while (true) {
nextAug = augCosts.indexOf(cost)
purchaseAugmentation(augFactions[nextAug], augNames[nextAug]);
tprint("Attempted to buy " + augNames[nextAug]);
cost = 0;
tprint("Removing " + augNames[nextAug]);
augNames.splice(nextAug, 1);
augCosts.splice(nextAug, 1);
augFactions.splice(nextAug, 1);
x = augCosts.length - 1;
for (o = 0; o <= x; o++) {
tprint(o + " " + augNames[o] + " " + augFactions[o] + " " + augCosts[o]);
if (cost < augCosts[o]) {
cost = augCosts[o];
tprint("New highest cost is " + cost);
} //else {
//tprint(augNames[o] + " doesn't meet criteria.");
//}
}
}