3 Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include "cpp_api/s_base.h"
28 #include "cpp_api/s_player.h"
29 #include "cpp_api/s_env.h"
30 #include "cpp_api/s_node.h"
31 #include "cpp_api/s_inventory.h"
32 #include "cpp_api/s_entity.h"
36 /*****************************************************************************/
37 /* Scriptapi <-> Core Interface */
38 /*****************************************************************************/
41 : virtual public ScriptApiBase,
42 public ScriptApiPlayer,
45 public ScriptApiDetached,
46 public ScriptApiEntity
50 ScriptApi(Server* server);
53 // Returns true if script handled message
54 bool on_chat_message(const std::string &name, const std::string &message);
60 bool getAuth(const std::string &playername,
61 std::string *dst_password, std::set<std::string> *dst_privs);
62 void createAuth(const std::string &playername,
63 const std::string &password);
64 bool setPassword(const std::string &playername,
65 const std::string &password);
67 /** register a lua api module to scriptapi */
68 static bool registerModApiModule(ModApiBase* prototype);
70 bool loadMod(const std::string &scriptpath,const std::string &modname);
73 void getAuthHandler();
74 void readPrivileges(int index,std::set<std::string> &result);
76 bool scriptLoad(const char *path);
78 static std::vector<ModApiBase*>* m_mod_api_modules;
82 #endif /* SCRIPTAPI_H_ */