Fixed: Server side issues
This commit is contained in:
parent
01585a53a7
commit
a09fce6fb3
4 changed files with 60 additions and 38 deletions
|
@ -91,6 +91,8 @@ void CRoomInstanceGuild::removeUser( CCharacter* user )
|
|||
return;
|
||||
}
|
||||
|
||||
user->sendUrl("app_ryzhome action=quit_guild_room&room_name="+guildBuilding->getName(), "");
|
||||
|
||||
--_RefCount;
|
||||
if ( _RefCount == 0 )
|
||||
{
|
||||
|
@ -104,9 +106,14 @@ void CRoomInstanceGuild::addUser( CCharacter* user, CCharacter* owner )
|
|||
{
|
||||
BOMB_IF( !user, "<BUILDING> null character!", return );
|
||||
|
||||
CBuildingPhysicalGuild * guildBuilding = dynamic_cast<CBuildingPhysicalGuild *>( _Building );
|
||||
BOMB_IF( !guildBuilding, "<BUILDING> building type does not match with room type", return );
|
||||
|
||||
// open guild inventory window
|
||||
PlayerManager.sendImpulseToClient(user->getId(), "GUILD:OPEN_INVENTORY");
|
||||
|
||||
user->sendUrl("app_ryzhome action=open_guild_room&owner="+ owner->getName().toString()+"&room_name="+guildBuilding->getName(), "");
|
||||
|
||||
++_RefCount;
|
||||
}
|
||||
|
||||
|
@ -141,20 +148,7 @@ void CRoomInstancePlayer::removeUser( CCharacter* user )
|
|||
return;
|
||||
}
|
||||
|
||||
TVectorParamCheck titleParams;
|
||||
TVectorParamCheck textParams;
|
||||
uint32 userId = PlayerManager.getPlayerId( user->getId() );
|
||||
std::string name = "CLOSE_URL";
|
||||
//send command to close webig
|
||||
ucstring phrase = ucstring("CLOSE_URL(){[WEB : app_ryzhome action=quit_room]}");
|
||||
NLNET::CMessage msgout("SET_PHRASE");
|
||||
msgout.serial(name);
|
||||
msgout.serial(phrase);
|
||||
sendMessageViaMirror("IOS", msgout);
|
||||
|
||||
uint32 titleId = STRING_MANAGER::sendStringToUser(userId, "web_transactions", titleParams);
|
||||
uint32 textId = STRING_MANAGER::sendStringToUser(userId, "CLOSE_URL", textParams);
|
||||
PlayerManager.sendImpulseToClient(user->getId(), "USER:POPUP", titleId, textId);
|
||||
user->sendUrl("app_ryzhome action=quit_player_room&room_name="+playerBuilding->getName(), "");
|
||||
|
||||
--_RefCount;
|
||||
if ( _RefCount == 0 )
|
||||
|
@ -170,6 +164,9 @@ void CRoomInstancePlayer::addUser( CCharacter* user, CCharacter* owner )
|
|||
{
|
||||
BOMB_IF( !user, "<BUILDING> null character!", return );
|
||||
|
||||
CBuildingPhysicalPlayer * playerBuilding = dynamic_cast<CBuildingPhysicalPlayer *>( _Building );
|
||||
BOMB_IF( !playerBuilding, "<BUILDING> building type does not match with room type", return );
|
||||
|
||||
// open room inventory window
|
||||
PlayerManager.sendImpulseToClient(user->getId(), "ITEM:OPEN_ROOM_INVENTORY");
|
||||
if (owner)
|
||||
|
@ -182,23 +179,7 @@ void CRoomInstancePlayer::addUser( CCharacter* user, CCharacter* owner )
|
|||
// Very rare case
|
||||
owner = user;
|
||||
}
|
||||
// solve bot names for title and text
|
||||
TVectorParamCheck titleParams;
|
||||
TVectorParamCheck textParams;
|
||||
// send the popup message
|
||||
uint32 userId = PlayerManager.getPlayerId( user->getId() );
|
||||
|
||||
std::string name = "RYZHOME_URL";
|
||||
ucstring phrase = "RYZHOME_URL(){[WEB : app_ryzhome user=" + owner->getName().toString() + "]}";
|
||||
NLNET::CMessage msgout("SET_PHRASE");
|
||||
msgout.serial(name);
|
||||
msgout.serial(phrase);
|
||||
sendMessageViaMirror("IOS", msgout);
|
||||
|
||||
uint32 titleId = STRING_MANAGER::sendStringToUser(userId, "web_transactions", titleParams);
|
||||
uint32 textId = STRING_MANAGER::sendStringToUser(userId, "RYZHOME_URL", textParams);
|
||||
PlayerManager.sendImpulseToClient(user->getId(), "USER:POPUP", titleId, textId);
|
||||
|
||||
user->sendUrl("app_ryzhome action=open_player_room&owner="+ owner->getName().toString()+"&room_name="+playerBuilding->getName(), "");
|
||||
|
||||
++_RefCount;
|
||||
}
|
||||
|
|
|
@ -50,14 +50,14 @@ void CDynChatEGS::init()
|
|||
{
|
||||
{ "DYN_CHAT:ADD_SERVICE_CHAN", CDynChatEGS::cbServiceAddChan },
|
||||
{ "DYN_CHAT:SET_HIDE_BUBBLE", CDynChatEGS::cbServiceSetHideBubble },
|
||||
{ "DYN_CHAT:SET_UNIVERSAL_CHANNEL", CDynChatEGS::cbServiceSetUniversalChannel},
|
||||
{ "DYN_CHAT:SET_CHAN_HISTORY", CDynChatEGS::cbServiceSetChanHistory },
|
||||
{ "DYN_CHAT:REMOVE_SERVICE_CHAN", CDynChatEGS::cbServiceRemoveChan },
|
||||
{ "DYN_CHAT:ADD_CLIENT", CDynChatEGS::cbServiceAddClient },
|
||||
{ "DYN_CHAT:ADD_SESSION", CDynChatEGS::cbServiceAddSession },
|
||||
{ "DYN_CHAT:ADD_SESSION_ENTITY", CDynChatEGS::cbServiceAddSessionEntity },
|
||||
{ "DYN_CHAT:REMOVE_SESSION", CDynChatEGS::cbServiceRemoveSession },
|
||||
{ "DYN_CHAT:REMOVE_SESSION_ENTITY", CDynChatEGS::cbServiceRemoveSessionEntity }
|
||||
|
||||
{ "DYN_CHAT:REMOVE_SESSION_ENTITY", CDynChatEGS::cbServiceRemoveSessionEntity}
|
||||
};
|
||||
|
||||
CUnifiedNetwork::getInstance()->addCallbackArray( _cbArray, sizeof(_cbArray) / sizeof(_cbArray[0]) );
|
||||
|
@ -315,7 +315,16 @@ bool CDynChatEGS::setHideBubble(TChanID chanID, bool hideBubble)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================================================
|
||||
bool CDynChatEGS::setUniversalChannel(TChanID chanID, bool universalChannel)
|
||||
{
|
||||
CDynChatChan *chan = _DynChat.getChan(chanID);
|
||||
if (!chan) return false;
|
||||
if (universalChannel == chan->UniversalChannel) return true; // already good value
|
||||
chan->UniversalChannel = universalChannel;
|
||||
iosSetUniversalChannel(chanID, universalChannel);
|
||||
return true;
|
||||
}
|
||||
|
||||
//============================================================================================================
|
||||
void CDynChatEGS::cbServiceAddChan(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId)
|
||||
|
@ -344,6 +353,16 @@ void CDynChatEGS::cbServiceSetHideBubble(NLNET::CMessage& msgin, const std::stri
|
|||
DynChatEGS.setHideBubble(chan, hideBubble);
|
||||
}
|
||||
//============================================================================================================
|
||||
void CDynChatEGS::cbServiceSetUniversalChannel(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId)
|
||||
{
|
||||
TChanID chan;
|
||||
bool universalChannel;
|
||||
|
||||
msgin.serial(chan);
|
||||
msgin.serial(universalChannel);
|
||||
DynChatEGS.setUniversalChannel(chan, universalChannel);
|
||||
}
|
||||
//============================================================================================================
|
||||
void CDynChatEGS::cbServiceAddClient(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId)
|
||||
{
|
||||
TDataSetRow dsr;
|
||||
|
@ -484,6 +503,15 @@ void CDynChatEGS::iosSetHideBubble(TChanID chan, bool hideBubble)
|
|||
sendMessageViaMirror( "IOS", msg);
|
||||
}
|
||||
|
||||
//============================================================================================================
|
||||
void CDynChatEGS::iosSetUniversalChannel(TChanID chan, bool universalChannel)
|
||||
{
|
||||
CMessage msg("DYN_CHAT:SET_UNIVERSAL_CHANNEL");
|
||||
msg.serial(chan);
|
||||
msg.serial(universalChannel);
|
||||
sendMessageViaMirror( "IOS", msg);
|
||||
}
|
||||
|
||||
//============================================================================================================
|
||||
void CDynChatEGS::iosRemoveSession(TChanID chan, const TDataSetRow &client)
|
||||
{
|
||||
|
|
|
@ -68,8 +68,14 @@ public:
|
|||
* \return true if success
|
||||
*/
|
||||
bool setHideBubble(TChanID chan, bool hideBubble);
|
||||
|
||||
/** Change sessions in channel 'chan' so that chat is treated like universe channel
|
||||
* \return true if success
|
||||
*/
|
||||
bool setUniversalChannel(TChanID chan, bool universalChannel);
|
||||
|
||||
/** Stop session in channel 'chan' for the client 'client'.
|
||||
* \return true if success
|
||||
* \return true if success
|
||||
*/
|
||||
bool removeSession(TChanID chan, const TDataSetRow &client);
|
||||
// Set 'write right' flag for a session.
|
||||
|
@ -92,6 +98,8 @@ public:
|
|||
static void cbServiceAddChan(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId);
|
||||
/// Message from a service that need to hide bubbble of player/npc speaking in that channel
|
||||
static void cbServiceSetHideBubble(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId);
|
||||
/// Message from a service that need to set channel to be like universe channel
|
||||
static void cbServiceSetUniversalChannel(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId);
|
||||
/// Message from a service: remove a channel.
|
||||
static void cbServiceRemoveChan(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId);
|
||||
/// Message from a service : set the channel history
|
||||
|
@ -116,7 +124,8 @@ private:
|
|||
private:
|
||||
// ios msg
|
||||
void iosAddChan(TChanID chan, bool noBroadcast, bool forwardPlayerInputs, bool unify);
|
||||
void iosSetHideBubble(TChanID chan, bool hiddeBubble);
|
||||
void iosSetHideBubble(TChanID chan, bool hideBubble);
|
||||
void iosSetUniversalChannel(TChanID chan, bool universalChannel);
|
||||
void iosRemoveChan(TChanID chan);
|
||||
void iosAddSession(TChanID chan, const TDataSetRow &client, bool readOnly);
|
||||
void iosRemoveSession(TChanID chan, const TDataSetRow &client);
|
||||
|
|
|
@ -13660,9 +13660,13 @@ void CCharacter::sendUrl(const string &url, const string &salt)
|
|||
string control;
|
||||
if (!salt.empty())
|
||||
{
|
||||
string checksum = salt+url;
|
||||
control = "&hmac="+getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&salt[0], (uint32)salt.size()).toString();
|
||||
}
|
||||
else
|
||||
{
|
||||
string defaultSalt = toString(getLastConnectedDate());
|
||||
control = "&hmac="+getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&defaultSalt[0], (uint32)defaultSalt.size()).toString();
|
||||
}
|
||||
|
||||
nlinfo(url.c_str());
|
||||
TVectorParamCheck titleParams;
|
||||
|
|
Loading…
Reference in a new issue