Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- #####################################
- #Program Name: Metin2DropBuilder.cpp#
- #Written by: Samuel Roberto #
- #Date: 11/06/2014 #
- #####################################
- */
- #include <iostream>
- #include <cstdio>
- #include <cstdlib>
- #include <fstream>
- #include <iostream>
- #include <windows.h>
- using namespace std;
- /*
- Global Variable
- */
- char filename[18] = "mob_drop_item.txt"; //File to Read
- fstream file (filename);
- /*
- Function Name: headerMain
- Input: /
- Output: Program Header
- */
- void headerMain();
- /*
- Function Name: checkMobDropItem
- Input: /
- Output: New MobDropItem.txt file clean
- */
- void checkMobDropItem();
- /*
- Function Name: programMenu
- Input: /
- Output: Menu with all Function
- */
- void programMenu();
- /*
- Function Name: createMobDropNL
- Input: /
- Output: New Line with a Mob Drop without Level_Limit
- */
- void createMobDropNL();
- /*
- Function Name: createMobDropL
- Input: /
- Output: New Line with a Mob Drop with Level_Limit
- */
- void createMobDropL();
- /*
- Function Name: createMetinDrop
- Input: /
- Output: New Line with Metin Drop
- */
- void createMetinDrop();
- /*
- Function Name: Main
- */
- int main()
- {
- checkMobDropItem();
- programMenu();
- return 0;
- }
- /*
- #############
- Function Code
- #############
- */
- void headerMain()
- {
- SetConsoleTitle("Metin2DropBuilder ~ Samu");//Set Consol Title
- system("color 4"); //Set Screen Color
- wcout << " __ .__ ________ .___ " << endl;
- wcout << " _____ _____/ |_|__| ____ \\_____ \\ __| _/______ ____ ______ " << endl;
- wcout << " / \\_/ __ \\ __\\ |/ \\ / ____/ / __ |\\_ __ \\/ _ \\\\____ \\ " << endl;
- wcout << "| Y Y \\ ___/| | | | | \\ / \\ / /_/ | | | \\( <_> ) |_> >" << endl;
- wcout << "|__|_| /\\___ >__| |__|___| / \\_______ \\ \\____ | |__| \\____/| __/ " << endl;
- wcout << " \\/ \\/ \\/ \\/ \\/ |__| " << endl;
- wcout << "___. .__.__ .___ " << endl;
- wcout << "\\_ |__ __ __|__| | __| _/___________ " << endl;
- wcout << " | __ \\| | \\ | | / __ |/ __ \\_ __ \\" << endl;
- wcout << " | \\_\\ \\ | / | |__/ /_/ \\ ___/| | \\/" << endl;
- wcout << " |___ /____/|__|____/\\____ |\\___ >__| " << endl;
- wcout << " \\/ \\/ \\/ " << endl;
- }
- void checkMobDropItem()
- {
- char filename[18] = "mob_drop_item.txt"; //File to Read
- char del; //Variable for Do-While Cicle
- fstream file (filename);
- headerMain();
- cout << "#Check if file '" << filename << "' exist" << endl;
- if (file.is_open()){
- do{
- cout << "#File exist.. Rebuild File? Only Y when you are ready for Delete ";
- cin >> del;
- }while(del!='y');
- if(del=='y'){
- cout << "#File succesfully deleted" << endl;
- cout << "#Creating a new File '" << filename << "'" << endl;
- file.close();
- remove(filename);
- ofstream outfile (filename);
- outfile.close();
- }
- }else{
- ofstream outfile (filename);
- outfile.close();
- }
- cout << "#Check " << filename << " complete" << endl << endl;
- cout << "#Press Enter.." << endl;
- cin.get();
- cin.get();
- system("cls");
- }
- void programMenu()
- {
- char c;
- int exit = 0;
- do{
- headerMain();
- cout << "#Make your choise:" << endl;
- cout << "#1. Create a Mob Drop (without level_limit)" << endl;
- cout << "#2. Create a Mob Drop (with level_limit" << endl;
- cout << "#3. Create a Metin Stone Drop" << endl;
- cout << "#4. Exit Program" << endl << endl;
- cout << "User Choise: ";
- cin >> c;
- if(c=='1') //Drop Mob without Level Limit
- createMobDropNL();
- if(c=='2') //Drop Mob with Level Limit
- createMobDropL();
- if(c=='3') //Drop Metin
- createMetinDrop();
- if (c=='4') //Exit Program with this Choise
- exit = 1;
- if((c!='1')and(c!='2')and(c!='3')and(c!='4')) //Clear Screen if Wrong Choise
- system("cls");
- }while((c!='1')and(c!='2')and(c!='3')and(c!='4')and(exit==0));
- file.close();
- }
- void createMobDropNL()
- {
- int valueMob;
- int numDrop;
- int valueItem;
- int itemQ;
- float prob;
- system("cls"); //Clear Screen
- headerMain();
- cout << "Insert value of Mob: ";
- cin >> valueMob;
- cout << "Insert number of Item to drop: ";
- cin >> numDrop;
- cout << endl;
- file << "Group\t";
- file << valueMob << "\n{\n\t" << "type\tdrop\n\t" << "mob ";
- file << valueMob << "\n\t";
- for(int i=0;i<numDrop; i++){
- valueItem = 0;
- itemQ = 0;
- prob = 0;
- file << i+1 << "\t";
- cout << "Insert value of " << i+1 << " item: ";
- cin >> valueItem;
- cout << "Insert quantity of " << i+1 << " item: ";
- cin >> itemQ;
- cout << "Insert probability of " << i+1 << " item: ";
- cin >> prob;
- cout << endl;
- file << valueItem << "\t" << itemQ << "\t" << prob << "\n";
- if((i+1)==numDrop)
- file << "}" << "\n";
- else
- file << "\t";
- }
- cout << endl;
- cout << "#Drop added succesfully" << endl;
- cout << "#Press Enter.." << endl;
- cin.get();
- cin.get();
- system("cls");
- programMenu();
- }
- void createMobDropL()
- {
- int valueMob;
- int levelLimit;
- int numDrop;
- int valueItem;
- int itemQ;
- float prob;
- system("cls"); //Clear Screen
- headerMain();
- cout << "Insert value of Mob: ";
- cin >> valueMob;
- cout << "Insert Level Limit of Drop: ";
- cin >> levelLimit;
- cout << "Insert number of Item to drop: ";
- cin >> numDrop;
- cout << endl;
- file << "Group\t";
- file << valueMob << "\n{\n\t" << "type\tlimit\n\t" << "mob\t";
- file << valueMob << "\n\t";
- file << "level_limit\t" << levelLimit << "\n\t";
- for(int i=0;i<numDrop; i++){
- valueItem = 0;
- itemQ = 0;
- prob = 0;
- file << i+1 << "\t";
- cout << "Insert value of " << i+1 << " item: ";
- cin >> valueItem;
- cout << "Insert quantity of " << i+1 << " item: ";
- cin >> itemQ;
- cout << "Insert probability of " << i+1 << " item: ";
- cin >> prob;
- cout << endl;
- file << valueItem << "\t" << itemQ << "\t" << prob << "\n";
- if((i+1)==numDrop)
- file << "}" << "\n\n";
- else
- file << "\t";
- }
- cout << endl;
- cout << "#Drop added succesfully" << endl;
- cout << "#Press Enter.." << endl;
- cin.get();
- cin.get();
- system("cls");
- programMenu();
- }
- void createMetinDrop()
- {
- int valueMetin;
- int numDrop;
- int valueItem;
- int itemQ;
- float prob;
- system("cls"); //Clear Screen
- headerMain();
- cout << "Insert value of Metin: ";
- cin >> valueMetin;
- cout << "Insert number of Item to drop: ";
- cin >> numDrop;
- cout << endl;
- file << "Group\t";
- file << valueMetin << "\n{\n\t" << "type\tdrop\n\t" << "mob ";
- file << valueMetin << "\n\t";
- for(int i=0;i<numDrop; i++){
- valueItem = 0;
- itemQ = 0;
- prob = 0;
- file << i+1 << "\t";
- cout << "Insert value of " << i+1 << " item: ";
- cin >> valueItem;
- cout << "Insert quantity of " << i+1 << " item: ";
- cin >> itemQ;
- cout << "Insert probability of " << i+1 << " item: ";
- cin >> prob;
- cout << endl;
- file << valueItem << "\t" << itemQ << "\t" << prob << "\n";
- if((i+1)==numDrop)
- file << "}" << "\n\n";
- else
- file << "\t";
- }
- cout << endl;
- cout << "#Drop added succesfully" << endl;
- cout << "#Press Enter.." << endl;
- cin.get();
- cin.get();
- system("cls");
- programMenu();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement