diff --git a/code/ryzom/client/src/attached_fx.h b/code/ryzom/client/src/attached_fx.h index c58a9e92c..6cd8d2ef7 100644 --- a/code/ryzom/client/src/attached_fx.h +++ b/code/ryzom/client/src/attached_fx.h @@ -71,6 +71,8 @@ public: const NLMISC::CMatrix *StaticMatrix; // Useful if stick mode is "StaticMatrix" uint MaxNumAnimCount; // Number of frame on which the fx can overlap when it is being shutdown float TimeOut; + double StartTime; + float DelayBeforeStart; public: CBuildInfo() { @@ -80,6 +82,8 @@ public: StaticMatrix = NULL; MaxNumAnimCount = 0; TimeOut = FX_MANAGER_DEFAULT_TIMEOUT; + StartTime = 0.0; + DelayBeforeStart = 0.f; } }; CAttachedFX(); diff --git a/code/ryzom/client/src/character_cl.cpp b/code/ryzom/client/src/character_cl.cpp index 9a651e331..87332f42d 100644 --- a/code/ryzom/client/src/character_cl.cpp +++ b/code/ryzom/client/src/character_cl.cpp @@ -5874,6 +5874,27 @@ void CCharacterCL::updateAttachedFX() CMatrix alignMatrix; buildAlignMatrix(alignMatrix); + std::list::iterator itAttachedFxToStart = _AttachedFXListToStart.begin(); + while(itAttachedFxToStart != _AttachedFXListToStart.end()) + { + if ((*itAttachedFxToStart).DelayBeforeStart < (float)(TimeInSec - (*itAttachedFxToStart).StartTime)) + { + uint index = (*itAttachedFxToStart).MaxNumAnimCount; + (*itAttachedFxToStart).MaxNumAnimCount = 0; + CAttachedFX::TSmartPtr fx = new CAttachedFX; + fx->create(*this, (*itAttachedFxToStart), CAttachedFX::CTargeterInfo()); + if (!fx->FX.empty()) + { + _AuraFX[index] = fx; + } + itAttachedFxToStart = _AttachedFXListToStart.erase(itAttachedFxToStart); + } + else + { + ++itAttachedFxToStart; + } + } + // update tracks & pos for anim attachedfxs std::list::iterator itAttachedFx = _AttachedFXListForCurrentAnim.begin(); while(itAttachedFx != _AttachedFXListForCurrentAnim.end()) @@ -8993,16 +9014,40 @@ void CCharacterCL::setAuraFX(uint index, const CAnimationFX *sheet) } else { + std::list::iterator itAttachedFxToStart = _AttachedFXListToStart.begin(); + while(itAttachedFxToStart != _AttachedFXListToStart.end()) + { + if ((*itAttachedFxToStart).MaxNumAnimCount == index) + return; + } // remove previous aura _AuraFX[index] = NULL; - CAttachedFX::TSmartPtr fx = new CAttachedFX; CAttachedFX::CBuildInfo bi; bi.Sheet = sheet; bi.TimeOut = 0.f; - fx->create(*this, bi, CAttachedFX::CTargeterInfo()); - if (!fx->FX.empty()) + + if (sheet->Sheet->PSName == "misc_caravan_teleportout.ps") { - _AuraFX[index] = fx; + bi.MaxNumAnimCount = index; + bi.StartTime = TimeInSec; + bi.DelayBeforeStart = 12.5f; + _AttachedFXListToStart.push_front(bi); + } + else if (sheet->Sheet->PSName == "misc_kami_teleportout.ps") + { + bi.MaxNumAnimCount = index; + bi.StartTime = TimeInSec; + bi.DelayBeforeStart = 11.5f; + _AttachedFXListToStart.push_front(bi); + } + else + { + CAttachedFX::TSmartPtr fx = new CAttachedFX; + fx->create(*this, bi, CAttachedFX::CTargeterInfo()); + if (!fx->FX.empty()) + { + _AuraFX[index] = fx; + } } } } diff --git a/code/ryzom/client/src/character_cl.h b/code/ryzom/client/src/character_cl.h index 1a0e864d0..a5d7ba880 100644 --- a/code/ryzom/client/src/character_cl.h +++ b/code/ryzom/client/src/character_cl.h @@ -675,6 +675,7 @@ protected: /// List of attached to remove as soon as possible (when there are no particles left) std::list _AttachedFXListToRemove; + std::list _AttachedFXListToStart; CAttachedFX::TSmartPtr _AuraFX[MaxNumAura]; // special case for aura CAttachedFX::TSmartPtr _LinkFX; // special case for link diff --git a/code/ryzom/client/src/client_chat_manager.cpp b/code/ryzom/client/src/client_chat_manager.cpp index 184c3fac3..0eafbd007 100644 --- a/code/ryzom/client/src/client_chat_manager.cpp +++ b/code/ryzom/client/src/client_chat_manager.cpp @@ -1199,6 +1199,11 @@ class CHandlerTell : public IActionHandler // display msg with good color // TDataSetIndex dsi; // not used .... PeopleInterraction.ChatInput.Tell.displayTellMessage(/*dsi, */finalMsg, receiver, prop.getRGBA()); + + ucstring s = CI18N::get("youTellPlayer"); + strFindReplace(s, "%name", receiver); + strFindReplace(finalMsg, CI18N::get("youTell"), s); + CInterfaceManager::getInstance()->log(finalMsg); } }; REGISTER_ACTION_HANDLER( CHandlerTell, "tell"); diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index 0e27ff487..fbea6da96 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -1271,6 +1271,30 @@ NLMISC_COMMAND(7,"talk in 7th dynamic chat channel"," ") { return talkInChan(7,args); } + + +NLMISC_COMMAND(setItemName, "set name of items, sbrick, etc.."," ") +{ + if (args.size() < 2) return false; + CSheetId id(args[0]); + ucstring name; + name.fromUtf8(args[1]); + ucstring desc; + ucstring desc2; + if (args.size() > 2) + desc.fromUtf8(args[2]); + if (args.size() > 2) + desc2.fromUtf8(args[3]); + + STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance(); + if (pSMC) + pSMC->replaceSBrickName(id, name, desc, desc2); + else + return false; + return true; +} + + ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// diff --git a/code/ryzom/client/src/cursor_functions.cpp b/code/ryzom/client/src/cursor_functions.cpp index 437624a86..c212dbb0d 100644 --- a/code/ryzom/client/src/cursor_functions.cpp +++ b/code/ryzom/client/src/cursor_functions.cpp @@ -550,7 +550,9 @@ void checkUnderCursor() if (!instref.ContextText.empty()) { selectedInstanceURL = instref.ContextURL; - if(ContextCur.context("WEBIG", 0.f, ucstring(instref.ContextText))) + ucstring contextText; + contextText.fromUtf8(instref.ContextText); + if(ContextCur.context("WEBIG", 0.f, contextText)) return; } } diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 7ae13500c..f94fa8321 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -1326,7 +1326,7 @@ void postlogInit() ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) ); CSBrickManager::getInstance()->init(); // Must be done after sheet loading - STRING_MANAGER::CStringManagerClient::specialWordsMemoryCompress(); // Must be done after brick manager init + //STRING_MANAGER::CStringManagerClient::specialWordsMemoryCompress(); // Must be done after brick manager init initLast = initCurrent; initCurrent = ryzomGetLocalTime(); diff --git a/code/ryzom/client/src/interface_v3/action_handler_item.cpp b/code/ryzom/client/src/interface_v3/action_handler_item.cpp index f6e397c26..819b8c0d4 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -1761,7 +1761,7 @@ class CHandlerItemMenuCheck : public IActionHandler if (pCS->getInventoryIndex()==INVENTORIES::bag) { bool isTextEditionActive = false; - static const string itemTextEditionPriv = ":DEV:SGM:EM:"; + static const string itemTextEditionPriv = ":DEV:SGM:GM:EM:"; if (!UserPrivileges.empty() && itemTextEditionPriv.find(UserPrivileges)!=std::string::npos) { isTextEditionActive = true; diff --git a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 4c7c081f8..a24c49ad0 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -60,6 +60,7 @@ void launchPhraseComposition(bool creation); const std::string PhraseComposition="ui:interface:phrase_composition"; const std::string PhraseCompositionGroup="ui:interface:phrase_composition:header_opened"; const std::string PhraseMemoryCtrlBase= "ui:interface:gestionsets:shortcuts:s"; +const std::string PhraseMemoryAltCtrlBase= "ui:interface:gestionsets2:header_closed:shortcuts:s"; // ********************************************************************************************************** @@ -129,7 +130,11 @@ public: if(pCSDst && pCSDst->isSPhraseId() && pCSDst->isSPhraseIdMemory()) { // then will auto-memorize it in this slot - pPM->CompositionPhraseMemoryLineDest= pPM->getSelectedMemoryLineDB(); + if (pCSDst->isShortCut()) + pPM->CompositionPhraseMemoryLineDest= pPM->getSelectedMemoryLineDB(); + else + pPM->CompositionPhraseMemoryLineDest= 0; + pPM->CompositionPhraseMemorySlotDest= pCSDst->getIndexInDB(); } // else no auto memorize @@ -1110,7 +1115,11 @@ public: return; // Ok, the user try to cast a phrase slot. - sint32 memoryLine= pPM->getSelectedMemoryLineDB(); + sint32 memoryLine; + if (pCSDst->isShortCut()) + memoryLine = pPM->getSelectedMemoryLineDB(); + else + memoryLine = 0; if(memoryLine<0) return; @@ -1249,12 +1258,16 @@ public: { sint shortcut; fromString(Params, shortcut); - if (shortcut>=0 && shortcut <= RYZOM_MAX_SHORTCUT) + if (shortcut>=0 && shortcut <= 2*RYZOM_MAX_SHORTCUT) { CInterfaceManager *pIM= CInterfaceManager::getInstance(); // get the control - CInterfaceElement *elm= pIM->getElementFromId(PhraseMemoryCtrlBase + toString(shortcut) ); + CInterfaceElement *elm; + if (shortcut < RYZOM_MAX_SHORTCUT) + elm = pIM->getElementFromId(PhraseMemoryCtrlBase + toString(shortcut) ); + else + elm = pIM->getElementFromId(PhraseMemoryAltCtrlBase + toString(shortcut-RYZOM_MAX_SHORTCUT) ); CDBCtrlSheet *ctrl= dynamic_cast(elm); if(ctrl) { @@ -1491,7 +1504,11 @@ public: return; // Ok, the user try to cast a phrase slot. - sint32 memoryLine= pPM->getSelectedMemoryLineDB(); + sint32 memoryLine; + if (pCSDst->isShortCut()) + memoryLine = pPM->getSelectedMemoryLineDB(); + else + memoryLine = 0; if(memoryLine<0) return; diff --git a/code/ryzom/client/src/interface_v3/chat_filter.cpp b/code/ryzom/client/src/interface_v3/chat_filter.cpp index 8f5db8f20..ef370b689 100644 --- a/code/ryzom/client/src/interface_v3/chat_filter.cpp +++ b/code/ryzom/client/src/interface_v3/chat_filter.cpp @@ -313,7 +313,7 @@ void CChatTargetFilter::msgEntered(const ucstring &msg, CChatWindow *chatWindow) // the target must be a player, make a tell on him ChatMngr.tell(_TargetPlayer.toString(), msg); // direct output in the chat - chatWindow->displayLocalPlayerTell(msg); + chatWindow->displayLocalPlayerTell(_TargetPlayer.toString(), msg); } else { diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index d58ccde77..6f13b1bed 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -199,7 +199,7 @@ bool CChatWindow::isVisible() const } //================================================================================= -void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType /* gt */, uint32 /* dynamicChatDbIndex */, uint numBlinks /* = 0*/, bool *windowVisible /*= NULL*/) +void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks /* = 0*/, bool *windowVisible /*= NULL*/) { if (!_Chat) { @@ -466,7 +466,7 @@ void CChatWindow::setHeaderColor(const std::string &n) } //================================================================================= -void CChatWindow::displayLocalPlayerTell(const ucstring &msg, uint numBlinks /*= 0*/) +void CChatWindow::displayLocalPlayerTell(const ucstring &receiver, const ucstring &msg, uint numBlinks /*= 0*/) { ucstring finalMsg; CInterfaceProperty prop; @@ -484,7 +484,12 @@ void CChatWindow::displayLocalPlayerTell(const ucstring &msg, uint numBlinks /*= prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); encodeColorTag(prop.getRGBA(), finalMsg, true); finalMsg += msg; + + ucstring s = CI18N::get("youTellPlayer"); + strFindReplace(s, "%name", receiver); + strFindReplace(finalMsg, CI18N::get("youTell"), s); displayMessage(finalMsg, prop.getRGBA(), CChatGroup::tell, 0, numBlinks); + CInterfaceManager::getInstance()->log(finalMsg); } void CChatWindow::encodeColorTag(const NLMISC::CRGBA &color, ucstring &text, bool append) @@ -797,14 +802,6 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c } } - // Create the free teller in all the desktops - uint8 nMode = pIM->getMode(); - pGC->setActive(false); - for (uint8 m = 0; m < MAX_NUM_MODES; ++m) - { - if (m != nMode) - pIM->updateGroupContainerImage(*pGC, m); - } // the group is only active on the current desktop pGC->setActive(true); } @@ -812,7 +809,7 @@ CGroupContainer *CChatGroupWindow::createFreeTeller(const ucstring &winNameIn, c if (!winColor.empty()) _FreeTellers[i]->setHeaderColor(winColor); - updateFreeTellerHeader(*_FreeTellers[i]); +// updateFreeTellerHeader(*_FreeTellers[i]); return _FreeTellers[i]; } diff --git a/code/ryzom/client/src/interface_v3/chat_window.h b/code/ryzom/client/src/interface_v3/chat_window.h index a18b950f6..5daf24c36 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.h +++ b/code/ryzom/client/src/interface_v3/chat_window.h @@ -143,7 +143,7 @@ public: void setAHOnCloseButtonParams(const std::string &n); void setHeaderColor(const std::string &n); // - void displayLocalPlayerTell(const ucstring &msg, uint numBlinks = 0); + void displayLocalPlayerTell(const ucstring &receiver, const ucstring &msg, uint numBlinks = 0); /// Encode a color tag '@{RGBA}' in the text. If append is true, append at end of text, otherwise, replace the text static void encodeColorTag(const NLMISC::CRGBA &color, ucstring &text, bool append=true); diff --git a/code/ryzom/client/src/interface_v3/ctrl_base_button.h b/code/ryzom/client/src/interface_v3/ctrl_base_button.h index c1d993aec..06a27b276 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_base_button.h +++ b/code/ryzom/client/src/interface_v3/ctrl_base_button.h @@ -114,7 +114,7 @@ public: /// \name Handlers // @{ // Event part - void setActionOnLeftClick (const std::string &actionHandlerName) { _AHOnLeftClick = getAH(actionHandlerName, _AHLeftClickParams); } + void setActionOnLeftClick (const std::string &actionHandlerName) { _AHOnLeftClickString = actionHandlerName; _AHOnLeftClick = getAH(actionHandlerName, _AHLeftClickParams); } void setActionOnRightClick (const std::string &actionHandlerName) { _AHOnRightClick = getAH(actionHandlerName, _AHRightClickParams); } void setActionOnClockTick (const std::string &ahName) { _AHOnClockTick = getAH(ahName, _AHClockTickParams); } void setParamsOnLeftClick (const std::string ¶msHandlerName) { _AHLeftClickParams = paramsHandlerName; } @@ -203,6 +203,7 @@ protected: //@{ IActionHandler *_AHOnOver; CStringShared _AHOverParams; + std::string _AHOnLeftClickString; IActionHandler *_AHOnLeftClick; CStringShared _AHLeftClickParams; IActionHandler *_AHOnLeftDblClick; diff --git a/code/ryzom/client/src/interface_v3/ctrl_button.cpp b/code/ryzom/client/src/interface_v3/ctrl_button.cpp index 17d89e900..fd1ba049b 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_button.cpp +++ b/code/ryzom/client/src/interface_v3/ctrl_button.cpp @@ -333,4 +333,16 @@ void CCtrlButton::fitTexture() setH(h); } - +// *************************************************************************** +bool CCtrlButton::getMouseOverShape(string &texName, uint8 &rot, CRGBA &col) +{ + if (_AHOnLeftClickString == "browse") + { + texName = "curs_pick.tga"; + rot= 0; + col = CRGBA::White; + return true; + } + + return false; +} diff --git a/code/ryzom/client/src/interface_v3/ctrl_button.h b/code/ryzom/client/src/interface_v3/ctrl_button.h index 3dcb0f896..ff769e6c4 100644 --- a/code/ryzom/client/src/interface_v3/ctrl_button.h +++ b/code/ryzom/client/src/interface_v3/ctrl_button.h @@ -50,6 +50,8 @@ public: virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); } + virtual bool getMouseOverShape(std::string &/* texName */, uint8 &/* rot */, NLMISC::CRGBA &/* col */); + // Display part virtual void draw(); diff --git a/code/ryzom/client/src/interface_v3/group_editbox.cpp b/code/ryzom/client/src/interface_v3/group_editbox.cpp index b87d95f2d..66318a893 100644 --- a/code/ryzom/client/src/interface_v3/group_editbox.cpp +++ b/code/ryzom/client/src/interface_v3/group_editbox.cpp @@ -21,6 +21,7 @@ #include "group_editbox.h" #include "interface_manager.h" #include "input_handler_manager.h" +#include "nel/misc/command.h" #include "view_text.h" #include "game_share/xml_auto_ptr.h" #include "interface_options.h" @@ -56,6 +57,7 @@ CGroupEditBox::CGroupEditBox(const TCtorParam ¶m) : _MaxCharsSize(32768), _FirstVisibleChar(0), _LastVisibleChar(0), + _SelectingText(false), _ViewText(NULL), _MaxHistoric(0), _CurrentHistoricIndex(-1), @@ -354,16 +356,27 @@ void CGroupEditBox::paste() if (Driver->pasteTextFromClipboard(sString)) { // append string now - appendString(sString); + appendStringFromClipboard(sString); } } // ---------------------------------------------------------------------------- -void CGroupEditBox::appendString(const ucstring &str) +void CGroupEditBox::appendStringFromClipboard(const ucstring &str) { stopParentBlink(); makeTopWindow(); + writeString(str, true, false); + nlinfo ("Chat input was pasted from the clipboard"); + + triggerOnChangeAH(); + + _CursorAtPreviousLineEnd = false; +} + +// ---------------------------------------------------------------------------- +void CGroupEditBox::writeString(const ucstring &str, bool replace, bool atEnd) +{ sint length = (sint)str.length(); ucstring toAppend; @@ -500,13 +513,41 @@ void CGroupEditBox::appendString(const ucstring &str) length = _MaxNumChar - (sint)_InputString.length(); } ucstring toAdd = toAppend.substr(0, length); - _InputString = _InputString.substr(0, _CursorPos) + toAdd + _InputString.substr(_CursorPos); - _CursorPos += (sint32)toAdd.length(); - nlinfo ("Chat input was pasted from the clipboard"); + sint32 minPos; + sint32 maxPos; + if (_CurrSelection == this) + { + minPos = min(_CursorPos, _SelectCursorPos); + maxPos = max(_CursorPos, _SelectCursorPos); + } + else + { + minPos = _CursorPos; + maxPos = _CursorPos; + } - triggerOnChangeAH(); + nlinfo("%d, %d", minPos, maxPos); + if (replace) + { + _InputString = _InputString.substr(0, minPos) + toAdd + _InputString.substr(maxPos); + _CursorPos = minPos+(sint32)toAdd.length(); + } + else + { + if (atEnd) + { + _InputString = _InputString.substr(0, maxPos) + toAdd + _InputString.substr(maxPos); + _CursorPos = maxPos; + _SelectCursorPos = _CursorPos; - _CursorAtPreviousLineEnd = false; + } + else + { + _InputString = _InputString.substr(0, minPos) + toAdd + _InputString.substr(minPos); + _CursorPos = minPos+(sint32)toAdd.length(); + _SelectCursorPos = maxPos+(sint32)toAdd.length(); + } + } } // ---------------------------------------------------------------------------- @@ -862,6 +903,7 @@ bool CGroupEditBox::handleEvent (const CEventDescriptor& event) // if click, and not frozen, then get the focus if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftdown && !_Frozen) { + _SelectingText = true; stopParentBlink(); pIM->setCaptureKeyboard (this); // set the right cursor position @@ -872,9 +914,34 @@ bool CGroupEditBox::handleEvent (const CEventDescriptor& event) _CursorPos = newCurPos; _CursorPos -= (sint32)_Prompt.length(); _CursorPos = std::max(_CursorPos, sint32(0)); + _SelectCursorPos = _CursorPos; + _CurrSelection = NULL; return true; } + // if click, and not frozen, then get the focus + if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mousemove && !_Frozen && _SelectingText) + { + // set the right cursor position + uint newCurPos; + bool cursorAtPreviousLineEnd; + _CurrSelection = this; + _ViewText->getCharacterIndexFromPosition(eventDesc.getX() - _ViewText->getXReal(), eventDesc.getY() - _ViewText->getYReal(), newCurPos, cursorAtPreviousLineEnd); + _SelectCursorPos = newCurPos; + _SelectCursorPos -= (sint32)_Prompt.length(); + _SelectCursorPos = std::max(_SelectCursorPos, sint32(0)); + return true; + } + + // if click, and not frozen, then get the focus + if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouseleftup && !_Frozen) + { + _SelectingText = false; + if (_SelectCursorPos == _CursorPos) + _CurrSelection = NULL; + + return true; + } if (eventDesc.getEventTypeExtended() == CEventDescriptorMouse::mouserightdown) { diff --git a/code/ryzom/client/src/interface_v3/group_editbox.h b/code/ryzom/client/src/interface_v3/group_editbox.h index 3a067cf25..f2856709a 100644 --- a/code/ryzom/client/src/interface_v3/group_editbox.h +++ b/code/ryzom/client/src/interface_v3/group_editbox.h @@ -125,6 +125,8 @@ public: void copy(); // Paste the selection into buffer void paste(); + // Write the string into buffer + void writeString(const ucstring &str, bool replace = true, bool atEnd = true); // Expand the expression (true if there was a '/' at the start of the line) bool expand(); @@ -217,6 +219,7 @@ protected: // Text selection static sint32 _SelectCursorPos; static CGroupEditBox *_CurrSelection; // the edit box for which the selection is currently active, or NULL if there's none + bool _SelectingText; NLMISC::CRGBA _TextSelectColor; NLMISC::CRGBA _BackSelectColor; @@ -291,7 +294,7 @@ private: void handleEventString(const CEventDescriptorKey &event); void setup(); void triggerOnChangeAH(); - void appendString(const ucstring &str); + void appendStringFromClipboard(const ucstring &str); ucstring getSelection(); diff --git a/code/ryzom/client/src/interface_v3/group_html.cpp b/code/ryzom/client/src/interface_v3/group_html.cpp index 43ff1ca75..dda2250a8 100644 --- a/code/ryzom/client/src/interface_v3/group_html.cpp +++ b/code/ryzom/client/src/interface_v3/group_html.cpp @@ -442,6 +442,9 @@ void CGroupHTML::addText (const char * buf, int len) { if (_Browsing) { + if (_IgnoreText) + return; + // Build a UTF8 string string inputString(buf, buf+len); // inputString.resize (len); @@ -525,6 +528,11 @@ void CGroupHTML::addLink (uint element_number, uint /* attribute_number */, HTCh // in ah: command we don't respect the uri standard so the HTAnchor_address doesn't work correctly _Link.push_back (suri); } + else if (suri[0] == '#') + { + // Direct url (hack for lua beginElement) + _Link.push_back (suri.substr(1)); + } else { HTAnchor * dest = HTAnchor_followMainLink((HTAnchor *) anchor); @@ -839,6 +847,14 @@ void CGroupHTML::beginElement (uint element_number, const BOOL *present, const c } } break; + case HTML_DIV: + { + if (present[MY_HTML_DIV_NAME] && value[MY_HTML_DIV_NAME]) + { + _DivName = value[MY_HTML_DIV_NAME]; + } + } + break; case HTML_FONT: { bool found = false; @@ -856,7 +872,7 @@ void CGroupHTML::beginElement (uint element_number, const BOOL *present, const c _TextColor.push_back(_TextColor.empty() ? CRGBA::White : _TextColor.back()); } } - break; + break; case HTML_BR: addString(ucstring ("\n")); break; @@ -1372,6 +1388,9 @@ void CGroupHTML::beginElement (uint element_number, const BOOL *present, const c _ObjectAction = value[HTML_OBJECT_STANDBY]; _Object = true; + break; + case HTML_STYLE: + _IgnoreText = true; break; } } @@ -1409,6 +1428,10 @@ void CGroupHTML::endElement (uint element_number) case HTML_PRE: popIfNotEmpty (_PRE); break; + case HTML_DIV: + _DivName = ""; + break; + case HTML_TABLE: popIfNotEmpty (_CellParams); popIfNotEmpty (_TR); @@ -1493,6 +1516,9 @@ void CGroupHTML::endElement (uint element_number) popIfNotEmpty (_UL); } break; + case HTML_STYLE: + _IgnoreText = false; + break; case HTML_OBJECT: if (_ObjectType=="application/ryzom-data") { @@ -1560,6 +1586,7 @@ CGroupHTML::CGroupHTML(const TCtorParam ¶m) // init _ParsingLua = false; + _IgnoreText = false; _BrowseNextTime = false; _PostNextTime = false; _Browsing = false; @@ -2506,6 +2533,7 @@ void CGroupHTML::clearContext() _Cells.clear(); _TR.clear(); _Forms.clear(); + _Groups.clear(); _CellParams.clear(); _Title = false; _TextArea = false; @@ -2584,6 +2612,12 @@ void CGroupHTML::addGroup (CInterfaceGroup *group, uint beginSpace) _Paragraph = NULL; } + if (!_DivName.empty()) + { + group->setName(_DivName); + _Groups.push_back(group); + } + group->setSizeRef(CInterfaceElement::width); // Compute begin space between paragraph and tables @@ -3337,6 +3371,171 @@ int CGroupHTML::luaRefresh(CLuaState &ls) return 0; } +// *************************************************************************** +int CGroupHTML::luaRemoveContent(CLuaState &ls) +{ + const char *funcName = "refresh"; + CLuaIHM::checkArgCount(ls, funcName, 0); + removeContent(); + return 0; +} + +// *************************************************************************** +int CGroupHTML::luaInsertText(CLuaState &ls) +{ + const char *funcName = "insertText"; + CLuaIHM::checkArgCount(ls, funcName, 3); + CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); + CLuaIHM::checkArgType(ls, funcName, 2, LUA_TSTRING); + CLuaIHM::checkArgType(ls, funcName, 3, LUA_TBOOLEAN); + + string name = ls.toString(1); + + ucstring text; + text.fromUtf8(ls.toString(2)); + + if (!_Forms.empty()) { + for (uint i=0; i<_Forms.back().Entries.size(); i++) + { + if (_Forms.back().Entries[i].TextArea && _Forms.back().Entries[i].Name == name) + { + // Get the edit box view + CInterfaceGroup *group = _Forms.back().Entries[i].TextArea->getGroup ("eb"); + if (group) + { + // Should be a CGroupEditBox + CGroupEditBox *editBox = dynamic_cast(group); + if (editBox) + editBox->writeString(text, false, ls.toBoolean(3)); + } + } + } + } + + return 0; +} + +// *************************************************************************** +int CGroupHTML::luaAddString(CLuaState &ls) +{ + const char *funcName = "addString"; + CLuaIHM::checkArgCount(ls, funcName, 1); + CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); + addString(ucstring(ls.toString(1))); + return 0; +} + +// *************************************************************************** +int CGroupHTML::luaAddImage(CLuaState &ls) +{ + const char *funcName = "addImage"; + CLuaIHM::checkArgCount(ls, funcName, 2); + CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); + CLuaIHM::checkArgType(ls, funcName, 2, LUA_TBOOLEAN); + if (!_Paragraph) + { + newParagraph(0); + paragraphChange(); + } + string url = getLink(); + if (!url.empty()) { + string params = "name=" + getId() + "|url=" + getLink (); + addButton(CCtrlButton::PushButton, ls.toString(1), ls.toString(1), ls.toString(1), + "", ls.toBoolean(2), "browse", params.c_str(), ""); + } else { + addImage(ls.toString(1), ls.toBoolean(2)); + } + + + return 0; +} + +// *************************************************************************** +int CGroupHTML::luaBeginElement(CLuaState &ls) +{ + const char *funcName = "beginElement"; + CLuaIHM::checkArgCount(ls, funcName, 2); + CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); + CLuaIHM::checkArgType(ls, funcName, 2, LUA_TTABLE); + + uint element_number = (uint)ls.toNumber(1); + std::vector present; + std::vector value; + present.resize(30, false); + value.resize(30); + + CLuaObject params; + params.pop(ls); + uint max_idx = 0; + + + ENUM_LUA_TABLE(params, it) + { + if (!it.nextKey().isNumber()) + { + nlwarning("%s : bad key encountered with type %s, number expected.", funcName, it.nextKey().getTypename()); + continue; + } + if (!it.nextValue().isString()) + { + nlwarning("%s : bad value encountered with type %s for key %s, string expected.", funcName, it.nextValue().getTypename(), it.nextKey().toString().c_str()); + continue; + } + uint idx = (uint)it.nextKey().toNumber(); + + present.insert(present.begin() + (uint)it.nextKey().toNumber(), true); + + string str = it.nextValue().toString(); + size_t size = str.size() + 1; + char * buffer = new char[ size ]; + strncpy(buffer, str.c_str(), size ); + + value.insert(value.begin() + (uint)it.nextKey().toNumber(), buffer); + } + + beginElement(element_number, &present[0], &value[0]); + if (element_number == HTML_A) + addLink(element_number, 0, NULL, &present[0], &value[0]); + + return 0; +} + + +// *************************************************************************** +int CGroupHTML::luaEndElement(CLuaState &ls) +{ + const char *funcName = "endElement"; + CLuaIHM::checkArgCount(ls, funcName, 1); + CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER); + + uint element_number = (uint)ls.toNumber(1); + endElement(element_number); + + return 0; +} + + +// *************************************************************************** +int CGroupHTML::luaShowDiv(CLuaState &ls) +{ + const char *funcName = "showDiv"; + CLuaIHM::checkArgCount(ls, funcName, 2); + CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); + CLuaIHM::checkArgType(ls, funcName, 2, LUA_TBOOLEAN); + + if (!_Groups.empty()) { + for (uint i=0; i<_Groups.size(); i++) + { + CInterfaceGroup *group = _Groups[i]; + if (group->getName() == ls.toString(1)) + { + group->setActive(ls.toBoolean(2)); + } + } + } + return 0; +} + // *************************************************************************** void CGroupHTML::setURL(const std::string &url) { diff --git a/code/ryzom/client/src/interface_v3/group_html.h b/code/ryzom/client/src/interface_v3/group_html.h index b4f4ee00b..92cb81e6e 100644 --- a/code/ryzom/client/src/interface_v3/group_html.h +++ b/code/ryzom/client/src/interface_v3/group_html.h @@ -165,10 +165,24 @@ public: int luaBrowse(CLuaState &ls); int luaRefresh(CLuaState &ls); + int luaRemoveContent(CLuaState &ls); + int luaInsertText(CLuaState &ls); + int luaAddString(CLuaState &ls); + int luaAddImage(CLuaState &ls); + int luaBeginElement(CLuaState &ls); + int luaEndElement(CLuaState &ls); + int luaShowDiv(CLuaState &ls); REFLECT_EXPORT_START(CGroupHTML, CGroupScrollText) REFLECT_LUA_METHOD("browse", luaBrowse) REFLECT_LUA_METHOD("refresh", luaRefresh) + REFLECT_LUA_METHOD("removeContent", luaRemoveContent) + REFLECT_LUA_METHOD("insertText", luaInsertText) + REFLECT_LUA_METHOD("addString", luaAddString) + REFLECT_LUA_METHOD("addImage", luaAddImage) + REFLECT_LUA_METHOD("beginElement", luaBeginElement) + REFLECT_LUA_METHOD("endElement", luaEndElement) + REFLECT_LUA_METHOD("showDiv", luaShowDiv) REFLECT_STRING("url", getURL, setURL) REFLECT_FLOAT("timeout", getTimeout, setTimeout) REFLECT_EXPORT_END @@ -290,6 +304,7 @@ protected : // element has been found // True when the element has been encountered bool _ParsingLua; + bool _IgnoreText; // the script to execute std::string _LuaScript; @@ -303,6 +318,7 @@ protected : class CLibWWWData *_LibWWW; // Current paragraph + std::string _DivName; CGroupParagraph* _Paragraph; inline CGroupParagraph *getParagraph() { @@ -442,6 +458,7 @@ protected : std::vector Entries; }; std::vector _Forms; + std::vector _Groups; // Cells parameters class CCellParams diff --git a/code/ryzom/client/src/interface_v3/group_quick_help.cpp b/code/ryzom/client/src/interface_v3/group_quick_help.cpp index 9df6c343e..210c7110e 100644 --- a/code/ryzom/client/src/interface_v3/group_quick_help.cpp +++ b/code/ryzom/client/src/interface_v3/group_quick_help.cpp @@ -278,8 +278,11 @@ void CGroupQuickHelp::browse (const char *url) _IsQuickHelp = false; string completeURL = url; - completeURL = completeURL.substr(0, completeURL.size()-5); // Substract the ".html" - completeURL += "_" + ClientCfg.getHtmlLanguageCode() + ".html"; + if (completeURL.substr(completeURL.size()-5, 5) == ".html") + { + completeURL = completeURL.substr(0, completeURL.size()-5); // Substract the ".html" + completeURL += "_" + ClientCfg.getHtmlLanguageCode() + ".html"; + } CGroupHTML::browse (completeURL.c_str()); } diff --git a/code/ryzom/client/src/interface_v3/interface_element.h b/code/ryzom/client/src/interface_v3/interface_element.h index c77fc41b6..24982cad2 100644 --- a/code/ryzom/client/src/interface_v3/interface_element.h +++ b/code/ryzom/client/src/interface_v3/interface_element.h @@ -250,6 +250,9 @@ public: /// Accessors : SET void setId (const std::string &newID) { _Id = newID; } + inline void setName(const std::string &name) { _Name = name; } + inline const std::string& getName() { return _Name; } + virtual void setIdRecurse(const std::string &newID); void setParent (CInterfaceGroup *pIG) { _Parent = pIG; } @@ -510,6 +513,8 @@ protected: ///the id of the element std::string _Id; + std::string _Name; + ///is the element active? bool _Active; diff --git a/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp b/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp index bbd664ad5..35afeb618 100644 --- a/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp +++ b/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp @@ -113,6 +113,33 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * effects += "\n"; } + if ( name == "SP_LIFE_AURA2" ) + { + + uint16 regenMod; + fromString(params[0].c_str(), regenMod); + uint32 bonus = regenMod * itemQuality; + uint32 duration; + fromString(params[1].c_str(), duration); + uint32 radius; + fromString(params[2].c_str(), radius); + uint32 targetDisableTime; + fromString(params[3].c_str(), targetDisableTime); + uint32 userDisableTime; + fromString(params[4].c_str(), userDisableTime); + + ucstring result = CI18N::get("uiItemConsumableEffectLifeAura"); + strFindReplace(result, "%modifier", toString(bonus)); + strFindReplace(result, "%minutes", toString(duration/60)); + strFindReplace(result, "%secondes", toString(duration%60)); + strFindReplace(result, "%radius", toString(radius)); + strFindReplace(result, "%targetDisableTime", toString(targetDisableTime)); + strFindReplace(result, "%userDisableTime", toString(userDisableTime)); + + effects += result; + effects += "\n"; + } + if ( name == "SP_STAMINA_AURA" ) { @@ -139,6 +166,34 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * effects += "\n"; } + + if ( name == "SP_STAMINA_AURA2" ) + { + + uint16 regenMod; + fromString(params[0].c_str(), regenMod); + uint32 bonus = regenMod * itemQuality; + uint32 duration; + fromString(params[1].c_str(), duration); + uint32 radius; + fromString(params[2].c_str(), radius); + uint32 targetDisableTime; + fromString(params[3].c_str(), targetDisableTime); + uint32 userDisableTime; + fromString(params[4].c_str(), userDisableTime); + + ucstring result = CI18N::get("uiItemConsumableEffectStaminaAura"); + strFindReplace(result, "%modifier", toString(regenMod)); + strFindReplace(result, "%minutes", toString(duration/60)); + strFindReplace(result, "%secondes", toString(duration%60)); + strFindReplace(result, "%radius", toString(radius)); + strFindReplace(result, "%targetDisableTime", toString(targetDisableTime)); + strFindReplace(result, "%userDisableTime", toString(userDisableTime)); + + effects += result; + effects += "\n"; + } + if ( name == "SP_SAP_AURA" ) { @@ -165,6 +220,33 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * effects += "\n"; } + if ( name == "SP_SAP_AURA2" ) + { + + uint16 regenMod; + fromString(params[0].c_str(), regenMod); + uint32 bonus = regenMod * itemQuality; + uint32 duration; + fromString(params[1].c_str(), duration); + uint32 radius; + fromString(params[2].c_str(), radius); + uint32 targetDisableTime; + fromString(params[3].c_str(), targetDisableTime); + uint32 userDisableTime; + fromString(params[4].c_str(), userDisableTime); + + ucstring result = CI18N::get("uiItemConsumableEffectSapAura"); + strFindReplace(result, "%modifier", toString(bonus)); + strFindReplace(result, "%minutes", toString(duration/60)); + strFindReplace(result, "%secondes", toString(duration%60)); + strFindReplace(result, "%radius", toString(radius)); + strFindReplace(result, "%targetDisableTime", toString(targetDisableTime)); + strFindReplace(result, "%userDisableTime", toString(userDisableTime)); + + effects += result; + effects += "\n"; + } + // skill modifier consumables //--------------------------- ucstring result(""); diff --git a/code/ryzom/client/src/interface_v3/lua_ihm.cpp b/code/ryzom/client/src/interface_v3/lua_ihm.cpp index 6fee6811a..cf34912f8 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm.cpp @@ -115,6 +115,7 @@ #include "game_share/scenario_entry_points.h" #include "game_share/bg_downloader_msg.h" #include "game_share/constants.h" +#include "game_share/visual_slot_manager.h" #ifdef LUA_NEVRAX_VERSION #include "lua_ide_dll_nevrax/include/lua_ide_dll/ide_interface.h" // external debugger @@ -1368,6 +1369,8 @@ void CLuaIHM::registerIHM(CLuaState &ls) ls.registerFunc("isPlayerNewbie", isPlayerNewbie); ls.registerFunc("isInRingMode", isInRingMode); ls.registerFunc("getUserRace", getUserRace); + ls.registerFunc("getSheet2idx", getSheet2idx); + // Through LUABind API lua_State *L= ls.getStatePointer(); @@ -4412,3 +4415,25 @@ int CLuaIHM::getUserRace(CLuaState &ls) return 1; } +// *************************************************************************** +int CLuaIHM::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.toNumber(2); + + NLMISC::CSheetId sheetId; + + if (sheetId.buildSheetId(sheedtName)) + { + uint32 idx = CVisualSlotManager::getInstance()->sheet2Index(sheetId, (SLOTTYPE::EVisualSlot)slotId); + ls.push((lua_Number)idx); + } + else + return 0; + return 1; +} + diff --git a/code/ryzom/client/src/interface_v3/lua_ihm.h b/code/ryzom/client/src/interface_v3/lua_ihm.h index f2a0e2628..6a11a5c91 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm.h +++ b/code/ryzom/client/src/interface_v3/lua_ihm.h @@ -351,6 +351,7 @@ private: static int isPlayerNewbie(CLuaState &ls); static int isInRingMode(CLuaState &ls); static int getUserRace(CLuaState &ls); + static int getSheet2idx(CLuaState &ls); // LUA functions exported for Dev only (debug) diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index 3b5a4fb43..170d20ffd 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -999,7 +999,7 @@ class CHandlerChatGroupFilter : public IActionHandler } - rCTF.setTargetGroup(PeopleInterraction.TheUserChat.Filter.getTargetGroup()); + rCTF.setTargetGroup(PeopleInterraction.TheUserChat.Filter.getTargetGroup(), PeopleInterraction.TheUserChat.Filter.getTargetDynamicChannelDbIndex()); } else { @@ -1813,8 +1813,6 @@ void CPeopleInterraction::setupUserChatFromSummary(const CFilteredChatSummary &s //================================================================================================================= void CPeopleInterraction::setupUserDynChatFromSummary(const CFilteredDynChatSummary &summary, CFilteredChat &dest) { - // User Dest - dest.Filter.setTargetGroup(summary.Target, 0, false); // src for (uint8 i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++) { @@ -2666,12 +2664,12 @@ class CHandlerChatTargetSelected : public IActionHandler // Case of user chat in grouped chat window if (cw == PeopleInterraction.ChatGroup.Window) { - PeopleInterraction.TheUserChat.Filter.setTargetGroup(cf.getTargetGroup()); + PeopleInterraction.TheUserChat.Filter.setTargetGroup(cf.getTargetGroup(), cf.getTargetDynamicChannelDbIndex()); CInterfaceManager::getInstance()->runActionHandler("chat_group_filter", NULL, "user"); } if (cw == PeopleInterraction.TheUserChat.Window) { - PeopleInterraction.TheUserChat.Filter.setTargetGroup(cf.getTargetGroup()); + PeopleInterraction.TheUserChat.Filter.setTargetGroup(cf.getTargetGroup(), cf.getTargetDynamicChannelDbIndex()); CInterfaceManager::getInstance()->runActionHandler("user_chat_active", NULL, ""); } diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index 66ce8a2a8..cd3d75067 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -441,7 +441,7 @@ void CPeopleList::setContactId(uint index, uint32 contactId) } //================================================================== -void CPeopleList::displayLocalPlayerTell(uint index,const ucstring &msg,uint numBlinks /*=0*/) +void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, const ucstring &msg,uint numBlinks /*=0*/) { if (_ContactType == CPeopleListDesc::Ignore) { @@ -475,7 +475,12 @@ void CPeopleList::displayLocalPlayerTell(uint index,const ucstring &msg,uint num // display msg with good color CInterfaceProperty prop; prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); + + ucstring s = CI18N::get("youTellPlayer"); + strFindReplace(s, "%name", receiver); + strFindReplace(finalMsg, CI18N::get("youTell"), s); gl->addChild(getChatTextMngr().createMsgText(finalMsg, prop.getRGBA())); + CInterfaceManager::getInstance()->log(finalMsg); // if the group is closed, make it blink if (!gc->isOpen()) @@ -924,7 +929,7 @@ class CHandlerContactEntry : public IActionHandler uint index; if (PeopleInterraction.getPeopleFromContainerID(str, peopleList, index)) { - peopleList->displayLocalPlayerTell(index, text); + peopleList->displayLocalPlayerTell(str2, index, text); } } else @@ -948,6 +953,11 @@ class CHandlerContactEntry : public IActionHandler CChatWindow::encodeColorTag(prop.getRGBA(), final, true); final += text; pWin->displayTellMessage(final, prop.getRGBA(), pWin->getFreeTellerName(str)); + + ucstring s = CI18N::get("youTellPlayer"); + strFindReplace(s, "%name", pWin->getFreeTellerName(str)); + strFindReplace(final, CI18N::get("youTell"), s); + CInterfaceManager::getInstance()->log(final); } } diff --git a/code/ryzom/client/src/interface_v3/people_list.h b/code/ryzom/client/src/interface_v3/people_list.h index 0ab0f3508..a3748c01a 100644 --- a/code/ryzom/client/src/interface_v3/people_list.h +++ b/code/ryzom/client/src/interface_v3/people_list.h @@ -111,7 +111,7 @@ public: * If the window is closed, it causes it to blink (and also the parent window) */ void displayMessage(uint index, const ucstring &msg, NLMISC::CRGBA col, uint numBlinks = 0); - void displayLocalPlayerTell(uint index, const ucstring &msg, uint numBlinks = 0); + void displayLocalPlayerTell(const ucstring &receiver, uint index, const ucstring &msg, uint numBlinks = 0); // Is the given people window visible ? bool isPeopleChatVisible(uint index) const; // reset remove everything from the interface diff --git a/code/ryzom/client/src/interface_v3/sphrase_manager.cpp b/code/ryzom/client/src/interface_v3/sphrase_manager.cpp index 8058e41da..6820a10e8 100644 --- a/code/ryzom/client/src/interface_v3/sphrase_manager.cpp +++ b/code/ryzom/client/src/interface_v3/sphrase_manager.cpp @@ -57,6 +57,7 @@ const std::string PhraseMemoryViewNextAction= "ui:interface:gestionsets:shortcu const std::string PhraseMemoryViewCycleAction= "ui:interface:gestionsets:shortcuts:view_cycle_action"; const std::string PhraseMemoryViewSlotBase= "ui:interface:gestionsets:shortcuts:s"; const std::string PhraseMemoryCtrlBase= "ui:interface:gestionsets:shortcuts:s"; +const std::string PhraseMemoryAltCtrlBase= "ui:interface:gestionsets2:header_closed:shortcuts:s"; const std::string PhraseMemoryPhraseMenu= "ui:interface:cm_memory_phrase"; const std::string PhraseMemoryPhraseAction= "cast_phrase_or_create_new"; @@ -118,11 +119,16 @@ void CSPhraseManager::initInGame() _BookDbLeaves[i]= node; } _MemoryDbLeaves.resize(PHRASE_MAX_MEMORY_SLOT, NULL); + _MemoryAltDbLeaves.resize(PHRASE_MAX_MEMORY_SLOT, NULL); + for(i=0;igetDbProp(PHRASE_DB_MEMORY + ":" + toString(i) + ":PHRASE"); node->setValue32(0); _MemoryDbLeaves[i]= node; + CCDBNodeLeaf *node_alt= pIM->getDbProp(PHRASE_DB_MEMORY_ALT + ":" + toString(i) + ":PHRASE"); + node_alt->setValue32(0); + _MemoryAltDbLeaves[i]= node_alt; } // Progression Db leaves @@ -497,6 +503,7 @@ void CSPhraseManager::updateMemoryDBAll() for(uint i=0;isetValue32(0); + _MemoryAltDbLeaves[i]->setValue32(0); } } else @@ -508,6 +515,12 @@ void CSPhraseManager::updateMemoryDBAll() _MemoryDbLeaves[i]->setValue32(0); else _MemoryDbLeaves[i]->setValue32(slot.Id); + + CMemorySlot &slotAlt= _Memories[0].Slot[i]; + if(!slotAlt.isPhrase()) + _MemoryAltDbLeaves[i]->setValue32(0); + else + _MemoryAltDbLeaves[i]->setValue32(slotAlt.Id); } } } @@ -530,6 +543,15 @@ void CSPhraseManager::updateMemoryDBSlot(uint32 memorySlot) else _MemoryDbLeaves[memorySlot]->setValue32(slot.Id); } + + if (_SelectedMemoryDB == 0) + { + CMemorySlot &slotAlt= _Memories[0].Slot[memorySlot]; + if(!slotAlt.isPhrase()) + _MemoryAltDbLeaves[memorySlot]->setValue32(0); + else + _MemoryAltDbLeaves[memorySlot]->setValue32(slotAlt.Id); + } } // *************************************************************************** @@ -873,6 +895,7 @@ void CSPhraseManager::reset() _LastProgressionNumDbFill[i]= 0; } _MemoryDbLeaves.clear(); + _MemoryAltDbLeaves.clear(); _NextExecuteLeaf= NULL; _NextExecuteIsCyclicLeaf= NULL; @@ -2645,7 +2668,13 @@ static sint getRightHandEnchantValue() void CSPhraseManager::updateMemoryCtrlRegenTickRange(uint memorySlot, CDBCtrlSheet *ctrl) { // - uint memoryLine= getSelectedMemoryLineDB(); + sint32 memoryLine; + if (ctrl->isShortCut()) + memoryLine = getSelectedMemoryLineDB(); + else + memoryLine = 0; + if (memoryLine < 0) + return; sint32 phraseId= getMemorizedPhrase(memoryLine, memorySlot); // if(phraseId) @@ -2780,8 +2809,12 @@ void CSPhraseManager::updateMemoryCtrlState(uint memorySlot, CDBCtrlSheet *ctrl, CSBrickManager *pBM = CSBrickManager::getInstance(); CSkillManager *pSM = CSkillManager::getInstance(); + uint memoryLine; // get the slot info - uint memoryLine= getSelectedMemoryLineDB(); + if (ctrl->isShortCut()) // No memoryLine defined + memoryLine= getSelectedMemoryLineDB(); + else + memoryLine= 0; bool newIsMacro= isMemorizedMacro(memoryLine, memorySlot); sint32 macroId= getMemorizedMacro(memoryLine, memorySlot); sint32 phraseId= getMemorizedPhrase(memoryLine, memorySlot); @@ -3004,6 +3037,9 @@ void CSPhraseManager::updateAllMemoryCtrlState() // update the valid state. updateMemoryCtrlState(i, ctrl, itemSkill); } + CDBCtrlSheet *ctrlAlt= dynamic_cast(pIM->getElementFromId(PhraseMemoryAltCtrlBase + toString(i)) ); + if(ctrlAlt) + updateMemoryCtrlState(i, ctrlAlt, itemSkill); } TTicks endTime = CTime::getPerformanceTime(); //nldebug("***** %d ms for CSPhraseManager::updateAllMemoryCtrlState", (int) (1000 * CTime::ticksToSecond(endTime - startTime))); @@ -3030,26 +3066,49 @@ CDBCtrlSheet *CSPhraseManager::getMemorySlotCtrl(uint memorySlot) return dynamic_cast(pIM->getElementFromId(PhraseMemoryCtrlBase + toString(memorySlot))); } +// *************************************************************************** +CDBCtrlSheet *CSPhraseManager::getMemoryAltSlotCtrl(uint memorySlot) +{ + if(memorySlot>=PHRASE_MAX_MEMORY_SLOT) + return NULL; + + // Get the ctrl + CInterfaceManager *pIM= CInterfaceManager::getInstance(); + return dynamic_cast(pIM->getElementFromId(PhraseMemoryAltCtrlBase + toString(memorySlot))); +} + // *************************************************************************** void CSPhraseManager::updateMemoryCtrlState(uint memorySlot) { CDBCtrlSheet *ctrl= getMemorySlotCtrl(memorySlot); + CDBCtrlSheet *ctrlAlt= getMemoryAltSlotCtrl(memorySlot); if(ctrl) { // update the valid state. updateMemoryCtrlState(memorySlot, ctrl, getRightHandItemSkill()); } + if(ctrlAlt) + { + // update the valid state. + updateMemoryCtrlState(memorySlot, ctrlAlt, getRightHandItemSkill()); + } } // *************************************************************************** void CSPhraseManager::updateMemoryCtrlRegenTickRange(uint memorySlot) { CDBCtrlSheet *ctrl= getMemorySlotCtrl(memorySlot); + CDBCtrlSheet *ctrlAlt= getMemoryAltSlotCtrl(memorySlot); if(ctrl) { // update the valid state. updateMemoryCtrlRegenTickRange(memorySlot, ctrl); } + if(ctrlAlt) + { + // update the valid state. + updateMemoryCtrlRegenTickRange(memorySlot, ctrlAlt); + } } // *************************************************************************** diff --git a/code/ryzom/client/src/interface_v3/sphrase_manager.h b/code/ryzom/client/src/interface_v3/sphrase_manager.h index 0a934f4e2..bf40dcc35 100644 --- a/code/ryzom/client/src/interface_v3/sphrase_manager.h +++ b/code/ryzom/client/src/interface_v3/sphrase_manager.h @@ -34,6 +34,7 @@ const std::string PHRASE_DB_BOOK="UI:PHRASE:BOOK"; const std::string PHRASE_DB_PROGRESSION[2]= {"UI:PHRASE:PROGRESS_ACTIONS", "UI:PHRASE:PROGRESS_UPGRADES"}; const std::string PHRASE_DB_MEMORY="UI:PHRASE:MEMORY"; +const std::string PHRASE_DB_MEMORY_ALT="UI:PHRASE:MEMORY_ALT"; const std::string PHRASE_DB_EXECUTE_NEXT="UI:PHRASE:EXECUTE_NEXT:PHRASE"; const std::string PHRASE_DB_EXECUTE_NEXT_IS_CYCLIC="UI:PHRASE:EXECUTE_NEXT:ISCYCLIC"; const std::string PHRASE_DB_BOTCHAT="LOCAL:TRADING"; @@ -458,6 +459,7 @@ private: // Shortcut To Phrases Leaves std::vector _BookDbLeaves; std::vector _MemoryDbLeaves; + std::vector _MemoryAltDbLeaves; CCDBNodeLeaf *_NextExecuteLeaf; CCDBNodeLeaf *_NextExecuteIsCyclicLeaf; @@ -698,6 +700,7 @@ private: void updateMemoryCtrlRegenTickRange(uint memorySlot); CDBCtrlSheet *getMemorySlotCtrl(uint memorySlot); + CDBCtrlSheet *getMemoryAltSlotCtrl(uint memorySlot); CTickRange getRegenTickRange(const CSPhraseCom &phrase) const; diff --git a/code/ryzom/client/src/libwww.cpp b/code/ryzom/client/src/libwww.cpp index dc5c151bd..c4695840d 100644 --- a/code/ryzom/client/src/libwww.cpp +++ b/code/ryzom/client/src/libwww.cpp @@ -218,6 +218,14 @@ HTAttr p_attr[] = HTML_ATTR(P,QUICK_HELP_CONDITION), HTML_ATTR(P,QUICK_HELP_EVENTS), HTML_ATTR(P,QUICK_HELP_LINK), + HTML_ATTR(P,NAME), + { 0 } +}; + + +HTAttr div_attr[] = +{ + HTML_ATTR(DIV,NAME), { 0 } }; @@ -684,6 +692,8 @@ void initLibWWW() HTML_DTD->tags[HTML_A].number_of_attributes = sizeof(a_attr) / sizeof(HTAttr) - 1; //HTML_DTD->tags[HTML_I].attributes = a_attr; HTML_DTD->tags[HTML_I].number_of_attributes = 0; + HTML_DTD->tags[HTML_DIV].attributes = div_attr; + HTML_DTD->tags[HTML_DIV].number_of_attributes = sizeof(div_attr) / sizeof(HTAttr) - 1; // Set a request timeout // HTHost_setEventTimeout (30000); diff --git a/code/ryzom/client/src/libwww.h b/code/ryzom/client/src/libwww.h index f3f681268..5c686e39b 100644 --- a/code/ryzom/client/src/libwww.h +++ b/code/ryzom/client/src/libwww.h @@ -201,8 +201,15 @@ enum HTML_ATTR(P,QUICK_HELP_CONDITION) = 0, HTML_ATTR(P,QUICK_HELP_EVENTS), HTML_ATTR(P,QUICK_HELP_LINK), + HTML_ATTR(P,NAME), }; +enum +{ + HTML_ATTR(DIV,NAME) = 0, +}; + + #undef HTML_ATTR // *************************************************************************** diff --git a/code/ryzom/client/src/motion/user_controls.cpp b/code/ryzom/client/src/motion/user_controls.cpp index 8b20ae026..7ce5523b2 100644 --- a/code/ryzom/client/src/motion/user_controls.cpp +++ b/code/ryzom/client/src/motion/user_controls.cpp @@ -619,6 +619,7 @@ void CUserControls::commonMove() // MOUSE WHEEL // CEventsListener::TWheelState wheelState = EventsListener.getWheelState(); // Done all the time, to reset the state View.changeCameraDist((wheelState == CEventsListener::foreward), (wheelState == CEventsListener::backward)); + View.changeCameraDist(Actions.valide("camera_foreward"), Actions.valide("camera_backward")); // Camera Up/Down. View.changeCameraHeight(Actions.valide("camera_up"), Actions.valide("camera_down")); ////////////////// diff --git a/code/ryzom/client/src/net_manager.cpp b/code/ryzom/client/src/net_manager.cpp index 608eae45b..36a0767cd 100644 --- a/code/ryzom/client/src/net_manager.cpp +++ b/code/ryzom/client/src/net_manager.cpp @@ -895,6 +895,7 @@ void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const u colorizeSender(finalString, senderPart, prop.getRGBA()); PeopleInterraction.ChatInput.Tell.displayTellMessage(/*senderIndex, */finalString, goodSenderName, prop.getRGBA(), 2, &windowVisible); + CInterfaceManager::getInstance()->log(finalString); // Open the free teller window CChatGroupWindow *pCGW = PeopleInterraction.getChatGroupWindow(); @@ -3216,9 +3217,13 @@ private: // get the content string (should have been received!) ucstring contentStr; + ucstring titleStr; if(!pSMC->getDynString(_TextId[ContentType], contentStr)) return; + if(!pSMC->getDynString(_TextId[TitleType], titleStr)) + return; + // if the string start with a @{Wxxxx} code, remove it and get the wanted window size sint w = 256; // default size to 256 !! bool is_webig = false; @@ -3273,23 +3278,36 @@ private: if (is_webig) { - CGroupHTML *groupHtml = dynamic_cast(pIM->getElementFromId("ui:interface:webig:content:html")); + CGroupHTML *groupHtml; + string group = titleStr.toString(); + // + group = group.substr(9, group.size()-10); + nlinfo("group = %s", group.c_str()); + groupHtml = dynamic_cast(pIM->getElementFromId("ui:interface:"+group+":content:html")); + if (!groupHtml) + { + groupHtml = dynamic_cast(pIM->getElementFromId("ui:interface:webig:content:html")); + group = "webig"; + } + if (groupHtml) { - - CGroupContainer *pGC = dynamic_cast(pIM->getElementFromId("ui:interface:webig")); - - if (contentStr.empty()) + CGroupContainer *pGC = dynamic_cast(pIM->getElementFromId("ui:interface:"+group)); + if (pGC) { - pGC->setActive(false); - } - else - { - pGC->setActive(true); - string url = contentStr.toString(); - addWebIGParams(url); - groupHtml->browse(url.c_str()); - pIM->setTopWindow(pGC); + if (contentStr.empty()) + { + pGC->setActive(false); + } + else + { + if (group == "webig") + pGC->setActive(true); + string url = contentStr.toString(); + addWebIGParams(url); + groupHtml->browse(url.c_str()); + pIM->setTopWindow(pGC); + } } } } diff --git a/code/ryzom/client/src/string_manager_client.cpp b/code/ryzom/client/src/string_manager_client.cpp index e46895368..6fd3400ae 100644 --- a/code/ryzom/client/src/string_manager_client.cpp +++ b/code/ryzom/client/src/string_manager_client.cpp @@ -1641,8 +1641,6 @@ const ucchar *CStringManagerClient::getSquadLocalizedDescription(NLMISC::CSheetI // *************************************************************************** void CStringManagerClient::replaceSBrickName(NLMISC::CSheetId id, const ucstring &name, const ucstring &desc, const ucstring &desc2) { - nlassert(!_SpecItem_MemoryCompressed); - std::string label= id.toString(); if (label.empty()) { @@ -1654,14 +1652,57 @@ void CStringManagerClient::replaceSBrickName(NLMISC::CSheetId id, const ucstrin lwrLabel= label; strlwr(lwrLabel); - map::iterator it(_SpecItem_TempMap.find(lwrLabel)); - if (it == _SpecItem_TempMap.end()) - return; + if (_SpecItem_MemoryCompressed) + { + ucchar *strName = (ucchar *)name.c_str(); + ucchar *strDesc = (ucchar *)desc.c_str(); + ucchar *strDesc2 = (ucchar *)desc2.c_str(); + CItemLight tmp; + tmp.Label = (char*)lwrLabel.c_str(); + vector::iterator it = lower_bound(_SpecItems.begin(), _SpecItems.end(), tmp, CItemLightComp()); - // Then replace - it->second.Name= name; - it->second.Desc= desc; - it->second.Desc2= desc2; + if (it != _SpecItems.end()) + { + if (strcmp(it->Label, lwrLabel.c_str()) == 0) + { + it->Name = strName; + it->Desc = strDesc; + it->Desc2 = strDesc2; + } + else + { + it->Label = tmp.Label; + it->Name = strName; + it->Desc = strDesc; + it->Desc2 = strDesc2; + } + } + else + { + tmp.Name = strName; + tmp.Desc = strDesc; + tmp.Desc2 = strDesc2; + _SpecItems.push_back(tmp); + } + } + else + { + map::iterator it(_SpecItem_TempMap.find(lwrLabel)); + if (it != _SpecItem_TempMap.end()) + { + it->second.Name= name; + it->second.Desc= desc; + it->second.Desc2= desc2; + } + else + { + CItem newItem; + newItem.Name = name; + newItem.Desc = desc; + newItem.Desc2 = desc2; + _SpecItem_TempMap.insert(pair(lwrLabel,newItem)); + } + } }