Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / r2 / dmc / com_lua_module.h
blobcddbc7f8567a5dcb665a1e96a5bd73f808442ef3
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2013 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef DMS_COMLUAMODULE_H
21 #define DMS_COMLUAMODULE_H
23 #include "nel/misc/types_nl.h"
26 extern "C"
28 #include "nel/gui/lua_loadlib.h"
35 #include <map>
36 #include <string>
38 #include "game_share/scenario.h"
40 namespace R2
42 class CObject;
43 class CDynamicMapClient;
45 class CComLuaModule
47 public:
48 /** Build the communication module
49 * \param luaState NULL If the lua environment should be built by this object
50 * If the lua state is provided externally, then it won't be deleted by this object
53 CComLuaModule(CDynamicMapClient* client, lua_State *luaState = NULL);
55 void doFile(const std::string& filename);
57 bool runLuaScript(const std::string& filename, std::string& errorMsg);
59 CObject* translateFeatures(CObject* hlScenario, std::string& errorMsg) const;
61 void loadFeatures();
63 static CComLuaModule* getInstance(lua_State* state);
65 void callTranslateFeatures(CObject* scenario);
68 //Edition
69 static sint luaAddPaletteElement(lua_State* state);
70 static sint luaIsInPalette(lua_State* state);
72 static sint luaGetPropertyValue(lua_State* state);
73 static sint luaPrint(lua_State* state);
75 static sint luaGetPaletteElement(lua_State* state);
77 static sint luaRequestTranslateFeatures(lua_State* state);
79 static sint luaNewComponent(lua_State* state);
81 static sint luaNewGhostComponent(lua_State* state);
83 static sint luaRegisterGenerator(lua_State* state);
85 static sint luaShow(lua_State* state);
87 static sint luaRequestInsertNode(lua_State* state);
89 static sint luaRequestInsertGhostNode(lua_State* state);
91 static sint luaRequestSetNode(lua_State* state);
93 static sint luaRequestSetGhostNode(lua_State* state);
95 static sint luaRequestEraseNode(lua_State* state);
97 static sint luaRequestMoveNode(lua_State* state);
99 static sint luaRequestNewAction(lua_State* state);
101 static sint luaRequestNewMultiAction(lua_State* state);
103 static sint luaRequestCancelAction(lua_State* state);
105 static sint luaRequestForceEndMultiAction(lua_State* state);
107 static sint luaRequestNewPendingMultiAction(lua_State* state);
109 static sint luaRequestClearActionHistoric(lua_State* state);
111 static sint luaRequestNewPendingAction(lua_State* state);
113 static sint luaRequestEndAction(lua_State* state);
115 static sint luaRequestUpdateRtScenario(lua_State* state);
117 static sint luaSetScenarioUpToDate(lua_State* state);
121 //Admin
123 static sint luaRequestCreatePrimitives(lua_State* state);
125 static sint luaRequestStopLive(lua_State* state);
127 static sint luaRequestStartAct(lua_State* state);
129 static sint luaRequestStopAct(lua_State* state);
131 static sint luaRequestMapConnection(lua_State* state);
133 static sint luaRequestReconnection(lua_State* state);
135 static sint luaRequestUploadCurrentScenario(lua_State* state);
137 static sint luaRequestCreateScenario(lua_State* state);
139 static sint luaRequestSetWeather(lua_State* state);
141 static sint luaRequestSetSeason(lua_State* state);
143 static void setObjectToLua(lua_State* state, CObject* object);
145 static CObject* getObjectFromLua(lua_State* state, sint idx=-1);
148 CObject* loadFromBuffer(const std::string& data, const std::string& filename, const CScenarioValidator::TValues& values);
149 bool load(const std::string& filename);
150 bool loadUserComponent(const std::string& filename);
153 CObject* loadLocal(const std::string& filename, const CScenarioValidator::TValues& values);
155 static sint luaUpdateScenario(lua_State* state);
157 static sint luaLoadUserComponent(lua_State* state);
158 static sint luaSaveUserComponent(lua_State* state);
160 static sint luaLoad(lua_State* state);
161 static sint luaLoadAnimation(lua_State* state);
163 static sint luaSave(lua_State* state);
164 static sint luaDoFile2(lua_State* state);
165 static sint luaTalkAs(lua_State* state);
166 static sint luaStopTalkAs(lua_State* state);
167 static sint luaRequestTpPosition(lua_State* state);
168 static sint luaRequestDespawnEntity(lua_State* state);
169 static sint luaRequestDespawnGrp(lua_State* state);
170 static sint luaRequestIdList(lua_State* state);
171 static sint luaRequestStringTable(lua_State* state);
172 static sint luaRequestSetStringValue(lua_State* state);
173 static sint luaRequestStringValue(lua_State* state);
174 static sint luaGetScenarioObj(lua_State* state);
175 static sint luaGetNamespace(lua_State* state);
176 static sint luaGetIslandsLocation(lua_State* state);
177 static sint luaObjectToLua(lua_State* state);
178 static sint luaIsSessionOwner(lua_State* state);
180 //Component
181 static sint luaReadUserComponentFile(lua_State* state);
182 static sint luaRegisterUserComponent(lua_State* state);
183 static sint luaUpdateUserComponentsInfo(lua_State* state);
184 static sint luaSaveUserComponentFile(lua_State* state);
186 //Acts
187 static sint luaGetRuntimeActs(lua_State* state);
188 static sint luaGetUserTriggers(lua_State* state);
189 static sint luaGetCurrentActIndex(lua_State* state);
190 static sint luaTriggerUserTrigger(lua_State* state);
191 static sint luaRequestTpToEntryPoint(lua_State* state);
192 static sint luaRequestSetStartingAct(lua_State* state);
193 static sint luaSetStartingActIndex(lua_State* state);
197 //Quotas
198 static sint luaGetMaxNpcs(lua_State* state);
199 static sint luaGetMaxStaticObjects(lua_State* state);
201 static sint luaGetSheetIdName(lua_State* state);
203 //Scenario Component exporter
204 static sint luaGetMaxId(lua_State* state);
205 static sint luaReserveIdRange(lua_State* state);
206 static sint luaGetUserSlot(lua_State* state);
208 static sint luaGetEmoteBehaviorFromEmoteId(lua_State* state);
210 //features tutorial form display
211 static sint luaMustDisplayInfo(lua_State* state);
212 static sint luaHasDisplayInfo(lua_State* state);
213 static sint luaSetDisplayInfo(lua_State* state);
214 static sint luaResetDisplayInfo(lua_State* state);
217 static sint luaDssTarget(lua_State* state);
219 // DM functions
221 static sint luaGetTalkingAsList(lua_State* state);
222 static sint luaGetIncarnatingList(lua_State* state);
223 static sint luaGetScenarioHeader(lua_State* state);
225 // Ring Access
226 static sint luaGetRingAccessAsMap(lua_State* state);
227 static sint luaGetSheetRingAccess(lua_State* state);
228 static sint luaGetIslandRingAccess(lua_State* state);
229 static sint luaUpdateScenarioAck(lua_State* statet);
230 static sint luaGetCharacterRingAccess(lua_State* statet);
231 static sint luaVerifyRtScenario(lua_State* statet);
232 static sint luaCheckRingAccess(lua_State* state);
235 static sint luaGetEditSessionLink(lua_State* statet);
237 //Scenario files header access
238 static sint luaGetFileHeader(lua_State* state);
239 static sint luaGetMustVerifyRingAccessWhileLoadingAnimation(lua_State* state);
241 static sint luaGetUseVerboseRingAccess(lua_State* state);
242 static sint luaGetIsAnimationSession(lua_State* state);
244 static sint luaResetNameGiver(lua_State* state);
245 static sint luaGetCharIdMd5(lua_State* state);
246 static sint luaHasCharacterSameCharacterIdMd5(lua_State* state);
247 static sint luaGetScenarioSavePath(lua_State* state);
250 static sint luaCheckServerEditionModule(lua_State* state);
253 //static sint luaGetPropertyList(lua_State* state);
254 ~CComLuaModule();
255 private:
256 lua_State* _LuaState;
257 bool _LuaOwnerShip;
259 CDynamicMapClient* _Client;
261 static std::map<lua_State*, CComLuaModule*> _Instance;
263 // register the com lib into lua
264 void initLuaLib();
267 static sint requestInsertNode(lua_State* state, bool ghost);
268 static sint requestSetNode(lua_State* state, bool ghost);
271 static int luaRequestNewAction(lua_State* state, bool pending, uint count);
277 } // namespace DMS
278 #endif // DMS_COMLUAMODULE_H