| @ -0,0 +1,16 @@ | |||||
| { | |||||
| "configurations": [ | |||||
| { | |||||
| "name": "Linux", | |||||
| "includePath": [ | |||||
| "${workspaceFolder}/**" | |||||
| ], | |||||
| "defines": [], | |||||
| "compilerPath": "/usr/bin/gcc", | |||||
| "cStandard": "c11", | |||||
| "cppStandard": "c++17", | |||||
| "intelliSenseMode": "clang-x64" | |||||
| } | |||||
| ], | |||||
| "version": 4 | |||||
| } | |||||
| @ -0,0 +1,7 @@ | |||||
| { | |||||
| "files.associations": { | |||||
| "limits": "cpp", | |||||
| "type_traits": "cpp", | |||||
| "ostream": "cpp" | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,12 @@ | |||||
| { | |||||
| // See https://go.microsoft.com/fwlink/?LinkId=733558 | |||||
| // for the documentation about the tasks.json format | |||||
| "version": "2.0.0", | |||||
| "tasks": [ | |||||
| { | |||||
| "label": "echo", | |||||
| "type": "shell", | |||||
| "command": "echo Hello" | |||||
| } | |||||
| ] | |||||
| } | |||||
| @ -0,0 +1,44 @@ | |||||
| COMPILER=g++ | |||||
| #FLAGS=-g -I. -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Werror -Wno-unused | |||||
| #FLAGS=-g -I. | |||||
| FLAGS=-I. | |||||
| O_DIR=obj | |||||
| CLASS_DIR=src/class | |||||
| INTER_DIR=src/interface | |||||
| SYS_DIR=src/system | |||||
| OBJ_CMD=$(COMPILER) $(FLAGS) -c $< -o $@ | |||||
| .PHONY : clean | |||||
| version001 : main001.o character.o player.o monster.o creation.o info.o betatest.o | |||||
| $(COMPILER) $(FLAGS) -o $@ \ | |||||
| main001.o \ | |||||
| character.o player.o monster.o \ | |||||
| info.o creation.o \ | |||||
| betatest.o | |||||
| main001.o : main001.cpp $(CLASS_DIR)/player.hpp $(INTER_DIR)/creation.hpp $(INTER_DIR)/info.hpp $(SYS_DIR)/betatest.hpp | |||||
| $(OBJ_CMD) | |||||
| character.o : $(CLASS_DIR)/character.cpp $(CLASS_DIR)/character.hpp | |||||
| $(OBJ_CMD) | |||||
| player.o : $(CLASS_DIR)/player.cpp $(CLASS_DIR)/player.hpp $(CLASS_DIR)/character.hpp | |||||
| $(OBJ_CMD) | |||||
| monster.o : $(CLASS_DIR)/monster.cpp $(CLASS_DIR)/monster.hpp $(CLASS_DIR)/character.hpp | |||||
| $(OBJ_CMD) | |||||
| creation.o : $(INTER_DIR)/creation.cpp $(INTER_DIR)/creation.hpp $(CLASS_DIR)/player.hpp $(INTER_DIR)/info.hpp | |||||
| $(OBJ_CMD) | |||||
| info.o : $(INTER_DIR)/info.cpp $(INTER_DIR)/info.hpp $(CLASS_DIR)/player.hpp $(CLASS_DIR)/character.hpp $(CLASS_DIR)/monster.hpp | |||||
| $(OBJ_CMD) | |||||
| betatest.o : $(SYS_DIR)/betatest.cpp $(SYS_DIR)/betatest.hpp | |||||
| $(OBJ_CMD) | |||||
| clean : | |||||
| rm -f *.o | |||||
| @ -0,0 +1 @@ | |||||
| GKSK{4re_Y0u_53ri0usly_checking_f0r_b3t4_t3sT?} | |||||
| @ -1,95 +0,0 @@ | |||||
| #ifndef _2EASY4ME_CHARACTER_H_ | |||||
| #define _2EASY4ME_CHARACTER_H_ | |||||
| #include <cstring> | |||||
| class Character | |||||
| { | |||||
| protected: | |||||
| char name[16]; | |||||
| int maxHp; | |||||
| int hp; | |||||
| int att; | |||||
| int def; | |||||
| public: | |||||
| Character(char *name) | |||||
| { | |||||
| strncpy(this->name, name, sizeof(this->name)); | |||||
| this->maxHp = 100; | |||||
| this->hp = 100; | |||||
| this->att = 10; | |||||
| this->def = 5; | |||||
| } | |||||
| Character(char *name, int hp, int att, int def) | |||||
| { | |||||
| strncpy(this->name, name, sizeof(this->name)); | |||||
| this->maxHp = hp; | |||||
| this->hp = hp; | |||||
| this->att = att; | |||||
| this->def = def; | |||||
| } | |||||
| bool isDead() | |||||
| { | |||||
| return hp <= 0; | |||||
| } | |||||
| bool isAlive() | |||||
| { | |||||
| return hp > 0; | |||||
| } | |||||
| bool restoreHP() | |||||
| { | |||||
| this->hp = this->maxHp; | |||||
| } | |||||
| int checkHP() | |||||
| { | |||||
| return hp; | |||||
| } | |||||
| int getMaxHP() | |||||
| { | |||||
| return maxHp; | |||||
| } | |||||
| int getDef() | |||||
| { | |||||
| return def; | |||||
| } | |||||
| char *getName() | |||||
| { | |||||
| return name; | |||||
| } | |||||
| int getAtt() | |||||
| { | |||||
| return att; | |||||
| } | |||||
| int defend(int dmg) | |||||
| { | |||||
| dmg -= def; | |||||
| if (dmg > 0) | |||||
| { | |||||
| hp -= dmg; | |||||
| return dmg; | |||||
| } | |||||
| else | |||||
| { | |||||
| return 0; | |||||
| } | |||||
| } | |||||
| int attack() | |||||
| { | |||||
| return att; | |||||
| } | |||||
| }; | |||||
| #endif | |||||
| @ -1,36 +0,0 @@ | |||||
| #ifndef _2EASY4ME_MONSTER_H_ | |||||
| #define _2EASY4ME_MONSTER_H_ | |||||
| #include "character.hpp" | |||||
| class Monster : public Character | |||||
| { | |||||
| protected: | |||||
| int bounty; | |||||
| public: | |||||
| Monster(char *name) | |||||
| : Character(name) | |||||
| { | |||||
| this->bounty = 0; | |||||
| } | |||||
| Monster(char *name, int hp, int att, int def) | |||||
| : Character(name, hp, att, def) | |||||
| { | |||||
| this->bounty = 0; | |||||
| } | |||||
| Monster(char *name, int hp, int att, int def, int bounty) | |||||
| : Character(name, hp, att, def) | |||||
| { | |||||
| this->bounty = bounty; | |||||
| } | |||||
| int drop() | |||||
| { | |||||
| return bounty; | |||||
| } | |||||
| }; | |||||
| #endif | |||||
| @ -1,88 +0,0 @@ | |||||
| #ifndef _2EASY4ME_PLAYER_H_ | |||||
| #define _2EASY4ME_PLAYER_H_ | |||||
| #include "character.hpp" | |||||
| #include "string.h" | |||||
| class Player : public Character | |||||
| { | |||||
| protected: | |||||
| int xp; | |||||
| int level; | |||||
| public: | |||||
| Player(char *name) | |||||
| : Character(name) | |||||
| { | |||||
| this->xp = 0; | |||||
| this->level = 1; | |||||
| } | |||||
| Player(char *name, int hp, int att, int def, int level, int xp) | |||||
| : Character(name, hp, att, def) | |||||
| { | |||||
| this->xp = xp; | |||||
| this->level = level; | |||||
| } | |||||
| int getLevel() | |||||
| { | |||||
| return level; | |||||
| } | |||||
| bool checkLevelup() | |||||
| { | |||||
| return xp > (level * level); | |||||
| } | |||||
| bool levelUp(int stat) | |||||
| { | |||||
| switch (stat) | |||||
| { | |||||
| case 1: | |||||
| hp += 10; | |||||
| break; | |||||
| case 2: | |||||
| att += 2; | |||||
| break; | |||||
| case 3: | |||||
| def += 1; | |||||
| break; | |||||
| } | |||||
| xp -= level * level; | |||||
| } | |||||
| int generateCode(char *dst) | |||||
| { | |||||
| return sprintf(dst, | |||||
| "PlayerName:%15s;PlayerHp:%d;PlayerAtt:%d;PlayerDef:%d;PlayerLvl:%d;PlayerExp:%d;", | |||||
| this->name, this->hp, this->att, this->def, this->level, this->xp); | |||||
| } | |||||
| Player *loadCode(char *dst) | |||||
| { | |||||
| char name[16]; | |||||
| int hp; | |||||
| int att; | |||||
| int def; | |||||
| int lvl; | |||||
| int exp; | |||||
| int result = sscanf(dst, | |||||
| "PlayerName:%15s;PlayerAtt:%d;PlayerDef:%d;PlayerLvl:%d;PlayerExp:%d;", | |||||
| name, &hp, &att, &def, &lvl, &exp); | |||||
| if (result == 5) | |||||
| { | |||||
| return new Player(name, hp, att, def, lvl, exp); | |||||
| } | |||||
| else | |||||
| { | |||||
| return nullptr; | |||||
| } | |||||
| } | |||||
| }; | |||||
| #endif | |||||
| @ -1,33 +0,0 @@ | |||||
| #include <iostream> | |||||
| #include <cstring> | |||||
| #include <math.h> | |||||
| #include "cpp-base64/base64.h" | |||||
| #include "cpp-base64/base64.cpp" | |||||
| #include "class/monster.hpp" | |||||
| #include "class/player.hpp" | |||||
| Player* createNewPlayer() | |||||
| { | |||||
| char name[16]; | |||||
| printf("Input character name (MAX 15): "); | |||||
| scanf("%15s", name); | |||||
| return new Player(name); | |||||
| } | |||||
| int main(int argc, char const *argv[]) | |||||
| { | |||||
| char name[16]; | |||||
| printf("Input name: "); | |||||
| scanf("%15s", name); | |||||
| Player *player = new Player(name); | |||||
| printf("Created new player with name %s at %p\n", name, (void *)player); | |||||
| return 0; | |||||
| } | |||||
| @ -0,0 +1,58 @@ | |||||
| #include "src/class/player.hpp" | |||||
| #include "src/interface/creation.hpp" | |||||
| #include "src/interface/info.hpp" | |||||
| #include "src/system/betatest.hpp" | |||||
| #include <iostream> | |||||
| int main(int argc, char const *argv[]) | |||||
| { | |||||
| Player *player = nullptr; | |||||
| if (checkBetaTest()) | |||||
| { | |||||
| int choice; | |||||
| do | |||||
| { | |||||
| printf("===== HackTheGame v0.0.1 (Beta) =====\n"); | |||||
| printf("[1] Create new Character\n"); | |||||
| printf("[2] Character Info\n"); | |||||
| printf("[9] Credits\n"); | |||||
| printf("[0] Exit\n"); | |||||
| printf(">"); | |||||
| scanf("%d", &choice); | |||||
| switch (choice) | |||||
| { | |||||
| case 1: | |||||
| player = createCharacter(); | |||||
| break; | |||||
| case 2: | |||||
| if (player == nullptr) | |||||
| { | |||||
| std::cout << "Please create a character first!" << std::endl; | |||||
| } | |||||
| else | |||||
| { | |||||
| Info::ofPlayer(player); | |||||
| } | |||||
| break; | |||||
| case 9: | |||||
| Info::ofApplication(); | |||||
| break; | |||||
| case 0: | |||||
| break; | |||||
| default: | |||||
| printf("Not Implemented...\n"); | |||||
| } | |||||
| } while (choice != 0); | |||||
| } | |||||
| else | |||||
| { | |||||
| printf("Please get a beta.test key from one of our developer to get access to beta test...\n"); | |||||
| return 0; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1 @@ | |||||
| @ -0,0 +1,73 @@ | |||||
| #include "src/class/character.hpp" | |||||
| Character::Character(std::string characterName) | |||||
| { | |||||
| name = characterName; | |||||
| maxHP = 100; | |||||
| currentHP = 100; | |||||
| atk = 10; | |||||
| def = 5; | |||||
| } | |||||
| Character::Character(std::string characterName, int characterMaxHP, int characterAtk, int characterDef) | |||||
| { | |||||
| name = characterName; | |||||
| maxHP = characterMaxHP; | |||||
| currentHP = maxHP; | |||||
| atk = characterAtk; | |||||
| def = characterDef; | |||||
| } | |||||
| bool Character::isDead() | |||||
| { | |||||
| return currentHP <= 0; | |||||
| } | |||||
| bool Character::isAlive() | |||||
| { | |||||
| return currentHP > 0; | |||||
| } | |||||
| std::string Character::getName() | |||||
| { | |||||
| return name; | |||||
| } | |||||
| void Character::restoreHP() | |||||
| { | |||||
| currentHP = maxHP; | |||||
| } | |||||
| int Character::getCurrentHP() | |||||
| { | |||||
| return currentHP; | |||||
| } | |||||
| int Character::getMaxHP() | |||||
| { | |||||
| return maxHP; | |||||
| } | |||||
| int Character::getDef() | |||||
| { | |||||
| return def; | |||||
| } | |||||
| int Character::getAtk() | |||||
| { | |||||
| return atk; | |||||
| } | |||||
| int Character::defend(int dmg) | |||||
| { | |||||
| int cleanDamage = dmg - def; | |||||
| if (cleanDamage <= 0) | |||||
| { | |||||
| return 0; | |||||
| } | |||||
| else | |||||
| { | |||||
| currentHP = currentHP - cleanDamage; | |||||
| return cleanDamage; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,36 @@ | |||||
| #ifndef HACKTHEGAME_CHARACTER_HPP | |||||
| #define HACKTHEGAME_CHARACTER_HPP | |||||
| #include <string> | |||||
| class Character | |||||
| { | |||||
| protected: | |||||
| std::string name; | |||||
| int maxHP; | |||||
| int currentHP; | |||||
| int atk; | |||||
| int def; | |||||
| public: | |||||
| Character(std::string characterName); | |||||
| Character(std::string characterName, int characterMaxHP, int characterAtk, int characterDef); | |||||
| bool isDead(); | |||||
| bool isAlive(); | |||||
| std::string getName(); | |||||
| void restoreHP(); | |||||
| int getCurrentHP(); | |||||
| int getMaxHP(); | |||||
| int getDef(); | |||||
| int getAtk(); | |||||
| int defend(int dmg); | |||||
| }; | |||||
| #endif | |||||
| @ -0,0 +1,24 @@ | |||||
| #include "src/class/monster.hpp" | |||||
| Monster::Monster(std::string monsterName) | |||||
| : Character(monsterName) | |||||
| { | |||||
| bounty = 0; | |||||
| } | |||||
| Monster::Monster(std::string monsterName, int monsterMaxHP, int monsterAtk, int monsterDef) | |||||
| : Character(monsterName, monsterMaxHP, monsterAtk, monsterDef) | |||||
| { | |||||
| bounty = 0; | |||||
| } | |||||
| Monster::Monster(std::string monsterName, int monsterMaxHP, int monsterAtk, int monsterDef, int monsterBounty) | |||||
| : Character(monsterName, monsterMaxHP, monsterAtk, monsterDef) | |||||
| { | |||||
| bounty = monsterBounty; | |||||
| } | |||||
| int Monster::getBounty() | |||||
| { | |||||
| return bounty; | |||||
| } | |||||
| @ -0,0 +1,19 @@ | |||||
| #ifndef HACKTHEGAME_MONSTER_HPP | |||||
| #define HACKTHEGAME_MONSTER_HPP | |||||
| #include "src/class/character.hpp" | |||||
| class Monster : public Character | |||||
| { | |||||
| protected: | |||||
| int bounty; | |||||
| public: | |||||
| Monster(std::string monsterName); | |||||
| Monster(std::string monsterName, int monsterMaxHP, int monsterAtk, int monsterDef); | |||||
| Monster(std::string monsterName, int monsterMaxHP, int monsterAtk, int monsterDef, int monsterBounty); | |||||
| int getBounty(); | |||||
| }; | |||||
| #endif | |||||
| @ -0,0 +1,81 @@ | |||||
| #include "src/class/player.hpp" | |||||
| #include <string.h> | |||||
| Player::Player(std::string playerName) | |||||
| : Character(playerName) | |||||
| { | |||||
| experience = 0; | |||||
| level = 1; | |||||
| } | |||||
| Player::Player(std::string playerName, int playerMaxHP, int playerAtk, int playerDef, int playerLevel, int playerExp) | |||||
| : Character(playerName, playerMaxHP, playerAtk, playerDef) | |||||
| { | |||||
| experience = playerExp; | |||||
| level = playerLevel; | |||||
| } | |||||
| int Player::getLevel() | |||||
| { | |||||
| return level; | |||||
| } | |||||
| int Player::getExp() | |||||
| { | |||||
| return experience; | |||||
| } | |||||
| int Player::expToLevelUp() | |||||
| { | |||||
| if (level >= PLAYER_MAX_LEVEL) | |||||
| { | |||||
| return 0; | |||||
| } | |||||
| else | |||||
| { | |||||
| return (level * level) - experience; | |||||
| } | |||||
| } | |||||
| bool Player::checkLevelup() | |||||
| { | |||||
| return expToLevelUp() < 0; | |||||
| } | |||||
| bool Player::levelUp(int stat) | |||||
| { | |||||
| if (checkLevelup()) | |||||
| { | |||||
| switch (stat) | |||||
| { | |||||
| case 1: | |||||
| maxHP += 10; | |||||
| restoreHP(); | |||||
| break; | |||||
| case 2: | |||||
| atk += 2; | |||||
| break; | |||||
| case 3: | |||||
| def += 1; | |||||
| break; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| else | |||||
| { | |||||
| return false; | |||||
| } | |||||
| } | |||||
| int Player::takeExperience(int bounty) | |||||
| { | |||||
| experience = experience + bounty; | |||||
| if (experience > PLAYER_MAX_EXPERIENCE) | |||||
| { | |||||
| experience = PLAYER_MAX_EXPERIENCE; | |||||
| } | |||||
| return experience; | |||||
| } | |||||
| @ -0,0 +1,28 @@ | |||||
| #ifndef HACKTHEGAME_PLAYER_HPP | |||||
| #define HACKTHEGAME_PLAYER_HPP | |||||
| #define PLAYER_MAX_LEVEL 1000 | |||||
| #define PLAYER_MAX_EXPERIENCE 9999999 | |||||
| #include "src/class/character.hpp" | |||||
| class Player : public Character | |||||
| { | |||||
| protected: | |||||
| int experience; | |||||
| int level; | |||||
| public: | |||||
| Player(std::string playerName); | |||||
| Player(std::string playerName, int playerMaxHP, int playerAtt, int playerDef, int playerLevel, int playerExp); | |||||
| int getLevel(); | |||||
| int getExp(); | |||||
| int expToLevelUp(); | |||||
| int takeExperience(int drop); | |||||
| bool checkLevelup(); | |||||
| bool levelUp(int stat); | |||||
| }; | |||||
| #endif | |||||
| @ -0,0 +1,11 @@ | |||||
| #ifndef HACKTHEGAME_BATTLESYSTEM_VERSION_000_HPP | |||||
| #define HACKTHEGAME_BATTLESYSTEM_VERSION_000_HPP | |||||
| #include "src/class/monster.hpp" | |||||
| #include "src/class/player.hpp" | |||||
| #include <cstdio> | |||||
| int startBattle(Player *player, Monster *monster); | |||||
| #endif | |||||
| @ -0,0 +1,43 @@ | |||||
| #include "src/interface/creation.hpp" | |||||
| #include "src/interface/info.hpp" | |||||
| #include <iostream> | |||||
| Player *createCharacter() | |||||
| { | |||||
| std::string name; | |||||
| char choice; | |||||
| Player *newPlayer = new Player("HackTheGame"); | |||||
| std::cout << "Welcome to character creation !!!" << std::endl; | |||||
| do | |||||
| { | |||||
| std::cout << "Please enter your character name: (Max 15 letters)\n" | |||||
| << "> " << std::flush; | |||||
| std::cin >> name; | |||||
| if (name.size() > 15) | |||||
| { | |||||
| std::cout << "Your name is too long!" << std::endl; | |||||
| continue; | |||||
| } | |||||
| std::cout << "Creating your character..." << std::endl; | |||||
| delete newPlayer; | |||||
| newPlayer = new Player(name); | |||||
| std::cout << "Done...\n" | |||||
| << "Character Info: " << std::endl; | |||||
| Info::ofCharacter(newPlayer); | |||||
| std::cout << "Accept (y/N)?: " << std::flush; | |||||
| std::cin >> choice; | |||||
| } while (choice != 'Y' && choice != 'y'); | |||||
| return newPlayer; | |||||
| } | |||||
| @ -0,0 +1,9 @@ | |||||
| #ifndef HACKTHEGAME_CHARACTER_CREATION_HPP | |||||
| #define HACKTHEGAME_CHARACTER_CREATION_HPP | |||||
| #include "src/class/player.hpp" | |||||
| #include "src/class/monster.hpp" | |||||
| Player *createCharacter(); | |||||
| #endif | |||||
| @ -0,0 +1,49 @@ | |||||
| #include "src/interface/info.hpp" | |||||
| #include <iostream> | |||||
| void Info::ofCharacter(Character *character) | |||||
| { | |||||
| std::cout << "Name: " << character->getName() << "\n" | |||||
| << " HP : " << character->getCurrentHP() << "/" << character->getMaxHP() << "\n" | |||||
| << " Atk: " << character->getAtk() << "\n" | |||||
| << " Def: " << character->getDef() << std::endl; | |||||
| } | |||||
| void Info::ofPlayer(Player *player) | |||||
| { | |||||
| std::cout << "Name: " << player->getName() << "\n" | |||||
| << " Lvl: " << player->getLevel() << "\n" | |||||
| << " Experience: " << player->getExp() << "\n" | |||||
| << " to LevelUp: " << player->expToLevelUp() << "\n" | |||||
| << " HP : " << player->getCurrentHP() << "/" << player->getMaxHP() << "\n" | |||||
| << " Atk: " << player->getAtk() << "\n" | |||||
| << " Def: " << player->getDef() << std::endl; | |||||
| } | |||||
| void Info::ofMonster(Monster *monster) | |||||
| { | |||||
| std::cout << "Name: " << monster->getName() << "\n" | |||||
| << " HP : " << monster->getCurrentHP() << "/" << monster->getMaxHP() << "\n" | |||||
| << " Atk: " << monster->getAtk() << "\n" | |||||
| << " Def: " << monster->getDef() << "\n" | |||||
| << " Lvl: " << monster->getBounty() << std::endl; | |||||
| } | |||||
| void Info::ofApplication() | |||||
| { | |||||
| std::cout << "=================================\n" | |||||
| << "========== HackTheGame ==========\n" | |||||
| << "=================================\n" | |||||
| << "This stupid app is developed for \n" | |||||
| << "CTF @GKSK2019 that was held on \n" | |||||
| << "16 Feb 2019 as a playground for \n" | |||||
| << "Kelompok Studi Linux Members of \n" | |||||
| << "STMIK STIKOM Bali-> \n" | |||||
| << "Developed by: \n" | |||||
| << " myitinos \n" | |||||
| << " \n" | |||||
| << "Thanks for Playing !!! \n" | |||||
| << "=================================\n" | |||||
| << std::endl; | |||||
| } | |||||
| @ -0,0 +1,21 @@ | |||||
| #ifndef HACKTHEGAME_CHARACTER_INFO_HPP | |||||
| #define HACKTHEGAME_CHARACTER_INFO_HPP | |||||
| #include "src/class/character.hpp" | |||||
| #include "src/class/monster.hpp" | |||||
| #include "src/class/player.hpp" | |||||
| class Info | |||||
| { | |||||
| private: | |||||
| Info(){}; | |||||
| public: | |||||
| static void ofCharacter(Character *); | |||||
| static void ofPlayer(Player *); | |||||
| static void ofMonster(Monster *); | |||||
| static void ofApplication(); | |||||
| }; | |||||
| #endif | |||||
| @ -0,0 +1,29 @@ | |||||
| #include "src/system/betatest.hpp" | |||||
| #include <fstream> | |||||
| #include <string> | |||||
| bool checkBetaTest() | |||||
| { | |||||
| std::string betaFlag = "4re_Y0u_53ri0usly_checking_f0r_b3t4_t3sT?"; | |||||
| std::string tmp; | |||||
| int result = -1; | |||||
| try | |||||
| { | |||||
| std::fstream betaFile("beta.test"); | |||||
| if (betaFile) { | |||||
| betaFile >> tmp; | |||||
| result = tmp.compare("GKSK{" + betaFlag + "}"); | |||||
| } | |||||
| } | |||||
| catch(...) | |||||
| { | |||||
| return false; | |||||
| } | |||||
| return result == 0; | |||||
| } | |||||
| @ -0,0 +1,6 @@ | |||||
| #ifndef HACKTHEGAME_BETATEST_HPP | |||||
| #define HACKTHEGAME_BETATEST_HPP | |||||
| bool checkBetaTest(); | |||||
| #endif | |||||