Changed: Changes from last patch
This commit is contained in:
parent
030bdfd729
commit
5ac53fb64e
18 changed files with 374 additions and 47 deletions
|
@ -5743,3 +5743,24 @@ NLMISC_COMMAND(guildmotd, "Set the guild message of the day","<msg of the day>")
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
NLMISC_COMMAND(time, "Shows information about the current time", "")
|
||||
{
|
||||
const uint8 size = 50;
|
||||
char cs_local[size];
|
||||
char cs_utc[size];
|
||||
time_t date;
|
||||
time(&date);
|
||||
struct tm *tm;
|
||||
tm = localtime(&date);
|
||||
strftime(cs_local, size, "%X", tm);
|
||||
tm = gmtime(&date);
|
||||
strftime(cs_utc, size, "%X", tm);
|
||||
|
||||
ucstring msg = CI18N::get("uiCurrentLocalAndUtcTime");
|
||||
strFindReplace(msg, "%local", cs_local);
|
||||
strFindReplace(msg, "%utc", cs_utc);
|
||||
CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND");
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2999,8 +2999,17 @@ void CEntityCL::updateClipped(const NLMISC::TTime &/* currentTimeInMs */, CEntit
|
|||
void CEntityCL::updateVisiblePostPos(const NLMISC::TTime &/* currentTimeInMs */, CEntityCL * /* target */)
|
||||
{
|
||||
if (R2::isEditionCurrent()) return; // selection managed by r2 editor in edition mode
|
||||
|
||||
bool bShowReticle = true;
|
||||
|
||||
CCDBNodeLeaf* node = CInterfaceManager::getInstance()->getDbProp("UI:SAVE:SHOW_RETICLE");
|
||||
if (node)
|
||||
{
|
||||
bShowReticle = node->getValueBool();
|
||||
}
|
||||
|
||||
// No-op if I am not the current UserEntity Target
|
||||
if(isTarget())
|
||||
if(bShowReticle && isTarget())
|
||||
{
|
||||
// activate selection fx
|
||||
if (_SelectionFX.empty())
|
||||
|
@ -3028,7 +3037,7 @@ void CEntityCL::updateVisiblePostPos(const NLMISC::TTime &/* currentTimeInMs */,
|
|||
}
|
||||
|
||||
// Mouse over SFX, only if the entity is selectable
|
||||
if (ShowInterface && !isTarget() && isUnderCursor() && properties().selectable())
|
||||
if (bShowReticle && ShowInterface && !isTarget() && isUnderCursor() && properties().selectable())
|
||||
{
|
||||
// activate selection fx
|
||||
if (_MouseOverFX.empty())
|
||||
|
|
|
@ -356,7 +356,7 @@ class CAHEditPreviousLine : public CAHEdit
|
|||
{
|
||||
void actionPart ()
|
||||
{
|
||||
if(_GroupEdit->getMaxHistoric())
|
||||
if (_GroupEdit->getMaxHistoric() && (! _GroupEdit->getViewText()->getMultiLine()))
|
||||
{
|
||||
// Get the start of the string.
|
||||
ucstring startStr= _GroupEdit->getInputStringRef().substr(0, _GroupEdit->getCursorPos());
|
||||
|
@ -372,7 +372,7 @@ class CAHEditPreviousLine : public CAHEdit
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (!_GroupEdit->getMaxHistoric() && _GroupEdit->getViewText()->getMultiLine())
|
||||
else if (_GroupEdit->getViewText()->getMultiLine())
|
||||
{
|
||||
uint cursorPosInText = _GroupEdit->getCursorPos() + (uint)_GroupEdit->getPrompt().length();
|
||||
if (
|
||||
|
@ -428,7 +428,7 @@ class CAHEditNextLine : public CAHEdit
|
|||
{
|
||||
void actionPart ()
|
||||
{
|
||||
if(_GroupEdit->getMaxHistoric() && _GroupEdit->getCurrentHistoricIndex()>0)
|
||||
if( (! _GroupEdit->getViewText()->getMultiLine()) && _GroupEdit->getMaxHistoric() && _GroupEdit->getCurrentHistoricIndex()>0)
|
||||
{
|
||||
// Get the start of the string.
|
||||
ucstring startStr= _GroupEdit->getInputStringRef().substr(0, _GroupEdit->getCursorPos());
|
||||
|
@ -444,7 +444,7 @@ class CAHEditNextLine : public CAHEdit
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (!_GroupEdit->getMaxHistoric() && _GroupEdit->getViewText()->getMultiLine())
|
||||
else if (_GroupEdit->getViewText()->getMultiLine())
|
||||
{
|
||||
sint cx, cy;
|
||||
sint height;
|
||||
|
|
|
@ -111,6 +111,7 @@ string convertLanguageIntToLanguageCode(sint val)
|
|||
case 1: return "fr"; break;
|
||||
case 2: return "de"; break;
|
||||
case 3: return "ru"; break;
|
||||
case 4: return "es"; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2467,7 +2468,7 @@ class CAHAddShape : public IActionHandler
|
|||
string c = getParam(Params, "text");
|
||||
string u = getParam(Params, "url");
|
||||
string texture_name = getParam(Params, "texture");
|
||||
string highlight = getParam(Params, "texture");
|
||||
string highlight = getParam(Params, "highlight");
|
||||
string transparency = getParam(Params, "transparency");
|
||||
|
||||
if (!getParam(Params, "x").empty())
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#include "../r2/editor.h"
|
||||
#include "../init.h"
|
||||
#include "../browse_faq.h"
|
||||
#include "people_list.h"
|
||||
#include "people_interraction.h"
|
||||
|
||||
extern CSheetManager SheetMngr;
|
||||
|
||||
|
@ -618,7 +620,34 @@ class CHandlerOpenTitleHelp : public IActionHandler
|
|||
void execute (CCtrlBase *pCaller, const std::string &sParams)
|
||||
{
|
||||
// display web profile if necessary
|
||||
if (getParam(sParams, "from") == "target")
|
||||
if (getParam(sParams, "from") == "contact")
|
||||
{
|
||||
if (pCaller == NULL)
|
||||
return;
|
||||
|
||||
CInterfaceGroup *fatherGC = pCaller->getParent();
|
||||
if (fatherGC == NULL)
|
||||
return;
|
||||
fatherGC = fatherGC->getParent();
|
||||
if (fatherGC == NULL)
|
||||
return;
|
||||
string str = fatherGC->getId().substr(0,fatherGC->getId().rfind('_'));
|
||||
str = str.substr(str.rfind(':')+1, str.size());
|
||||
CPeopleList *peopleList = PeopleInterraction.getPeopleListFromContainerID(str);
|
||||
if (peopleList == NULL)
|
||||
return;
|
||||
|
||||
sint index = peopleList->getIndexFromContainerID(fatherGC->getId());
|
||||
if (index == -1)
|
||||
return;
|
||||
ucstring name = peopleList->getName(index);
|
||||
if ( ! name.empty())
|
||||
{
|
||||
CInterfaceManager::getInstance()->runActionHandler("show_hide", pCaller, "profile|pname="+name.toUtf8()+"|ptype="+toString((int)CEntityCL::Player));
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (getParam(sParams, "from") == "target")
|
||||
{
|
||||
// Require info on the target
|
||||
CEntityCL *selection = EntitiesMngr.entity(UserEntity->selection());
|
||||
|
|
|
@ -378,7 +378,7 @@ void CChatTargetFilter::setTargetGroup(CChatGroup::TGroupType groupType, uint32
|
|||
const bool guildActive = pIM->getDbProp("SERVER:GUILD:NAME")->getValueBool();
|
||||
switch(groupType)
|
||||
{
|
||||
case CChatGroup::dyn_chat: // dyn_chat takes the color of say
|
||||
case CChatGroup::dyn_chat: entry+="DYN"; break;
|
||||
case CChatGroup::say: entry+="SAY"; break;
|
||||
case CChatGroup::shout: entry+="SHOUT"; break;
|
||||
case CChatGroup::team: if(!teamActive) return; entry+="GROUP"; break;
|
||||
|
|
|
@ -557,9 +557,12 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
|
|||
CInterfaceManager *pIM= CInterfaceManager::getInstance();
|
||||
CRGBA newMsgColor= stringToRGBA(pIM->getDefine("chat_group_tab_color_newmsg").c_str());
|
||||
|
||||
ucstring newmsg = msg;
|
||||
ucstring prefix;
|
||||
|
||||
if (gl != NULL)
|
||||
{
|
||||
gl->addChild(ctm.createMsgText(msg, col));
|
||||
gl->addChild(ctm.createMsgText(newmsg, col));
|
||||
if (!gl->getParent()->getActive())
|
||||
if (tab != NULL)
|
||||
tab->setTextColorNormal(newMsgColor);
|
||||
|
@ -584,14 +587,37 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
|
|||
case CChatGroup::guild: if (ci.Guild.isListeningWindow(cw)) gl = gl2; break;
|
||||
case CChatGroup::system: if (ci.SystemInfo.isListeningWindow(cw)) gl = gl2; break;
|
||||
case CChatGroup::universe: if (ci.Universe.isListeningWindow(cw)) gl = gl2; break;
|
||||
// NB: the yubo chat and dyn_chat cannot be in a user chat
|
||||
case CChatGroup::dyn_chat:
|
||||
if (ci.DynamicChat[dynamicChatDbIndex].isListeningWindow(cw))
|
||||
{
|
||||
gl = gl2;
|
||||
|
||||
// Add dynchannel number and optionally name before text if user channel
|
||||
CCDBNodeLeaf* node = CInterfaceManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB", false);
|
||||
if (node && node->getValueBool())
|
||||
{
|
||||
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChatDbIndex);
|
||||
ucstring title;
|
||||
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
|
||||
if ( ! title.empty())
|
||||
{
|
||||
prefix = " " + title;
|
||||
}
|
||||
}
|
||||
|
||||
// Put the new prefix in the correct position
|
||||
size_t pos = newmsg.find(ucstring("] "));
|
||||
newmsg = newmsg.substr(0, pos) + prefix + newmsg.substr(pos);
|
||||
}
|
||||
break;
|
||||
|
||||
// NB: the yubo chat cannot be in a user chat
|
||||
case CChatGroup::yubo_chat: gl = NULL; break;
|
||||
case CChatGroup::dyn_chat: gl = NULL; break;
|
||||
}
|
||||
|
||||
if (gl != NULL)
|
||||
{
|
||||
gl->addChild(ctm.createMsgText(msg, col));
|
||||
gl->addChild(ctm.createMsgText(newmsg, col));
|
||||
if (!gl->getParent()->getActive())
|
||||
if (tab != NULL)
|
||||
tab->setTextColorNormal(newMsgColor);
|
||||
|
|
|
@ -37,3 +37,18 @@ void CFilteredChatSummary::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
|
|||
if(ver>=2)
|
||||
f.serial(SrcRegion);
|
||||
}
|
||||
|
||||
//===================================================================================
|
||||
void CFilteredDynChatSummary::serial(NLMISC::IStream &f) throw(NLMISC::EStream)
|
||||
{
|
||||
sint ver = f.serialVersion(0);
|
||||
f.serialCheck((uint32) 'USHC');
|
||||
if (ver >= 0)
|
||||
{
|
||||
for (uint8 i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++)
|
||||
{
|
||||
f.serial(SrcDynChat[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -39,6 +39,18 @@ public:
|
|||
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
|
||||
};
|
||||
|
||||
// class for serialisation of user dyn chat (filtered chat) info
|
||||
class CFilteredDynChatSummary
|
||||
{
|
||||
public:
|
||||
// Inputs
|
||||
bool SrcDynChat[CChatGroup::MaxDynChanPerPlayer];
|
||||
// output
|
||||
CChatGroup::TGroupType Target;
|
||||
public:
|
||||
void serial(NLMISC::IStream &f) throw(NLMISC::EStream);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -135,6 +135,7 @@ namespace R2
|
|||
|
||||
// ***************************************************************************
|
||||
/*
|
||||
Version 11: - Dyn chat in user tab
|
||||
Version 10: - Last screen resolution serialisation
|
||||
Version 9: UI_DB_SAVE_VERSION system
|
||||
Version 8: - serialInSceneBubbleInfo (for ignore context help)
|
||||
|
@ -147,7 +148,7 @@ namespace R2
|
|||
Version 1: - people interraction
|
||||
Version 0: - base version
|
||||
*/
|
||||
#define ICFG_STREAM_VERSION 10
|
||||
#define ICFG_STREAM_VERSION 11
|
||||
|
||||
#ifdef AJM_DEBUG_TRACK_INTERFACE_GROUPS
|
||||
#define FOREACH(__itvar,__conttype,__contvar) \
|
||||
|
@ -191,7 +192,7 @@ NLMISC::CLog g_log;
|
|||
// GLOBAL //
|
||||
////////////
|
||||
|
||||
// Hierachical timer
|
||||
// Hierarchical timer
|
||||
H_AUTO_DECL ( RZ_Client_Update_Frame_Events )
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -1649,6 +1650,14 @@ bool CInterfaceManager::loadConfig (const string &filename)
|
|||
|
||||
if(ver>=8)
|
||||
CGroupInSceneBubbleManager::serialInSceneBubbleInfo(f);
|
||||
|
||||
if (ver >= 11)
|
||||
{
|
||||
if ( ! PeopleInterraction.loadUserDynChatsInfos(f))
|
||||
{
|
||||
nlwarning("Bad user dyn chat saving");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(NLMISC::EStream &)
|
||||
{
|
||||
|
@ -1831,6 +1840,11 @@ bool CInterfaceManager::saveConfig (const string &filename)
|
|||
|
||||
CGroupInSceneBubbleManager::serialInSceneBubbleInfo(f);
|
||||
|
||||
if ( ! PeopleInterraction.saveUserDynChatsInfos(f))
|
||||
{
|
||||
nlwarning("Bad user dyn chat saving");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch(NLMISC::EStream &)
|
||||
{
|
||||
|
|
|
@ -4710,7 +4710,9 @@ bool CInterfaceParser::loadLUA(const std::string &fileName, std::string &error)
|
|||
|
||||
if (needCheck && !isInData)
|
||||
{
|
||||
return false;
|
||||
nlwarning("You are not allowed to modify the lua files");
|
||||
// return true so it'll not generate a message box, we just ignore the file
|
||||
return true;
|
||||
}
|
||||
|
||||
// Parse script
|
||||
|
|
|
@ -2328,6 +2328,42 @@ bool CDBGroupListSheetFilterExchangeable::CSheetChildFilter::isSheetValid(CDBGro
|
|||
return false;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CDBGroupListSheetFilterExchangeable::sort()
|
||||
{
|
||||
vector<SSortStruct> vTemp;
|
||||
|
||||
vTemp.resize (_MaxItems);
|
||||
|
||||
uint i;
|
||||
for (i = 0; i < _MaxItems; ++i)
|
||||
{
|
||||
vTemp[i].SheetIcon = _SheetChildren[i];
|
||||
|
||||
CDBCtrlSheet *ctrl= _SheetChildren[i]->Ctrl;
|
||||
initStructForItemSort (vTemp, ctrl->getSheetId(), ctrl->getQuality(), i, ctrl->getIndexInDB());
|
||||
}
|
||||
|
||||
std::sort(vTemp.begin(), vTemp.end());
|
||||
|
||||
for (i = 0; i < _MaxItems; ++i)
|
||||
{
|
||||
_SheetChildren[i] = vTemp[i].SheetIcon;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
bool CDBGroupListSheetFilterExchangeable::parse(xmlNodePtr cur, CInterfaceGroup *parentGroup)
|
||||
{
|
||||
if(!CDBGroupListSheet::parse(cur, parentGroup))
|
||||
return false;
|
||||
|
||||
// Parse options (type, filters ...)
|
||||
if (!_BO.parse(cur,parentGroup))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// ***************************************************************************
|
||||
|
|
|
@ -692,6 +692,12 @@ public:
|
|||
{
|
||||
virtual bool isSheetValid(CDBGroupListSheet *pFather);
|
||||
};
|
||||
|
||||
void sort();
|
||||
bool parse (xmlNodePtr cur, CInterfaceGroup *parentGroup);
|
||||
|
||||
private:
|
||||
SBagOptions _BO;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -487,9 +487,6 @@ void CPeopleInterraction::initStdInputs()
|
|||
if (YuboChat)
|
||||
ChatInput.YuboChat.addListeningWindow(YuboChat);
|
||||
|
||||
// NB: The universe channel can only be seen from the user chat (and hence chat group)
|
||||
// There is no Special universe window
|
||||
|
||||
if (TheUserChat.Window)
|
||||
{
|
||||
ChatInput.AroundMe.addListeningWindow(TheUserChat.Window);
|
||||
|
@ -498,6 +495,11 @@ void CPeopleInterraction::initStdInputs()
|
|||
ChatInput.Guild.addListeningWindow(TheUserChat.Window);
|
||||
ChatInput.Universe.addListeningWindow (TheUserChat.Window);
|
||||
// Don't add the system info by default
|
||||
// Dynamic chats
|
||||
for(i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++)
|
||||
{
|
||||
ChatInput.DynamicChat[i].addListeningWindow(TheUserChat.Window);
|
||||
}
|
||||
}
|
||||
|
||||
ChatInput.Tell.addListeningPeopleList(&FriendList);
|
||||
|
@ -804,8 +806,8 @@ void CPeopleInterraction::createDynamicChats()
|
|||
chatDesc.ChatTemplateParams.push_back(make_pair(string("dyn_chat_nb"),toString(i)));
|
||||
chatDesc.Id = string("dynamic_chat") + toString(i);
|
||||
// no active proc because active state is driven by database
|
||||
chatDesc.AHOnDeactive = "proc";
|
||||
chatDesc.AHOnDeactiveParams = string("dynamic_chat_proc_deactive|") + toString(i);
|
||||
chatDesc.AHOnCloseButton = "proc";
|
||||
chatDesc.AHOnCloseButtonParams = string("dynamic_chat_proc_close|") + toString(i);
|
||||
chatDesc.HeaderColor = "UI:SAVE:WIN:COLORS:MEM";
|
||||
|
||||
DynamicChat[i] = getChatWndMgr().createChatWindow(chatDesc);
|
||||
|
@ -1560,7 +1562,6 @@ bool CPeopleInterraction::createNewPartyChat(const ucstring &title)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================================================
|
||||
void CPeopleInterraction::buildFilteredChatSummary(const CFilteredChat &src, CFilteredChatSummary &fcs)
|
||||
{
|
||||
|
@ -1584,6 +1585,15 @@ void CPeopleInterraction::buildFilteredChatSummary(const CFilteredChat &src, CFi
|
|||
}
|
||||
}
|
||||
|
||||
//=================================================================================================================
|
||||
void CPeopleInterraction::buildFilteredDynChatSummary(const CFilteredChat &src, CFilteredDynChatSummary &fcs)
|
||||
{
|
||||
for (uint8 i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++)
|
||||
{
|
||||
fcs.SrcDynChat[i] = ChatInput.DynamicChat[i].isListeningWindow(src.Window);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================================
|
||||
void CPeopleInterraction::saveFilteredChat(NLMISC::IStream &f, const CFilteredChat &src)
|
||||
{
|
||||
|
@ -1603,6 +1613,25 @@ void CPeopleInterraction::saveFilteredChat(NLMISC::IStream &f, const CFilteredCh
|
|||
}
|
||||
}
|
||||
|
||||
//=================================================================================================================
|
||||
void CPeopleInterraction::saveFilteredDynChat(NLMISC::IStream &f, const CFilteredChat &src)
|
||||
{
|
||||
bool present;
|
||||
if (src.Window == NULL)
|
||||
{
|
||||
present = false;
|
||||
f.serial(present);
|
||||
}
|
||||
else
|
||||
{
|
||||
present = true;
|
||||
f.serial(present);
|
||||
CFilteredDynChatSummary fcs;
|
||||
buildFilteredDynChatSummary(src, fcs);
|
||||
f.serial(fcs);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================================
|
||||
CChatGroupWindow *CPeopleInterraction::getChatGroupWindow() const
|
||||
{
|
||||
|
@ -1610,6 +1639,7 @@ CChatGroupWindow *CPeopleInterraction::getChatGroupWindow() const
|
|||
}
|
||||
|
||||
#define USER_CHATS_INFO_VERSION 2
|
||||
#define USER_DYN_CHATS_INFO_VERSION 1
|
||||
|
||||
//=================================================================================================================
|
||||
bool CPeopleInterraction::saveUserChatsInfos(NLMISC::IStream &f)
|
||||
|
@ -1648,6 +1678,27 @@ bool CPeopleInterraction::saveUserChatsInfos(NLMISC::IStream &f)
|
|||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================================================
|
||||
bool CPeopleInterraction::saveUserDynChatsInfos(NLMISC::IStream &f)
|
||||
{
|
||||
nlassert(!f.isReading());
|
||||
try
|
||||
{
|
||||
sint ver = f.serialVersion(USER_DYN_CHATS_INFO_VERSION);
|
||||
f.serialCheck((uint32) 'OMGY');
|
||||
if (ver >= 1)
|
||||
{
|
||||
saveFilteredDynChat(f, TheUserChat);
|
||||
}
|
||||
}
|
||||
catch(NLMISC::EStream &e)
|
||||
{
|
||||
nlwarning("Error while saving user dyn chat infos : %s", e.what());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================================================
|
||||
bool CPeopleInterraction::loadUserChatsInfos(NLMISC::IStream &f)
|
||||
{
|
||||
|
@ -1713,6 +1764,37 @@ bool CPeopleInterraction::loadUserChatsInfos(NLMISC::IStream &f)
|
|||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================================================
|
||||
bool CPeopleInterraction::loadUserDynChatsInfos(NLMISC::IStream &f)
|
||||
{
|
||||
nlassert(f.isReading());
|
||||
try
|
||||
{
|
||||
bool present;
|
||||
sint ver = f.serialVersion(USER_DYN_CHATS_INFO_VERSION);
|
||||
f.serialCheck((uint32) 'OMGY');
|
||||
f.serial(present);
|
||||
if (!present)
|
||||
{
|
||||
nlwarning("Bad data in user dyn chats infos");
|
||||
return false;
|
||||
}
|
||||
CFilteredDynChatSummary fcs;
|
||||
if (ver >= 1)
|
||||
{
|
||||
f.serial(fcs);
|
||||
setupUserDynChatFromSummary(fcs, TheUserChat);
|
||||
}
|
||||
}
|
||||
catch(NLMISC::EStream &e)
|
||||
{
|
||||
nlwarning("Error while loading user dyn chat infos : %s", e.what());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================================================
|
||||
void CPeopleInterraction::setupUserChatFromSummary(const CFilteredChatSummary &summary, CFilteredChat &dest)
|
||||
{
|
||||
|
@ -1728,6 +1810,18 @@ void CPeopleInterraction::setupUserChatFromSummary(const CFilteredChatSummary &s
|
|||
ChatInput.Universe.setWindowState(dest.Window, summary.SrcUniverse);
|
||||
}
|
||||
|
||||
//=================================================================================================================
|
||||
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++)
|
||||
{
|
||||
ChatInput.DynamicChat[i].setWindowState(dest.Window, summary.SrcDynChat[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================================================
|
||||
void CPeopleInterraction::removeAllUserChats()
|
||||
{
|
||||
|
@ -2494,7 +2588,7 @@ public:
|
|||
for (uint i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++)
|
||||
{
|
||||
string s = toString(i);
|
||||
uint32 textId = im->getDbProp("SERVER:DYN_CHAT:CHANNEL"+s+":NAME")->getValue32();
|
||||
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(i);
|
||||
bool active = (textId != 0);
|
||||
if (active)
|
||||
{
|
||||
|
@ -2681,7 +2775,7 @@ class CHandlerSelectChatSource : public IActionHandler
|
|||
CViewTextMenu *pVTM = dynamic_cast<CViewTextMenu *>(im->getElementFromId(MAIN_CHAT_SOURCE_MENU+":tab:dyn"+s));
|
||||
if (pVTM)
|
||||
{
|
||||
uint32 textId = im->getDbProp("SERVER:DYN_CHAT:CHANNEL"+s+":NAME")->getValue32();
|
||||
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(i);
|
||||
bool active = (textId != 0);
|
||||
pVTM->setActive(active);
|
||||
if (active)
|
||||
|
@ -2802,6 +2896,23 @@ class CHandlerSelectChatSource : public IActionHandler
|
|||
++ insertionIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Add all existing dynamic channels and set the names
|
||||
for (uint8 i = 0; i < CChatGroup::MaxDynChanPerPlayer; i++)
|
||||
{
|
||||
string s = toString(i);
|
||||
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(i);
|
||||
bool active = (textId != 0);
|
||||
if (active)
|
||||
{
|
||||
ucstring title;
|
||||
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
|
||||
menu->addLineAtIndex(insertionIndex, "["+s+"] " + title, FILTER_TOGGLE, "dyn"+s);
|
||||
menu->setUserGroupLeft(insertionIndex, createMenuCheckBox(FILTER_TOGGLE, "dyn"+s, pi.ChatInput.DynamicChat[i].isListeningWindow(cw)));
|
||||
++insertionIndex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -2910,6 +3021,13 @@ class CHandlerChatSourceSelected : public IActionHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (nlstricmp(sParams.substr(0, 3), "dyn") == 0)
|
||||
{
|
||||
uint8 i = 0;
|
||||
fromString(sParams.substr(3), i);
|
||||
if (ci.DynamicChat[i].isListeningWindow(cw)) ci.DynamicChat[i].removeListeningWindow(cw);
|
||||
else ci.DynamicChat[i].addListeningWindow(cw);
|
||||
}
|
||||
}
|
||||
};
|
||||
REGISTER_ACTION_HANDLER( CHandlerChatSourceSelected, "chat_source_selected");
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
class CChatWindow;
|
||||
class CFilteredChatSummary;
|
||||
|
||||
class CFilteredDynChatSummary;
|
||||
|
||||
// ***************************************************************************
|
||||
#define TEAM_DB_PATH "SERVER:GROUP"
|
||||
|
@ -238,6 +238,11 @@ public:
|
|||
// restore infos about user chats
|
||||
bool loadUserChatsInfos(NLMISC::IStream &f);
|
||||
|
||||
// save info about user dyn chats
|
||||
bool saveUserDynChatsInfos(NLMISC::IStream &f);
|
||||
// restore info about user dyn chats
|
||||
bool loadUserDynChatsInfos(NLMISC::IStream &f);
|
||||
|
||||
// remove all the user chats
|
||||
void removeAllUserChats();
|
||||
|
||||
|
@ -281,9 +286,12 @@ private:
|
|||
//
|
||||
// build summary about a filtered chat
|
||||
void buildFilteredChatSummary(const CFilteredChat &src, CFilteredChatSummary &dest);
|
||||
void buildFilteredDynChatSummary(const CFilteredChat &src, CFilteredDynChatSummary &dest);
|
||||
void saveFilteredChat(NLMISC::IStream &f, const CFilteredChat &src);
|
||||
void saveFilteredDynChat(NLMISC::IStream &f, const CFilteredChat &src);
|
||||
// setup a user chat from its summary
|
||||
void setupUserChatFromSummary(const CFilteredChatSummary &summary, CFilteredChat &dest);
|
||||
void setupUserDynChatFromSummary(const CFilteredDynChatSummary &summary, CFilteredChat &dest);
|
||||
private:
|
||||
// Contact waiting their name (received by string_manager) to be added
|
||||
struct SWaitingContact
|
||||
|
|
|
@ -508,7 +508,7 @@ void CSkillManager::onSkillChange()
|
|||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CSkillManager::checkTitleUnblocked(CHARACTER_TITLE::ECharacterTitle i)
|
||||
void CSkillManager::checkTitleUnblocked(CHARACTER_TITLE::ECharacterTitle i, bool show_message)
|
||||
{
|
||||
if (isTitleReserved(i)) return;
|
||||
|
||||
|
@ -581,7 +581,7 @@ void CSkillManager::checkTitleUnblocked(CHARACTER_TITLE::ECharacterTitle i)
|
|||
if (!IngameDbMngr.initInProgress())
|
||||
{
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
if (bAllUnblocked)
|
||||
if (bAllUnblocked && show_message)
|
||||
{
|
||||
// This is a new title, send a message
|
||||
string titleStr = CHARACTER_TITLE::toString((CHARACTER_TITLE::ECharacterTitle)i);
|
||||
|
@ -682,7 +682,7 @@ void CSkillManager::tryToUnblockTitleFromSkill(SKILLS::ESkills eSkill, sint32 va
|
|||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CSkillManager::tryToUnblockTitleFromBricks()
|
||||
void CSkillManager::tryToUnblockTitleFromBricks(bool show_message)
|
||||
{
|
||||
CSBrickManager *pSBM = CSBrickManager::getInstance();
|
||||
|
||||
|
@ -703,7 +703,7 @@ void CSkillManager::tryToUnblockTitleFromBricks()
|
|||
}
|
||||
}
|
||||
|
||||
checkTitleUnblocked((CHARACTER_TITLE::ECharacterTitle)i);
|
||||
checkTitleUnblocked((CHARACTER_TITLE::ECharacterTitle)i, show_message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -763,7 +763,7 @@ void CSkillManager::tryToUnblockTitleFromMaxFames( uint32 factionIndex, sint32 f
|
|||
|
||||
|
||||
// ***************************************************************************
|
||||
void CSkillManager::tryToUnblockTitleFromCiv()
|
||||
void CSkillManager::tryToUnblockTitleFromCiv(bool show_message)
|
||||
{
|
||||
for (uint i = 0; i < CHARACTER_TITLE::NB_CHARACTER_TITLE; ++i)
|
||||
{
|
||||
|
@ -796,12 +796,12 @@ void CSkillManager::tryToUnblockTitleFromCiv()
|
|||
}
|
||||
}
|
||||
}
|
||||
checkTitleUnblocked((CHARACTER_TITLE::ECharacterTitle)i);
|
||||
checkTitleUnblocked((CHARACTER_TITLE::ECharacterTitle)i, show_message);
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CSkillManager::tryToUnblockTitleFromCult()
|
||||
void CSkillManager::tryToUnblockTitleFromCult(bool show_message)
|
||||
{
|
||||
|
||||
for (uint i = 0; i < CHARACTER_TITLE::NB_CHARACTER_TITLE; ++i)
|
||||
|
@ -835,7 +835,7 @@ void CSkillManager::tryToUnblockTitleFromCult()
|
|||
}
|
||||
}
|
||||
}
|
||||
checkTitleUnblocked((CHARACTER_TITLE::ECharacterTitle)i);
|
||||
checkTitleUnblocked((CHARACTER_TITLE::ECharacterTitle)i, show_message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -933,7 +933,7 @@ void CSkillManager::tryToUnblockTitleFromRingRatings( uint32 authorRating, uint3
|
|||
}
|
||||
|
||||
// ***************************************************************************
|
||||
void CSkillManager::tryToUnblockTitleFromItems()
|
||||
void CSkillManager::tryToUnblockTitleFromItems(bool show_message)
|
||||
{
|
||||
if (IngameDbMngr.initInProgress())
|
||||
return;
|
||||
|
@ -1007,7 +1007,7 @@ void CSkillManager::tryToUnblockTitleFromItems()
|
|||
if (allItemsFromListValidated != _TitlesUnblocked[i].UnblockedItemLists[j])
|
||||
{
|
||||
_TitlesUnblocked[i].UnblockedItemLists[j] = allItemsFromListValidated;
|
||||
checkTitleUnblocked((CHARACTER_TITLE::ECharacterTitle)i);
|
||||
checkTitleUnblocked((CHARACTER_TITLE::ECharacterTitle)i, show_message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1077,10 +1077,11 @@ public:
|
|||
virtual void execute(CCtrlBase * /* pCaller */, const string &/* Params */)
|
||||
{
|
||||
CSkillManager *pSM = CSkillManager::getInstance();
|
||||
pSM->tryToUnblockTitleFromBricks();
|
||||
pSM->tryToUnblockTitleFromCiv();
|
||||
pSM->tryToUnblockTitleFromCult();
|
||||
pSM->tryToUnblockTitleFromItems();
|
||||
// Try to unblock titles without showing the new title message
|
||||
pSM->tryToUnblockTitleFromBricks(false);
|
||||
pSM->tryToUnblockTitleFromCiv(false);
|
||||
pSM->tryToUnblockTitleFromCult(false);
|
||||
pSM->tryToUnblockTitleFromItems(false);
|
||||
|
||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
||||
CDBGroupComboBox *pCB = dynamic_cast<CDBGroupComboBox*>(pIM->getElementFromId(GROUP_TITLE_COMBO));
|
||||
|
|
|
@ -128,16 +128,16 @@ public:
|
|||
void tryToUnblockTitleFromSkill(SKILLS::ESkills eSkill, sint32 value);
|
||||
|
||||
/// The same but with parsing all bricks wanted
|
||||
void tryToUnblockTitleFromBricks();
|
||||
void tryToUnblockTitleFromBricks(bool show_message = true);
|
||||
|
||||
/// The same but with civ allegiance
|
||||
void tryToUnblockTitleFromCiv();
|
||||
void tryToUnblockTitleFromCiv(bool show_message = true);
|
||||
|
||||
/// The same but with cult allegiance
|
||||
void tryToUnblockTitleFromCult();
|
||||
void tryToUnblockTitleFromCult(bool show_message = true);
|
||||
|
||||
/// The same but with parsing all items wanted
|
||||
void tryToUnblockTitleFromItems();
|
||||
void tryToUnblockTitleFromItems(bool show_message = true);
|
||||
|
||||
/// Called when a fame changes to look if we can unblock a title
|
||||
void tryToUnblockTitleFromMinFames(uint32 factionIndex, sint32 fameValue);
|
||||
|
@ -242,7 +242,7 @@ private:
|
|||
};
|
||||
|
||||
std::vector<SUnblockingTitle> _TitlesUnblocked;
|
||||
void checkTitleUnblocked(CHARACTER_TITLE::ECharacterTitle i);
|
||||
void checkTitleUnblocked(CHARACTER_TITLE::ECharacterTitle i, bool show_message = true);
|
||||
|
||||
uint8 _CurrentTitle;
|
||||
std::vector<sint32> _UIUnblockedTitles;
|
||||
|
|
|
@ -368,6 +368,7 @@ void impulseUserChars(NLMISC::CBitMemStream &impulse)
|
|||
// read privileges
|
||||
readPrivileges(impulse);
|
||||
impulse.serial(FreeTrial);
|
||||
FreeTrial = false;
|
||||
impulse.serialCont(Mainlands);
|
||||
userChar = true;
|
||||
|
||||
|
@ -666,7 +667,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
|
|||
string entry="UI:SAVE:CHAT:COLORS:";
|
||||
switch(mode)
|
||||
{
|
||||
case CChatGroup::dyn_chat: // dyn_chat takes the color of say
|
||||
case CChatGroup::dyn_chat: entry+="DYN"; break;
|
||||
case CChatGroup::say: entry+="SAY"; break;
|
||||
case CChatGroup::shout: entry+="SHOUT"; break;
|
||||
case CChatGroup::team: entry+="GROUP"; break;
|
||||
|
@ -764,7 +765,35 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
|
|||
// if found, display, else discarded
|
||||
if(dbIndex >= 0 && dbIndex < CChatGroup::MaxDynChanPerPlayer)
|
||||
{
|
||||
// Add dyn chan number before string
|
||||
ucstring prefix = "[" + NLMISC::toString(dbIndex) + "]";
|
||||
// Find position to put the new string
|
||||
// After timestamp?
|
||||
size_t pos = finalString.find(ucstring("]"));
|
||||
if (pos == ucstring::npos)
|
||||
{
|
||||
// No timestamp, so put it right after the color and add a space
|
||||
pos = finalString.find(ucstring("}"));
|
||||
prefix += " ";
|
||||
}
|
||||
finalString = finalString.substr(0, pos + 1) + prefix + finalString.substr(pos + 1);
|
||||
PeopleInterraction.ChatInput.DynamicChat[dbIndex].displayMessage(finalString, col, 2, &windowVisible);
|
||||
// Add optionally dynchannel name before text so that the chat log
|
||||
// will show the correct string if enabled.
|
||||
CCDBNodeLeaf* node = pIM->getDbProp("UI:SAVE:CHAT:SHOW_DYN_CHANNEL_NAME_IN_CHAT_CB", false);
|
||||
if (node && pIM->getLogState() && node->getValueBool())
|
||||
{
|
||||
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dbIndex);
|
||||
ucstring title;
|
||||
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
|
||||
if ( ! title.empty())
|
||||
{
|
||||
prefix = " " + title;
|
||||
}
|
||||
// Put the new prefix in the correct position
|
||||
size_t pos = finalString.find(ucstring("] "));
|
||||
finalString = finalString.substr(0, pos) + prefix + finalString.substr(pos);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3775,12 +3804,12 @@ bool CNetManager::update()
|
|||
{
|
||||
nldebug("CNetManager::update : Lag detected.");
|
||||
}
|
||||
// Lag detected.
|
||||
// Probe received.
|
||||
else if(change.Property == ProbeReceived)
|
||||
{
|
||||
nldebug("CNetManager::update : Probe Received.");
|
||||
}
|
||||
// Lag detected.
|
||||
// Connection ready.
|
||||
else if(change.Property == ConnectionReady)
|
||||
{
|
||||
nldebug("CNetManager::update : Connection Ready.");
|
||||
|
|
Loading…
Reference in a new issue