h4344

Backup

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