Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main.cpp~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- #include <iostream>
- #include <string>
- #include <fstream>
- #include <cstdlib>
- #include <sstream>
- #include <cmath>
- #include "Ore.h"
- #include "PVal.h"
- using std::cout;
- using std::cin;
- using std::endl;
- using std::string;
- using std::ifstream;
- void GetUserVals(PVal& Player);
- void SetUserOreEff(PVal& Player);
- void Output(PVal& Player);
- int GetOreEle(string ID);
- int main()
- {
- cout << "Welcome to Raezzor's Mining Profitability Calculator!" << endl;
- cout << "First we need to collect some information!" << endl;
- PVal User;
- GetUserVals(User);
- SetUserOreEff(User);
- ifstream ore_in("ore.txt");
- if (!ore_in.is_open())
- {
- cout << "Error opening ore data file!" << endl;
- exit(EXIT_FAILURE);
- }
- Ore OreArr[48];
- string tempOreIn;
- string OreID;
- string tempName;
- float tempVol;
- float tempCompVol;
- int tempTrit;
- int tempPye;
- int tempMex;
- int tempIso;
- int tempNoc;
- int tempMeg;
- int tempZyd;
- int tempMor;
- std::stringstream strcon;
- for(int i = 0; i < 48; i++)
- {
- OreArr[i].SetMins(0,0,0,0,0,0,0,0);
- OreArr[i].SetVol(0,0);
- OreArr[i].SetSaleVal(0,0,0);
- }
- while (getline(ore_in, tempOreIn, ';'))
- {
- strcon << tempOreIn;
- strcon >> OreID >> tempName >> tempVol >> tempCompVol >> tempTrit >> tempPye >> tempMex >> tempIso >> tempNoc >> tempMeg >> tempZyd >> tempMor;
- OreArr[GetOreEle(OreID)].SetName(tempName);
- OreArr[GetOreEle(OreID)].SetVol(tempVol, tempCompVol);
- OreArr[GetOreEle(OreID)].SetMins(tempTrit, tempPye, tempMex, tempIso, tempNoc, tempMeg, tempZyd, tempMor);
- }
- //get min and ore sale values from user
- //calculate ore min values
- //output ore isk values (ask user which ore they want to see, or all? Or seperate by null/low/high?
- for(int i = 0; i < 48; i++)
- {
- OreArr[i].OutAll();
- }
- Output(User);
- return 0;
- }
- void GetUserVals(PVal& Player)
- {
- cout << "What is the base refine of the station/POS/outpost you might refine at?" << endl;
- cin >> Player.fBaseRef;
- cout << "Thanks! Now what is your ReProcessing skill at?" << endl;
- cin >> Player.fReProc;
- cout << "And what is your Reprocessing Efficiency skill?" << endl;
- cin >> Player.fReProcEff;
- cout << "Do you have a refining implant? If so enter the % grade of it. Otherwise enter 0." << endl;
- float fTempImp;
- cin >> fTempImp;
- Player.fImp = fTempImp/100;
- cout << "What is your standing with the corporation owning the station you are refining at?" << endl << "Note, if using a POS and not a station/outpost enter any value over 6.67." << endl;
- cin >> fTempImp;
- if (fTempImp >= 6.67)
- {
- Player.fTaxRate = 1;
- }
- else
- {
- Player.fTaxRate = 1 - ((5 - (.75 * fTempImp))/100);
- }
- cout << "What is the level of your Veldspar Processing skill?" << endl;
- cin >> Player.fVelProc;
- cout << "And Scordite?" << endl;
- cin >> Player.fScoProc;
- cout << "Pyroxeres?" << endl;
- cin >> Player.fPyrProc;
- cout << "Placioclase?" << endl;
- cin >> Player.fPlaProc;
- cout << "Omber?" << endl;
- cin >> Player.fOmbProc;
- cout << "Kernite?" << endl;
- cin >> Player.fKerProc;
- cout << "Jaspet?" << endl;
- cin >> Player.fJasProc;
- cout << "Hemorphite?" << endl;
- cin >> Player.fHemProc;
- cout << "Hedbergite?" << endl;
- cin >> Player.fHedProc;
- cout << "Gneiss" << endl;
- cin >> Player.fGneProc;
- cout << "Dark Ochre?" << endl;
- cin >> Player.fOchProc;
- cout << "Spodumain?" << endl;
- cin >> Player.fSpoProc;
- cout << "Crokite?" << endl;
- cin >> Player.fCroProc;
- cout << "Bistot?" << endl;
- cin >> Player.fBisProc;
- cout << "Arkonor?" << endl;
- cin >> Player.fArkProc;
- cout << "And lastly, Mercoxit?" << endl;
- cin >> Player.fMerProc;
- cout << "All done! " << endl << endl;
- return;
- }
- void SetUserOreEff(PVal& Player)
- {
- Player.fVelEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fVelProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fScoEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fScoProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fPyrEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fPyrProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fPlaEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fPlaProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fOmbEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fOmbProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fKerEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fKerProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fJasEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fJasProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fHemEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fHemProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fHedEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fHedProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fGneEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fGneProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fOchEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fOchProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fSpoEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fSpoProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fCroEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fCroProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fBisEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fBisProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fArkEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fArkProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- Player.fMerEff = Player.fBaseRef * (Player.fReProc * .03 + 1) * (Player.fReProcEff * .02 + 1) * (Player.fMerProc * .02 + 1) * (1 + Player.fImp) * Player.fTaxRate;
- return;
- }
- void Output(PVal& Player)
- {
- cout << "Veld refine rate is: " << Player.fVelEff << "%." << endl;
- cout << "Scord refine rate is: " << Player.fScoEff << "%." << endl;
- cout << "Pyro refine rate is: " << Player.fPyrEff << "%." << endl;
- cout << "Plag refine rate is: " << Player.fPlaEff << "%." << endl;
- cout << "Omb refine rate is: " << Player.fOmbEff << "%." << endl;
- cout << "Kern refine rate is: " << Player.fKerEff << "%." << endl;
- cout << "Jasper refine rate is: " << Player.fJasEff << "%." << endl;
- cout << "Hemo refine rate is: " << Player.fHemEff << "%." << endl;
- cout << "Hed refine rate is: " << Player.fHedEff << "%." << endl;
- cout << "Gneiss refine rate is: " << Player.fGneEff << "%." << endl;
- cout << "Dark Ocher refine rate is: " << Player.fOchEff << "%." << endl;
- cout << "Spod refine rate is: " << Player.fSpoEff << "%." << endl;
- cout << "Crok refine rate is: " << Player.fCroEff << "%." << endl;
- cout << "Bis refine rate is: " << Player.fBisEff << "%." << endl;
- cout << "Ark refine rate is: " << Player.fArkEff << "%." << endl;
- cout << "Merc refine rate is: " << Player.fMerEff << "%." << endl;
- }
- int GetOreEle(string ID)
- {
- if (!ID.compare("Vel")) return 0;
- else if (!ID.compare("CVel")) return 1;
- else if (!ID.compare("DVel")) return 2;
- else if (!ID.compare("Sco")) return 3;
- else if (!ID.compare("CSco")) return 4;
- else if (!ID.compare("MSco")) return 5;
- else if (!ID.compare("Pyr")) return 6;
- else if (!ID.compare("Spyr")) return 7;
- else if (!ID.compare("VPyr")) return 8;
- else if (!ID.compare("Pla")) return 9;
- else if (!ID.compare("APla")) return 10;
- else if (!ID.compare("RPla")) return 11;
- else if (!ID.compare("Omb")) return 12;
- else if (!ID.compare("SOmb")) return 13;
- else if (!ID.compare("GOmb")) return 14;
- else if (!ID.compare("Ker")) return 15;
- else if (!ID.compare("LKer")) return 16;
- else if (!ID.compare("FKer")) return 17;
- else if (!ID.compare("Jas")) return 18;
- else if (!ID.compare("PuJas")) return 19;
- else if (!ID.compare("PrJas")) return 20;
- else if (!ID.compare("Hem")) return 21;
- else if (!ID.compare("VHem")) return 22;
- else if (!ID.compare("RHem")) return 23;
- else if (!ID.compare("Hed")) return 24;
- else if (!ID.compare("VHed")) return 25;
- else if (!ID.compare("GHed")) return 26;
- else if (!ID.compare("Gne")) return 27;
- else if (!ID.compare("IGne")) return 28;
- else if (!ID.compare("PGne")) return 29;
- else if (!ID.compare("DOch")) return 30;
- else if (!ID.compare("OnOch")) return 31;
- else if (!ID.compare("ObOch")) return 32;
- else if (!ID.compare("Spo")) return 33;
- else if (!ID.compare("BSpo")) return 34;
- else if (!ID.compare("GSpo")) return 35;
- else if (!ID.compare("Cro")) return 36;
- else if (!ID.compare("SCro")) return 37;
- else if (!ID.compare("CCro")) return 38;
- else if (!ID.compare("Bis")) return 39;
- else if (!ID.compare("TBis")) return 40;
- else if (!ID.compare("MBis")) return 41;
- else if (!ID.compare("Ark")) return 42;
- else if (!ID.compare("CArk")) return 43;
- else if (!ID.compare("PArk")) return 44;
- else if (!ID.compare("Mer")) return 45;
- else if (!ID.compare("MMer")) return 46;
- else if (!ID.compare("VMer")) return 47;
- else
- {
- cout << "Error reading into array. Aborting";
- exit(EXIT_FAILURE);
- }
- }
- Ore.h~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- #ifndef ORE_H_INCLUDED
- #define ORE_H_INCLUDED
- #include <string>
- using std::string;
- using std::cout;
- using std::endl;
- #endif // ORE_H_INCLUDED
- class Ore
- {
- private:
- string sName;
- float fOreMinVal;
- float fOreSaleVal;
- float fOreCompSaleVal;
- float fUncVol;
- float fCompVol;
- int nTri;
- int nPye;
- int nMex;
- int nIso;
- int nNoc;
- int nMeg;
- int nZyd;
- int nMor;
- public:
- Ore(string Name = "None", float UncVol = 0, float CompVol = 0, int Tri = 0, int Pye = 0, int Mex = 0, int Iso = 0, int Noc = 0, int Meg = 0, int Zyd = 0, int Mor = 0)
- {
- sName = Name;
- fUncVol = UncVol * 100;
- fCompVol = CompVol;
- nTri = Tri * 100;
- nPye = Pye * 100;
- nMex = Mex * 100;
- nIso = Iso * 100;
- nNoc = Noc * 100;
- nMeg = Meg * 100;
- nZyd = Zyd * 100;
- nMor = Mor * 100;
- }
- void SetMins(int Tri, int Pye, int Mex, int Iso, int Noc, int Meg, int Zyd, int Mor)
- {
- nTri = Tri;
- nPye = Pye;
- nMex = Mex;
- nIso = Iso;
- nNoc = Noc;
- nMeg = Meg;
- nZyd = Zyd;
- nMor = Mor;
- return;
- }
- void SetVol(float UncVol, float CompVol)
- {
- fUncVol = UncVol;
- fCompVol = CompVol;
- return;
- }
- void SetSaleVal(float OreMinVal, float OreVal, float OreCompVal)
- {
- fOreMinVal = OreMinVal;
- fOreSaleVal = OreVal;
- fOreCompSaleVal = OreCompVal;
- return;
- }
- void SetMinVal(float OreMinVal)
- {
- fOreMinVal = OreMinVal;
- return;
- }
- void SetOreSaleVal(float OreVal)
- {
- fOreSaleVal = OreVal;
- return;
- }
- void SetOreCompVal(float OreCompVal)
- {
- fOreCompSaleVal = OreCompVal;
- return;
- }
- void SetName(string Name)
- {
- sName = Name;
- return;
- }
- void SetUncvol(float UVol)
- {
- fUncVol = UVol;
- return;
- }
- void SetVol(float Vol)
- {
- fCompVol = Vol;
- return;
- }
- void SetTri(int Tri)
- {
- nTri = Tri;
- return;
- }
- void SetPye(int Pye)
- {
- nPye = Pye;
- return;
- }
- void SetMex(int Mex)
- {
- nMex = Mex;
- return;
- }
- void SetIso(int Iso)
- {
- nIso = Iso;
- return;
- }
- void SetNoc(int Noc)
- {
- nNoc = Noc;
- return;
- }
- void SetMeg(int Meg)
- {
- nMeg = Meg;
- return;
- }
- void SetZyd(int Zyd)
- {
- nZyd = Zyd;
- return;
- }
- void SetMor(int Mor)
- {
- nMor = Mor;
- return;
- }
- void OutAll()
- {
- cout << sName << "\t" << fOreMinVal << "\t" << fOreSaleVal << "\t" << fOreCompSaleVal << "\t"
- << fUncVol << "\t" << fCompVol << "\t" << endl
- << nTri << "\t" << nPye << "\t" << nMex << "\t" << nIso << "\t"
- << nNoc << "\t" << nMeg << "\t" << nZyd << "\t" << nMor << endl << endl;
- }
- };
- PVal.h~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- #ifndef PVAL_H_INCLUDED
- #define PVAL_H_INCLUDED
- #endif // PVAL_H_INCLUDED
- struct PVal
- {
- public:
- float fBaseRef;
- float fReProc;
- float fReProcEff;
- float fVelProc;
- float fScoProc;
- float fPyrProc;
- float fPlaProc;
- float fOmbProc;
- float fKerProc;
- float fJasProc;
- float fHemProc;
- float fHedProc;
- float fGneProc;
- float fOchProc;
- float fSpoProc;
- float fCroProc;
- float fBisProc;
- float fArkProc;
- float fMerProc;
- float fImp;
- float fTaxRate;
- float fVelEff;
- float fScoEff;
- float fPyrEff;
- float fPlaEff;
- float fOmbEff;
- float fKerEff;
- float fJasEff;
- float fHemEff;
- float fHedEff;
- float fGneEff;
- float fOchEff;
- float fSpoEff;
- float fCroEff;
- float fBisEff;
- float fArkEff;
- float fMerEff;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement