Compare commits

...

6 Commits

@ -565,6 +565,7 @@ void CLuaIHMRyzom::RegisterRyzomFunctions(NLGUI::CLuaState &ls)
LUABIND_FUNC(isDynStringAvailable), LUABIND_FUNC(isDynStringAvailable),
LUABIND_FUNC(isFullyPatched), LUABIND_FUNC(isFullyPatched),
LUABIND_FUNC(getSheetType), LUABIND_FUNC(getSheetType),
LUABIND_FUNC(getSheetShape),
LUABIND_FUNC(getSheetFamily), LUABIND_FUNC(getSheetFamily),
LUABIND_FUNC(getSheetName), LUABIND_FUNC(getSheetName),
LUABIND_FUNC(getFameIndex), LUABIND_FUNC(getFameIndex),
@ -1245,7 +1246,7 @@ int CLuaIHMRyzom::getMousePos(CLuaState &ls)
CTool::getMousePos(x, y); CTool::getMousePos(x, y);
ls.push(x); ls.push(x);
ls.push(y); ls.push(y);
return 2; return 2;
} }
@ -1257,7 +1258,7 @@ int CLuaIHMRyzom::getMouseDown(CLuaState &ls)
ls.push(down); ls.push(down);
ls.push(x); ls.push(x);
ls.push(y); ls.push(y);
return 3; return 3;
} }
@ -1266,11 +1267,11 @@ int CLuaIHMRyzom::getMouseMiddleDown(CLuaState &ls)
sint32 x, y; sint32 x, y;
bool down; bool down;
CTool::getMouseMiddleDown(down, x, y); CTool::getMouseMiddleDown(down, x, y);
ls.push(down); ls.push(down);
ls.push(x); ls.push(x);
ls.push(y); ls.push(y);
return 3; return 3;
} }
@ -1279,11 +1280,11 @@ int CLuaIHMRyzom::getMouseRightDown(CLuaState &ls)
sint32 x, y; sint32 x, y;
bool down; bool down;
CTool::getMouseRightDown(down, x, y); CTool::getMouseRightDown(down, x, y);
ls.push(down); ls.push(down);
ls.push(x); ls.push(x);
ls.push(y); ls.push(y);
return 3; return 3;
} }
@ -1294,10 +1295,10 @@ int CLuaIHMRyzom::getShapeIdAt(CLuaState &ls)
CLuaIHM::checkArgCount(ls, funcName, 2); CLuaIHM::checkArgCount(ls, funcName, 2);
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER);
uint32 x = (uint32)ls.toInteger(1); uint32 x = (uint32)ls.toInteger(1);
uint32 y = (uint32)ls.toInteger(2); uint32 y = (uint32)ls.toInteger(2);
uint32 w, h; uint32 w, h;
CViewRenderer &viewRender = *CViewRenderer::getInstance(); CViewRenderer &viewRender = *CViewRenderer::getInstance();
viewRender.getScreenSize(w, h); viewRender.getScreenSize(w, h);
@ -1308,11 +1309,11 @@ int CLuaIHMRyzom::getShapeIdAt(CLuaState &ls)
float cursX = (float)x/(float)w; float cursX = (float)x/(float)w;
float cursY = (float)y/(float)h; float cursY = (float)y/(float)h;
sint32 instance_idx; sint32 instance_idx;
EntitiesMngr.getShapeInstanceUnderPos(cursX, cursY, instance_idx); EntitiesMngr.getShapeInstanceUnderPos(cursX, cursY, instance_idx);
ls.push(instance_idx); ls.push(instance_idx);
return 1; return 1;
} }
@ -1339,7 +1340,7 @@ int CLuaIHMRyzom::getGroundAtMouse(CLuaState &ls)
worldViewRay.Up = camMatrix.getK().normed(); worldViewRay.Up = camMatrix.getK().normed();
CVector sceneInter; CVector sceneInter;
CTool::TRayIntersectionType rayInterType = CTool::computeLandscapeRayIntersection(worldViewRay, sceneInter); CTool::TRayIntersectionType rayInterType = CTool::computeLandscapeRayIntersection(worldViewRay, sceneInter);
ls.push(sceneInter.x); ls.push(sceneInter.x);
ls.push(sceneInter.y); ls.push(sceneInter.y);
ls.push(sceneInter.z); ls.push(sceneInter.z);
@ -1367,7 +1368,7 @@ int CLuaIHMRyzom::moveCam(CLuaState &ls)
float z = (float)ls.toNumber(3); float z = (float)ls.toNumber(3);
CVector moves(x, y, z); CVector moves(x, y, z);
UserEntity->setCameraMoves(moves); UserEntity->setCameraMoves(moves);
return 0; return 0;
} }
@ -1541,7 +1542,7 @@ int CLuaIHMRyzom::moveToTarget(CLuaState &ls)
const std::string &url = ls.toString(1); const std::string &url = ls.toString(1);
CEntityCL *target = getTargetEntity(); CEntityCL *target = getTargetEntity();
if (!target) return 0; if (!target) return 0;
CLuaManager::getInstance().executeLuaScript("ArkTargetUrl = [["+url+"]]", 0); CLuaManager::getInstance().executeLuaScript("ArkTargetUrl = [["+url+"]]", 0);
UserEntity->moveTo(UserEntity->selection(), 1.0, CUserEntity::OpenArkUrl); UserEntity->moveTo(UserEntity->selection(), 1.0, CUserEntity::OpenArkUrl);
return 0; return 0;
@ -2180,7 +2181,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING);
sint32 idx = -1; sint32 idx = -1;
if (!Scene) if (!Scene)
{ {
nlwarning("No scene available"); nlwarning("No scene available");
@ -2189,7 +2190,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
} }
string shape = ls.toString(1); string shape = ls.toString(1);
float x = 0.0f, y = 0.0f, z = 0.0f; float x = 0.0f, y = 0.0f, z = 0.0f;
float scale = 1.0f; float scale = 1.0f;
string context, url, skeleton, texture; string context, url, skeleton, texture;
@ -2197,7 +2198,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
bool transparency = false; bool transparency = false;
bool collision = true; bool collision = true;
bool inIgZone = false; bool inIgZone = false;
if (ls.getTop() >= 2) if (ls.getTop() >= 2)
{ {
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER);
@ -2223,14 +2224,14 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
y = UserEntity->pos().y; y = UserEntity->pos().y;
z = UserEntity->pos().z; z = UserEntity->pos().z;
} }
CVector userDir = UserEntity->dir(); CVector userDir = UserEntity->dir();
if (ls.getTop() >= 5) if (ls.getTop() >= 5)
{ {
CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING);
string angle = ls.toString(5); string angle = ls.toString(5);
if (angle != "user") if (angle != "user")
{ {
float a; float a;
@ -2238,7 +2239,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
userDir = CVector(sin(a), cos(a), 0.f); userDir = CVector(sin(a), cos(a), 0.f);
} }
} }
if (ls.getTop() >= 6) if (ls.getTop() >= 6)
{ {
CLuaIHM::checkArgType(ls, funcName, 6, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 6, LUA_TNUMBER);
@ -2250,19 +2251,19 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
CLuaIHM::checkArgType(ls, funcName, 7, LUA_TBOOLEAN); CLuaIHM::checkArgType(ls, funcName, 7, LUA_TBOOLEAN);
collision = ls.toBoolean(7); collision = ls.toBoolean(7);
} }
if (ls.getTop() >= 8) if (ls.getTop() >= 8)
{ {
CLuaIHM::checkArgType(ls, funcName, 8, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 8, LUA_TSTRING);
context = ls.toString(8); context = ls.toString(8);
} }
if (ls.getTop() >= 9) if (ls.getTop() >= 9)
{ {
CLuaIHM::checkArgType(ls, funcName, 9, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 9, LUA_TSTRING);
url = ls.toString(9); url = ls.toString(9);
} }
if (ls.getTop() >= 10) if (ls.getTop() >= 10)
{ {
CLuaIHM::checkArgType(ls, funcName, 10, LUA_TBOOLEAN); CLuaIHM::checkArgType(ls, funcName, 10, LUA_TBOOLEAN);
@ -2274,25 +2275,25 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
CLuaIHM::checkArgType(ls, funcName, 11, LUA_TBOOLEAN); CLuaIHM::checkArgType(ls, funcName, 11, LUA_TBOOLEAN);
transparency = ls.toBoolean(11); transparency = ls.toBoolean(11);
} }
if (ls.getTop() >= 12) if (ls.getTop() >= 12)
{ {
CLuaIHM::checkArgType(ls, funcName, 12, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 12, LUA_TSTRING);
texture = ls.toString(12); texture = ls.toString(12);
} }
if (ls.getTop() >= 13) if (ls.getTop() >= 13)
{ {
CLuaIHM::checkArgType(ls, funcName, 13, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 13, LUA_TSTRING);
skeleton = ls.toString(13); skeleton = ls.toString(13);
} }
if (ls.getTop() >= 14) if (ls.getTop() >= 14)
{ {
CLuaIHM::checkArgType(ls, funcName, 14, LUA_TBOOLEAN); CLuaIHM::checkArgType(ls, funcName, 14, LUA_TBOOLEAN);
inIgZone = ls.toBoolean(14); inIgZone = ls.toBoolean(14);
} }
CShapeInstanceReference instref = EntitiesMngr.createInstance(shape, CVector(x, y, z), context, url, collision, inIgZone, idx); CShapeInstanceReference instref = EntitiesMngr.createInstance(shape, CVector(x, y, z), context, url, collision, inIgZone, idx);
UInstance instance = instref.Instance; UInstance instance = instref.Instance;
@ -2373,9 +2374,9 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
instance.setPos(CVector(x, y, z)); instance.setPos(CVector(x, y, z));
instance.setRotQuat(dir.getRot()); instance.setRotQuat(dir.getRot());
} }
instance.setTransformMode(UTransformable::RotEuler); instance.setTransformMode(UTransformable::RotEuler);
// if the shape is a particle system, additionnal parameters are user params // if the shape is a particle system, additionnal parameters are user params
UParticleSystemInstance psi; UParticleSystemInstance psi;
psi.cast (instance); psi.cast (instance);
@ -2398,7 +2399,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
} }
} }
}*/ }*/
UMovePrimitive *primitive = instref.Primitive; UMovePrimitive *primitive = instref.Primitive;
if (primitive) if (primitive)
{ {
@ -2408,7 +2409,7 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
primitive->setReactionType(UMovePrimitive::Slide); primitive->setReactionType(UMovePrimitive::Slide);
primitive->setTriggerType(UMovePrimitive::NotATrigger); primitive->setTriggerType(UMovePrimitive::NotATrigger);
primitive->setAbsorbtion(0); primitive->setAbsorbtion(0);
primitive->setPrimitiveType(UMovePrimitive::_2DOrientedBox); primitive->setPrimitiveType(UMovePrimitive::_2DOrientedBox);
primitive->setSize((bbox.getMax().x - bbox.getMin().x)*scale, (bbox.getMax().y - bbox.getMin().y)*scale); primitive->setSize((bbox.getMax().x - bbox.getMin().x)*scale, (bbox.getMax().y - bbox.getMin().y)*scale);
primitive->setHeight((bbox.getMax().z - bbox.getMin().z)*scale); primitive->setHeight((bbox.getMax().z - bbox.getMin().z)*scale);
@ -2416,10 +2417,10 @@ int CLuaIHMRyzom::addShape(CLuaState &ls)
primitive->setCollisionMask(MaskColPlayer | MaskColNpc | MaskColDoor); primitive->setCollisionMask(MaskColPlayer | MaskColNpc | MaskColDoor);
primitive->setOcclusionMask(MaskColPlayer | MaskColNpc | MaskColDoor); primitive->setOcclusionMask(MaskColPlayer | MaskColNpc | MaskColDoor);
primitive->setObstacle(true); primitive->setObstacle(true);
primitive->setGlobalPosition(instance.getPos(), dynamicWI); primitive->setGlobalPosition(instance.getPos(), dynamicWI);
primitive->insertInWorldImage(dynamicWI); primitive->insertInWorldImage(dynamicWI);
} }
} }
@ -2434,9 +2435,9 @@ int CLuaIHMRyzom::setupShape(CLuaState &ls)
CLuaIHM::checkArgCount(ls, funcName, 2); CLuaIHM::checkArgCount(ls, funcName, 2);
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TTABLE); CLuaIHM::checkArgType(ls, funcName, 2, LUA_TTABLE);
uint32 idx = (uint32)ls.toInteger(1); uint32 idx = (uint32)ls.toInteger(1);
std::vector<string> keys; std::vector<string> keys;
std::vector<string> values; std::vector<string> values;
CLuaObject params; CLuaObject params;
@ -2459,12 +2460,12 @@ int CLuaIHMRyzom::setupShape(CLuaState &ls)
values.push_back(it.nextValue().toString()); values.push_back(it.nextValue().toString());
keys.push_back(it.nextKey().toString()); keys.push_back(it.nextKey().toString());
} }
if (EntitiesMngr.setupInstance(idx, keys, values)) if (EntitiesMngr.setupInstance(idx, keys, values))
ls.push(1); ls.push(1);
else else
ls.pushNil(); ls.pushNil();
return 1; return 1;
} }
@ -2476,15 +2477,15 @@ int CLuaIHMRyzom::moveShape(CLuaState &ls)
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING);
CLuaIHM::checkArgType(ls, funcName, 3, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 3, LUA_TSTRING);
CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING);
uint32 idx = (uint32)ls.toInteger(1); uint32 idx = (uint32)ls.toInteger(1);
CVector pos = EntitiesMngr.getInstancePos(idx); CVector pos = EntitiesMngr.getInstancePos(idx);
string x = ls.toString(2); string x = ls.toString(2);
string y = ls.toString(3); string y = ls.toString(3);
string z = ls.toString(4); string z = ls.toString(4);
float move_x = 0; float move_x = 0;
float move_y = 0; float move_y = 0;
float move_z = 0; float move_z = 0;
@ -2502,7 +2503,7 @@ int CLuaIHMRyzom::moveShape(CLuaState &ls)
pos.x = move_x; pos.x = move_x;
} }
} }
if (!y.empty()) if (!y.empty())
{ {
if (y[0] == '+') if (y[0] == '+')
@ -2516,7 +2517,7 @@ int CLuaIHMRyzom::moveShape(CLuaState &ls)
pos.y = move_y; pos.y = move_y;
} }
} }
if (!z.empty()) if (!z.empty())
{ {
if (z[0] == '+') if (z[0] == '+')
@ -2530,12 +2531,12 @@ int CLuaIHMRyzom::moveShape(CLuaState &ls)
pos.z = move_z; pos.z = move_z;
} }
} }
if (EntitiesMngr.setInstancePos(idx, pos)) if (EntitiesMngr.setInstancePos(idx, pos))
ls.push(1); ls.push(1);
else else
ls.pushNil(); ls.pushNil();
return 1; return 1;
} }
@ -2547,9 +2548,9 @@ int CLuaIHMRyzom::rotateShape(CLuaState &ls)
CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING);
CLuaIHM::checkArgType(ls, funcName, 3, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 3, LUA_TSTRING);
CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 4, LUA_TSTRING);
uint32 idx = (uint32)ls.toInteger(1); uint32 idx = (uint32)ls.toInteger(1);
CVector rot = EntitiesMngr.getInstanceRot(idx); CVector rot = EntitiesMngr.getInstanceRot(idx);
string x = ls.toString(2); string x = ls.toString(2);
@ -2573,7 +2574,7 @@ int CLuaIHMRyzom::rotateShape(CLuaState &ls)
rot.x = rot_x; rot.x = rot_x;
} }
} }
if (!y.empty()) if (!y.empty())
{ {
if (y[0] == '+') if (y[0] == '+')
@ -2587,7 +2588,7 @@ int CLuaIHMRyzom::rotateShape(CLuaState &ls)
rot.y = rot_y; rot.y = rot_y;
} }
} }
if (!z.empty()) if (!z.empty())
{ {
if (z[0] == '+') if (z[0] == '+')
@ -2601,12 +2602,12 @@ int CLuaIHMRyzom::rotateShape(CLuaState &ls)
rot.z = rot_z; rot.z = rot_z;
} }
} }
if (EntitiesMngr.setInstanceRot(idx, rot)) if (EntitiesMngr.setInstanceRot(idx, rot))
ls.push(1); ls.push(1);
else else
ls.pushNil(); ls.pushNil();
return 1; return 1;
} }
@ -2615,7 +2616,7 @@ int CLuaIHMRyzom::deleteShape(CLuaState &ls)
const char* funcName = "deleteShape"; const char* funcName = "deleteShape";
CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgCount(ls, funcName, 1);
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
if (EntitiesMngr.deleteInstance((uint32)ls.toInteger(1))) if (EntitiesMngr.deleteInstance((uint32)ls.toInteger(1)))
ls.push(1); ls.push(1);
else else
@ -2629,9 +2630,9 @@ int CLuaIHMRyzom::getShapePos(CLuaState &ls)
const char* funcName = "getShapePos"; const char* funcName = "getShapePos";
CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgCount(ls, funcName, 1);
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
uint32 idx = (uint32)ls.toInteger(1); uint32 idx = (uint32)ls.toInteger(1);
CVector pos = EntitiesMngr.getInstancePos(idx); CVector pos = EntitiesMngr.getInstancePos(idx);
ls.push(pos.x); ls.push(pos.x);
@ -2645,9 +2646,9 @@ int CLuaIHMRyzom::getShapeRot(CLuaState &ls)
const char* funcName = "getShapeRot"; const char* funcName = "getShapeRot";
CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgCount(ls, funcName, 1);
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
uint32 idx = (uint32)ls.toInteger(1); uint32 idx = (uint32)ls.toInteger(1);
CVector rot = EntitiesMngr.getInstanceRot(idx); CVector rot = EntitiesMngr.getInstanceRot(idx);
ls.push(rot.x); ls.push(rot.x);
@ -2661,11 +2662,11 @@ int CLuaIHMRyzom::getShapeScale(CLuaState &ls)
const char* funcName = "getShapeScale"; const char* funcName = "getShapeScale";
CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgCount(ls, funcName, 1);
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
uint32 idx = (uint32)ls.toInteger(1); uint32 idx = (uint32)ls.toInteger(1);
CVector scale = EntitiesMngr.getInstanceScale(idx); CVector scale = EntitiesMngr.getInstanceScale(idx);
ls.push(scale.x); ls.push(scale.x);
ls.push(scale.y); ls.push(scale.y);
ls.push(scale.z); ls.push(scale.z);
@ -2677,11 +2678,11 @@ int CLuaIHMRyzom::getShapeColPos(CLuaState &ls)
const char* funcName = "getShapeColPos"; const char* funcName = "getShapeColPos";
CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgCount(ls, funcName, 1);
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
uint32 idx = (uint32)ls.toInteger(1); uint32 idx = (uint32)ls.toInteger(1);
CVector pos = EntitiesMngr.getInstanceColPos(idx); CVector pos = EntitiesMngr.getInstanceColPos(idx);
ls.push(pos.x); ls.push(pos.x);
ls.push(pos.y); ls.push(pos.y);
ls.push(pos.z); ls.push(pos.z);
@ -2693,11 +2694,11 @@ int CLuaIHMRyzom::getShapeColScale(CLuaState &ls)
const char* funcName = "getShapeColScale"; const char* funcName = "getShapeColScale";
CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgCount(ls, funcName, 1);
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
uint32 idx = (uint32)ls.toInteger(1); uint32 idx = (uint32)ls.toInteger(1);
CVector scale = EntitiesMngr.getInstanceColScale(idx); CVector scale = EntitiesMngr.getInstanceColScale(idx);
ls.push(scale.x); ls.push(scale.x);
ls.push(scale.y); ls.push(scale.y);
ls.push(scale.z); ls.push(scale.z);
@ -2709,11 +2710,11 @@ int CLuaIHMRyzom::getShapeColOrient(CLuaState &ls)
const char* funcName = "getShapeColOrient"; const char* funcName = "getShapeColOrient";
CLuaIHM::checkArgCount(ls, funcName, 1); CLuaIHM::checkArgCount(ls, funcName, 1);
CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
uint32 idx = (uint32)ls.toInteger(1); uint32 idx = (uint32)ls.toInteger(1);
double orient = EntitiesMngr.getInstanceColOrient(idx); double orient = EntitiesMngr.getInstanceColOrient(idx);
ls.push(orient); ls.push(orient);
return 1; return 1;
} }
@ -3469,6 +3470,30 @@ std::string CLuaIHMRyzom::getSheetType(const std::string &sheet)
return CEntitySheet::typeToString(sheetPtr->Type); return CEntitySheet::typeToString(sheetPtr->Type);
} }
// ***************************************************************************
std::string CLuaIHMRyzom::getSheetShape(const std::string &sheet)
{
//H_AUTO(Lua_CLuaIHM_getSheetType)
const CEntitySheet *sheetPtr = SheetMngr.get(CSheetId(sheet));
if (!sheetPtr)
return "";
if (sheetPtr->type() == CEntitySheet::ITEM)
{
CItemSheet *sheet = (CItemSheet*)sheetPtr;
return sheet->getShape();
}
else if (sheetPtr->type() == CEntitySheet::FAUNA)
{
CCharacterSheet *sheet = (CCharacterSheet*)(sheetPtr);
return sheet->Body.getItem();
}
return "";
}
// *************************************************************************** // ***************************************************************************
std::string CLuaIHMRyzom::getSheetFamily(const std::string &sheet) std::string CLuaIHMRyzom::getSheetFamily(const std::string &sheet)
@ -3481,7 +3506,7 @@ std::string CLuaIHMRyzom::getSheetFamily(const std::string &sheet)
if (pIS) if (pIS)
return ITEMFAMILY::toString(pIS->Family); return ITEMFAMILY::toString(pIS->Family);
} }
return ""; return "";
} }
@ -3712,7 +3737,7 @@ float CLuaIHMRyzom::setChar3dDBfromVPX(const std::string &branch, const std::str
cs.People = EGSPD::CPeople::fromString(people); cs.People = EGSPD::CPeople::fromString(people);
SCharacter3DSetup::setupDBFromCharacterSummary(branch, cs); SCharacter3DSetup::setupDBFromCharacterSummary(branch, cs);
return cs.VisualPropC.PropertySubData.CharacterHeight; return cs.VisualPropC.PropertySubData.CharacterHeight;
} }
@ -4172,12 +4197,12 @@ int CLuaIHMRyzom::addLandMark(CLuaState &ls)
point.LeftClickParam = ls.toString(6); point.LeftClickParam = ls.toString(6);
point.RightClickAction = ls.toString(7); point.RightClickAction = ls.toString(7);
point.RightClickParam = ls.toString(8); point.RightClickParam = ls.toString(8);
point.Color = CRGBA(255,255,255,255); point.Color = CRGBA(255,255,255,255);
if (ls.getTop() >= 9) if (ls.getTop() >= 9)
CLuaIHM::pop(ls, point.Color); CLuaIHM::pop(ls, point.Color);
CGroupMap *pMap = dynamic_cast<CGroupMap*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:actual_map")); CGroupMap *pMap = dynamic_cast<CGroupMap*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:actual_map"));
if (pMap != NULL) if (pMap != NULL)
pMap->addArkPoint(point); pMap->addArkPoint(point);

@ -15,7 +15,7 @@ private:
static int luaClientCfgIndex(CLuaState &ls); static int luaClientCfgIndex(CLuaState &ls);
static int luaClientCfgNewIndex(CLuaState &ls); static int luaClientCfgNewIndex(CLuaState &ls);
// CInterfaceElement management on stack, stored by a CRefPtr. // CInterfaceElement management on stack, stored by a CRefPtr.
public: public:
@ -204,6 +204,7 @@ private:
static bool isDynStringAvailable(sint32 dynStringId); static bool isDynStringAvailable(sint32 dynStringId);
static bool isFullyPatched(); static bool isFullyPatched();
static std::string getSheetType(const std::string &sheet); static std::string getSheetType(const std::string &sheet);
static std::string getSheetShape(const std::string &sheet);
static std::string getSheetFamily(const std::string &sheet); static std::string getSheetFamily(const std::string &sheet);
static std::string getSheetName(uint32 sheetId); static std::string getSheetName(uint32 sheetId);
static sint32 getFameIndex(const std::string &factionName); static sint32 getFameIndex(const std::string &factionName);
@ -251,7 +252,7 @@ private:
static int addRespawnPoint(CLuaState &ls); static int addRespawnPoint(CLuaState &ls);
static int delArkPoints(CLuaState &ls); static int delArkPoints(CLuaState &ls);
static int setArkPowoOptions(CLuaState &ls); static int setArkPowoOptions(CLuaState &ls);
// open the window to do a tell to 'player', if 'msg' is not empty, then the message will be sent immediatly // 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' // else, current command of the chat window will be replaced with tell 'player'
@ -260,7 +261,7 @@ private:
static void updateTooltipCoords(); static void updateTooltipCoords();
// test if the ctrl key is down (NB nico : I didn't add other key, // 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 ...) // because it would be too easy to write a key recorder ...)
static bool isCtrlKeyDown(); static bool isCtrlKeyDown();
static std::string encodeURLUnicodeParam(const ucstring &text); static std::string encodeURLUnicodeParam(const ucstring &text);
static std::string encodeURLParam(const std::string &text); static std::string encodeURLParam(const std::string &text);

Loading…
Cancel
Save