00001 #ifndef CRONOUS_INTERFACE_HH_
00002 # define CRONOUS_INTERFACE_HH_
00003
00004 # include <string>
00005 # include <vector>
00006 # include <map>
00007
00008 # include "language.hh"
00009
00010 namespace environment
00011 {
00012 struct ServerInfo
00013 {
00014 ServerInfo(std::string ip, std::string description, unsigned short port, int server_id = -1);
00015 ~ServerInfo();
00016
00017 static void make(std::string ip, std::string description, unsigned short port, int server_id = -1);
00018
00019 std::string _ip;
00020 std::string _description;
00021 unsigned short _port;
00022 int _server_id;
00023 };
00024
00025 class CronousInterface
00026 {
00027 public:
00028 typedef std::map<std::string, std::string> EnvironmentVariables;
00029 typedef std::map<int, int> ItemPrice;
00030
00031 public:
00032 CronousInterface(std::string username, std::string password, int character = 0);
00033 ~CronousInterface();
00034
00035 static CronousInterface &get_instance();
00036
00037
00038 std::string get_username() const;
00039 std::string get_password() const;
00040 void set_username(std::string user);
00041 void set_password(std::string pass);
00042
00043
00044 int get_character() const;
00045 void set_character(int id);
00046
00047
00048 const std::vector<ServerInfo *> &get_server_list() const;
00049 ServerInfo *get_selected_server() const;
00050 void set_selected_server(ServerInfo *si);
00051
00052
00053 void assign_status(int status_id);
00054 void assign_skill(int skill_id);
00055
00056
00057 bool get_attack_skills_enabled() const;
00058 bool get_support_skills_enabled() const;
00059 void set_attack_skills_enabled(bool enabled);
00060 void set_support_skills_enabled(bool enabled);
00061
00062
00063 void set_desired_hunt_course(int map_id, const std::string &name);
00064 const std::string *get_desired_hunt_course() const;
00065 int get_desired_hunt_course_map_id() const;
00066
00067
00068 void set_variable(const std::string &name, const std::string &value);
00069 const std::string &get_variable(const std::string &name);
00070 const std::vector<std::string> &get_variables() const;
00071
00072
00073 void clear_personal_shop();
00074 void add_personal_shop_item(int id, int price);
00075 const ItemPrice &get_personal_shop_item_price() const;
00076 const std::string &get_personal_shop_message() const;
00077 void set_personal_shop_message(const std::string &message);
00078
00079
00080 language::Language &get_language();
00081
00082 protected:
00083 std::string _username;
00084 std::string _password;
00085 ServerInfo *_selected_server;
00086 int _character;
00087 bool _attack_skills_enabled;
00088 bool _support_skills_enabled;
00089 std::string *_desired_hunt_course;
00090 int _desired_hunt_course_map_id;
00091 EnvironmentVariables _variables;
00092 ItemPrice _personal_shop_item_price;
00093 std::string _personal_shop_message;
00094 };
00095 }
00096
00097 # include "cronous-interface.hxx"
00098
00099 #endif