Merge fixes from core branch

feature/core4-atys
kaetemi 4 years ago
parent ca54ba7934
commit 41e4f6800f
No known key found for this signature in database
GPG Key ID: 9873C4D40BB479BC

@ -4520,24 +4520,25 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", "<user id> <chan
CPVPManager2 *inst = CPVPManager2::getInstance();
string pass;
string name = toLower(args[1]);
TChanID channel = inst->getUserDynChannel(name);
string name = args[1];
string nameLwr = toCaseInsensitive(args[1]);
TChanID channel = inst->getUserDynChannel(nameLwr);
if (args.size() < 3)
pass = toLower(name);
pass = nameLwr;
else
pass = args[2];
if ( (channel == DYN_CHAT_INVALID_CHAN) && (pass != string("*")) && (pass != string("***")) )
channel = inst->createUserChannel(name, pass);
if ( (channel == DYN_CHAT_INVALID_CHAN) && (pass != nlstr("*")) && (pass != nlstr("***")) )
channel = inst->createUserChannel(nameLwr, pass);
if (channel != DYN_CHAT_INVALID_CHAN)
{
string channelPass = inst->getPassUserChannel(channel);
if ( pass == string("***") && (c->havePriv(":DEV:") || c->havePriv(":SGM:") || c->havePriv(":GM:") || c->havePriv(":EM:")))
if ( pass == nlstr("***") && (c->havePriv(":DEV:") || c->havePriv(":SGM:") || c->havePriv(":GM:") || c->havePriv(":EM:")))
{
inst->deleteUserChannel(name);
inst->deleteUserChannel(nameLwr);
}
else if (channelPass == pass)
{
@ -4548,7 +4549,7 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", "<user id> <chan
}
inst->addFactionChannelToCharacter(channel, c, true, true);
}
else if (pass == string("*"))
else if (pass == nlstr("*"))
{
inst->removeFactionChannelForCharacter(channel, c, true);
}
@ -4556,7 +4557,7 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", "<user id> <chan
{
SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal);
params[0].Literal = name;
CCharacter::sendDynamicSystemMessage( eid, "EGS_CHANNEL_NO_RIGHTS", params );
CCharacter::sendDynamicSystemMessage( eid, nlstr("EGS_CHANNEL_NO_RIGHTS"), params );
}
return true;
@ -4564,7 +4565,7 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", "<user id> <chan
SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal);
params[0].Literal = name;
CCharacter::sendDynamicSystemMessage( eid, "EGS_CHANNEL_INVALID_NAME", params );
CCharacter::sendDynamicSystemMessage( eid, nlstr("EGS_CHANNEL_INVALID_NAME"), params );
return false;
}
@ -6802,9 +6803,9 @@ ENTITY_VARIABLE (FullPVP, "Full Pvp Mode")
}
else
{
if (value=="1" || value=="on" || toLower(value)=="pvp" || toLower(value)=="true" )
if (value=="1" || value=="on" || toLowerAscii(value)=="pvp" || toLowerAscii(value)=="true" )
c->setFullPVP(true);
else if (value=="0" || value=="off" || toLower(value)=="false" )
else if (value=="0" || value=="off" || toLowerAscii(value)=="false" )
c->setFullPVP(false);
// c->setPVPRecentActionFlag();
CPVPManager2::getInstance()->setPVPModeInMirror(c);

@ -1980,7 +1980,7 @@ void cbClientSendCustomEmote( NLNET::CMessage& msgin, const std::string &service
return;
}
if(behaviour >= 140 && behaviour <= 169)
if (behaviour >= (MBEHAV::EMOTE_BEGIN + 80) && behaviour <= (MBEHAV::EMOTE_BEGIN + 109))
{
string name = CEntityIdTranslator::getInstance()->getByEntity(id).toString();
nlwarning("HACK: %s %s tries to launch a firework %d", id.toString().c_str(), name.c_str(), behaviour);

@ -53,7 +53,7 @@ void cbStallShard( NLNET::CMessage& msgin, const std::string &serviceName, NLNET
msgin.serial( filename );
nlwarning("Backup service send Stall order when trying write %s file", filename.c_str() );
PlayerManager.broadcastMessage( 2, 0, 5, "Technical problem occured on the server,");
PlayerManager.broadcastMessage( 2, 0, 5, "Technical problem occurred on the server,");
PlayerManager.broadcastMessage( 2, 0, 5, "All non administrator accounts are disconnected immediately.");
PlayerManager.broadcastMessage( 2, 0, 5, "Customer Support is already working on it.");
PlayerManager.broadcastMessage( 2, 0, 5, "Sorry for any inconveniences.");

@ -586,7 +586,7 @@ void CDeposit::selectRMsByFilters( std::vector<std::string>& exactRMCodesS, cons
if ( ! depositReportCreated )
{
depositReportCreated = true;
depositReportFile = fopen( "deposit_contents.csv", "wt" ); // fclose() auto?
depositReportFile = nlfopen( "deposit_contents.csv", "wt" ); // fclose() auto?
if ( depositReportFile )
{
fprintf( depositReportFile, "Deposit;RM;When in year;When in day;Weather;\n" );

@ -27,7 +27,7 @@ class CStaticWorld
{
public:
/// Serialisation
void serial(class NLMISC::IStream &f);
void serial(NLMISC::IStream &f);
/// read georges sheet
void readGeorges (const NLMISC::CSmartPtr<NLGEORGES::UForm> &form, const NLMISC::CSheetId &sheetId);

@ -1004,6 +1004,10 @@ void CPlayerService::egsAddMonkeyPlayer()
}
idx++;
}
else
{
return;
}
}
if( PlayerManager.getPlayer( userId ) != 0 )
@ -3938,7 +3942,8 @@ NLMISC_COMMAND( db, "Display or set the value of a property in the database", "<
{
// Set
sint64 value;
sscanf( args[2].c_str(), "%" NL_I64 "d", &value );
fromString(args[2], value);
if ( (args.size() > 3) && (args[3]!="0") )
{
res = e->_PropertyDatabase.x_setPropButDontSend( entry, value );

@ -194,7 +194,7 @@ void CInventoryUpdaterForCharacter::resetItemIntoClassicDatabase( INVENTORIES::
arrayItem.setSHEET(*_PropertyDatabasePt, CSheetId::Unknown);
arrayItem.setQUALITY(*_PropertyDatabasePt, 0);
arrayItem.setQUANTITY(*_PropertyDatabasePt, 0);
arrayItem.setUSER_COLOR(*_PropertyDatabasePt, 0);
arrayItem.setUSER_COLOR(*_PropertyDatabasePt, 1);
// arrayItem.setLOCKED(_PropertyDatabasePt, 0);
arrayItem.setWEIGHT(*_PropertyDatabasePt, 0);
arrayItem.setNAMEID(*_PropertyDatabasePt, 0);

@ -971,6 +971,11 @@ NLMISC_COMMAND(buildSpire, "build a spire","<Eid> <region>")
x = 11105.0f;
y = -4400.0f;
}
else
{
log.displayNL( "buildSpire : Invalid region '%s'", args[1].c_str() );
return true;
}
NLMISC::CVector vec( x, y, 0.0f );
@ -1035,6 +1040,11 @@ NLMISC_COMMAND(destroySpire, "destroy a spire","<region>")
x = 11105.0f;
y = -4400.0f;
}
else
{
log.displayNL( "destroySpire : Invalid region '%s'", args[1].c_str() );
return true;
}
NLMISC::CVector vec( x, y, 0.0f );

@ -471,10 +471,12 @@ void CPVPManager2::addFactionChannelToCharacter(TChanID channel, CCharacter * us
{
if (DynChatEGS.addSession(channel, user->getEntityRowId(), writeRight))
{
#ifdef HAVE_MONGO
string playerName = CEntityIdTranslator::getInstance()->getByEntity(user->getId()).toString();
string::size_type pos = playerName.find('(');
if (pos != string::npos)
playerName = playerName.substr(0, pos);
#endif
std::vector<TChanID> currentChannels = getCharacterRegisteredChannels(user);
currentChannels.push_back(channel);
_CharacterChannels.erase(user->getId());
@ -502,7 +504,11 @@ void CPVPManager2::addFactionChannelToCharacter(TChanID channel, CCharacter * us
(*it).second.push_back(user->getId());
}
#ifndef HAVE_MONGO
const string playerName = CEntityIdTranslator::getInstance()->getByEntity(user->getId()).toString();
#endif
broadcastMessage(channel, string("<INFO>"), "<-- "+playerName);
sendChannelUsers(channel, user);
}
}
@ -512,23 +518,35 @@ void CPVPManager2::addFactionChannelToCharacter(TChanID channel, CCharacter * us
//----------------------------------------------------------------------------
void CPVPManager2::removeFactionChannelForCharacter(TChanID channel, CCharacter * user, bool userChannel)
{
const string channelName = DynChatEGS.getChanNameFromID(channel);
std::vector<TChanID> currentChannels;
#ifdef HAVE_MONGO
const string channelName = DynChatEGS.getChanNameFromID(channel);
string playerName = CEntityIdTranslator::getInstance()->getByEntity(user->getId()).toString();
string::size_type pos = playerName.find('(');
if (pos != string::npos)
playerName = playerName.substr(0, pos);
#endif
if (channel == DYN_CHAT_INVALID_CHAN) // Send leaves message to all user channels
{
currentChannels = getCharacterUserChannels(user);
for (uint i = 0; i < currentChannels.size(); i++)
{
#ifndef HAVE_MONGO
const string playerName = CEntityIdTranslator::getInstance()->getByEntity(user->getId()).toString();
#endif
broadcastMessage(currentChannels[i], string("<INFO>"), playerName+" -->[]");
}
}
if (userChannel)
{
#ifndef HAVE_MONGO
const string playerName = CEntityIdTranslator::getInstance()->getByEntity(user->getId()).toString();
#endif
broadcastMessage(channel, string("<INFO>"), playerName+" -->[]");
}
currentChannels = getCharacterRegisteredChannels(user);
for (uint i = 0; i < currentChannels.size(); i++)
@ -613,19 +631,23 @@ void CPVPManager2::addRemoveFactionChannelToUserWithPriviledge(TChanID channel,
//----------------------------------------------------------------------------
void CPVPManager2::playerConnects(CCharacter * user)
{
#ifdef HAVE_MONGO
string playerName = CEntityIdTranslator::getInstance()->getByEntity(user->getId()).toString();
string::size_type pos = playerName.find('(');
if (pos != string::npos)
playerName = playerName.substr(0, pos);
#ifdef HAVE_MONGO
CMongo::update("ryzom_users", toString("{'name': '%s'}", playerName.c_str()), toString("{$set: {'cid': %" NL_I64 "u, 'guildId': %d, 'online': true} }", user->getId().getShortId(), user->getGuildId()), true);
#endif
std::vector<TChanID> currentChannels = getCharacterUserChannels(user);
for (uint i = 0; i < currentChannels.size(); i++)
{
#ifndef HAVE_MONGO
const string playerName = CEntityIdTranslator::getInstance()->getByEntity(user->getId()).toString();
#endif
broadcastMessage(currentChannels[i], string("<INFO>"), "<-- "+playerName);
}
}
//----------------------------------------------------------------------------

@ -61,6 +61,7 @@ CCharacterShoppingList::CCharacterShoppingList( CSmartPtr<CMerchant>& merchant,
//-----------------------------------------------------------------------------
CCharacterShoppingList::~CCharacterShoppingList()
{
TLogNoContext_Item noLog;
_CurrentTradeListNpc.clear();
_CurrentTradeListPlayer.clear();
_CurrentTradeListYours.clear();
@ -196,8 +197,11 @@ bool CCharacterShoppingList::passThruFilter(TItemTradePtr itemTrade, bool dynnam
{
const CStaticItem * form = CSheets::getForm( itemTrade->getSheetId() );
if (!_Character)
return false;
// No filter on Faction trade
if(_Character && _Character->getBotChatType() == BOTCHATTYPE::TradeFactionFlag)
if(_Character->getBotChatType() == BOTCHATTYPE::TradeFactionFlag)
return true;
if( form != 0 )
@ -650,7 +654,7 @@ void CCharacterShoppingList::fillTradePage( uint16 session )
tradeElem.setSERIAL(_Character->_PropertyDatabase, 0);
tradeElem.setCREATE_TIME(_Character->_PropertyDatabase, 0);
// _Character->_PropertyDatabase.setProp( NLMISC::toString("TRADING:%u:USER_COLOR",index ), 1);
tradeElem.setUSER_COLOR(_Character->_PropertyDatabase, 0);
tradeElem.setUSER_COLOR(_Character->_PropertyDatabase, 1);
// _Character->_PropertyDatabase.setProp( NLMISC::toString("TRADING:%u:WEIGHT",index ), 0 );
tradeElem.setWEIGHT(_Character->_PropertyDatabase, 0);
// _Character->_PropertyDatabase.setProp( NLMISC::toString("TRADING:%u:NAMEID",index ), 0 );

@ -425,6 +425,7 @@ void CDynamicItems::tickUpdate()
COfflineCharacterCommand::getInstance()->addOfflineCommand( command );
}
TLogNoContext_Item noLog;
subVec[_NextItemToCheck] = subVec.back();
subVec.pop_back();
TotalNbItemsForSale = --_TotalNbItemsForSale;

@ -110,6 +110,7 @@ void CItemsForSale::serial(NLMISC::IStream &f)
//-----------------------------------------------------------------------------
void CItemsForSale::checkSellStore( CEntityId charId )
{
TLogContext_Item_CheckSaleStore itemStoreContext(charId);
std::vector< TItemTradePtr > itemsForSaleOfCharacter;
std::vector< TItemTradePtr > itemsOfCharacterMustBeRemoved;
CDynamicItems::getInstance()->getItemsOfCharacter( charId, itemsForSaleOfCharacter );

@ -1046,7 +1046,7 @@ void CShopTypeManager::addTpShopBase( uint32 shopCategoryNumber, uint32 ecosyste
//----------------------------------------------------------------------------
void CShopTypeManager::addShopBase( uint32 shopCategoryNumber, CMerchant& merchant, std::vector< uint32 >& rmSelector, std::vector< uint32 >& originSelector, std::vector< uint32 >& qualitySelector, std::vector< uint32 >& levelSelector, std::vector< uint32 >& shopTypeSelector )
{
TShopTypeSelected shopTypeSelected;
TShopTypeSelected shopTypeSelected = InvalidShopSelected;
if( shopTypeSelector.size() == 0 )
{
shopTypeSelected = AllShopSelected;
@ -1055,15 +1055,15 @@ void CShopTypeManager::addShopBase( uint32 shopCategoryNumber, CMerchant& mercha
{
for( uint32 i = 0; i < shopTypeSelector.size(); ++i )
{
if( _CategoryName[ shopTypeSelector[ i ] ] == string("STATIC_SHOP") )
if( _CategoryName[ shopTypeSelector[ i ] ] == "STATIC_SHOP" )
{
shopTypeSelected = StaticShopSelected;
}
else if( _CategoryName[ shopTypeSelector[ i ] ] == string("DYNAMIC_SHOP") )
else if( _CategoryName[ shopTypeSelector[ i ] ] == "DYNAMIC_SHOP" )
{
shopTypeSelected = DynamicShopSelected;
}
else if( _CategoryName[ shopTypeSelector[ i ] ] == string("STATIC_DYNAMIC_SHOP") )
else if( _CategoryName[ shopTypeSelector[ i ] ] == "STATIC_DYNAMIC_SHOP" )
{
shopTypeSelected = AllShopSelected;
}

@ -54,7 +54,7 @@ class CShopTypeManager : public NLMISC::CEvalNumExpr
{
public:
enum TShopTypeSelected { StaticShopSelected = 0, DynamicShopSelected, AllShopSelected };
enum TShopTypeSelected { StaticShopSelected = 0, DynamicShopSelected, AllShopSelected, InvalidShopSelected };
/// init / release class
static void initShopBase();

@ -264,7 +264,7 @@ bool CRewardSharing::userValidSelect(const TDataSetRow & userRow, uint8 state)
shareItem.setSERIAL(user->_PropertyDatabase, 0);
shareItem.setCREATE_TIME(user->_PropertyDatabase, 0);
// user->_PropertyDatabase.setProp( NLMISC::toString("INVENTORY:SHARE:%u:USER_COLOR",j), 0 );
shareItem.setUSER_COLOR(user->_PropertyDatabase, 0);
shareItem.setUSER_COLOR(user->_PropertyDatabase, 1);
// user->_PropertyDatabase.setProp( NLMISC::toString("INVENTORY:SHARE:%u:WEIGHT",j), 0 );
shareItem.setWEIGHT(user->_PropertyDatabase, 0);
// user->_PropertyDatabase.setProp( NLMISC::toString("INVENTORY:SHARE:%u:NAMEID",j), 0 );
@ -422,7 +422,7 @@ void CRewardSharing::setUsersDb()
shareItem.setSERIAL(user->_PropertyDatabase, 0);
shareItem.setCREATE_TIME(user->_PropertyDatabase, 0);
// user->_PropertyDatabase.setProp( NLMISC::toString("INVENTORY:SHARE:%u:USER_COLOR",j), 0 );
shareItem.setUSER_COLOR(user->_PropertyDatabase, 0);
shareItem.setUSER_COLOR(user->_PropertyDatabase, 1);
// user->_PropertyDatabase.setProp( NLMISC::toString("INVENTORY:SHARE:%u:WEIGHT",j), 0 );
shareItem.setWEIGHT(user->_PropertyDatabase, 0);
// user->_PropertyDatabase.setProp( NLMISC::toString("INVENTORY:SHARE:%u:NAMEID",j), 0 );

Loading…
Cancel
Save