h4344

Test Generator

Jul 16th, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.20 KB | None | 0 0
  1. //Created by h4344, more of to test and practice my coding skills more than trying to make a popular program
  2.  
  3. #include <iostream>
  4. #include <fstream>
  5. #include <string>
  6. #include <cstdlib>
  7. #include <windows.h>
  8. #include <sstream>
  9.  
  10. using namespace std;
  11.  
  12. string sign(string bank,string aan,string pan){
  13.  
  14. string Bank = bank; //set this to the string that contains the whole bank before signing.
  15. string AuthorAccountNumber = aan; //set this to the author's account number.
  16. string UserAccountNumber = pan; //you know what to do...
  17. string BankName = "UA3"; //the name of the bank. If the filename was "CheeZecake.SC2Bank", this would be "CheeZecake".
  18.  
  19. string AfterSign = ""; //hmmm... I wonder what this is...
  20.  
  21. typedef void (*SignFunc)(const char*, const char*, const char*, const char*, char*, int); //tells the compiler the exact type of function pointer we want later
  22. SignFunc Sign = NULL;
  23. HINSTANCE hBankSign = LoadLibrary("BankSign.dll"); //assuming it's in the same folder
  24.  
  25. if (hBankSign != NULL) //we don't want to assume it loaded when it might not have
  26. {
  27. Sign = (SignFunc)GetProcAddress(hBankSign, "Sign");
  28. if (Sign != NULL) //make sure we actually got the function
  29. {
  30. char* buffer = new char[Bank.length() + 100]; //making sure it's big enough. If the bank already has a signature, the length probably won't change, but if not, it could gain 60+ characters.
  31. Sign(AuthorAccountNumber.c_str(), UserAccountNumber.c_str(), BankName.c_str(), Bank.c_str(), buffer, (int)Bank.length() + 100); //better hope Bank.length() + 100 isn't over 2147483647!
  32. AfterSign = buffer;
  33. delete[] buffer; //no memory leaks allowed!
  34. }
  35. else
  36. {
  37. cout << "Failed to find the function for signing the bank!";
  38. }
  39.  
  40. //FreeLibrary(BankSign);
  41. }
  42. else
  43. {
  44. std::cout << "BankSign.dll Failed To Load!" << std::endl;
  45. }
  46.  
  47. if (AfterSign != "") //make sure it's not just an empty string
  48. {
  49. return(AfterSign);
  50. }
  51.  
  52. }
  53.  
  54. int main(){
  55.  
  56.  
  57. //All my variables
  58.  
  59.  
  60. int option;
  61. int ee = 0;
  62. int we = 0;
  63. int oe = 0;
  64. int games = 0;
  65. int gametime = 0;
  66. int camocheck = 0;
  67. int decalcheck = 0;
  68. int abilcheck = 0;
  69. int revives = 0;
  70.  
  71. bool decal = false;
  72. bool camo = false;
  73. bool abil = false;
  74.  
  75. string camobool = ("Locked");
  76. string decalbool = ("Locked");
  77. string abilbool = ("Locked");
  78. string aan =("1-S2-1-1086513");
  79. string pan =("guy.000@1");
  80. string bankstring;
  81.  
  82.  
  83. //While loop to keep the numbers from setting to 0 everytime the user comes back from choosing an option
  84.  
  85. while(1){
  86.  
  87. system("CLS");
  88.  
  89. ofstream FFile;
  90.  
  91. stringstream File (stringstream::in | stringstream::out);
  92.  
  93. if(decal == false){
  94. decalbool = ("Locked");
  95. decalcheck = 0;
  96. }else if(decal != false){
  97. decalbool = ("Unlocked");
  98. decalcheck = 1;
  99. }
  100.  
  101. if(camo == false){
  102. camobool = ("Locked");
  103. camocheck = 0;
  104. }else if(camo != false){
  105. camobool = ("Unlocked");
  106. camocheck = 1;
  107. }
  108.  
  109. if(abil == false){
  110. abilbool = ("Locked");
  111. abilcheck = 0;
  112. }else if(abil != false){
  113. abilbool = ("Unlocked");
  114. abilcheck = 1;
  115. }
  116.  
  117. cout << "---------------------------------------------------------" << endl;
  118. cout << "Undead Assault 3 Bank Generator V0.6, Created by h4344" << endl;
  119. cout << "---------------------------------------------------------" << endl;
  120. cout << "99:Player Account #: " << pan << " ***Folder right under Starcraft 2" << endl << endl;
  121. cout << "98:Author's Account #: " << aan << " ***Should be this by default" << endl;
  122. cout << "---------------------------------------------------------" << endl;
  123. cout << " ---Stat--- ---Value---" << endl;
  124. cout << "1:Enlisted Experience " << ee << endl << endl;
  125. cout << "2:Warrant Officer Experience " << we << endl << endl;
  126. cout << "3:Officer Experience " << oe << endl << endl;
  127. cout << "4:Games Played " << games << endl << endl;
  128. cout << "5:Average Game Time " << gametime << endl << endl;
  129. cout << "6:Revives " << revives << endl << endl;
  130. cout << "7:All Decals " << decalbool << endl << endl;
  131. cout << "8:All Camo " << camobool << endl << endl;
  132. cout << "9:All Abilites " << abilbool << endl << endl;
  133. cout << "---------------------------------------------------------" << endl;
  134. cout << "0:Done, Generate My Bank File" << endl;
  135. cout << "---------------------------------------------------------" << endl;
  136. cin >> option;
  137.  
  138.  
  139. //Switch for all the options
  140.  
  141. switch (option) {
  142. case 1:
  143. system("CLS");
  144. cout << "Enter desired value for Enlisted Experience" << endl;
  145. cout << "***Note This value is currently broken and cannot go above 189999 (Max Rank) or else your game will break at the start" << endl << endl;
  146. cout << "PVT- 0" << endl;
  147. cout << "PV2- 400" << endl;
  148. cout << "PFC- 1000" << endl;
  149. cout << "SPC- 1550" << endl;
  150. cout << "CPL- 2600" << endl;
  151. cout << "SGT- 3800" << endl;
  152. cout << "SSG- 5500" << endl;
  153. cout << "SFC- 11000" << endl;
  154. cout << "MSG- 17000" << endl;
  155. cout << "1SG- 25000" << endl;
  156. cout << "SGM- 65000" << endl;
  157. cout << "CSM- 95000" << endl;
  158. cout << "SMA- 190000" << endl << endl;
  159. cin >> ee;
  160. break;
  161. case 2:
  162. system("CLS");
  163. cout << "Enter desired value for Warrant Officer Experience" << endl;
  164. cout << "***Note This value is currently broken and cannot go above 119999 (Max Rank) or else your game will break at the start" << endl << endl;
  165. cout << "WO1- 0" << endl;
  166. cout << "WO2- 8000" << endl;
  167. cout << "WO3- 25000" << endl;
  168. cout << "WO4- 65000" << endl;
  169. cout << "WO5- 120000" << endl << endl;
  170. cin >> we;
  171. break;
  172. case 3:
  173. system("CLS");
  174. cout << "Enter desired value for Officer Experience" << endl;
  175. cout << "***Note This value is currently broken and cannot go above 249999 (Max Rank) or else your game will break at the start" << endl << endl;
  176. cout << "2LT- 0" << endl;
  177. cout << "1LT- 3500" << endl;
  178. cout << "CPT- 12000" << endl;
  179. cout << "MAJ- 18000" << endl;
  180. cout << "LTCOL- 30000" << endl;
  181. cout << "COL- 65000" << endl;
  182. cout << "BGEN- 100000" << endl;
  183. cout << "MGEN- 130000" << endl;
  184. cout << "LTGEN- 180000" << endl;
  185. cout << "GEN- 250000" << endl << endl;
  186. cin >> oe;
  187. break;
  188. case 4:
  189. system("CLS");
  190. cout << "Enter desired value for Games Played" << endl;
  191. cin >> games;
  192. break;
  193. case 5:
  194. system("CLS");
  195. cout << "Enter desired value for Average Game Time" << endl;
  196. cin >> gametime;
  197. break;
  198. case 6:
  199. system("CLS");
  200. cout << "Enter desired value for Revives" << endl;
  201. cin >> revives;
  202. break;
  203. case 7:
  204. system("CLS");
  205. if(decal != true){
  206. decal = true;
  207. }else if(decal != false){
  208. decal = false;
  209. }
  210. break;
  211. case 8:
  212. if(camo != true){
  213. camo = true;
  214. }else if(camo != false){
  215. camo = false;
  216. }
  217. break;
  218. case 9:
  219. if(abil != true){
  220. abil = true;
  221. }else if(abil != false){
  222. abil = false;
  223. }
  224. break;
  225. case 0:
  226.  
  227. File << "<?xml version=\"1.0\" encoding=\"utf-8\"?>" << endl;
  228. File << "<Bank version=\"1\">" << endl;
  229. File << " <Section name=\"officer\">" << endl;
  230. File << " <Key name=\"experience\">" << endl;
  231. File << " <Value int=\"" << oe <<"\"/>" << endl;
  232. File << " </Key>" << endl;
  233. File << " </Section>" << endl;
  234. File << " <Section name=\"SIs\">" << endl;
  235. File << " <Key name=\"INT\">" << endl;
  236. File << " <Value flag=\"" << abilcheck <<"\"/>" << endl;
  237. File << " </Key>" << endl;
  238. File << " <Key name=\"HE\">" << endl;
  239. File << " <Value flag=\"" << abilcheck <<"\"/>" << endl;
  240. File << " </Key>" << endl;
  241. File << " <Key name=\"TT\">" << endl;
  242. File << " <Value flag=\"" << abilcheck <<"\"/>" << endl;
  243. File << " </Key>" << endl;
  244. File << " <Key name=\"RF\">" << endl;
  245. File << " <Value flag=\"" << abilcheck <<"\"/>" << endl;
  246. File << " </Key>" << endl;
  247. File << " <Key name=\"INST\">" << endl;
  248. File << " <Value flag=\"" << abilcheck <<"\"/>" << endl;
  249. File << " </Key>" << endl;
  250. File << " <Key name=\"BARB\">" << endl;
  251. File << " <Value flag=\"" << abilcheck <<"\"/>" << endl;
  252. File << " </Key>" << endl;
  253. File << " <Key name=\"DS\">" << endl;
  254. File << " <Value flag=\"" << abilcheck <<"\"/>" << endl;
  255. File << " </Key>" << endl;
  256. File << " <Key name=\"QT\">" << endl;
  257. File << " <Value flag=\"" << abilcheck <<"\"/>" << endl;
  258. File << " </Key>" << endl;
  259. File << " <Key name=\"TAN\">" << endl;
  260. File << " <Value flag=\"" << abilcheck <<"\"/>" << endl;
  261. File << " </Key>" << endl;
  262. File << " <Key name=\"EN\">" << endl;
  263. File << " <Value flag=\"" << abilcheck <<"\"/>" << endl;
  264. File << " </Key>" << endl;
  265. File << " <Key name=\"AR\">" << endl;
  266. File << " <Value flag=\"" << abilcheck <<"\"/>" << endl;
  267. File << " </Key>" << endl;
  268. File << " <Key name=\"BL\">" << endl;
  269. File << " <Value flag=\"" << abilcheck <<"\"/>" << endl;
  270. File << " </Key>" << endl;
  271. File << " </Section>" << endl;
  272. File << " <Section name=\"camo\">" << endl;
  273. File << " <Key name=\"ACUPAT\">" << endl;
  274. File << " <Value flag=\"" << camocheck <<"\"/>" << endl;
  275. File << " </Key>" << endl;
  276. File << " <Key name=\"SAS\">" << endl;
  277. File << " <Value flag=\"" << camocheck <<"\"/>" << endl;
  278. File << " </Key>" << endl;
  279. File << " <Key name=\"Olive\">" << endl;
  280. File << " <Value flag=\"" << camocheck <<"\"/>" << endl;
  281. File << " </Key>" << endl;
  282. File << " <Key name=\"Night\">" << endl;
  283. File << " <Value flag=\"" << camocheck <<"\"/>" << endl;
  284. File << " </Key>" << endl;
  285. File << " <Key name=\"Woodland Tiger\">" << endl;
  286. File << " <Value flag=\"" << camocheck <<"\"/>" << endl;
  287. File << " </Key>" << endl;
  288. File << " <Key name=\"Red Tiger\">" << endl;
  289. File << " <Value flag=\"" << camocheck <<"\"/>" << endl;
  290. File << " </Key>" << endl;
  291. File << " <Key name=\"Woodland\">" << endl;
  292. File << " <Value flag=\"" << camocheck <<"\"/>" << endl;
  293. File << " </Key>" << endl;
  294. File << " <Key name=\"MARPAT\">" << endl;
  295. File << " <Value flag=\"" << camocheck <<"\"/>" << endl;
  296. File << " </Key>" << endl;
  297. File << " <Key name=\"CADPAT\">" << endl;
  298. File << " <Value flag=\"" << camocheck <<"\"/>" << endl;
  299. File << " </Key>" << endl;
  300. File << " </Section>" << endl;
  301. File << " <Section name=\"general\">" << endl;
  302. File << " <Key name=\"avg game time\">" << endl;
  303. File << " <Value int=\"" << gametime <<"\"/>" << endl;
  304. File << " </Key>" << endl;
  305. File << " <Key name=\"games played\">" << endl;
  306. File << " <Value int=\"" << games <<"\"/>" << endl;
  307. File << " </Key>" << endl;
  308. File << " <Key name=\"revives\">" << endl;
  309. File << " <Value int=\"" << revives <<"\"/>" << endl;
  310. File << " </Key>" << endl;
  311. File << " </Section>" << endl;
  312. File << " <Section name=\"enlisted\">" << endl;
  313. File << " <Key name=\"experience\">" << endl;
  314. File << " <Value int=\"" << ee <<"\"/>" << endl;
  315. File << " </Key>" << endl;
  316. File << " </Section>" << endl;
  317. File << " <Section name=\"decals\">" << endl;
  318. File << " <Key name=\"RA\">" << endl;
  319. File << " <Value flag=\"" << decalcheck <<"\"/>" << endl;
  320. File << " </Key>" << endl;
  321. File << " <Key name=\"Outlaw\">" << endl;
  322. File << " <Value flag=\"" << decalcheck <<"\"/>" << endl;
  323. File << " </Key>" << endl;
  324. File << " <Key name=\"Combat Medic Badge\">" << endl;
  325. File << " <Value flag=\"" << decalcheck <<"\"/>" << endl;
  326. File << " </Key>" << endl;
  327. File << " <Key name=\"Bear Claw\">" << endl;
  328. File << " <Value flag=\"" << decalcheck <<"\"/>" << endl;
  329. File << " </Key>" << endl;
  330. File << " <Key name=\"Blue Diamond\">" << endl;
  331. File << " <Value flag=\"" << decalcheck <<"\"/>" << endl;
  332. File << " </Key>" << endl;
  333. File << " <Key name=\"Cavalry Sabers\">" << endl;
  334. File << " <Value flag=\"" << decalcheck <<"\"/>" << endl;
  335. File << " </Key>" << endl;
  336. File << " <Key name=\"Ravensword\">" << endl;
  337. File << " <Value flag=\"" << decalcheck <<"\"/>" << endl;
  338. File << " </Key>" << endl;
  339. File << " </Section>" << endl;
  340. File << " <Section name=\"warrant officer\">" << endl;
  341. File << " <Key name=\"experience\">" << endl;
  342. File << " <Value int=\"" << we <<"\"/>" << endl;
  343. File << " </Key>" << endl;
  344. File << " </Section>" << endl;
  345. File << " <Signature value=\"60BADBB1BAA7F3C1209C7AB3F71DDA4822095B2A\"/>" << endl;
  346. File << "</Bank>" << endl;
  347.  
  348. //Variable to store the entire bank and send it through the signer
  349.  
  350. bankstring = sign(File.str(),aan,pan);
  351.  
  352. FFile.open("UA3.SC2Bank");
  353. FFile << bankstring;
  354. FFile.close();
  355.  
  356. system("CLS");
  357. cout << "***Bank File Generated, you should backup your old Bank File before switching" << endl;
  358. cout << "***Dont forget to sign the bank file with Mr.Nukes bank signer before using it" << endl;
  359. system("PAUSE");
  360. exit(1);
  361. break;
  362. case 99:
  363. system("CLS");
  364. cout << "Enter your player account number under Documents>Starcraft 2" << endl;
  365. cin >> pan;
  366. break;
  367. case 98:
  368. system("CLS");
  369. cout << "Enter the authors account number ***This value should be what it was by default" << endl;
  370. cin >> aan;
  371. break;
  372. default:
  373. system("CLS");
  374. cout << "You have entered an invalid option, please try again" << endl;
  375. system("PAUSE");
  376. break;
  377. }
  378. }
  379. }
Advertisement
Add Comment
Please, Sign In to add comment