mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-25 16:26:18 +00:00
Some more Lua refactoring, started to break CLuaIHM into 2 parts. CLuaIHM will be generic, CLuaIHMRyzom will contain the Ryzom only code.
This commit is contained in:
parent
fe6f5bb29a
commit
0df735f986
14 changed files with 3578 additions and 3350 deletions
|
@ -94,6 +94,7 @@
|
|||
#include "connection.h"
|
||||
#include "interface_v3/lua_object.h"
|
||||
#include "interface_v3/lua_ihm.h"
|
||||
#include "interface_v3/lua_ihm_ryzom.h"
|
||||
#include "init.h"
|
||||
#include "interface_v3/people_interraction.h"
|
||||
#include "far_tp.h"
|
||||
|
@ -5157,7 +5158,7 @@ NLMISC_COMMAND(luaObject, "Dump the content of a lua object", "<table name> [max
|
|||
}
|
||||
catch(const ELuaError &e)
|
||||
{
|
||||
CLuaIHM::debugInfo(e.what());
|
||||
CLuaIHMRyzom::debugInfo(e.what());
|
||||
return false;
|
||||
}
|
||||
luaState->pushValue(LUA_GLOBALSINDEX);
|
||||
|
|
|
@ -113,6 +113,7 @@ namespace NLGUI
|
|||
}
|
||||
using namespace NLGUI;
|
||||
#include "lua_ihm.h"
|
||||
#include "lua_ihm_ryzom.h"
|
||||
|
||||
#include "add_on_manager.h"
|
||||
|
||||
|
@ -5750,7 +5751,7 @@ bool CInterfaceManager::executeLuaScript(const std::string &luaScript, bool smal
|
|||
// Hamster: quick fix on AJM code but sscanf is still awfull
|
||||
if (sscanf(msg.c_str(), "%s: %s.lua:%d:",exceptionName, filename, &line) == 3) // NB: test not exact here, but should work in 99,9 % of cases
|
||||
{
|
||||
msg = CLuaIHM::createGotoFileButtonTag(filename, line) + msg;
|
||||
msg = CLuaIHMRyzom::createGotoFileButtonTag(filename, line) + msg;
|
||||
nlwarning(LuaHelperStuff::formatLuaErrorNlWarn(msg).c_str());
|
||||
displaySystemInfo(LuaHelperStuff::formatLuaErrorSysInfo(msg));
|
||||
}
|
||||
|
|
|
@ -108,6 +108,7 @@
|
|||
#include "nel/gui/lua_helper.h"
|
||||
using namespace NLGUI;
|
||||
#include "lua_ihm.h"
|
||||
#include "lua_ihm_ryzom.h"
|
||||
#include "../r2/editor.h"
|
||||
|
||||
#ifdef LUA_NEVRAX_VERSION
|
||||
|
@ -4671,6 +4672,7 @@ void CInterfaceParser::initLUA()
|
|||
|
||||
// register LUA methods
|
||||
CLuaIHM::registerAll(*_LuaState);
|
||||
CLuaIHMRyzom::RegisterRyzomFunctions( *_LuaState );
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -103,30 +103,6 @@ public:
|
|||
// helper : get a 2D poly (a table of cvector2f) from a lua table (throw on fail)
|
||||
static void getPoly2DOnStack(CLuaState &ls, sint index, NLMISC::CPolygon2D &dest);
|
||||
|
||||
// Print a message in the log.
|
||||
// Lua messages must be enabled (with ClientCfg.DisplayLuaDebugInfo = 1)
|
||||
// Additionnally, if ClientCfg.LuaDebugInfoGotoButtonEnabled is set, then
|
||||
// a button will be created near the line to allow to goto the lua line that issued the message
|
||||
// by using an external editor
|
||||
static void debugInfo(const std::string &dbg);
|
||||
// Print a message in the log
|
||||
// No 'goto file' button is created
|
||||
// Lua messages must be enabled (with ClientCfg.DisplayLuaDebugInfo = 1)
|
||||
static void rawDebugInfo(const std::string &dbg);
|
||||
// Dump callstack in the console
|
||||
// Additionnally, if ClientCfg.LuaDebugInfoGotoButtonEnabled is set, then
|
||||
// buttons will be created in fonr of eahc line to allow to goto the lua line that issued the message
|
||||
// by using an external editor
|
||||
static void dumpCallStack(int startStackLevel = 0);
|
||||
static void getCallStackAsString(int startStackLevel, std::string &result);
|
||||
|
||||
// Create a special tag that will add a 'goto' button for the given file and line
|
||||
// The tag should be appended in front of a string to use with 'rawDebugInfo'.
|
||||
// when the final string will be printed, a button will be created in front of it
|
||||
// Requires that 'ClientCfg.LuaDebugInfoGotoButtonEnabled' is set to 1, else
|
||||
// a, empty tag is returned
|
||||
static std::string createGotoFileButtonTag(const char *fileName, uint line);
|
||||
|
||||
// argument checkin helpers
|
||||
static void checkArgCount(CLuaState &ls, const char* funcName, uint nArgs); // check that number of argument is exactly the one required
|
||||
static void checkArgMin(CLuaState &ls, const char* funcName, uint nArgs); // check that number of argument is at least the one required
|
||||
|
@ -141,12 +117,6 @@ public:
|
|||
*/
|
||||
static void fails(CLuaState &ls, const char *format, ...);
|
||||
|
||||
/** execute function that is currently on the stack, possibly outputing error messages to the log
|
||||
* \return true if execution succeeded
|
||||
*/
|
||||
static bool executeFunctionOnStack(CLuaState &ls, int numArgs, int numRet);
|
||||
|
||||
|
||||
// pop a sint32 from a lua stack, throw an exception on fail
|
||||
static bool popSINT32(CLuaState &ls, sint32 & dest);
|
||||
bool popString(CLuaState &ls, std::string & dest);
|
||||
|
@ -184,231 +154,24 @@ private:
|
|||
// @{
|
||||
|
||||
// LUA exported Functions with luabind
|
||||
static sint32 getPlayerLevel(); // get max level among player skills (magi, combat, crafting ,foraging)
|
||||
static sint64 getPlayerVpa();
|
||||
static sint64 getPlayerVpb();
|
||||
static sint64 getPlayerVpc();
|
||||
static sint32 getTargetLevel(); // get current, precise level of the selected target, or -1 if there's no such selected target
|
||||
static sint32 getTargetForceRegion(); // get 'force region' for current target, or -1 if there's no selected target
|
||||
static sint32 getTargetLevelForce(); // get 'level force' for current target, or -1 if there's no selected target
|
||||
static ucstring getTargetSheet(); // get the name of the target sheet (like 'zoha2old.creature')
|
||||
static sint64 getTargetVpa();
|
||||
static sint64 getTargetVpb();
|
||||
static sint64 getTargetVpc();
|
||||
static bool isTargetNPC(); // return 'true' if the target is an npc
|
||||
static bool isTargetPlayer(); // return 'true' if the target is a player
|
||||
static bool isTargetUser(); // return 'true' if the target is the user
|
||||
static bool isPlayerInPVPMode();
|
||||
static bool isTargetInPVPMode();
|
||||
|
||||
static void pauseBGDownloader();
|
||||
static void unpauseBGDownloader();
|
||||
static void requestBGDownloaderPriority(uint priority);
|
||||
static sint getBGDownloaderPriority();
|
||||
static ucstring getPatchLastErrorMessage();
|
||||
static bool isInGame();
|
||||
static uint32 getPlayerSelectedSlot();
|
||||
static bool isPlayerSlotNewbieLand(uint32 slot); // test if one of the player slot is a newbieland one, if not so, client must be patched in order to continue
|
||||
static uint32 getLocalTime();
|
||||
static double getPreciseLocalTime();
|
||||
static sint32 getDbProp(const std::string &dbProp); // return 0 if not found.
|
||||
static void setDbProp(const std::string &dbProp, sint32 value); // Nb: the db prop is not created if not present.
|
||||
static void addDbProp(const std::string &dbProp, sint32 value); // Nb: the db prop is created if not present.
|
||||
static void delDbProp(const std::string &dbProp);
|
||||
static std::string getDefine(const std::string &def);
|
||||
static void messageBox(const ucstring &text);
|
||||
static void messageBox(const ucstring &text, const std::string &masterGroup);
|
||||
static void messageBox(const ucstring &text, const std::string &masterGroup, int caseMode);
|
||||
static void messageBox(const std::string &text);
|
||||
static void messageBoxWithHelp(const ucstring &text);
|
||||
static void messageBoxWithHelp(const ucstring &text, const std::string &masterGroup);
|
||||
static void messageBoxWithHelp(const ucstring &text, const std::string &masterGroup, int caseMode);
|
||||
static void messageBoxWithHelp(const std::string &text);
|
||||
|
||||
static std::string findReplaceAll(const std::string &str, const std::string &search, const std::string &replace);
|
||||
static ucstring findReplaceAll(const ucstring &str, const ucstring &search, const ucstring &replace);
|
||||
static bool fileExists(const std::string &fileName);
|
||||
// just for ease of use
|
||||
static ucstring findReplaceAll(const ucstring &str, const std::string &search, const std::string &replace);
|
||||
static ucstring findReplaceAll(const ucstring &str, const std::string &search, const ucstring &replace);
|
||||
static ucstring findReplaceAll(const ucstring &str, const ucstring &search, const std::string &replace);
|
||||
static void setContextHelpText(const ucstring &text);
|
||||
// GameInfo
|
||||
static sint32 getSkillIdFromName(const std::string &def);
|
||||
static ucstring getSkillLocalizedName(sint32 skillId);
|
||||
static sint32 getMaxSkillValue(sint32 skillId);
|
||||
static sint32 getBaseSkillValueMaxChildren(sint32 skillId);
|
||||
static sint32 getMagicResistChance(bool elementalSpell, sint32 casterSpellLvl, sint32 victimResistLvl);
|
||||
static sint32 getDodgeParryChance(sint32 attLvl, sint32 defLvl);
|
||||
static void browseNpcWebPage(const std::string &htmlId, const std::string &url, bool addParameters, double timeout);
|
||||
static void clearHtmlUndoRedo(const std::string &htmlId);
|
||||
static ucstring getDynString(sint32 dynStringId);
|
||||
static bool isDynStringAvailable(sint32 dynStringId);
|
||||
static bool isFullyPatched();
|
||||
static std::string getSheetType(const std::string &sheet);
|
||||
static std::string getSheetName(uint32 sheetId);
|
||||
static sint32 getFameIndex(const std::string &factionName);
|
||||
static std::string getFameName(sint32 fameIndex);
|
||||
static sint32 getFameDBIndex(sint32 fameIndex); // convert from the fame index
|
||||
static sint32 getFirstTribeFameIndex(); // fame index of the 1st tribe
|
||||
static sint32 getNbTribeFameIndex(); // number of tribe fame index (which are contiguous)
|
||||
static std::string getClientCfg(const std::string &varName);
|
||||
static void sendMsgToServer(const std::string &msgName);
|
||||
static void sendMsgToServerPvpTag(bool pvpTag);
|
||||
static ucstring replacePvpEffectParam(const ucstring &str, sint32 parameter);
|
||||
static std::string getRegionByAlias(uint32 alias);
|
||||
|
||||
static void tell(const ucstring &player, const ucstring &msg); // open the window to do a tell to 'player', if 'msg' is not empty, then the message will be sent immediatly
|
||||
// else, current command of the chat window will be replaced with tell 'player'
|
||||
|
||||
static bool isGuildQuitAvailable();
|
||||
static void sortGuildMembers();
|
||||
static sint32 getNbGuildMembers();
|
||||
static std::string getGuildMemberName(sint32 nMemberId);
|
||||
static std::string getGuildMemberGrade(sint32 nMemberId);
|
||||
static sint32 secondsSince1970ToHour(sint32 seconds);
|
||||
|
||||
// sheet access
|
||||
// TODO nico : using the reflection system on sheets would allow to export them to lua without these functions ...
|
||||
static std::string getCharacterSheetSkel(const std::string &sheet, bool isMale);
|
||||
static sint32 getSheetId(const std::string &itemName);
|
||||
static bool isR2Player(const std::string &sheet);
|
||||
static std::string getR2PlayerRace(const std::string &sheet);
|
||||
static bool isR2PlayerMale(const std::string &sheet);
|
||||
static sint getCharacterSheetRegionForce(const std::string &sheet);
|
||||
static sint getCharacterSheetRegionLevel(const std::string &sheet);
|
||||
|
||||
static bool isCtrlKeyDown(); // test if the ctrl key is down (NB nico : I didn't add other key,
|
||||
// because it would be too easy to write a key recorder ...)
|
||||
|
||||
static std::string encodeURLUnicodeParam(const ucstring &text);
|
||||
static bool isRingAccessPointInReach();
|
||||
|
||||
static void updateTooltipCoords();
|
||||
|
||||
|
||||
// LUA exported Functions with standard lua (because use ui object, use variable param number, or return dynamic-typed object)
|
||||
static int setCaptureKeyboard(CLuaState &ls);
|
||||
static int resetCaptureKeyboard(CLuaState &ls);
|
||||
static int setOnDraw(CLuaState &ls); // params: CInterfaceGroup*, "script". return: none
|
||||
static int addOnDbChange(CLuaState &ls); // params: CInterfaceGroup*, "dblist", "script". return: none
|
||||
static int removeOnDbChange(CLuaState &ls);// params: CInterfaceGroup*. return: none
|
||||
static int getUICaller(CLuaState &ls); // params: none. return: CInterfaceElement* (nil if error)
|
||||
static int getCurrentWindowUnder(CLuaState &ls); // params: none. return: CInterfaceElement* (nil if none)
|
||||
static int getUI(CLuaState &ls); // params: "ui:interface:...". return: CInterfaceElement* (nil if error), an additionnal boolean parameter
|
||||
// can specify verbose display when the element is note found (default is true)
|
||||
static int createGroupInstance(CLuaState &ls); // params : param 1 = template name,
|
||||
// param 2 = id of parent where the instance will be inserted
|
||||
// param 3 = table with ("template_param", "template_param_value") key/value pairs
|
||||
// such as { id="foo", x="10" } etc. -> returns a new instance of the template, or nil on fail
|
||||
static int createRootGroupInstance(CLuaState &ls); // params : param 1 = template name,
|
||||
// param 2 = id of parent where the instance will be inserted
|
||||
// param 3 = table with ("template_param", "template_param_value") key/value pairs
|
||||
// such as { id="foo", x="10" } etc. -> returns a new instance of the template, or nil on fail
|
||||
static int createUIElement(CLuaState &ls); // params : param 1 = template name,
|
||||
// param 2 = id of parent where the instance will be inserted
|
||||
// param 3 = table with ("template_param", "template_param_value") key/value pairs
|
||||
// such as { id="foo", x="10" } etc. -> returns a new instance of the template, or nil on fail
|
||||
|
||||
static int displayBubble(CLuaState &ls); // params : param 1 = bot id
|
||||
// param 2 = text
|
||||
// param 3 = table with all strings and urls
|
||||
// {"main text"="http:///", "text option 1"="http:///", "text option 2"="http:///") etc...
|
||||
static int getIndexInDB(CLuaState &ls); // params: CDBCtrlSheet*.... return: index, or 0 if error
|
||||
static int getUIId(CLuaState &ls); // params: CInterfaceElement*. return: ui id (empty if error)
|
||||
static int runAH(CLuaState &ls); // params: CInterfaceElement *, "ah", "params". return: none
|
||||
static int runExpr(CLuaState &ls); // params: "expr". return: any of: nil,bool,string,number, RGBA, UCString
|
||||
static int runFct(CLuaState &ls); // params: "expr", param1, param2.... return: any of: nil,bool,string,number, RGBA, UCString
|
||||
static int runCommand(CLuaState &ls); // params: "command name", param1, param2 ... return true or false
|
||||
static int formatUI(CLuaState &ls); // params: "expr", param1, param2.... return: string with # and % parsed
|
||||
static int formatDB(CLuaState &ls); // params: param1, param2.... return: string with @ and , added
|
||||
static int launchContextMenuInGame(CLuaState &ls); // params : menu name
|
||||
static int parseInterfaceFromString(CLuaState &ls); // params : intreface script
|
||||
static int updateAllLocalisedElements(CLuaState &ls);
|
||||
static int breakPoint(CLuaState &ls);
|
||||
static int getWindowSize(CLuaState &ls);
|
||||
static int i18n(CLuaState &ls); // retrieve an unicode string from CI18N
|
||||
static int setTextFormatTaged(CLuaState &ls); // set a text that may contains Tag Format infos
|
||||
static int validMessageBox(CLuaState &ls); // ok/cancel type message box (can't get it to work through luabind)
|
||||
static int concatUCString(CLuaState &ls); // workaround for + operator that don't work in luabind for ucstrings ...
|
||||
static int concatString(CLuaState &ls); // speedup concatenation of several strings
|
||||
static int tableToString(CLuaState &ls); // concat element of a table to build a string
|
||||
static int setTopWindow(CLuaState &ls); // set the top window
|
||||
static int initEmotesMenu(CLuaState &ls);
|
||||
static int isUCString(CLuaState &ls);
|
||||
static int hideAllWindows(CLuaState &ls);
|
||||
static int hideAllNonSavableWindows(CLuaState &ls);
|
||||
static int getDesktopIndex(CLuaState &ls);
|
||||
static int setLuaBreakPoint(CLuaState &ls); // set a breakpoint in lua external debugger (file, line)
|
||||
static int getMainPageURL(CLuaState &ls);
|
||||
static int getCharSlot(CLuaState &ls);
|
||||
static int displaySystemInfo(CLuaState &ls);
|
||||
static int setWeatherValue(CLuaState &ls); // first value is a boolean to say automatic, second value ranges from of to 1 and gives the weather
|
||||
static int getWeatherValue(CLuaState &ls); // get current real weather value (blend between server driven value & predicted value). Manual weather value is ignored
|
||||
static int disableContextHelpForControl(CLuaState &ls); // params: CCtrlBase*. return: none
|
||||
static int disableContextHelp(CLuaState &ls);
|
||||
static int getPathContent(CLuaState &ls);
|
||||
static int getServerSeason(CLuaState &ls); // get the last season sent by the server
|
||||
// 0->auto, computed locally from the current day (or not received from server yet)
|
||||
// 1->server force spring
|
||||
// 2->' ' ' summer
|
||||
// 3->' ' ' autumn
|
||||
// 4->' ' ' winter
|
||||
static int computeCurrSeason(CLuaState &ls); // compute current displayed season (1->spring, etc .)
|
||||
static int getAutoSeason(CLuaState &ls); // compute automatic season that would be at this time (1->spring, etc .)
|
||||
|
||||
|
||||
static int getTextureSize(CLuaState &ls);
|
||||
static int enableModalWindow(CLuaState &ls);
|
||||
static int disableModalWindow(CLuaState &ls);
|
||||
static int getPlayerPos(CLuaState &ls);
|
||||
static int getPlayerFront(CLuaState &ls);
|
||||
static int getPlayerDirection(CLuaState &ls);
|
||||
static int getPlayerGender(CLuaState &ls);
|
||||
static int getPlayerName(CLuaState &ls);
|
||||
static int getPlayerTitleRaw(CLuaState &ls);
|
||||
static int getPlayerTitle(CLuaState &ls);
|
||||
static int getTargetPos(CLuaState &ls);
|
||||
static int getTargetFront(CLuaState &ls);
|
||||
static int getTargetDirection(CLuaState &ls);
|
||||
static int getTargetGender(CLuaState &ls);
|
||||
static int getTargetName(CLuaState &ls);
|
||||
static int getTargetTitleRaw(CLuaState &ls);
|
||||
static int getTargetTitle(CLuaState &ls);
|
||||
static int addSearchPathUser(CLuaState &ls);
|
||||
static int getClientCfgVar(CLuaState &ls);
|
||||
static int isPlayerFreeTrial(CLuaState &ls);
|
||||
static int isPlayerNewbie(CLuaState &ls);
|
||||
static int isInRingMode(CLuaState &ls);
|
||||
static int getUserRace(CLuaState &ls);
|
||||
static int getSheet2idx(CLuaState &ls);
|
||||
static int getTargetSlot(CLuaState &ls);
|
||||
static int getSlotDataSetId(CLuaState &ls);
|
||||
|
||||
|
||||
// LUA functions exported for Dev only (debug)
|
||||
static int deleteUI(CLuaState &ls); // params: CInterfaceElement*.... return: none
|
||||
static int deleteReflectable(CLuaState &ls); // params: CInterfaceElement*.... return: none
|
||||
static int dumpUI(CLuaState &ls); // params: CInterfaceElement*.... return: none
|
||||
static int setKeyboardContext(CLuaState &ls);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// @}
|
||||
|
||||
|
||||
|
||||
// Function export tools
|
||||
static int runExprAndPushResult(CLuaState &ls, const std::string &expr); // Used by runExpr and runFct
|
||||
|
||||
// Function to forward lua call to C++ to a 'lua method' exported from a reflected object
|
||||
static int luaMethodCall(lua_State *ls);
|
||||
|
||||
static int getCompleteIslands(CLuaState &ls);
|
||||
static int getIslandId(CLuaState &ls);//TEMP
|
||||
|
||||
|
||||
public:
|
||||
static int runExprAndPushResult(CLuaState &ls, const std::string &expr); // Used by runExpr and runFct
|
||||
};
|
||||
|
||||
|
||||
|
|
3271
code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp
Normal file
3271
code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp
Normal file
File diff suppressed because it is too large
Load diff
257
code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h
Normal file
257
code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h
Normal file
|
@ -0,0 +1,257 @@
|
|||
#ifndef LUA_IHM_RYZOM_H
|
||||
#define LUA_IHM_RYZOM_H
|
||||
|
||||
#include "lua_ihm.h"
|
||||
|
||||
class CLuaIHMRyzom
|
||||
{
|
||||
public:
|
||||
static void RegisterRyzomFunctions( NLGUI::CLuaState &ls );
|
||||
|
||||
private:
|
||||
static void createLuaEnumTable(CLuaState &ls, const std::string &str);
|
||||
|
||||
|
||||
static int getUI(CLuaState &ls); // params: "ui:interface:...". return: CInterfaceElement* (nil if error), an additionnal boolean parameter
|
||||
// LUA exported Functions with standard lua (because use ui object, use variable param number, or return dynamic-typed object)
|
||||
static int setCaptureKeyboard(CLuaState &ls);
|
||||
static int resetCaptureKeyboard(CLuaState &ls);
|
||||
static int setOnDraw(CLuaState &ls); // params: CInterfaceGroup*, "script". return: none
|
||||
static int addOnDbChange(CLuaState &ls); // params: CInterfaceGroup*, "dblist", "script". return: none
|
||||
static int removeOnDbChange(CLuaState &ls);// params: CInterfaceGroup*. return: none
|
||||
static int getUICaller(CLuaState &ls); // params: none. return: CInterfaceElement* (nil if error)
|
||||
static int getCurrentWindowUnder(CLuaState &ls); // params: none. return: CInterfaceElement* (nil if none)
|
||||
// can specify verbose display when the element is note found (default is true)
|
||||
static int createGroupInstance(CLuaState &ls); // params : param 1 = template name,
|
||||
// param 2 = id of parent where the instance will be inserted
|
||||
// param 3 = table with ("template_param", "template_param_value") key/value pairs
|
||||
// such as { id="foo", x="10" } etc. -> returns a new instance of the template, or nil on fail
|
||||
static int createRootGroupInstance(CLuaState &ls); // params : param 1 = template name,
|
||||
// param 2 = id of parent where the instance will be inserted
|
||||
// param 3 = table with ("template_param", "template_param_value") key/value pairs
|
||||
// such as { id="foo", x="10" } etc. -> returns a new instance of the template, or nil on fail
|
||||
static int createUIElement(CLuaState &ls); // params : param 1 = template name,
|
||||
// param 2 = id of parent where the instance will be inserted
|
||||
// param 3 = table with ("template_param", "template_param_value") key/value pairs
|
||||
// such as { id="foo", x="10" } etc. -> returns a new instance of the template, or nil on fail
|
||||
|
||||
static int displayBubble(CLuaState &ls); // params : param 1 = bot id
|
||||
// param 2 = text
|
||||
// param 3 = table with all strings and urls
|
||||
// {"main text"="http:///", "text option 1"="http:///", "text option 2"="http:///") etc...
|
||||
static int getIndexInDB(CLuaState &ls); // params: CDBCtrlSheet*.... return: index, or 0 if error
|
||||
static int getUIId(CLuaState &ls); // params: CInterfaceElement*. return: ui id (empty if error)
|
||||
static int runAH(CLuaState &ls); // params: CInterfaceElement *, "ah", "params". return: none
|
||||
static int runExpr(CLuaState &ls); // params: "expr". return: any of: nil,bool,string,number, RGBA, UCString
|
||||
static int runFct(CLuaState &ls); // params: "expr", param1, param2.... return: any of: nil,bool,string,number, RGBA, UCString
|
||||
static int runCommand(CLuaState &ls); // params: "command name", param1, param2 ... return true or false
|
||||
static int formatUI(CLuaState &ls); // params: "expr", param1, param2.... return: string with # and % parsed
|
||||
static int formatDB(CLuaState &ls); // params: param1, param2.... return: string with @ and , added
|
||||
static int launchContextMenuInGame(CLuaState &ls); // params : menu name
|
||||
static int parseInterfaceFromString(CLuaState &ls); // params : intreface script
|
||||
static int updateAllLocalisedElements(CLuaState &ls);
|
||||
static int breakPoint(CLuaState &ls);
|
||||
static int getWindowSize(CLuaState &ls);
|
||||
static int i18n(CLuaState &ls); // retrieve an unicode string from CI18N
|
||||
static int setTextFormatTaged(CLuaState &ls); // set a text that may contains Tag Format infos
|
||||
static int validMessageBox(CLuaState &ls); // ok/cancel type message box (can't get it to work through luabind)
|
||||
static int concatUCString(CLuaState &ls); // workaround for + operator that don't work in luabind for ucstrings ...
|
||||
static int concatString(CLuaState &ls); // speedup concatenation of several strings
|
||||
static int tableToString(CLuaState &ls); // concat element of a table to build a string
|
||||
static int setTopWindow(CLuaState &ls); // set the top window
|
||||
static int initEmotesMenu(CLuaState &ls);
|
||||
static int isUCString(CLuaState &ls);
|
||||
static int hideAllWindows(CLuaState &ls);
|
||||
static int hideAllNonSavableWindows(CLuaState &ls);
|
||||
static int getDesktopIndex(CLuaState &ls);
|
||||
static int setLuaBreakPoint(CLuaState &ls); // set a breakpoint in lua external debugger (file, line)
|
||||
static int getMainPageURL(CLuaState &ls);
|
||||
static int getCharSlot(CLuaState &ls);
|
||||
static int displaySystemInfo(CLuaState &ls);
|
||||
static int setWeatherValue(CLuaState &ls); // first value is a boolean to say automatic, second value ranges from of to 1 and gives the weather
|
||||
static int getWeatherValue(CLuaState &ls); // get current real weather value (blend between server driven value & predicted value). Manual weather value is ignored
|
||||
static int disableContextHelpForControl(CLuaState &ls); // params: CCtrlBase*. return: none
|
||||
static int disableContextHelp(CLuaState &ls);
|
||||
static int getPathContent(CLuaState &ls);
|
||||
static int getServerSeason(CLuaState &ls); // get the last season sent by the server
|
||||
// 0->auto, computed locally from the current day (or not received from server yet)
|
||||
// 1->server force spring
|
||||
// 2->' ' ' summer
|
||||
// 3->' ' ' autumn
|
||||
// 4->' ' ' winter
|
||||
static int computeCurrSeason(CLuaState &ls); // compute current displayed season (1->spring, etc .)
|
||||
static int getAutoSeason(CLuaState &ls); // compute automatic season that would be at this time (1->spring, etc .)
|
||||
|
||||
|
||||
static int getTextureSize(CLuaState &ls);
|
||||
static int enableModalWindow(CLuaState &ls);
|
||||
static int disableModalWindow(CLuaState &ls);
|
||||
static int getPlayerPos(CLuaState &ls);
|
||||
static int getPlayerFront(CLuaState &ls);
|
||||
static int getPlayerDirection(CLuaState &ls);
|
||||
static int getPlayerGender(CLuaState &ls);
|
||||
static int getPlayerName(CLuaState &ls);
|
||||
static int getPlayerTitleRaw(CLuaState &ls);
|
||||
static int getPlayerTitle(CLuaState &ls);
|
||||
static int getTargetPos(CLuaState &ls);
|
||||
static int getTargetFront(CLuaState &ls);
|
||||
static int getTargetDirection(CLuaState &ls);
|
||||
static int getTargetGender(CLuaState &ls);
|
||||
static int getTargetName(CLuaState &ls);
|
||||
static int getTargetTitleRaw(CLuaState &ls);
|
||||
static int getTargetTitle(CLuaState &ls);
|
||||
static int addSearchPathUser(CLuaState &ls);
|
||||
static int getClientCfgVar(CLuaState &ls);
|
||||
static int isPlayerFreeTrial(CLuaState &ls);
|
||||
static int isPlayerNewbie(CLuaState &ls);
|
||||
static int isInRingMode(CLuaState &ls);
|
||||
static int getUserRace(CLuaState &ls);
|
||||
static int getSheet2idx(CLuaState &ls);
|
||||
static int getTargetSlot(CLuaState &ls);
|
||||
static int getSlotDataSetId(CLuaState &ls);
|
||||
|
||||
// LUA functions exported for Dev only (debug)
|
||||
static int deleteUI(CLuaState &ls); // params: CInterfaceElement*.... return: none
|
||||
static int deleteReflectable(CLuaState &ls); // params: CInterfaceElement*.... return: none
|
||||
static int dumpUI(CLuaState &ls); // params: CInterfaceElement*.... return: none
|
||||
static int setKeyboardContext(CLuaState &ls);
|
||||
|
||||
static int getCompleteIslands(CLuaState &ls);
|
||||
static int getIslandId(CLuaState &ls);//TEMP
|
||||
|
||||
|
||||
///////////////////////////// Standard Lua stuff ends here //////////////////////////////////////////////
|
||||
|
||||
static sint32 getDbProp(const std::string &dbProp); // return 0 if not found.
|
||||
static void setDbProp(const std::string &dbProp, sint32 value); // Nb: the db prop is not created if not present.
|
||||
static void addDbProp(const std::string &dbProp, sint32 value); // Nb: the db prop is created if not present.
|
||||
static void delDbProp(const std::string &dbProp);
|
||||
|
||||
public:
|
||||
// Print a message in the log.
|
||||
// Lua messages must be enabled (with ClientCfg.DisplayLuaDebugInfo = 1)
|
||||
// Additionnally, if ClientCfg.LuaDebugInfoGotoButtonEnabled is set, then
|
||||
// a button will be created near the line to allow to goto the lua line that issued the message
|
||||
// by using an external editor
|
||||
static void debugInfo(const std::string &dbg);
|
||||
// Print a message in the log
|
||||
// No 'goto file' button is created
|
||||
// Lua messages must be enabled (with ClientCfg.DisplayLuaDebugInfo = 1)
|
||||
|
||||
static void dumpCallStack(int startStackLevel = 0);
|
||||
|
||||
/** execute function that is currently on the stack, possibly outputing error messages to the log
|
||||
* \return true if execution succeeded
|
||||
*/
|
||||
static bool executeFunctionOnStack(CLuaState &ls, int numArgs, int numRet);
|
||||
|
||||
private:
|
||||
static void rawDebugInfo(const std::string &dbg);
|
||||
// Dump callstack in the console
|
||||
// Additionnally, if ClientCfg.LuaDebugInfoGotoButtonEnabled is set, then
|
||||
// buttons will be created in fonr of eahc line to allow to goto the lua line that issued the message
|
||||
// by using an external editor
|
||||
|
||||
static void getCallStackAsString(int startStackLevel, std::string &result);
|
||||
static std::string getDefine(const std::string &def);
|
||||
static void setContextHelpText(const ucstring &text);
|
||||
|
||||
|
||||
static void messageBox(const ucstring &text);
|
||||
static void messageBox(const ucstring &text, const std::string &masterGroup);
|
||||
static void messageBox(const ucstring &text, const std::string &masterGroup, int caseMode);
|
||||
static void messageBox(const std::string &text);
|
||||
static void messageBoxWithHelp(const ucstring &text);
|
||||
static void messageBoxWithHelp(const ucstring &text, const std::string &masterGroup);
|
||||
static void messageBoxWithHelp(const ucstring &text, const std::string &masterGroup, int caseMode);
|
||||
static void messageBoxWithHelp(const std::string &text);
|
||||
|
||||
static ucstring replacePvpEffectParam(const ucstring &str, sint32 parameter);
|
||||
static sint32 secondsSince1970ToHour(sint32 seconds);
|
||||
static void pauseBGDownloader();
|
||||
static void unpauseBGDownloader();
|
||||
static void requestBGDownloaderPriority(uint priority);
|
||||
static sint getBGDownloaderPriority();
|
||||
static ucstring getPatchLastErrorMessage();
|
||||
static bool isInGame();
|
||||
static uint32 getPlayerSelectedSlot();
|
||||
static bool isPlayerSlotNewbieLand(uint32 slot); // test if one of the player slot is a newbieland one, if not so, client must be patched in order to continue
|
||||
|
||||
// GameInfo
|
||||
static sint32 getSkillIdFromName(const std::string &def);
|
||||
static ucstring getSkillLocalizedName(sint32 skillId);
|
||||
static sint32 getMaxSkillValue(sint32 skillId);
|
||||
static sint32 getBaseSkillValueMaxChildren(sint32 skillId);
|
||||
static sint32 getMagicResistChance(bool elementalSpell, sint32 casterSpellLvl, sint32 victimResistLvl);
|
||||
static sint32 getDodgeParryChance(sint32 attLvl, sint32 defLvl);
|
||||
static void browseNpcWebPage(const std::string &htmlId, const std::string &url, bool addParameters, double timeout);
|
||||
static void clearHtmlUndoRedo(const std::string &htmlId);
|
||||
static ucstring getDynString(sint32 dynStringId);
|
||||
static bool isDynStringAvailable(sint32 dynStringId);
|
||||
static bool isFullyPatched();
|
||||
static std::string getSheetType(const std::string &sheet);
|
||||
static std::string getSheetName(uint32 sheetId);
|
||||
static sint32 getFameIndex(const std::string &factionName);
|
||||
static std::string getFameName(sint32 fameIndex);
|
||||
static sint32 getFameDBIndex(sint32 fameIndex); // convert from the fame index
|
||||
static sint32 getFirstTribeFameIndex(); // fame index of the 1st tribe
|
||||
static sint32 getNbTribeFameIndex(); // number of tribe fame index (which are contiguous)
|
||||
static std::string getClientCfg(const std::string &varName);
|
||||
static bool fileExists(const std::string &fileName);
|
||||
static void sendMsgToServer(const std::string &msgName);
|
||||
static void sendMsgToServerPvpTag(bool pvpTag);
|
||||
static bool isGuildQuitAvailable();
|
||||
static void sortGuildMembers();
|
||||
static sint32 getNbGuildMembers();
|
||||
static std::string getGuildMemberName(sint32 nMemberId);
|
||||
static std::string getGuildMemberGrade(sint32 nMemberId);
|
||||
static bool isR2Player(const std::string &sheet);
|
||||
static std::string getR2PlayerRace(const std::string &sheet);
|
||||
static bool isR2PlayerMale(const std::string &sheet);
|
||||
// sheet access
|
||||
// TODO nico : using the reflection system on sheets would allow to export them to lua without these functions ...
|
||||
static std::string getCharacterSheetSkel(const std::string &sheet, bool isMale);
|
||||
static sint32 getSheetId(const std::string &itemName);
|
||||
static sint getCharacterSheetRegionForce(const std::string &sheet);
|
||||
static sint getCharacterSheetRegionLevel(const std::string &sheet);
|
||||
static std::string getRegionByAlias(uint32 alias);
|
||||
// open the window to do a tell to 'player', if 'msg' is not empty, then the message will be sent immediatly
|
||||
// else, current command of the chat window will be replaced with tell 'player'
|
||||
static void tell(const ucstring &player, const ucstring &msg);
|
||||
static bool isRingAccessPointInReach();
|
||||
static void updateTooltipCoords();
|
||||
// test if the ctrl key is down (NB nico : I didn't add other key,
|
||||
// because it would be too easy to write a key recorder ...)
|
||||
static bool isCtrlKeyDown();
|
||||
static std::string encodeURLUnicodeParam(const ucstring &text);
|
||||
|
||||
static sint32 getPlayerLevel(); // get max level among player skills (magi, combat, crafting ,foraging)
|
||||
static sint64 getPlayerVpa();
|
||||
static sint64 getPlayerVpb();
|
||||
static sint64 getPlayerVpc();
|
||||
static sint32 getTargetLevel(); // get current, precise level of the selected target, or -1 if there's no such selected target
|
||||
static sint32 getTargetForceRegion(); // get 'force region' for current target, or -1 if there's no selected target
|
||||
static sint32 getTargetLevelForce(); // get 'level force' for current target, or -1 if there's no selected target
|
||||
static ucstring getTargetSheet(); // get the name of the target sheet (like 'zoha2old.creature')
|
||||
static sint64 getTargetVpa();
|
||||
static sint64 getTargetVpb();
|
||||
static sint64 getTargetVpc();
|
||||
static bool isTargetNPC(); // return 'true' if the target is an npc
|
||||
static bool isTargetPlayer(); // return 'true' if the target is a player
|
||||
static bool isTargetUser(); // return 'true' if the target is the user
|
||||
static bool isPlayerInPVPMode();
|
||||
static bool isTargetInPVPMode();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Create a special tag that will add a 'goto' button for the given file and line
|
||||
// The tag should be appended in front of a string to use with 'rawDebugInfo'.
|
||||
// when the final string will be printed, a button will be created in front of it
|
||||
// Requires that 'ClientCfg.LuaDebugInfoGotoButtonEnabled' is set to 1, else
|
||||
// a, empty tag is returned
|
||||
static std::string createGotoFileButtonTag(const char *fileName, uint line);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -14,13 +14,14 @@
|
|||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "stdpch.h"
|
||||
//#include "stdpch.h"
|
||||
#include "lua_object.h"
|
||||
#include "lua_ihm.h"
|
||||
#include "lua_ihm_ryzom.h"
|
||||
#include "nel/gui/lua_helper.h"
|
||||
using namespace NLGUI;
|
||||
//
|
||||
#include "interface_manager.h"
|
||||
//#include "interface_manager.h"
|
||||
|
||||
////////////////
|
||||
// CLuaObject //
|
||||
|
@ -616,7 +617,7 @@ void CLuaObject::dump(uint maxDepth /*= 20*/, std::set<const void *> *alreadySee
|
|||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
CLuaIHM::dumpCallStack();
|
||||
CLuaIHMRyzom::dumpCallStack();
|
||||
nlwarning(e.what());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,7 @@
|
|||
|
||||
#include "nel/misc/xml_auto_ptr.h"
|
||||
#include "lua_ihm.h"
|
||||
|
||||
#include "lua_ihm.h"
|
||||
#include "lua_ihm_ryzom.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace NLMISC;
|
||||
|
@ -2416,7 +2415,7 @@ void CViewText::setTextFormatTaged(const ucstring &text)
|
|||
|
||||
// color format is available only if multilined
|
||||
if (!_MultiLine)
|
||||
CLuaIHM::debugInfo(toString("ViewText isn't multilined : uc_hardtext_format will not act as wanted !\n%s", text.toString().c_str()));
|
||||
CLuaIHMRyzom::debugInfo(toString("ViewText isn't multilined : uc_hardtext_format will not act as wanted !\n%s", text.toString().c_str()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2473,7 +2472,7 @@ void CViewText::setSingleLineTextFormatTaged(const ucstring &text)
|
|||
|
||||
// this color format is available only if not multilined
|
||||
if (_MultiLine)
|
||||
CLuaIHM::debugInfo(toString("ViewText is multilined : uc_hardtext_single_line_format will not act as wanted !\n%s", text.toString().c_str()));
|
||||
CLuaIHMRyzom::debugInfo(toString("ViewText is multilined : uc_hardtext_single_line_format will not act as wanted !\n%s", text.toString().c_str()));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "stdpch.h"
|
||||
#include "displayer_lua.h"
|
||||
#include "../interface_v3/lua_ihm.h"
|
||||
#include "../interface_v3/lua_ihm_ryzom.h"
|
||||
#include "editor.h"
|
||||
|
||||
namespace R2
|
||||
|
@ -45,7 +46,7 @@ bool CDisplayerLua::init(const CLuaObject ¶meters)
|
|||
}
|
||||
CLuaState &ls = *parameters.getLuaState();
|
||||
getEditor().getEnv().push(); // this is a method call
|
||||
if (CLuaIHM::executeFunctionOnStack(ls, 1, 1))
|
||||
if (CLuaIHMRyzom::executeFunctionOnStack(ls, 1, 1))
|
||||
{
|
||||
_ToLua._LuaTable.pop(ls);
|
||||
}
|
||||
|
@ -94,7 +95,7 @@ void CDisplayerLua::CToLua::executeHandler(const CLuaString &eventName, int numA
|
|||
getEnclosing()->getDisplayedInstance()->getLuaProjection().push();
|
||||
ls.insert(- numArgs - 1);
|
||||
if (dumpStackWanted) ls.dumpStack();
|
||||
CLuaIHM::executeFunctionOnStack(*_LuaTable.getLuaState(), numArgs + 2, 0);
|
||||
CLuaIHMRyzom::executeFunctionOnStack(*_LuaTable.getLuaState(), numArgs + 2, 0);
|
||||
if (dumpStackWanted) ls.dumpStack();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "../editor.h"
|
||||
#include "../../net_manager.h"
|
||||
#include "../../interface_v3/lua_ihm.h"
|
||||
#include "../../interface_v3/lua_ihm_ryzom.h"
|
||||
|
||||
#include "game_share/object.h"
|
||||
#include "../r2_lua.h"
|
||||
|
@ -797,7 +798,7 @@ sint CComLuaModule::luaRequestSetNode(lua_State* state)
|
|||
static volatile bool dumpCallstack = false;
|
||||
if (dumpCallstack)
|
||||
{
|
||||
CLuaIHM::dumpCallStack();
|
||||
CLuaIHMRyzom::dumpCallStack();
|
||||
}
|
||||
return requestSetNode(state, false);
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ using namespace NLGUI;
|
|||
#include "../interface_v3/group_tree.h"
|
||||
#include "../client_cfg.h"
|
||||
#include "../interface_v3/lua_ihm.h"
|
||||
#include "../interface_v3/lua_ihm_ryzom.h"
|
||||
#include "../interface_v3/lua_object.h"
|
||||
#include "../global.h"
|
||||
#include "../connection.h"
|
||||
|
@ -3213,7 +3214,7 @@ void CEditor::initObjectProjectionMetatable()
|
|||
ls.push(true);
|
||||
return 1;
|
||||
}
|
||||
CLuaIHM::dumpCallStack();
|
||||
CLuaIHMRyzom::dumpCallStack();
|
||||
// object has been deleted but the script maintains a reference on it
|
||||
throw ELuaWrappedFunctionException(&ls, "Attempt to access an erased object");
|
||||
}
|
||||
|
@ -3230,14 +3231,14 @@ void CEditor::initObjectProjectionMetatable()
|
|||
else
|
||||
{
|
||||
// 'bad index' message already printed by CObject::getValue
|
||||
CLuaIHM::dumpCallStack();
|
||||
CLuaIHMRyzom::dumpCallStack();
|
||||
}
|
||||
}
|
||||
|
||||
if (!ls.isString(2))
|
||||
{
|
||||
nlwarning("String expected when accessing an object property, %s found instead", ls.getTypename(2));
|
||||
CLuaIHM::dumpCallStack(0);
|
||||
CLuaIHMRyzom::dumpCallStack(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3554,7 +3555,7 @@ void CEditor::initObjectProjectionMetatable()
|
|||
{
|
||||
nlwarning("Duplicated key of type string found while attempting to enumerate an instance content.");
|
||||
nlwarning("key is %s", key.c_str());
|
||||
CLuaIHM::dumpCallStack(1);
|
||||
CLuaIHMRyzom::dumpCallStack(1);
|
||||
CLuaIHM::fails(ls, "Aborting to avoid infinite loop.");
|
||||
}
|
||||
keys.insert(key);
|
||||
|
@ -3623,7 +3624,7 @@ void CEditor::initObjectProjectionMetatable()
|
|||
static volatile bool from = false;
|
||||
if (from)
|
||||
{
|
||||
CLuaIHM::dumpCallStack(0);
|
||||
CLuaIHMRyzom::dumpCallStack(0);
|
||||
}
|
||||
nlassert(ls.getTop() == 2);
|
||||
if (!checkTag(ls)) return false;
|
||||
|
@ -4432,7 +4433,7 @@ bool CEditor::doLuaScript(const char *filename, const char *fileDescText)
|
|||
std::string filename = msg.substr(0, extPos + 4); // extract filename including extension
|
||||
int line;
|
||||
fromString(&*(msg.begin() + extPos + 5), line); // line number follows
|
||||
nlwarning((CLuaIHM::createGotoFileButtonTag(filename.c_str(), line) + e.what()).c_str());
|
||||
nlwarning((CLuaIHMRyzom::createGotoFileButtonTag(filename.c_str(), line) + e.what()).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "../entities.h"
|
||||
#include "../interface_v3/interface_manager.h"
|
||||
#include "../interface_v3/lua_ihm.h"
|
||||
#include "../interface_v3/lua_ihm_ryzom.h"
|
||||
//
|
||||
#include "displayer_visual_entity.h"
|
||||
|
||||
|
@ -631,7 +632,7 @@ void CInstance::CToLua::executeHandler(const CLuaString &name, int numArgs)
|
|||
ls.insert(- numArgs - 1);
|
||||
//
|
||||
if (dumpStackWanted) ls.dumpStack();
|
||||
CLuaIHM::executeFunctionOnStack(ls, numArgs + 1, 0);
|
||||
CLuaIHMRyzom::executeFunctionOnStack(ls, numArgs + 1, 0);
|
||||
if (dumpStackWanted) ls.dumpStack();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "editor.h"
|
||||
#include "instance.h"
|
||||
#include "../interface_v3/lua_ihm.h"
|
||||
#include "../interface_v3/lua_ihm_ryzom.h"
|
||||
|
||||
namespace R2
|
||||
{
|
||||
|
@ -287,7 +288,7 @@ void CObjectRefIdClient::getNameInParent(std::string &name, sint32 &indexInArray
|
|||
}
|
||||
// TMP TMP
|
||||
nlwarning("=========================================");
|
||||
CLuaIHM::dumpCallStack();
|
||||
CLuaIHMRyzom::dumpCallStack();
|
||||
nlwarning("=========================================");
|
||||
nlwarning("ObservedObject = %s", getValue().c_str());
|
||||
CInstance *obsInstance = getEditor().getInstanceFromId(getValue().c_str());
|
||||
|
|
Loading…
Reference in a new issue