mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-22 14:56:13 +00:00
Merge with develop
This commit is contained in:
parent
bb28b25e71
commit
1e8d28759a
17 changed files with 291 additions and 240 deletions
|
@ -1,5 +1,3 @@
|
|||
PROJECT(NeL CXX C)
|
||||
|
||||
IF(WITH_STATIC_DRIVERS)
|
||||
ADD_DEFINITIONS(-DNL_STATIC)
|
||||
ENDIF()
|
||||
|
@ -17,7 +15,6 @@ IF(WITH_3D)
|
|||
IF(WITH_NEL_CEGUI)
|
||||
FIND_PACKAGE(CEGUI)
|
||||
ENDIF()
|
||||
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_SOUND)
|
||||
|
|
|
@ -289,7 +289,7 @@ bool CForm::insertParent (uint before, const std::string &filename, CForm *paren
|
|||
else
|
||||
{
|
||||
// Output an error
|
||||
warning (false, "insertParent", "Can't insert parent form (%s) that has not the same DFN.", filename);
|
||||
warning (false, "insertParent", "Can't insert parent form (%s) that has not the same DFN.", filename.c_str());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -171,7 +171,7 @@ CFormDfn *CFormLoader::loadFormDfn (const std::string &filename, bool forceLoad)
|
|||
else
|
||||
{
|
||||
// Output error
|
||||
warning (false, "loadFormDfn", "Can't open the form file (%s).", filename);
|
||||
warning (false, "loadFormDfn", "Can't open the form file (%s).", filename.c_str());
|
||||
|
||||
// Delete the formDfn
|
||||
delete formDfn;
|
||||
|
@ -182,7 +182,7 @@ CFormDfn *CFormLoader::loadFormDfn (const std::string &filename, bool forceLoad)
|
|||
catch (const Exception &e)
|
||||
{
|
||||
// Output error
|
||||
warning (false, "loadFormDfn", "Error while loading the form (%s): %s", filename, e.what());
|
||||
warning (false, "loadFormDfn", "Error while loading the form (%s): %s", filename.c_str(), e.what());
|
||||
|
||||
// Delete the formDfn
|
||||
delete formDfn;
|
||||
|
@ -257,7 +257,7 @@ UForm *CFormLoader::loadForm (const std::string &filename)
|
|||
else
|
||||
{
|
||||
// Output error
|
||||
warning (false, "loadForm", "Can't open the form file (%s).", filename);
|
||||
warning (false, "loadForm", "Can't open the form file (%s).", filename.c_str());
|
||||
|
||||
// Delete the form
|
||||
delete form;
|
||||
|
@ -279,7 +279,7 @@ UForm *CFormLoader::loadForm (const std::string &filename)
|
|||
catch (const Exception &e)
|
||||
{
|
||||
// Output error
|
||||
warning (false, "loadForm", "Error while loading the form (%s): %s", filename, e.what());
|
||||
warning (false, "loadForm", "Error while loading the form (%s): %s", filename.c_str(), e.what());
|
||||
|
||||
// Delete the form
|
||||
delete form;
|
||||
|
@ -317,7 +317,7 @@ void CFormLoader::warning (bool exception, const std::string &function, const ch
|
|||
va_end( args );
|
||||
|
||||
// Set the warning
|
||||
NLGEORGES::warning (exception, "(CFormLoader::%s) : %s", function, buffer);
|
||||
NLGEORGES::warning (exception, "(CFormLoader::%s) : %s", function.c_str(), buffer);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -831,14 +831,15 @@ void CUnifiedNetwork::addService(const string &name, const vector<CInetAddress>
|
|||
|
||||
uint j = 0;
|
||||
|
||||
// it's loopback ip address, it's ok
|
||||
if (!addr[i].isLoopbackIPAddress())
|
||||
{
|
||||
// it's loopback ip address, it's ok
|
||||
for (j = 0; j < laddr.size (); j++)
|
||||
{
|
||||
if (laddr[j].internalNetAddress () == addr[i].internalNetAddress ())
|
||||
{
|
||||
break; // it's ok, we can try
|
||||
// it's ok, we can try
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1272,7 +1273,8 @@ uint8 CUnifiedNetwork::findConnectionId (TServiceId sid, uint8 nid)
|
|||
uint8 connectionId = _IdCnx[sid.get()].DefaultNetwork;
|
||||
|
||||
if (nid == 0xFF)
|
||||
{ // default network
|
||||
{
|
||||
// default network
|
||||
//nldebug ("HNETL5: nid %hu, will use the default connection %hu", (uint16)nid, (uint16)connectionId);
|
||||
}
|
||||
else if (nid >= _IdCnx[sid.get()].NetworkConnectionAssociations.size())
|
||||
|
@ -1293,7 +1295,6 @@ uint8 CUnifiedNetwork::findConnectionId (TServiceId sid, uint8 nid)
|
|||
|
||||
if (connectionId >= _IdCnx[sid.get()].Connections.size() || !_IdCnx[sid.get()].Connections[connectionId].valid() || !_IdCnx[sid.get()].Connections[connectionId].CbNetBase->connected())
|
||||
{
|
||||
|
||||
if (nid != 0xFF)
|
||||
{
|
||||
// not a default network. There's a problem with the selected connectionID, so try to find a valid one
|
||||
|
|
|
@ -732,9 +732,8 @@ bool CEntityManager::instancesRemoved()
|
|||
return instRemoved;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool CEntityManager::setupInstance(uint32 idx, const vector<string> &keys, const vector<string> &values) {
|
||||
bool CEntityManager::setupInstance(uint32 idx, const vector<string> &keys, const vector<string> &values)
|
||||
{
|
||||
if (!Scene || idx >= _ShapeInstances.size() || _ShapeInstances[idx].Deleted)
|
||||
return false;
|
||||
|
||||
|
@ -881,6 +880,8 @@ bool CEntityManager::setupInstance(uint32 idx, const vector<string> &keys, const
|
|||
primitive->setObstacle(active);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2654,7 +2654,6 @@ class CAHAddShape : public IActionHandler
|
|||
};
|
||||
REGISTER_ACTION_HANDLER (CAHAddShape, "add_shape");
|
||||
|
||||
|
||||
class CAHRemoveShapes : public IActionHandler
|
||||
{
|
||||
virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
|
||||
|
|
|
@ -199,12 +199,14 @@ static DECLARE_INTERFACE_USER_FCT(lua)
|
|||
ls.pushNil();
|
||||
ls.setTable(-3); //pop pop
|
||||
ls.pop();
|
||||
|
||||
// *** execute script
|
||||
std::string script = args[0].getString();
|
||||
// assign return value in retId.
|
||||
script = retId + "= " + script;
|
||||
// execute a small script here, because most often exprs are called from xml files => lot of redundant script
|
||||
CLuaManager::getInstance().executeLuaScript(script, true);
|
||||
|
||||
// *** retrieve and convert return value
|
||||
ls.pushGlobalTable();
|
||||
ls.push(retId);
|
||||
|
@ -254,6 +256,7 @@ static DECLARE_INTERFACE_USER_FCT(lua)
|
|||
else if (type == LUA_TUSERDATA)
|
||||
{
|
||||
// NB: the value is poped in obj.set() (no need to do ls.pop());
|
||||
|
||||
// try with ucstring
|
||||
ucstring ucstrVal;
|
||||
|
||||
|
@ -378,6 +381,7 @@ void CLuaIHMRyzom::createLuaEnumTable(CLuaState &ls, const std::string &str)
|
|||
void CLuaIHMRyzom::RegisterRyzomFunctions(NLGUI::CLuaState &ls)
|
||||
{
|
||||
CLuaStackChecker lsc(&ls);
|
||||
|
||||
// MISC ui ctors
|
||||
struct CUICtor
|
||||
{
|
||||
|
@ -389,7 +393,9 @@ void CLuaIHMRyzom::RegisterRyzomFunctions(NLGUI::CLuaState &ls)
|
|||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
ls.registerFunc("SNode", CUICtor::SNode);
|
||||
|
||||
// *** Register the metatable for access to client.cfg (nb nico this may be more general later -> access to any config file ...)
|
||||
ls.pushGlobalTable();
|
||||
CLuaObject globals(ls);
|
||||
|
@ -399,6 +405,7 @@ void CLuaIHMRyzom::RegisterRyzomFunctions(NLGUI::CLuaState &ls)
|
|||
mt.setValue("__index", luaClientCfgIndex);
|
||||
mt.setValue("__newindex", luaClientCfgNewIndex);
|
||||
globals.setNil("__cfmt"); // remove temp metatable
|
||||
|
||||
ls.registerFunc("getUI", getUI);
|
||||
ls.registerFunc("validMessageBox", validMessageBox);
|
||||
ls.registerFunc("getUICaller", getUICaller);
|
||||
|
@ -477,8 +484,10 @@ void CLuaIHMRyzom::RegisterRyzomFunctions(NLGUI::CLuaState &ls)
|
|||
ls.registerFunc("setupShape", setupShape);
|
||||
|
||||
lua_State *L = ls.getStatePointer();
|
||||
|
||||
LUABIND_ENUM(PVP_CLAN::TPVPClan, "game.TPVPClan", PVP_CLAN::NbClans, PVP_CLAN::toString);
|
||||
LUABIND_ENUM(BONUS_MALUS::TBonusMalusSpecialTT, "game.TBonusMalusSpecialTT", BONUS_MALUS::NbSpecialTT, BONUS_MALUS::toString);
|
||||
|
||||
luabind::module(L)
|
||||
[
|
||||
LUABIND_FUNC(getDbProp),
|
||||
|
@ -626,6 +635,7 @@ int CLuaIHMRyzom::getUI(CLuaState &ls)
|
|||
// get the string
|
||||
std::string eltStr;
|
||||
ls.toString(1, eltStr);
|
||||
|
||||
// return the element
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
CInterfaceElement *pIE = CWidgetManager::getInstance()->getElementFromId(eltStr);
|
||||
|
@ -655,13 +665,16 @@ int CLuaIHMRyzom::formatUI(CLuaState &ls)
|
|||
{
|
||||
//H_AUTO(Lua_CLuaIHM_formatUI)
|
||||
CLuaStackChecker lsc(&ls, 1);
|
||||
|
||||
// params: "expr", param1, param2....
|
||||
// return: string with # and % parsed
|
||||
CLuaIHM::checkArgMin(ls, "formatUI", 1);
|
||||
CLuaIHM::check(ls, ls.isString(1), "formatUI() require a string in param1");
|
||||
|
||||
// get the string to format
|
||||
std::string propVal;
|
||||
ls.toString(1, propVal);
|
||||
|
||||
// *** format with %
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
std::string newPropVal, defError;
|
||||
|
@ -679,6 +692,7 @@ int CLuaIHMRyzom::formatUI(CLuaState &ls)
|
|||
{
|
||||
std::string paramValue;
|
||||
ls.toString(stackIndex, paramValue);
|
||||
|
||||
// For stack param 4, the param index is 3 (because stack param 2 is the param No 1)
|
||||
sint paramIndex = stackIndex - 1;
|
||||
|
||||
|
@ -698,10 +712,12 @@ int CLuaIHMRyzom::formatDB(CLuaState &ls)
|
|||
{
|
||||
//H_AUTO(Lua_CLuaIHM_formatDB)
|
||||
CLuaStackChecker lsc(&ls, 1);
|
||||
|
||||
// params: param1, param2....
|
||||
// return: string with @ and , added
|
||||
CLuaIHM::checkArgMin(ls, "formatDB", 1);
|
||||
uint top = ls.getTop();
|
||||
|
||||
std::string dbRes;
|
||||
|
||||
for (uint i = 1; i <= top; i++)
|
||||
|
@ -726,10 +742,12 @@ int CLuaIHMRyzom::dumpUI(CLuaState &ls)
|
|||
{
|
||||
//H_AUTO(Lua_CLuaIHM_dumpUI)
|
||||
CLuaStackChecker lsc(&ls, 0);
|
||||
|
||||
// params: CInterfaceElement *
|
||||
// return: none
|
||||
CLuaIHM::checkArgCount(ls, "dumpUI", 1);
|
||||
CLuaIHM::check(ls, CLuaIHM::isUIOnStack(ls, 1), "dumpUI() requires a UI object in param 1");
|
||||
|
||||
// retrieve args
|
||||
CInterfaceElement *pIE = CLuaIHM::getUIOnStack(ls, 1);
|
||||
|
||||
|
@ -753,7 +771,9 @@ int CLuaIHMRyzom::setKeyboardContext(CLuaState &ls)
|
|||
const char *funcName = "setKeyboardContext";
|
||||
CLuaIHM::checkArgMin(ls, funcName, 1);
|
||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING);
|
||||
|
||||
ActionsContext.setContext(ls.toString(1));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -803,9 +823,11 @@ int CLuaIHMRyzom::setTextFormatTaged(CLuaState &ls)
|
|||
// params: CViewText*, "text" (or ucstring)
|
||||
// return: none
|
||||
CLuaIHM::checkArgCount(ls, "setTextFormatTaged", 2);
|
||||
|
||||
// *** check and retrieve param 1
|
||||
CLuaIHM::check(ls, CLuaIHM::isUIOnStack(ls, 1), "setTextFormatTaged() requires a UI object in param 1");
|
||||
CInterfaceElement *pIE = CLuaIHM::getUIOnStack(ls, 1);
|
||||
|
||||
// *** check and retrieve param 2. must be a string or a ucstring
|
||||
ucstring text;
|
||||
|
||||
|
@ -833,6 +855,7 @@ int CLuaIHMRyzom::setTextFormatTaged(CLuaState &ls)
|
|||
|
||||
// Set the text as format
|
||||
vt->setTextFormatTaged(text);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -853,8 +876,10 @@ struct CEmoteStruct
|
|||
{
|
||||
string::size_type pos1 = path1.find('|');
|
||||
string::size_type pos2 = path2.find('|');
|
||||
|
||||
ucstring s1 = toUpper(CI18N::get(path1.substr(0, pos1)));
|
||||
ucstring s2 = toUpper(CI18N::get(path2.substr(0, pos2)));
|
||||
|
||||
sint result = s1.compare(s2);
|
||||
|
||||
if (result != 0)
|
||||
|
@ -880,14 +905,16 @@ int CLuaIHMRyzom::initEmotesMenu(CLuaState &ls)
|
|||
//H_AUTO(Lua_CLuaIHM_initEmotesMenu)
|
||||
CLuaIHM::checkArgCount(ls, "initEmotesMenu", 2);
|
||||
CLuaIHM::checkArgType(ls, "initEmotesMenu", 2, LUA_TSTRING);
|
||||
|
||||
const std::string &emoteMenu = ls.toString(1);
|
||||
const std::string &luaParams = ls.toString(2);
|
||||
|
||||
ls.newTable();
|
||||
CLuaObject result(ls);
|
||||
std::map<std::string, std::string> emoteList;
|
||||
uint maxVisibleLine = 10;
|
||||
CTextEmotListSheet* pTELS = dynamic_cast<CTextEmotListSheet*>(SheetMngr.get(CSheetId("list.text_emotes")));
|
||||
|
||||
CTextEmotListSheet *pTELS = dynamic_cast<CTextEmotListSheet*>(SheetMngr.get(CSheetId("list.text_emotes")));
|
||||
if (pTELS == NULL)
|
||||
return 0;
|
||||
|
||||
|
@ -914,8 +941,10 @@ int CLuaIHMRyzom::initEmotesMenu(CLuaState &ls)
|
|||
nlassert(pEmotList->Emots.size() <= 255);
|
||||
// Get the focus beta tester flag
|
||||
bool betaTester = false;
|
||||
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
CSkillManager *pSM = CSkillManager::getInstance();
|
||||
|
||||
betaTester = pSM->isTitleUnblocked(CHARACTER_TITLE::FBT);
|
||||
CGroupMenu *pInitRootMenu = dynamic_cast<CGroupMenu*>(CWidgetManager::getInstance()->getElementFromId(emoteMenu));
|
||||
pInitRootMenu->reset();
|
||||
|
@ -1016,6 +1045,7 @@ int CLuaIHMRyzom::initEmotesMenu(CLuaState &ls)
|
|||
}
|
||||
|
||||
result.push();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1115,8 +1145,10 @@ int CLuaIHMRyzom::enableModalWindow(CLuaState &ls)
|
|||
//H_AUTO(Lua_CLuaIHM_enableModalWindow)
|
||||
const char *funcName = "enableModalWindow";
|
||||
CLuaIHM::checkArgCount(ls, funcName, 2);
|
||||
|
||||
CLuaIHM::check(ls, CLuaIHM::isUIOnStack(ls, 1), "enableModalWindow() requires a UI object in param 1");
|
||||
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING);
|
||||
|
||||
CInterfaceElement *pIE = CLuaIHM::getUIOnStack(ls, 1);
|
||||
std::string modalId = ls.toString(2);
|
||||
|
||||
|
@ -1133,6 +1165,7 @@ int CLuaIHMRyzom::enableModalWindow(CLuaState &ls)
|
|||
if (group)
|
||||
{
|
||||
UserControls.stopFreeLook();
|
||||
|
||||
// enable the modal
|
||||
CWidgetManager::getInstance()->enableModalWindow(ctrl, group);
|
||||
}
|
||||
|
@ -1223,8 +1256,6 @@ int CLuaIHMRyzom::getShapeIdAt(CLuaState &ls)
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int CLuaIHMRyzom::getGroundAtMouse(CLuaState &ls)
|
||||
{
|
||||
sint32 x, y;
|
||||
|
@ -1263,9 +1294,6 @@ int CLuaIHMRyzom::getGroundAtMouse(CLuaState &ls)
|
|||
return 3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
int CLuaIHMRyzom::getPlayerPos(CLuaState &ls)
|
||||
{
|
||||
|
@ -1457,14 +1485,18 @@ int CLuaIHMRyzom::disableContextHelpForControl(CLuaState &ls)
|
|||
{
|
||||
//H_AUTO(Lua_CLuaIHM_disableContextHelpForControl)
|
||||
CLuaStackChecker lsc(&ls, 0);
|
||||
|
||||
// params: CCtrlBase*
|
||||
// return: none
|
||||
CLuaIHM::checkArgCount(ls, "disableContextHelpForControl", 1);
|
||||
CLuaIHM::check(ls, CLuaIHM::isUIOnStack(ls, 1), "disableContextHelpForControl() requires a UI object in param 1");
|
||||
|
||||
// retrieve args
|
||||
CInterfaceElement *pIE = CLuaIHM::getUIOnStack(ls, 1);
|
||||
|
||||
// go
|
||||
CWidgetManager::getInstance()->disableContextHelpForControl(dynamic_cast<CCtrlBase*>(pIE));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1511,8 +1543,10 @@ int CLuaIHMRyzom::getSheet2idx(CLuaState &ls)
|
|||
CLuaIHM::checkArgCount(ls, "getSheet2idx", 2);
|
||||
CLuaIHM::checkArgType(ls, "getSheet2idx", 1, LUA_TSTRING);
|
||||
CLuaIHM::checkArgType(ls, "getSheet2idx", 2, LUA_TNUMBER);
|
||||
|
||||
const std::string &sheedtName = ls.toString(1);
|
||||
uint32 slotId = (uint32)ls.toInteger(2);
|
||||
|
||||
NLMISC::CSheetId sheetId;
|
||||
|
||||
if (sheetId.buildSheetId(sheedtName))
|
||||
|
@ -1539,6 +1573,7 @@ int CLuaIHMRyzom::getSlotDataSetId(CLuaState &ls)
|
|||
{
|
||||
CLuaIHM::checkArgCount(ls, "getSlotDataSetId", 1);
|
||||
CLuaIHM::checkArgType(ls, "getSlotDataSetId", 1, LUA_TNUMBER);
|
||||
|
||||
uint32 slot = (uint32)ls.toInteger(1);
|
||||
CEntityCL *e = getSlotEntity(slot);
|
||||
string id = toString(e->dataSetId());
|
||||
|
@ -1553,6 +1588,7 @@ int CLuaIHMRyzom::getClientCfgVar(CLuaState &ls)
|
|||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING);
|
||||
std::string varName = ls.toString(1);
|
||||
|
||||
CConfigFile::CVar *v = ClientCfg.ConfigFile.getVarPtr(varName);
|
||||
|
||||
if (!v) return 0;
|
||||
|
@ -1657,6 +1693,7 @@ int CLuaIHMRyzom::getUICaller(CLuaState &ls)
|
|||
{
|
||||
//H_AUTO(Lua_CLuaIHM_getUICaller)
|
||||
CLuaStackChecker lsc(&ls, 1);
|
||||
|
||||
// params: none.
|
||||
// return: CInterfaceElement* (nil if error)
|
||||
CInterfaceElement *pIE = CHandlerLUA::getUICaller();
|
||||
|
@ -1679,10 +1716,12 @@ int CLuaIHMRyzom::getIndexInDB(CLuaState &ls)
|
|||
{
|
||||
//H_AUTO(Lua_CLuaIHM_getIndexInDB)
|
||||
CLuaStackChecker lsc(&ls, 1);
|
||||
|
||||
// params: CDBCtrlSheet*
|
||||
// return: index in DB of a dbctrlsheet (empty if error)
|
||||
CLuaIHM::checkArgCount(ls, "getIndexInDB", 1);
|
||||
CLuaIHM::check(ls, CLuaIHM::isUIOnStack(ls, 1), "getIndexInDB() requires a UI object in param 1");
|
||||
|
||||
// retrieve args
|
||||
CInterfaceElement *pIE = CLuaIHM::getUIOnStack(ls, 1);
|
||||
CDBCtrlSheet *pCS = dynamic_cast<CDBCtrlSheet*>(pIE);
|
||||
|
@ -1866,7 +1905,9 @@ int CLuaIHMRyzom::displayBubble(CLuaState &ls)
|
|||
links.push_back(it.nextValue().toString());
|
||||
strs.push_back(it.nextKey().toString());
|
||||
}
|
||||
|
||||
InSceneBubbleManager.webIgChatOpen((uint32)ls.toInteger(1), ls.toString(2), strs, links);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1922,11 +1963,14 @@ int CLuaIHMRyzom::getCompleteIslands(CLuaState &ls)
|
|||
//H_AUTO(Lua_CLuaIHM_getCompleteIslands)
|
||||
const char *funcName = "getCompleteIslands";
|
||||
CLuaIHM::checkArgCount(ls, funcName, 0);
|
||||
|
||||
ls.newTable();
|
||||
CLuaObject result(ls);
|
||||
|
||||
// load entryPoints
|
||||
CScenarioEntryPoints scenarioEntryPoints = CScenarioEntryPoints::getInstance();
|
||||
const CScenarioEntryPoints::TCompleteIslands &islands = scenarioEntryPoints.getCompleteIslands();
|
||||
|
||||
CScenarioEntryPoints::TCompleteIslands::const_iterator island(islands.begin()), lastIsland(islands.end());
|
||||
|
||||
for (; island != lastIsland ; ++island)
|
||||
|
@ -1938,6 +1982,7 @@ int CLuaIHMRyzom::getCompleteIslands(CLuaState &ls)
|
|||
islandTable.setValue("ymin", island->YMin);
|
||||
islandTable.setValue("xmax", island->XMax);
|
||||
islandTable.setValue("ymax", island->YMax);
|
||||
|
||||
ls.newTable();
|
||||
CLuaObject entrypointsTable(ls);
|
||||
|
||||
|
@ -1948,25 +1993,28 @@ int CLuaIHMRyzom::getCompleteIslands(CLuaState &ls)
|
|||
CLuaObject entrypointTable(ls);
|
||||
entrypointTable.setValue("x", entryPoint.X);
|
||||
entrypointTable.setValue("y", entryPoint.Y);
|
||||
|
||||
entrypointsTable.setValue(entryPoint.Location, entrypointTable);
|
||||
}
|
||||
|
||||
islandTable.setValue("entrypoints", entrypointsTable);
|
||||
|
||||
result.setValue(island->Island, islandTable);
|
||||
}
|
||||
|
||||
result.push();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
|
||||
int CLuaIHMRyzom::getIslandId(CLuaState &ls)
|
||||
{
|
||||
//H_AUTO(Lua_CLuaIHM_getIslandId)
|
||||
const char *funcName = "getIslandId";
|
||||
CLuaIHM::checkArgCount(ls, funcName, 1);
|
||||
CLuaIHM::check(ls, ls.isString(1), "getIslandId() requires a string in param 1");
|
||||
|
||||
CScenarioEntryPoints scenarioEntryPoints = CScenarioEntryPoints::getInstance();
|
||||
uint32 id = scenarioEntryPoints.getIslandId(ls.toString(1));
|
||||
ls.push(id);
|
||||
|
@ -2532,11 +2580,11 @@ void CLuaIHMRyzom::setDbProp(const std::string &dbProp, sint32 value)
|
|||
static const std::string dbLocal = "LOCAL:";
|
||||
static const std::string dbLocalR2 = "LOCAL:R2";
|
||||
|
||||
if ((0 == dbProp.compare(0, dbServer.size(), dbServer)) ||
|
||||
(0 == dbProp.compare(0, dbLocal.size(), dbLocal))
|
||||
if ((dbProp.compare(0, dbServer.size(), dbServer) == 0) ||
|
||||
(dbProp.compare(0, dbLocal.size(), dbLocal) == 0)
|
||||
)
|
||||
{
|
||||
if (0 != dbProp.compare(0, dbLocalR2.size(), dbLocalR2))
|
||||
if (dbProp.compare(0, dbLocalR2.size(), dbLocalR2) != 0)
|
||||
{
|
||||
nlstop;
|
||||
throw ELuaIHMException("setDbProp(): You are not allowed to write on 'SERVER:...' or 'LOCAL:...' database");
|
||||
|
@ -2561,11 +2609,11 @@ void CLuaIHMRyzom::delDbProp(const string &dbProp)
|
|||
static const string dbLocal = "LOCAL:";
|
||||
static const string dbLocalR2 = "LOCAL:R2";
|
||||
|
||||
if ((0 == dbProp.compare(0, dbServer.size(), dbServer)) ||
|
||||
(0 == dbProp.compare(0, dbLocal.size(), dbLocal))
|
||||
if ((dbProp.compare(0, dbServer.size(), dbServer) == 0) ||
|
||||
(dbProp.compare(0, dbLocal.size(), dbLocal) == 0)
|
||||
)
|
||||
{
|
||||
if (0 != dbProp.compare(0, dbLocalR2.size(), dbLocalR2))
|
||||
if (dbProp.compare(0, dbLocalR2.size(), dbLocalR2) != 0)
|
||||
{
|
||||
nlstop;
|
||||
throw ELuaIHMException("setDbProp(): You are not allowed to write on 'SERVER:...' or 'LOCAL:...' database");
|
||||
|
@ -2585,11 +2633,11 @@ void CLuaIHMRyzom::addDbProp(const std::string &dbProp, sint32 value)
|
|||
static const std::string dbLocal = "LOCAL:";
|
||||
static const std::string dbLocalR2 = "LOCAL:R2";
|
||||
|
||||
if ((0 == dbProp.compare(0, dbServer.size(), dbServer)) ||
|
||||
(0 == dbProp.compare(0, dbLocal.size(), dbLocal))
|
||||
if ((dbProp.compare(0, dbServer.size(), dbServer) == 0) ||
|
||||
(dbProp.compare(0, dbLocal.size(), dbLocal) == 0)
|
||||
)
|
||||
{
|
||||
if (0 != dbProp.compare(0, dbLocalR2.size(), dbLocalR2))
|
||||
if (dbProp.compare(0, dbLocalR2.size(), dbLocalR2) != 0)
|
||||
{
|
||||
nlstop;
|
||||
throw ELuaIHMException("setDbProp(): You are not allowed to write on 'SERVER:...' or 'LOCAL:...' database");
|
||||
|
@ -2865,6 +2913,7 @@ ucstring CLuaIHMRyzom::replacePvpEffectParam(const ucstring &str, sint32 paramet
|
|||
ucstring result = str;
|
||||
CSString s = str.toString();
|
||||
std::string p, paramString;
|
||||
|
||||
// Locate parameter and store it
|
||||
p = s.splitTo('%', true);
|
||||
|
||||
|
@ -2904,6 +2953,7 @@ ucstring CLuaIHMRyzom::replacePvpEffectParam(const ucstring &str, sint32 paramet
|
|||
}
|
||||
|
||||
strFindReplace(result, paramString.c_str(), p);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -3042,6 +3092,7 @@ sint32 CLuaIHMRyzom::getMagicResistChance(bool elementalSpell, sint32 casterSp
|
|||
sint32 chanceToHit = pPM->getSuccessRate(elementalSpell ? CSPhraseManager::STResistMagic : CSPhraseManager::STResistMagicLink,
|
||||
casterSpellLvl - victimResistLvl, true);
|
||||
clamp(chanceToHit, 0, 100);
|
||||
|
||||
// Thus, the resist chance is 100 - hit chance.
|
||||
return 100 - chanceToHit;
|
||||
}
|
||||
|
@ -3053,8 +3104,10 @@ sint32 CLuaIHMRyzom::getDodgeParryChance(sint32 attLvl, sint32 defLvl)
|
|||
CSPhraseManager *pPM = CSPhraseManager::getInstance();
|
||||
attLvl = std::max(attLvl, sint32(0));
|
||||
defLvl = std::max(defLvl, sint32(0));
|
||||
|
||||
sint32 chance = pPM->getSuccessRate(CSPhraseManager::STDodgeParry, defLvl - attLvl, false);
|
||||
clamp(chance, 0, 100);
|
||||
|
||||
return chance;
|
||||
}
|
||||
|
||||
|
@ -3069,6 +3122,7 @@ void CLuaIHMRyzom::browseNpcWebPage(const std::string &htmlId, const std::string
|
|||
{
|
||||
// if true, it means that we want to display a web page that use webig auth
|
||||
bool webig = urlIn.find("http://") == 0;
|
||||
|
||||
string url;
|
||||
|
||||
// append the WebServer to the url
|
||||
|
@ -3121,6 +3175,7 @@ void CLuaIHMRyzom::browseNpcWebPage(const std::string &htmlId, const std::string
|
|||
*/
|
||||
// set the wanted timeout
|
||||
groupHtml->setTimeout((float)std::max(0.0, timeout));
|
||||
|
||||
// Browse the url
|
||||
groupHtml->clean();
|
||||
groupHtml->browse(url.c_str());
|
||||
|
@ -3393,10 +3448,11 @@ sint32 CLuaIHMRyzom::getGroundZ(uint32 x, sint32 y)
|
|||
vect.y = y;
|
||||
|
||||
UserEntity->getCollisionEntity()->snapToGround(vect);
|
||||
|
||||
return vect.z;
|
||||
}
|
||||
|
||||
void setMouseCursor(const std::string texture)
|
||||
void setMouseCursor(const std::string &texture)
|
||||
{
|
||||
if (texture.empty())
|
||||
CTool::setMouseCursor("curs_default.tga");
|
||||
|
@ -3451,7 +3507,6 @@ void CLuaIHMRyzom::tell(const ucstring &player, const ucstring &msg)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// ***************************************************************************
|
||||
bool CLuaIHMRyzom::isRingAccessPointInReach()
|
||||
{
|
||||
|
@ -3558,7 +3613,6 @@ sint32 CLuaIHMRyzom::getTargetLevel()
|
|||
ucstring CLuaIHMRyzom::getTargetSheet()
|
||||
{
|
||||
CEntityCL *target = getTargetEntity();
|
||||
|
||||
if (!target) return ucstring();
|
||||
|
||||
return target->sheetId().toString();
|
||||
|
@ -3568,10 +3622,10 @@ ucstring CLuaIHMRyzom::getTargetSheet()
|
|||
sint64 CLuaIHMRyzom::getTargetVpa()
|
||||
{
|
||||
CEntityCL *target = getTargetEntity();
|
||||
|
||||
if (!target) return 0;
|
||||
|
||||
sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E" + toString("%d", getTargetSlotNr()) + ":P" + toString("%d", CLFECOMMON::PROPERTY_VPA))->getValue64();
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
|
@ -3579,10 +3633,10 @@ sint64 CLuaIHMRyzom::getTargetVpa()
|
|||
sint64 CLuaIHMRyzom::getTargetVpb()
|
||||
{
|
||||
CEntityCL *target = getTargetEntity();
|
||||
|
||||
if (!target) return 0;
|
||||
|
||||
sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E" + toString("%d", getTargetSlotNr()) + ":P" + toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64();
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
|
@ -3590,10 +3644,10 @@ sint64 CLuaIHMRyzom::getTargetVpb()
|
|||
sint64 CLuaIHMRyzom::getTargetVpc()
|
||||
{
|
||||
CEntityCL *target = getTargetEntity();
|
||||
|
||||
if (!target) return 0;
|
||||
|
||||
sint64 prop = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:Entities:E" + toString("%d", getTargetSlotNr()) + ":P" + toString("%d", CLFECOMMON::PROPERTY_VPB))->getValue64();
|
||||
|
||||
return prop;
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ private:
|
|||
static int getMouseRightDown(CLuaState &ls);
|
||||
static int getShapeIdAt(CLuaState &ls);
|
||||
static int setupShape(CLuaState &ls);
|
||||
static void setMouseCursor(const std::string texture);
|
||||
static void setMouseCursor(const std::string &texture);
|
||||
// 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);
|
||||
|
|
|
@ -797,7 +797,7 @@ bool CTool::isMouseCaptured()
|
|||
}
|
||||
|
||||
// *********************************************************************************************************
|
||||
void CTool::setMouseCursor(const char *cursorTexture)
|
||||
void CTool::setMouseCursor(const std::string &cursorTexture)
|
||||
{
|
||||
//H_AUTO(R2_CTool_setMouseCursor)
|
||||
CViewPointer *cursor = static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
|
||||
|
|
|
@ -224,8 +224,7 @@ public:
|
|||
// Get mouse y position
|
||||
static sint32 getMouseY();
|
||||
// Set the current mouse cursor
|
||||
static void setMouseCursor(const char *cursorTexture);
|
||||
static void setMouseCursor(const std::string &cursorTexture) { setMouseCursor(cursorTexture.c_str()); }
|
||||
static void setMouseCursor(const std::string &cursorTexture);
|
||||
/** Compute a view vector (with its direction z set to 1) from coordinate of the mouse on screen
|
||||
* If the mouse is on the island map, then a vector looking down from heights will be returned
|
||||
*/
|
||||
|
|
|
@ -414,21 +414,21 @@ void CToolChoosePos::updateBeforeRender()
|
|||
{
|
||||
if (_MultiPos && isShiftDown() && !_MultiPosLocked)
|
||||
{
|
||||
setMouseCursor(_CursValidMulti.c_str());
|
||||
setMouseCursor(_CursValidMulti);
|
||||
}
|
||||
else
|
||||
{
|
||||
setMouseCursor(_CursValid.c_str());
|
||||
setMouseCursor(_CursValid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setMouseCursor(_CursInvalid.c_str());
|
||||
setMouseCursor(_CursInvalid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setMouseCursor(_CursValid.c_str());
|
||||
setMouseCursor(_CursValid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -596,7 +596,7 @@ void CToolCreateEntity::updateBeforeRender()
|
|||
}
|
||||
CGroupMap *worldMap = getWorldMap();
|
||||
if (worldMap) worldMap->setSelectionAxis(_ValidArray);
|
||||
setMouseCursor(_ValidArray ? _CursValid.c_str() : _CursInvalid.c_str());
|
||||
setMouseCursor(_ValidArray ? _CursValid : _CursInvalid);
|
||||
}
|
||||
|
||||
// ***************************************************************
|
||||
|
|
Loading…
Reference in a new issue