From 19fa9a35dc7bcf706ee8069218541da2bb721d6f Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 5 Mar 2012 18:56:30 +0100 Subject: [PATCH] Changed: #1433 Merge changes from patch 1.13 --- .../src/interface_v3/action_handler_help.cpp | 9 +++++ .../client/src/interface_v3/guild_manager.cpp | 10 ++++-- .../src/interface_v3/people_interraction.cpp | 13 ++++--- .../client/src/string_manager_client.cpp | 35 ++++++++++++------- code/ryzom/client/src/string_manager_client.h | 1 + .../player_manager/character.cpp | 30 ++++++---------- 6 files changed, 59 insertions(+), 39 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_help.cpp b/code/ryzom/client/src/interface_v3/action_handler_help.cpp index ddcb324d7..dfd923dea 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -251,8 +251,10 @@ CInterfaceGroup *CInterfaceHelp::activateNextWindow(CDBCtrlSheet *elt, sint forc CDBCtrlSheet *ctrlSrc= elt; // get the ctrl sheet in this help window. CDBCtrlSheet *ctrlDst= dynamic_cast(group->getCtrl(":ctrl_slot")); + bool showSlotAndCreator = false; if(ctrlDst && ctrlSrc) { + showSlotAndCreator = true; // if same Aspect if( ctrlSrc->sameAspect(ctrlDst) ) { @@ -277,6 +279,13 @@ CInterfaceGroup *CInterfaceHelp::activateNextWindow(CDBCtrlSheet *elt, sint forc } } } + + CInterfaceElement *ctrl = group->getElement(group->getId()+":content:ctrl_slot"); + if (ctrl) ctrl->setActive(showSlotAndCreator); + ctrl = group->getElement(group->getId()+":content:creator"); + if (ctrl) ctrl->setActive(showSlotAndCreator); + ctrl = group->getElement(group->getId()+":content:creator_header"); + if (ctrl) ctrl->setActive(showSlotAndCreator); } // If some free window possible, search which to take diff --git a/code/ryzom/client/src/interface_v3/guild_manager.cpp b/code/ryzom/client/src/interface_v3/guild_manager.cpp index 8d0066816..209e85ab2 100644 --- a/code/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/code/ryzom/client/src/interface_v3/guild_manager.cpp @@ -370,8 +370,14 @@ void CGuildManager::update() { for (uint j = 0; j < CachedGuildMembers.size(); ++j) { - if ((CachedGuildMembers[j].Name == _GuildMembers[i].Name) && - (CachedGuildMembers[j].Online != _GuildMembers[i].Online)) + // Status change is from offline to online/abroad online or vice versa. + TCharConnectionState prevState = CachedGuildMembers[j].Online; + TCharConnectionState curState = _GuildMembers[i].Online; + bool showMsg = (prevState != curState) && + (CachedGuildMembers[j].Name == _GuildMembers[i].Name) && + (prevState == ccs_offline || curState == ccs_offline); + + if (showMsg) { ucstring msg = (_GuildMembers[i].Online != ccs_offline) ? onlineMessage : offlineMessage; strFindReplace(msg, "%s", _GuildMembers[i].Name); diff --git a/code/ryzom/client/src/interface_v3/people_interraction.cpp b/code/ryzom/client/src/interface_v3/people_interraction.cpp index a6f5f8e31..ba67661bf 100644 --- a/code/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/code/ryzom/client/src/interface_v3/people_interraction.cpp @@ -1420,11 +1420,9 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS sint index = FriendList.getIndexFromContactId(contactId); if (index != -1) { + // Only do work if online status has changed if (FriendList.getOnline(index) != online) { - // Only do work if online status has changed - FriendList.setOnline(index, online); - CCDBNodeLeaf* node = CInterfaceManager::getInstance()->getDbProp("UI:SAVE:CHAT:SHOW_ONLINE_OFFLINE_NOTIFICATIONS_CB", false); if (node && node->getValueBool()) { @@ -1441,8 +1439,11 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS } } - // Player is not in my guild - if (bOnlyFriend) + TCharConnectionState prevState = FriendList.getOnline(index); + bool showMsg = bOnlyFriend && (prevState == ccs_offline || online == ccs_offline); + + // Player is not in my guild, and the status change is from offline to online/abroad online or vice versa. + if (showMsg) { ucstring msg = (online != ccs_offline) ? CI18N::get("uiPlayerOnline") : CI18N::get("uiPlayerOffline"); strFindReplace(msg, "%s", FriendList.getName(index)); @@ -1458,6 +1459,8 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS PeopleInterraction.ChatInput.AroundMe.displayMessage(msg, col, 2, &dummy); } } + + FriendList.setOnline(index, online); } } } diff --git a/code/ryzom/client/src/string_manager_client.cpp b/code/ryzom/client/src/string_manager_client.cpp index dd79da45e..fb7d5187d 100644 --- a/code/ryzom/client/src/string_manager_client.cpp +++ b/code/ryzom/client/src/string_manager_client.cpp @@ -1605,29 +1605,38 @@ const ucchar *CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CShee // *************************************************************************** const ucchar *CStringManagerClient::getTitleLocalizedName(const std::string &titleId, bool women) { - const ucchar * infos = getSpecialWord(titleId, women); - ucstring infosUC(infos); + vector listInfos = getTitleInfos(titleId, women); - vector listInfos; - splitUCString(infosUC, ucstring("#"), listInfos); - if (listInfos.empty()) - return infos; - - _TitleWords.push_back(listInfos[0]); - return _TitleWords.back().c_str(); + if (listInfos.size() > 0) + { + _TitleWords.push_back(listInfos[0]); + return _TitleWords.back().c_str(); + } + + ucstring ucId; + ucId.fromUtf8(titleId); + return ucId.c_str(); } +// *************************************************************************** vector CStringManagerClient::getTitleInfos(const std::string &titleId, bool women) { - const ucchar * infos = getSpecialWord(titleId, women); - ucstring infosUC(infos); - + ucstring infosUC; + infosUC.fromUtf8(titleId); vector listInfos; splitUCString(infosUC, ucstring("#"), listInfos); + + if (listInfos.size() > 0) + { + string title = listInfos[0].toUtf8(); + if (titleId[0] == '#') + title = "#" + title; + listInfos[0] = getSpecialWord(title, women); + } + return listInfos; } - // *************************************************************************** const ucchar *CStringManagerClient::getClassificationTypeLocalizedName(EGSPD::CClassificationType::TClassificationType type) { diff --git a/code/ryzom/client/src/string_manager_client.h b/code/ryzom/client/src/string_manager_client.h index 13f8188bb..0f34e24ac 100644 --- a/code/ryzom/client/src/string_manager_client.h +++ b/code/ryzom/client/src/string_manager_client.h @@ -108,6 +108,7 @@ public: // Get the Localized Title name static const ucchar *getTitleLocalizedName(const std::string &titleId, bool women); static std::vector getTitleInfos(const std::string &titleId, bool women); + // Get the Localized name of a classification type static const ucchar *getClassificationTypeLocalizedName(EGSPD::CClassificationType::TClassificationType type); diff --git a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp index a0cb96016..383d835a7 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/character.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/character.cpp @@ -11423,7 +11423,7 @@ void CCharacter::setBerserkFlag(bool isBerserk) } else { - sint8 percentTmp = sint8( (100.0 * ( target->getPhysScores()._PhysicalScores[ SCORES::hit_points ].Current ) ) / ( target->getPhysScores()._PhysicalScores[ SCORES::hit_points ].Max ) ); + sint8 percentTmp = sint8( (127.0 * ( target->getPhysScores()._PhysicalScores[ SCORES::hit_points ].Current ) ) / ( target->getPhysScores()._PhysicalScores[ SCORES::hit_points ].Max ) ); if( percentTmp < 0 ) percent = 0; else @@ -14846,16 +14846,12 @@ void CCharacter::addRoomAccessToPlayer(const NLMISC::CEntityId &id) //-------------------------------------------------------------- void CCharacter::addPlayerToFriendList(const NLMISC::CEntityId &id) { - /*// if player not found - if (id == CEntityId::Unknown || PlayerManager.getChar(id)==NULL) + // if player not found + if (id == CEntityId::Unknown) { - if ( ! (IShardUnifierEvent::getInstance() && IShardUnifierEvent::getInstance()->isCharacterOnlineAbroad(id))) - { - // player not found => message - PHRASE_UTILITIES::sendDynamicSystemMessage( _EntityRowId, "OPERATION_OFFLINE"); - return; - } - }*/ + PHRASE_UTILITIES::sendDynamicSystemMessage( _EntityRowId, "OPERATION_OFFLINE"); + return; + } // check not already in list const uint size = (uint)_FriendsList.size(); @@ -14923,15 +14919,11 @@ void CCharacter::addPlayerToFriendList(const NLMISC::CEntityId &id) void CCharacter::addPlayerToLeagueList(const NLMISC::CEntityId &id) { // if player not found - /*if (id == CEntityId::Unknown || PlayerManager.getChar(id)==NULL) + if (id == CEntityId::Unknown) { - if ( ! (IShardUnifierEvent::getInstance() && IShardUnifierEvent::getInstance()->isCharacterOnlineAbroad(id))) - { - // player not found => message - PHRASE_UTILITIES::sendDynamicSystemMessage( _EntityRowId, "OPERATION_OFFLINE"); - return; - } - }*/ + PHRASE_UTILITIES::sendDynamicSystemMessage( _EntityRowId, "OPERATION_OFFLINE"); + return; + } // check not already in list const uint size = _LeagueList.size(); @@ -14972,7 +14964,7 @@ void CCharacter::addPlayerToLeagueList(const NLMISC::CEntityId &id) if ( ! GenericMsgManager.pushNameToStream( "TEAM:CONTACT_CREATE", bms) ) { - nlwarning(" Msg name TEAM:CONTACT_CREATE not found"); + nlwarning(" Msg name TEAM:CONTACT_CREATE not found"); return; }