diff --git a/code/ryzom/server/data_shard/mirror_sheets/fe_temp.dataset b/code/ryzom/server/data_shard/mirror_sheets/fe_temp.dataset index 442a9a2cf..4caf2d0b2 100644 --- a/code/ryzom/server/data_shard/mirror_sheets/fe_temp.dataset +++ b/code/ryzom/server/data_shard/mirror_sheets/fe_temp.dataset @@ -292,7 +292,7 @@ - + diff --git a/code/ryzom/server/src/entities_game_service/admin.cpp b/code/ryzom/server/src/entities_game_service/admin.cpp index be097a3c1..20941e77f 100644 --- a/code/ryzom/server/src/entities_game_service/admin.cpp +++ b/code/ryzom/server/src/entities_game_service/admin.cpp @@ -430,6 +430,78 @@ bool getAIInstanceFromGroupName(string& groupName, uint32& instanceNumber) return true; } +bool checkBannerPriv(const string &sheetName, CEntityId eid) +{ + + if (sheetName.find("banner") == string::npos) + { + // Not a banner + return true; + } + + CPlayer* player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) ); + + if (player == NULL) + { + return false; + } + + if (player->havePriv(":DEV:")) + { + // Dev should be able to get all banners + return true; + } + + if ( ! player->havePriv(BannerPriv)) + { + // Player has no banner privs + return false; + } + + if (sheetName.find("_gu") != string::npos) + { + if (player->havePriv(":G:")) + { + return true; + } + } + else if (sheetName.find("_sgu") != string::npos) + { + if (player->havePriv(":SG:")) + { + return true; + } + // VG uses SG banner for now + if (player->havePriv(":VG:")) + { + return true; + } + } + else if (sheetName.find("_vgu") != string::npos) + { + if (player->havePriv(":VG:")) + { + return true; + } + } + else if (sheetName.find("_gm") != string::npos) + { + if (player->havePriv(":GM:")) + { + return true; + } + } + else if (sheetName.find("_sgm") != string::npos) + { + if (player->havePriv(":SGM:")) + { + return true; + } + } + + return false; +} + CAdminCommand * findAdminCommand(const string & name) { H_AUTO(findAdminCommand); @@ -1381,18 +1453,12 @@ NLMISC_COMMAND (createItemInBag, "Create an item and put it in the player bag", } // banners are the only items in game which use privilege - if( sheetName.find("banner") != string::npos ) + // banners are the only items in game which use privilege + bool ok = checkBannerPriv(sheetName, eid); + if ( ! ok) { - CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) ); -// if (player != NULL && !player->havePriv(":DEV:") ) - if (player != NULL && player->havePriv(BannerPriv) ) - { - if( sheetName.find("_gu") != string::npos && !player->havePriv(":G:") ) return false; - if( sheetName.find("_sgu") != string::npos && !player->havePriv(":SG:") ) return false; - if( sheetName.find("_vgu") != string::npos && !player->havePriv(":VG:") ) return false; - if( sheetName.find("_gm") != string::npos && !player->havePriv(":GM:") ) return false; - if( sheetName.find("_sgm") != string::npos && !player->havePriv(":SGM:") ) return false; - } + log.displayNL("Invalid banner priviledge"); + return false; } const CStaticItem *form = CSheets::getForm (sheet); @@ -1472,17 +1538,11 @@ NLMISC_COMMAND (createItemInTmpInv, "Create an item and put it in the player tem } // banners are the only items in game which use privilege - if( sheetName.find("banner") != string::npos ) + bool ok = checkBannerPriv(sheetName, eid); + if ( ! ok) { - CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) ); - if (player != NULL && player->havePriv(BannerPriv) ) - { - if( sheetName.find("_gu") != string::npos && !player->havePriv(":G:") ) return false; - if( sheetName.find("_sgu") != string::npos && !player->havePriv(":SG:") ) return false; - if( sheetName.find("_vgu") != string::npos && !player->havePriv(":VG:") ) return false; - if( sheetName.find("_gm") != string::npos && !player->havePriv(":GM:") ) return false; - if( sheetName.find("_sgm") != string::npos && !player->havePriv(":SGM:") ) return false; - } + log.displayNL("Invalid banner priviledge"); + return false; } const CStaticItem *form = CSheets::getForm (sheet); @@ -1545,17 +1605,11 @@ NLMISC_COMMAND (createItemInInv, "Create items and put them in the given invento } // banners are the only items in game which use privilege - if( sheetName.find("banner") != string::npos ) + bool ok = checkBannerPriv(sheetName, eid); + if ( ! ok) { - CPlayer * player = PlayerManager.getPlayer( PlayerManager.getPlayerId(eid) ); - if (player != NULL && player->havePriv(BannerPriv) ) - { - if( sheetName.find("_gu") != string::npos && !player->havePriv(":G:") ) return false; - if( sheetName.find("_sgu") != string::npos && !player->havePriv(":SG:") ) return false; - if( sheetName.find("_vgu") != string::npos && !player->havePriv(":VG:") ) return false; - if( sheetName.find("_gm") != string::npos && !player->havePriv(":GM:") ) return false; - if( sheetName.find("_sgm") != string::npos && !player->havePriv(":SGM:") ) return false; - } + log.displayNL("Invalid banner priviledge"); + return false; } const CStaticItem *form = CSheets::getForm (sheet); @@ -4629,7 +4683,7 @@ CInventoryPtr getInv(CCharacter *c, const string &inv) return inventoryPtr; } -NLMISC_COMMAND (webExecCommand, "Execute a web command", " [] [] []") +NLMISC_COMMAND (webExecCommand, "Execute a web command", " [] [] []") { if (args.size() < 5) @@ -5516,7 +5570,7 @@ NLMISC_COMMAND (webExecCommand, "Execute a web command", " args2; - if (args.size() == 3 && args[3] != "0") + if (args.size() == 3 && args[2] != "0") { // Do the whole group args2.push_back(args[0]); 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 cca9cbb3b..05154028b 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 @@ -501,7 +501,7 @@ CCharacter::CCharacter(): CEntityBase(false), _TeamId= CTEAM::InvalidTeamId; ///init LeagueId - _LeagueId = TChanID::Unknown; + _LeagueId = DYN_CHAT_INVALID_CHAN; // init combat flags _CombatEventFlagTicks.resize(32); @@ -12482,10 +12482,15 @@ bool CCharacter::autoFillExchangeView() { invItem = playerBagInvPointer->getItem(inventoryIndex); if (invItem == NULL) - continue; + continue; + + if (invItem->getLockedByOwner()) + continue; + + if (invItem->getRefInventory() != NULL) + continue; itemsSeenCount++; - // Changed to support comparisons on sheetID masks if (invItem->getSheetId() == validateSteps[stepCounter].Sheet) { diff --git a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp index 012877931..6beb7b1b2 100644 --- a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp +++ b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.cpp @@ -210,6 +210,21 @@ std::vector CPVPManager2::getCharacterChannels(CCharacter * user) std::vector result; result.clear(); + // Add lang channel, should be first. + if (!user->getLangChannel().empty()) { + TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find(user->getLangChannel()); + if (it != _ExtraFactionChannel.end()) + { + result.push_back((*it).second); + } + } else { + TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("en"); + if (it != _ExtraFactionChannel.end()) + { + result.push_back((*it).second); + } + } + PVP_CLAN::TPVPClan faction = user->getAllegiance().first; if( faction != PVP_CLAN::Neutral ) { @@ -230,21 +245,6 @@ std::vector CPVPManager2::getCharacterChannels(CCharacter * user) } } - // Add lang channel - if (!user->getLangChannel().empty()) { - TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find(user->getLangChannel()); - if (it != _ExtraFactionChannel.end()) - { - result.push_back((*it).second); - } - } else { - TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find("en"); - if (it != _ExtraFactionChannel.end()) - { - result.push_back((*it).second); - } - } - /* bool matis = CFameInterface::getInstance().getFameIndexed(user->getId(), 0) >= PVPFameRequired*6000; bool fyros = CFameInterface::getInstance().getFameIndexed(user->getId(), 1) >= PVPFameRequired*6000; @@ -1112,11 +1112,11 @@ void CPVPManager2::onIOSMirrorUp() */ // Community Channels - createExtraFactionChannel("en"); - createExtraFactionChannel("fr"); - createExtraFactionChannel("de"); - createExtraFactionChannel("ru"); - createExtraFactionChannel("es"); + createExtraFactionChannel("en", true); + createExtraFactionChannel("fr", true); + createExtraFactionChannel("de", true); + createExtraFactionChannel("ru", true); + createExtraFactionChannel("es", true); for (uint i = PVP_CLAN::BeginClans; i <= PVP_CLAN::EndClans; i++) { @@ -1161,7 +1161,7 @@ void CPVPManager2::createFactionChannel(PVP_CLAN::TPVPClan clan) } } -void CPVPManager2::createExtraFactionChannel(const std::string & channelName) +void CPVPManager2::createExtraFactionChannel(const std::string & channelName, bool universalChannel) { TMAPExtraFactionChannel::iterator it = _ExtraFactionChannel.find(channelName); @@ -1171,6 +1171,7 @@ void CPVPManager2::createExtraFactionChannel(const std::string & channelName) TChanID factionChannelId = DynChatEGS.addLocalizedChan(name); // set historic size of the newly created channel DynChatEGS.setHistoricSize( factionChannelId, FactionChannelHistoricSize ); + DynChatEGS.setUniversalChannel( factionChannelId, universalChannel ); _ExtraFactionChannel.insert( make_pair(channelName, factionChannelId) ); } diff --git a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.h b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.h index 1207b1a11..9d24f1fe6 100644 --- a/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.h +++ b/code/ryzom/server/src/entities_game_service/pvp_manager/pvp_manager_2.h @@ -150,7 +150,7 @@ public: // create a faction channel if not already exist void createFactionChannel(PVP_CLAN::TPVPClan clan); // create an extra faction channel if not already exist (for marauders, agnos, urasiens and hominits) - void createExtraFactionChannel(const std::string & channelName); + void createExtraFactionChannel(const std::string & channelName, bool universalChannel = false); // create an user channel if not already exist TChanID createUserChannel(const std::string & channelName, const std::string & pass); // remove a user channel