Advertisement
lol

Blasphemy(console client)

lol
Nov 21st, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. string profile_name;
  8.  
  9. /*
  10. * Menu -> Create a Character
  11. *       -> Load a Character
  12. *
  13. *   Load Modules
  14. *
  15. *       -> Chat Window
  16. *       -> Tattooer
  17. *       -> Reanimator / Concoctionator
  18. *       -> Defense
  19. *       -> Offense
  20. *       -> Queue
  21. *
  22. *       (if Applicible)-> Affliction Window (this character)
  23. *       (if Applicible)-> Affliction Window (Enemy/Target Character)
  24. *
  25. */
  26.  
  27. /*
  28. *   ->Have this program running before opening a client.( zmud, cmud, mudlet, tf5, etc.) This program will control connecting to server.
  29. *       ->User connects to localhost/127.0.0.1 on port 123
  30. */
  31.  
  32. void CharacterCreator()
  33. {
  34. ofstream profile;
  35. string profile_password;
  36. string state;
  37. char response;
  38.  
  39.     cout << "What is your Characters' name?\n";
  40.     cin >> profile_name;
  41.     cout << "\n";
  42.     //getline(cin,profile_name);
  43.     cout << "You said your Characters' name is " << profile_name << "?\n\n";
  44.     cout << "Is this correct?\n";
  45.     cout << "(y or n)\n";
  46.     cin >> response;
  47.     switch(response)
  48.     {
  49.     case 'y':
  50.     cout << "\n";
  51.     cout << "///////////////////////////////////\n";
  52.     cout << "Creating profile -> "<< profile_name <<".\n";
  53.     cout << "///////////////////////////////////\n\n";
  54.     profile.open( profile_name.c_str() );
  55.     profile << profile_name <<"\n";
  56.     cout << "What is " << profile_name <<"s' password?\n";
  57.     cin >> profile_password;
  58.     profile << profile_password <<"\n";
  59.     profile.close();
  60.     cout << "\n";
  61.     cout << "///////////////////////////////////\n";
  62.     cout << "Profile Created.\n";
  63.     cout << "///////////////////////////////////\n\n";
  64.     break;
  65.     case 'n':
  66.     CharacterCreator();
  67.     break;
  68.     default:
  69.     cout << "Invalid choice.\n";
  70.     CharacterCreator();
  71.     }
  72.  
  73. }
  74.  
  75. void LoadProfile()
  76. {
  77.   string line;
  78.   char response;
  79.  
  80.     cout << "Which profile are we loading?\n";
  81.     cin >> profile_name;
  82.     cout << "\n";
  83.     //getline(cin,profile_name);
  84.     cout << profile_name << ", is the profile we are loading?\n\n";
  85.     cout << "Is this correct?\n";
  86.     cout << "(y or n)\n";
  87.     cin >> response;
  88.     switch(response)
  89.     {
  90.     case 'y':
  91.     cout << "\n";
  92.     cout << "///////////////////////////////////\n";
  93.     cout << "Loading profile -> "<< profile_name <<".\n";
  94.     cout << "///////////////////////////////////\n\n";
  95.     /*ifstream profile ( profile_name.c_str() );
  96.     if (profile.is_open())
  97.     {
  98.     while ( getline (profile_name,line) )
  99.     {
  100.       cout << line << '\n';
  101.     }
  102.     profile.close();
  103.     }
  104.  
  105.     else cout << "Unable to open file";
  106.  */
  107.     break;
  108.     case 'n':
  109.     LoadProfile();
  110.     break;
  111.     default:
  112.     cout << "Invalid choice.\n";
  113.     LoadProfile();
  114.     }
  115. }
  116.  
  117. void menu()
  118. {
  119. int input;
  120.    
  121.     cout << " 1. Create a Character Profile.\n";
  122.     cout << " 2. Load a Character Profile.\n";
  123.     cout << " 3. Connect to Aetolia.\n";
  124.     cout << " 4. View Current Installed Modules.\n";
  125.     cout << " 5. Add a Module.\n";
  126.     cout << " 6. Delete a Module.\n";
  127.     cout << " 7. Exit Blasphemy.\n\n";
  128.     cout << "Selection: ";
  129.     cin >> input;
  130.     cout << endl;
  131.     switch (input) {
  132.         case 1:
  133.         CharacterCreator();
  134.         menu();
  135.         break;
  136.         case 2:
  137.         LoadProfile();
  138.         menu();
  139.         break;
  140.         case 3:
  141.         menu();
  142.         break;
  143.         case 4:
  144.         menu();
  145.         break;
  146.         case 5:
  147.         menu();
  148.         break;
  149.         case 6:
  150.         menu();
  151.         break;
  152.         case 7:
  153.         return;
  154.         break;
  155.     }
  156.     return;
  157. }
  158.  
  159. int main()
  160. {
  161.     cout << "Welcome to the Blasphemy Console!\n";
  162.     cout << endl;
  163.     menu();
  164.     return 0;
  165. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement