Merge branch 'yubo' into SIELA1915/friend_list_groups_and_notes

merge-requests/7/merge
Ulukyn 4 years ago
commit 3d6869fbae

@ -444,9 +444,13 @@ namespace NLGUI
SGlobalTexture ()
{
FromGlobaleTexture = true;
Scale = 1.f;
}
uint32 Width, Height;
uint32 DefaultWidth, DefaultHeight;
// used by texture atlas to unscale individual texture
// getTextureSizeFromId() calls to return 1x size for GUI.
float Scale;
NL3D::UTexture *Texture;
std::string Name;
bool FromGlobaleTexture;

@ -621,9 +621,7 @@ namespace NLGUI
return;
sint32 txw, txh;
SImage &rImage = *getSImage(nTxId);
txw = (sint32)((rImage.UVMax.U - rImage.UVMin.U)*rImage.GlobalTexturePtr->Width+0.5f);
txh = (sint32)((rImage.UVMax.V - rImage.UVMin.V)*rImage.GlobalTexturePtr->Height+0.5f);
getTextureSizeFromId(nTxId, txw, txh);
drawRotFlipBitmap (layerId, x, y, txw, txh, rot, flipv, nTxId, col);
}
@ -859,6 +857,14 @@ namespace NLGUI
CIFile ifTmp;
if (ifTmp.open(filename))
CBitmap::loadSize (ifTmp, gt.Width, gt.Height);
// extract textures scale from filename
// texture_interface_v3_2x.tga / texture_interface_v3_4x.tga
if (textureFileName.find("_2x.") != std::string::npos)
gt.Scale = 2.f;
else if (textureFileName.find("_4x.") != std::string::npos)
gt.Scale = 4.f;
gt.Texture = driver->createTextureFile (filename);
// Force to generate the texture now. This way we can extract the mouse bitmaps from it now without having to load it again.
// Its why we don't release it at the end, because it is likely to be uploaded soon)
@ -932,6 +938,10 @@ namespace NLGUI
CBitmap curs;
curs.resize(x1 - x0, y1 - y0);
curs.blit(*texDatas, x0, y0, (x1 - x0), (y1 - y0), 0, 0);
// TODO: scaled cursors not supported
if (gt.Scale > 1.f) {
curs.resample((sint)(curs.getWidth() / gt.Scale), (sint)(curs.getHeight() / gt.Scale));
}
driver->addCursor(image.Name, curs);
}
}
@ -1357,8 +1367,8 @@ namespace NLGUI
else
{
SImage &rImage = *getSImage(id);
width = (sint32)((rImage.UVMax.U - rImage.UVMin.U)*rImage.GlobalTexturePtr->Width+0.5f);
height = (sint32)((rImage.UVMax.V - rImage.UVMin.V)*rImage.GlobalTexturePtr->Height+0.5f);
width = (sint32)(((rImage.UVMax.U - rImage.UVMin.U)*rImage.GlobalTexturePtr->Width / rImage.GlobalTexturePtr->Scale)+0.5f);
height = (sint32)(((rImage.UVMax.V - rImage.UVMin.V)*rImage.GlobalTexturePtr->Height / rImage.GlobalTexturePtr->Scale)+0.5f);
}
}
/*
@ -1373,9 +1383,11 @@ namespace NLGUI
SImage &rImage = *getSImage(id);
SGlobalTexture &rGT = *rImage.GlobalTexturePtr;
// get (possibly) scaled width/height
sint32 width, height;
width = (sint32)((rImage.UVMax.U - rImage.UVMin.U)*rGT.Width+0.5f);
height = (sint32)((rImage.UVMax.V - rImage.UVMin.V)*rGT.Height+0.5f);
getTextureSizeFromId(id, width, height);
if (width == 0 || height == 0)
return CRGBA(255,255,255);
float xRatio = ((float)x) / ((float)(width));
float yRatio = ((float)y) / ((float)(height));
UTexture *pTF = rGT.Texture;

@ -136,7 +136,7 @@ public:
if (pCSDst->isShortCut())
pPM->CompositionPhraseMemoryLineDest= pPM->getSelectedMemoryLineDB();
else
pPM->CompositionPhraseMemoryLineDest= 0;
pPM->CompositionPhraseMemoryLineDest= pPM->getSelectedMemoryAltLineDB();
pPM->CompositionPhraseMemorySlotDest= pCSDst->getIndexInDB();
}
@ -536,7 +536,7 @@ public:
CInterfaceManager *pIM= CInterfaceManager::getInstance();
// Launch the modal to select the faber plan
extern void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection, TOOL_TYPE::TCraftingToolType toolType);
extern void fillFaberPlanSelection(const std::string &brickDB, uint maxSelection, TOOL_TYPE::TCraftingToolType toolType);
// from sphrase_manager.cpp
extern TOOL_TYPE::TCraftingToolType getRightHandCraftToolType();
fillFaberPlanSelection(CDBGroupBuildPhrase::BrickSelectionDB, CDBGroupBuildPhrase::MaxSelection, getRightHandCraftToolType());
@ -750,8 +750,8 @@ class CHandlerMemorizePhraseOrMacro : public IActionHandler
{
public:
virtual void execute (CCtrlBase *pCaller, const string &Params);
void memorizePhraseOrMacro(uint dstMemoryIndex, bool isMacro, sint32 phraseId, sint32 macroId);
void memorizePhraseSheet(uint dstMemoryIndex, uint32 sheetId);
void memorizePhraseOrMacro(sint32 memoryLine, uint dstMemoryIndex, bool isMacro, sint32 phraseId, sint32 macroId);
void memorizePhraseSheet(sint32 memoryLine, uint dstMemoryIndex, uint32 sheetId);
};
REGISTER_ACTION_HANDLER( CHandlerMemorizePhraseOrMacro, "memorize_phrase_or_macro");
@ -771,7 +771,11 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P
// The dest must be a memory or a macro memory
if (!pCSDst->isSPhraseIdMemory() && !pCSDst->isMacroMemory()) return;
// get the memory line and memory index
sint32 dstMemoryLine= pPM->getSelectedMemoryLineDB();
sint32 dstMemoryLine;
if (pCSDst->isShortCut())
dstMemoryLine = pPM->getSelectedMemoryLineDB();
else
dstMemoryLine = pPM->getSelectedMemoryAltLineDB();
uint dstMemoryIndex= pCSDst->getIndexInDB();
bool srcIsMacro;
@ -806,7 +810,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P
pPM->sendLearnToServer(newPhraseId);
// memorize the new phrase
memorizePhraseOrMacro(dstMemoryIndex, srcIsMacro, newPhraseId, srcMacroId);
memorizePhraseOrMacro(dstMemoryLine, dstMemoryIndex, srcIsMacro, newPhraseId, srcMacroId);
}
}
else
@ -833,7 +837,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P
if(pCSSrc->isSPhrase())
{
// learn and memorize this phrase
memorizePhraseSheet(dstMemoryIndex, pCSSrc->getSheetId());
memorizePhraseSheet(dstMemoryLine, dstMemoryIndex, pCSSrc->getSheetId());
}
else
{
@ -842,7 +846,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P
pPM->fullDeletePhraseIfLast(dstMemoryLine, dstMemoryIndex);
// memorize the phrase or macro
memorizePhraseOrMacro(dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId);
memorizePhraseOrMacro(dstMemoryLine, dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId);
}
}
// Else the src is a memory too
@ -868,7 +872,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P
pPM->sendLearnToServer(newPhraseId);
// memorize the new phrase
memorizePhraseOrMacro(dstMemoryIndex, srcIsMacro, newPhraseId, srcMacroId);
memorizePhraseOrMacro(dstMemoryLine, dstMemoryIndex, srcIsMacro, newPhraseId, srcMacroId);
}
else
{
@ -876,7 +880,7 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P
pPM->fullDeletePhraseIfLast(dstMemoryLine, dstMemoryIndex);
// memorize the macro (still a reference)
memorizePhraseOrMacro(dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId);
memorizePhraseOrMacro(dstMemoryLine, dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId);
}
}
// else this is a swap!
@ -887,17 +891,23 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P
{
// get the memory index for src
uint srcMemoryIndex= pCSSrc->getIndexInDB();
// get the memory line for src
sint32 srcMemoryLine;
if (pCSSrc->isShortCut())
srcMemoryLine = pPM->getSelectedMemoryLineDB();
else
srcMemoryLine = pPM->getSelectedMemoryAltLineDB();
// memorize dst into src
memorizePhraseOrMacro(srcMemoryIndex, dstIsMacro, dstPhraseId, dstMacroId);
memorizePhraseOrMacro(srcMemoryLine, srcMemoryIndex, dstIsMacro, dstPhraseId, dstMacroId);
// memorize src into dst
memorizePhraseOrMacro(dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId);
memorizePhraseOrMacro(dstMemoryLine, dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId);
}
// else, it's a move
else
{
// copy
memorizePhraseOrMacro(dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId);
memorizePhraseOrMacro(dstMemoryLine, dstMemoryIndex, srcIsMacro, srcPhraseId, srcMacroId);
// forget src (after shorctut change!)
CAHManager::getInstance()->runActionHandler("forget_phrase_or_macro", pCSSrc);
@ -909,14 +919,13 @@ void CHandlerMemorizePhraseOrMacro::execute (CCtrlBase *pCaller, const string &P
// memorize a spell
void CHandlerMemorizePhraseOrMacro::memorizePhraseOrMacro(uint memoryIndex, bool isMacro, sint32 phraseId, sint32 macroId)
void CHandlerMemorizePhraseOrMacro::memorizePhraseOrMacro(sint32 memoryLine, uint memoryIndex, bool isMacro, sint32 phraseId, sint32 macroId)
{
CSPhraseManager *pPM= CSPhraseManager::getInstance();
sint32 memoryLine= pPM->getSelectedMemoryLineDB();
if(memoryLine<0)
return;
if (memoryLine<0)
return;
if(isMacro)
{
pPM->memorizeMacro(memoryLine, memoryIndex, macroId);
@ -931,11 +940,10 @@ void CHandlerMemorizePhraseOrMacro::memorizePhraseOrMacro(uint memoryIndex, bool
}
// memorize a default spell
void CHandlerMemorizePhraseOrMacro::memorizePhraseSheet(uint memoryIndex, uint32 sheetId)
void CHandlerMemorizePhraseOrMacro::memorizePhraseSheet(sint32 memoryLine, uint memoryIndex, uint32 sheetId)
{
CSPhraseManager *pPM= CSPhraseManager::getInstance();
sint32 memoryLine= pPM->getSelectedMemoryLineDB();
if(memoryLine<0)
return;
@ -989,7 +997,11 @@ public:
return;
// Ok, the user try to forget a phrase slot.
sint32 memoryLine= pPM->getSelectedMemoryLineDB();
sint32 memoryLine;
if (pCSDst->isShortCut())
memoryLine = pPM->getSelectedMemoryLineDB();
else
memoryLine = pPM->getSelectedMemoryAltLineDB();
if(memoryLine<0)
return;
@ -1026,6 +1038,9 @@ public:
if (!pCSDst->isSPhraseIdMemory() && !pCSDst->isMacroMemory())
return;
// is alternative action bar
bool isMain = pCSDst->isShortCut();
// get the memory index
uint memoryIndex = pCSDst->getIndexInDB();
@ -1034,7 +1049,9 @@ public:
// build params string
string sParams;
sParams.append("memoryIndex=");
sParams.append("isMain=");
sParams.append(toString(isMain));
sParams.append("|memoryIndex=");
sParams.append(toString(memoryIndex));
sParams.append("|isMacro=");
sParams.append(toString(isMacro));
@ -1066,11 +1083,10 @@ public:
// Ok, the user try to forget a phrase slot
CSPhraseManager *pPM = CSPhraseManager::getInstance();
sint32 memoryLine = pPM->getSelectedMemoryLineDB();
if (memoryLine<0)
return;
// get params
bool isMain;
fromString(getParam(Params, "isMain"), isMain);
uint memoryIndex;
fromString(getParam(Params, "memoryIndex"), memoryIndex);
bool isMacro;
@ -1078,6 +1094,14 @@ public:
sint32 phraseId;
fromString(getParam(Params, "phraseId"),phraseId);
sint32 memoryLine;
if (isMain)
memoryLine = pPM->getSelectedMemoryLineDB();
else
memoryLine = pPM->getSelectedMemoryAltLineDB();
if (memoryLine<0)
return;
if (isMacro)
{
pPM->forgetMacro(memoryLine, memoryIndex);
@ -1513,7 +1537,7 @@ public:
if (pCSDst->isShortCut())
memoryLine = pPM->getSelectedMemoryLineDB();
else
memoryLine = 0;
memoryLine = pPM->getSelectedMemoryAltLineDB();
if(memoryLine<0)
return;

@ -588,7 +588,8 @@ void CBotChatPageTrade::updateTradeModal()
if ((_BuyMean == MoneyGuildXP) || (_BuyMean == GuildMoney) || (_BuyMean == GuildMoneyGuildXP))
{
uint64 totalPrice = (uint64) priceWithoutFame * (uint64) quantity;
NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:PRICE")->setValue64(totalPrice);
NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE")->setValue64(totalPrice);
NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:TRADE_ITEM:UNIT_PRICE_WITH_FAME")->setValue64(totalPrice);
uint64 totalXP = (uint64) getCurrItemXP() * (uint64) quantity;
CGuildManager *pGM = CGuildManager::getInstance();

@ -425,6 +425,9 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
ucstring::size_type pos = 0;
// Manage Translations
CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_TRANSLATION_ONLY_AS_TOOLTIP_CB", false);
bool originalFirst = node->getValueBool();
string::size_type startTr = msg.find(ucstring("{:"));
string::size_type endOfOriginal = msg.find(ucstring("}@{"));
@ -436,12 +439,22 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
string texture = "flag-"+toLower(msg.substr(startTr+2, 2)).toString()+".tga";
ucstring original = msg.substr(startTr+5, endOfOriginal-startTr-5);
pos = endOfOriginal+3;
ucstring translation = msg.substr(endOfOriginal+3);
CCtrlButton *ctrlButton = new CCtrlButton(CViewBase::TCtorParam());
ctrlButton->setTexture(texture);
ctrlButton->setTextureOver(texture);
ctrlButton->setTexturePushed(texture);
ctrlButton->setDefaultContextHelp(original);
if (!originalFirst)
{
ctrlButton->setDefaultContextHelp(original);
pos = endOfOriginal+3;
}
else
{
ctrlButton->setDefaultContextHelp(translation);
pos = startTr+5;
textSize = endOfOriginal;
}
ctrlButton->setId("tr");
para->addChild(ctrlButton);
}

@ -846,11 +846,26 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText,
// Clean bubble from translation system
CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_TRANSLATION_ONLY_AS_TOOLTIP_CB", false);
bool originalFirst = node->getValueBool();
ucstring::size_type pos = 0;
ucstring::size_type textSize = ucsText.size();
string::size_type startTr = ucsText.find(ucstring("{:"));
string::size_type endOfOriginal = ucsText.find(ucstring("}@{"));
if (endOfOriginal != string::npos)
pos = endOfOriginal+4;
{
if (!originalFirst)
{
pos = endOfOriginal+4;
}
else
{
pos = startTr+5;
textSize = endOfOriginal;
}
}
// Output the message in a bubble
bool show = false;
@ -870,7 +885,7 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText,
return;
// Get a bubble
CGroupInSceneBubble *bubble = newBubble (ucsText.substr(pos));
CGroupInSceneBubble *bubble = newBubble (ucsText.substr(pos, textSize-pos));
if (bubble)
{
// Link the bubble

@ -67,6 +67,7 @@ NLMISC_REGISTER_OBJECT(CViewBase, CDBGroupListAscensor, std::string, "list_sheet
#define VIEW_TEXT_GUILD_QUIT "ui:interface:guild:content:tab_guild_info:quit_guild"
#define CTRL_SHEET_GUILD_BLASON "ui:interface:guild:content:tab_guild_info:blason"
#define VIEW_TEXT_GUILD_MEMBER_COUNT "ui:interface:guild:content:tab_guild_info:member_count"
#define VIEW_TEXT_GUILD_MEMBER_COUNT_ONLINE "ui:interface:guild:content:tab_guild_info:member_count_online"
#define LIST_GUILD_MEMBERS "ui:interface:guild:content:tab_guild:list_member:guild_members"
@ -817,6 +818,7 @@ class CAHGuildSheetOpen : public IActionHandler
if (pParent == NULL) return;
pParent->clearGroups();
pParent->setDynamicDisplaySize(false);
uint member_online = 0;
for (uint i = 0; i < rGuildMembers.size(); i++)
{
// create the member line
@ -855,11 +857,13 @@ class CAHGuildSheetOpen : public IActionHandler
switch(rGuildMembers[i].Online)
{
case ccs_online:
member_online++;
onlineView->setTexture("w_online.tga");
if (toolTip)
toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOnline"));
break;
case ccs_online_abroad:
member_online++;
onlineView->setTexture("w_online_abroad.tga");
if (toolTip)
toolTip->setDefaultContextHelp(CI18N::get("uittGuildMemberOnlineAbroad"));
@ -895,6 +899,12 @@ class CAHGuildSheetOpen : public IActionHandler
pLine->setParent (pParent);
pParent->addChild (pLine);
}
// update member online count view
CViewText *pOnlineMember = dynamic_cast<CViewText*>(CWidgetManager::getInstance()->getElementFromId(VIEW_TEXT_GUILD_MEMBER_COUNT_ONLINE));
if (pOnlineMember)
pOnlineMember->setText(toString(member_online));
}
}
};

@ -3769,6 +3769,21 @@ void CInventoryManager::sortBag()
if (pIconList != NULL) pIconList->needToSort();
pList = dynamic_cast<CDBGroupListSheetBag*>(CWidgetManager::getInstance()->getElementFromId(LIST_PA3_TEXT));
if (pList != NULL) pList->needToSort();
pIconList = dynamic_cast<CDBGroupIconListBag*>(CWidgetManager::getInstance()->getElementFromId(LIST_PA4_ICONS));
if (pIconList != NULL) pIconList->needToSort();
pList = dynamic_cast<CDBGroupListSheetBag*>(CWidgetManager::getInstance()->getElementFromId(LIST_PA4_TEXT));
if (pList != NULL) pList->needToSort();
pIconList = dynamic_cast<CDBGroupIconListBag*>(CWidgetManager::getInstance()->getElementFromId(LIST_PA5_ICONS));
if (pIconList != NULL) pIconList->needToSort();
pList = dynamic_cast<CDBGroupListSheetBag*>(CWidgetManager::getInstance()->getElementFromId(LIST_PA5_TEXT));
if (pList != NULL) pList->needToSort();
pIconList = dynamic_cast<CDBGroupIconListBag*>(CWidgetManager::getInstance()->getElementFromId(LIST_PA6_ICONS));
if (pIconList != NULL) pIconList->needToSort();
pList = dynamic_cast<CDBGroupListSheetBag*>(CWidgetManager::getInstance()->getElementFromId(LIST_PA6_TEXT));
if (pList != NULL) pList->needToSort();
}
// ***************************************************************************

@ -822,6 +822,15 @@ private:
#define LIST_PA3_TEXT "ui:interface:inv_pa3:content:iil:bag_list"
#define LIST_PA3_ICONS "ui:interface:inv_pa3:content:iil:bag_icons"
#define LIST_PA4_TEXT "ui:interface:inv_pa4:content:iil:bag_list"
#define LIST_PA4_ICONS "ui:interface:inv_pa4:content:iil:bag_icons"
#define LIST_PA5_TEXT "ui:interface:inv_pa5:content:iil:bag_list"
#define LIST_PA5_ICONS "ui:interface:inv_pa5:content:iil:bag_icons"
#define LIST_PA6_TEXT "ui:interface:inv_pa6:content:iil:bag_list"
#define LIST_PA6_ICONS "ui:interface:inv_pa6:content:iil:bag_icons"
// Theorically never used
#define LIST_BAG2_TEXT "ui:interface:inv_bag:content:iil:bag_list"
#define LIST_BAG2_ICONS "ui:interface:inv_bag:content:iil:bag_icons"

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

@ -15,7 +15,7 @@ private:
static int luaClientCfgIndex(CLuaState &ls);
static int luaClientCfgNewIndex(CLuaState &ls);
// CInterfaceElement management on stack, stored by a CRefPtr.
public:
@ -204,6 +204,7 @@ private:
static bool isDynStringAvailable(sint32 dynStringId);
static bool isFullyPatched();
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 getSheetName(uint32 sheetId);
static sint32 getFameIndex(const std::string &factionName);
@ -251,7 +252,7 @@ private:
static int addRespawnPoint(CLuaState &ls);
static int delArkPoints(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
// else, current command of the chat window will be replaced with tell 'player'
@ -260,7 +261,7 @@ private:
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 bool isCtrlKeyDown();
static std::string encodeURLUnicodeParam(const ucstring &text);
static std::string encodeURLParam(const std::string &text);

@ -411,7 +411,7 @@ void CSPhraseManager::forgetPhrase(uint32 memoryLine, uint32 memorySlot)
_Memories[memoryLine].Slot[memorySlot].Id= 0;
// must update DB?
if((sint32)memoryLine==_SelectedMemoryDB)
if((sint32)memoryLine==_SelectedMemoryDB || (sint32)memoryLine==_SelectedMemoryDBalt)
{
// update the db
updateMemoryDBSlot(memorySlot);
@ -465,7 +465,7 @@ void CSPhraseManager::memorizePhrase(uint32 memoryLine, uint32 memorySlot, ui
_Memories[memoryLine].Slot[memorySlot].Id= slot;
// must update DB?
if((sint32)memoryLine==_SelectedMemoryDB)
if((sint32)memoryLine==_SelectedMemoryDB || (sint32)memoryLine==_SelectedMemoryDBalt)
{
// update the DB
updateMemoryDBSlot(memorySlot);
@ -3276,7 +3276,7 @@ void CSPhraseManager::memorizeMacro(uint32 memoryLine, uint32 memorySlot, uint32
_Memories[memoryLine].Slot[memorySlot].Id= macroId;
// must update DB?
if((sint32)memoryLine==_SelectedMemoryDB)
if((sint32)memoryLine==_SelectedMemoryDB || (sint32)memoryLine==_SelectedMemoryDBalt)
{
// update the DB
updateMemoryDBSlot(memorySlot);
@ -3302,7 +3302,7 @@ void CSPhraseManager::forgetMacro(uint32 memoryLine, uint32 memorySlot)
_Memories[memoryLine].Slot[memorySlot].Id= 0;
// must update DB?
if((sint32)memoryLine==_SelectedMemoryDB)
if((sint32)memoryLine==_SelectedMemoryDB || (sint32)memoryLine==_SelectedMemoryDBalt)
{
// update the db
updateMemoryDBSlot(memorySlot);

@ -733,6 +733,12 @@ std::string CItemGroupManager::toDbPath(INVENTORIES::TInventory inventory)
return LIST_PA2_TEXT; break;
case INVENTORIES::pet_animal4:
return LIST_PA3_TEXT; break;
case INVENTORIES::pet_animal5:
return LIST_PA4_TEXT; break;
case INVENTORIES::pet_animal6:
return LIST_PA5_TEXT; break;
case INVENTORIES::pet_animal7:
return LIST_PA6_TEXT; break;
case INVENTORIES::player_room:
return LIST_ROOM_TEXT;break;
case INVENTORIES::guild:

@ -269,6 +269,7 @@ public:
void setStartRyzomAtEnd(bool startAtEnd){ _StartRyzomAtEnd = startAtEnd; }
// Forward message to installation software if needed
void fatalError(const std::string& errorId, const std::string& param1, const std::string& param2);
bool bnpUnpack(const std::string &srcBigfile, const std::string &dstPath, std::vector<std::string> &vFilenames);
const std::string & getServerVersion () { return ServerVersion; }
private:
@ -320,8 +321,6 @@ private:
void getPatchFromDesc(SFileToPatch &ftpOut, const CBNPFile &fIn, bool forceCheckSumTest);
bool bnpUnpack(const std::string &srcBigfile, const std::string &dstPath, std::vector<std::string> &vFilenames);
// stop the threads (called when knowing the thread ended)
void stopCheckThread();
void stopPatchThread();

@ -200,9 +200,38 @@ int main(int argc, char *argv[])
Args.setVersion(getDisplayVersion());
Args.setDescription("Ryzom client");
Args.addArg("p", "patch", "patch", "Name of the file to use tp xdelta the source file");
Args.addArg("s", "source", "source", "Name of source file to xdelta with patch file");
Args.addArg("d", "destination", "destination", "Name of destination operation (patch or unpack)");
Args.addArg("u", "unpack", "unpack", "Name of bnp file to unpack");
if (!Args.parse(argc, argv)) return 1;
if (Args.haveArg("p") && Args.haveArg("p") && Args.haveArg("p"))
{
string patchName = Args.getArg("p").front();
string sourceName = Args.getArg("s").front();
string destinationName = Args.getArg("d").front();
std::string errorMsg;
CXDeltaPatch::TApplyResult ar = CXDeltaPatch::apply(patchName, sourceName, destinationName, errorMsg);
nlinfo("%s", errorMsg.c_str());
return ar;
}
// initialize patch manager and set the ryzom full path, before it's used
CPatchManager *pPM = CPatchManager::getInstance();
if (Args.haveArg("u") && Args.haveArg("d"))
{
string bnpName = Args.getArg("u").front();
string destinationName = Args.getArg("d").front();
vector<string> vFilenames;
if (pPM->bnpUnpack(bnpName, destinationName, vFilenames))
return 0;
return 1;
}
// create logs in temporary directory
createDebug(CPath::getTemporaryDirectory().c_str(), true, true);
@ -244,8 +273,6 @@ int main(int argc, char *argv[])
printf("\n");
printf("Checking %s files to patch...\n", convert(CI18N::get("TheSagaOfRyzom")).c_str());
// initialize patch manager and set the ryzom full path, before it's used
CPatchManager *pPM = CPatchManager::getInstance();
// use PatchUrl
vector<string> patchURLs;

Loading…
Cancel
Save