* fixed channels & linked them with DefScript
* functions: joinchannel, leavechannel * added script: chan.def (say on channels) * fixed DefScript loaddef & reloaddef * misc stuff
This commit is contained in:
parent
9823b60377
commit
9d0dd30a0c
@ -21,6 +21,12 @@ SAY [${@version_short}] login successful.
|
|||||||
// 126 = TEXTEMOTE_READY
|
// 126 = TEXTEMOTE_READY
|
||||||
EMOTE 126
|
EMOTE 126
|
||||||
|
|
||||||
|
// join some channels...
|
||||||
|
JOINCHANNEL generalchat
|
||||||
|
JOINCHANNEL help
|
||||||
|
JOINCHANNEL tradee
|
||||||
|
// ...
|
||||||
|
|
||||||
|
|
||||||
// add your own stuff here
|
// add your own stuff here
|
||||||
// ...
|
// ...
|
||||||
|
|||||||
12
bin/scripts/chan.def
Normal file
12
bin/scripts/chan.def
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
// Script to write on channels
|
||||||
|
// Arguments:
|
||||||
|
// ==========
|
||||||
|
// @def: text to write
|
||||||
|
// @0: channel name
|
||||||
|
// @1: language name/number
|
||||||
|
|
||||||
|
#permission=10
|
||||||
|
SET,lang ${@1}
|
||||||
|
DEFAULT,lang 0
|
||||||
|
SENDCHATMESSAGE,14,{${lang}},{${@def}},{${@0}}
|
||||||
@ -1,147 +0,0 @@
|
|||||||
#include "common.h"
|
|
||||||
#include "PseuWoW.h"
|
|
||||||
|
|
||||||
#include "Channel.h"
|
|
||||||
|
|
||||||
void Channel::Join(std::string channel, std::string password)
|
|
||||||
{
|
|
||||||
if (IsOnChannel(channel))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Send join channel request
|
|
||||||
WorldPacket worldPacket;
|
|
||||||
worldPacket.SetOpcode(CMSG_JOIN_CHANNEL);
|
|
||||||
worldPacket << channel << password;
|
|
||||||
_worldSession->SendWorldPacket(worldPacket);
|
|
||||||
|
|
||||||
// Put in channels-joined list, but don't flag as joined yet
|
|
||||||
ChannelStruct channelStruct;
|
|
||||||
channelStruct.channel = "TestChannel";
|
|
||||||
channelStruct.password = "";
|
|
||||||
channelStruct.joined = false;
|
|
||||||
|
|
||||||
channels.push_back(channelStruct);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Channel::Leave(std::string channel)
|
|
||||||
{
|
|
||||||
for(std::vector<ChannelStruct>::iterator i = channels.begin(); i != channels.end(); i++)
|
|
||||||
{
|
|
||||||
ChannelStruct s = *(i);
|
|
||||||
if (s.channel == channel)
|
|
||||||
{
|
|
||||||
if (s.joined)
|
|
||||||
{
|
|
||||||
// Send leave channel request
|
|
||||||
WorldPacket worldPacket;
|
|
||||||
worldPacket.SetOpcode(CMSG_LEAVE_CHANNEL);
|
|
||||||
worldPacket << channel;
|
|
||||||
_worldSession->SendWorldPacket(worldPacket);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Channel::Say(std::string channel, std::string text, uint32 lang)
|
|
||||||
{
|
|
||||||
_worldSession->SendChatMessage(CHAT_MSG_CHANNEL, lang, text, channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Channel::IsOnChannel(std::string channel)
|
|
||||||
{
|
|
||||||
for(std::vector<ChannelStruct>::iterator i = channels.begin(); i != channels.end(); i++)
|
|
||||||
{
|
|
||||||
ChannelStruct s = *(i);
|
|
||||||
if (s.channel == channel)
|
|
||||||
{
|
|
||||||
if (s.joined)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Channel::HandleNotifyOpcode(WorldPacket &packet)
|
|
||||||
{
|
|
||||||
uint8 code;
|
|
||||||
uint64 guid;
|
|
||||||
|
|
||||||
std::string channel, name;
|
|
||||||
|
|
||||||
packet >> code >> channel;
|
|
||||||
|
|
||||||
for(std::vector<ChannelStruct>::iterator i = channels.begin(); i != channels.end(); i++)
|
|
||||||
{
|
|
||||||
ChannelStruct s = *(i);
|
|
||||||
if (s.channel == channel)
|
|
||||||
{
|
|
||||||
switch (code)
|
|
||||||
{
|
|
||||||
// Player joined channel you are on
|
|
||||||
case 0x00:
|
|
||||||
packet >> guid;
|
|
||||||
if(guid){
|
|
||||||
name = _worldSession->plrNameCache.GetName(guid);
|
|
||||||
if (name.empty())
|
|
||||||
{
|
|
||||||
_worldSession->SendQueryPlayerName(guid);
|
|
||||||
name = "Unknown Entity";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("%s joined channel %s\n", channel.c_str());
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Player leaved channel you are on
|
|
||||||
case 0x01:
|
|
||||||
packet >> guid;
|
|
||||||
if(guid){
|
|
||||||
name = _worldSession->plrNameCache.GetName(guid);
|
|
||||||
if (name.empty())
|
|
||||||
{
|
|
||||||
_worldSession->SendQueryPlayerName(guid);
|
|
||||||
name = "Unknown Entity";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("%s leaved channel %s\n", channel.c_str());
|
|
||||||
break;
|
|
||||||
|
|
||||||
// You joined channel successfully
|
|
||||||
case 0x02:
|
|
||||||
s.joined = true;
|
|
||||||
printf("You joined channel %s\n", channel.c_str());
|
|
||||||
break;
|
|
||||||
|
|
||||||
// You leaved channel successfully
|
|
||||||
case 0x03:
|
|
||||||
channels.erase(i);
|
|
||||||
printf("You leaved channel %s\n", channel.c_str());
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Wrong password while trying to join channel
|
|
||||||
case 0x04:
|
|
||||||
channels.erase(i);
|
|
||||||
printf("Could not join channel %s (Wrong password)\n", channel.c_str());
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Not on channel while trying to write to channel etc.
|
|
||||||
case 0x05:
|
|
||||||
channels.erase(i);
|
|
||||||
printf("Your are not on channel %s\n", channel.c_str());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Even more channel notices to handle
|
|
||||||
/*
|
|
||||||
printf("Channel notice not handled! Code: %d - Channel name: %s\nData:\n", code, channel.c_str());
|
|
||||||
packet.textlike();
|
|
||||||
printf("\n");
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
@ -65,6 +65,8 @@ DefScriptFunctionTable *DefScriptPackage::_GetFunctionTable(void) const
|
|||||||
//{"follow",&DefScriptPackage::SCfollow},
|
//{"follow",&DefScriptPackage::SCfollow},
|
||||||
{"savecache",&DefScriptPackage::SCsavecache},
|
{"savecache",&DefScriptPackage::SCsavecache},
|
||||||
{"sendchatmessage",&DefScriptPackage::SCSendChatMessage},
|
{"sendchatmessage",&DefScriptPackage::SCSendChatMessage},
|
||||||
|
{"joinchannel",&DefScriptPackage::SCjoinchannel},
|
||||||
|
{"leavechannel",&DefScriptPackage::SCleavechannel},
|
||||||
|
|
||||||
// table termination
|
// table termination
|
||||||
{NULL,NULL}
|
{NULL,NULL}
|
||||||
|
|||||||
@ -145,6 +145,8 @@ private:
|
|||||||
bool SCemote(CmdSet);
|
bool SCemote(CmdSet);
|
||||||
bool SCfollow(CmdSet);
|
bool SCfollow(CmdSet);
|
||||||
bool SCshdn(CmdSet);
|
bool SCshdn(CmdSet);
|
||||||
|
bool SCjoinchannel(CmdSet);
|
||||||
|
bool SCleavechannel(CmdSet);
|
||||||
|
|
||||||
// Own variable declarations
|
// Own variable declarations
|
||||||
std::map<std::string, unsigned char> my_usrPermissionMap;
|
std::map<std::string, unsigned char> my_usrPermissionMap;
|
||||||
|
|||||||
@ -32,7 +32,10 @@ bool DefScriptPackage::func_loaddef(CmdSet Set){
|
|||||||
bool result=false;
|
bool result=false;
|
||||||
std::string fn;
|
std::string fn;
|
||||||
if(Set.arg[0].empty())
|
if(Set.arg[0].empty())
|
||||||
|
{
|
||||||
result=LoadByName(Set.defaultarg);
|
result=LoadByName(Set.defaultarg);
|
||||||
|
fn=(scPath + Set.defaultarg).append(".def");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string::size_type pos = Set.arg[0].find('/');
|
std::string::size_type pos = Set.arg[0].find('/');
|
||||||
@ -42,16 +45,19 @@ bool DefScriptPackage::func_loaddef(CmdSet Set){
|
|||||||
fn=Set.arg[0];
|
fn=Set.arg[0];
|
||||||
result=LoadScriptFromFile(fn,Set.defaultarg);
|
result=LoadScriptFromFile(fn,Set.defaultarg);
|
||||||
}
|
}
|
||||||
//if(!result && curIsDebug)
|
if(!result)
|
||||||
// std::cout << "Could not load script '" << Set->defaultarg << "' [" << fn << "]\n";
|
std::cout << "Could not load script '" << Set.defaultarg << "' [" << fn << "]\n";
|
||||||
return result;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefScriptPackage::func_reloaddef(CmdSet Set){
|
bool DefScriptPackage::func_reloaddef(CmdSet Set){
|
||||||
bool result=false;
|
bool result=false;
|
||||||
std::string fn;
|
std::string fn;
|
||||||
if(Set.arg[0].empty())
|
if(Set.arg[0].empty())
|
||||||
|
{
|
||||||
result=LoadByName(Set.defaultarg);
|
result=LoadByName(Set.defaultarg);
|
||||||
|
fn=(scPath + Set.defaultarg).append(".def");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string::size_type pos = Set.arg[0].find('/');
|
std::string::size_type pos = Set.arg[0].find('/');
|
||||||
@ -61,9 +67,9 @@ bool DefScriptPackage::func_reloaddef(CmdSet Set){
|
|||||||
fn=Set.arg[0];
|
fn=Set.arg[0];
|
||||||
result=LoadScriptFromFile(fn,Set.defaultarg);
|
result=LoadScriptFromFile(fn,Set.defaultarg);
|
||||||
}
|
}
|
||||||
//if(!result && curIsDebug)
|
if(!result)
|
||||||
// std::cout << "Could not load script '" << Set->defaultarg << "' [" << fn << "]\n";
|
std::cout << "Could not load script '" << Set.defaultarg << "' [" << fn << "]\n";
|
||||||
return result;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefScriptPackage::func_unset(CmdSet Set){
|
bool DefScriptPackage::func_unset(CmdSet Set){
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
#include "Opcodes.h"
|
#include "Opcodes.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
#include "Channel.h"
|
||||||
|
|
||||||
bool DefScriptPackage::SCshdn(CmdSet Set)
|
bool DefScriptPackage::SCshdn(CmdSet Set)
|
||||||
{
|
{
|
||||||
@ -70,8 +71,6 @@ bool DefScriptPackage::SCemote(CmdSet Set){
|
|||||||
uint32 id=atoi(Set.defaultarg.c_str());
|
uint32 id=atoi(Set.defaultarg.c_str());
|
||||||
((PseuInstance*)parentMethod)->GetWSession()->SendEmote(id);
|
((PseuInstance*)parentMethod)->GetWSession()->SendEmote(id);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefScriptPackage::SCfollow(CmdSet Set){
|
bool DefScriptPackage::SCfollow(CmdSet Set){
|
||||||
@ -92,6 +91,30 @@ bool DefScriptPackage::SCfollow(CmdSet Set){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::SCjoinchannel(CmdSet Set){
|
||||||
|
if(Set.defaultarg.empty())
|
||||||
|
return true;
|
||||||
|
if(!(((PseuInstance*)parentMethod)->GetWSession() && ((PseuInstance*)parentMethod)->GetWSession()->IsValid()))
|
||||||
|
{
|
||||||
|
log("Invalid Script call: SCjoinchannel: WorldSession not valid");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
((PseuInstance*)parentMethod)->GetWSession()->GetChannels()->Join(Set.defaultarg,Set.arg[0]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DefScriptPackage::SCleavechannel(CmdSet Set){
|
||||||
|
if(Set.defaultarg.empty())
|
||||||
|
return true;
|
||||||
|
if(!(((PseuInstance*)parentMethod)->GetWSession() && ((PseuInstance*)parentMethod)->GetWSession()->IsValid()))
|
||||||
|
{
|
||||||
|
log("Invalid Script call: SCleavechannel: WorldSession not valid");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
((PseuInstance*)parentMethod)->GetWSession()->GetChannels()->Leave(Set.defaultarg);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DefScriptPackage::My_LoadUserPermissions(VarSet &vs)
|
void DefScriptPackage::My_LoadUserPermissions(VarSet &vs)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include "Opcodes.h"
|
#include "Opcodes.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
#include "Channel.h"
|
||||||
|
|
||||||
void WorldSession::SendChatMessage(uint32 type, uint32 lang, std::string msg, std::string to){
|
void WorldSession::SendChatMessage(uint32 type, uint32 lang, std::string msg, std::string to){
|
||||||
if((!_valid) || (!_logged) || msg.empty())
|
if((!_valid) || (!_logged) || msg.empty())
|
||||||
@ -24,7 +25,7 @@ void WorldSession::SendChatMessage(uint32 type, uint32 lang, std::string msg, st
|
|||||||
packet<<to<<msg;
|
packet<<to<<msg;
|
||||||
break;
|
break;
|
||||||
case CHAT_MSG_CHANNEL:
|
case CHAT_MSG_CHANNEL:
|
||||||
if(to.empty() || !_channel->IsOnChannel(to))
|
if(to.empty() /*|| !_channels->IsOnChannel(to)*/)
|
||||||
return;
|
return;
|
||||||
packet<<to<<msg;
|
packet<<to<<msg;
|
||||||
break;
|
break;
|
||||||
|
|||||||
129
src/Client/World/Channel.cpp
Normal file
129
src/Client/World/Channel.cpp
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
#include "common.h"
|
||||||
|
#include "PseuWoW.h"
|
||||||
|
#include <map>
|
||||||
|
#include "Channel.h"
|
||||||
|
|
||||||
|
void Channel::Join(std::string channel, std::string password)
|
||||||
|
{
|
||||||
|
if (IsOnChannel(channel))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Send join channel request
|
||||||
|
WorldPacket worldPacket;
|
||||||
|
worldPacket.SetOpcode(CMSG_JOIN_CHANNEL);
|
||||||
|
worldPacket << channel << password;
|
||||||
|
_worldSession->SendWorldPacket(worldPacket);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Channel::Leave(std::string channel)
|
||||||
|
{
|
||||||
|
for(std::vector<std::string>::iterator i = channels.begin(); i != channels.end(); i++)
|
||||||
|
{
|
||||||
|
if (*i == channel)
|
||||||
|
{
|
||||||
|
// Send leave channel request
|
||||||
|
WorldPacket worldPacket;
|
||||||
|
worldPacket.SetOpcode(CMSG_LEAVE_CHANNEL);
|
||||||
|
worldPacket << channel;
|
||||||
|
_worldSession->SendWorldPacket(worldPacket);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log("Can't leave channel \"%s\": not joined",channel.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Channel::Say(std::string channel, std::string text, uint32 lang)
|
||||||
|
{
|
||||||
|
_worldSession->SendChatMessage(CHAT_MSG_CHANNEL, lang, text, channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Channel::IsOnChannel(std::string channel)
|
||||||
|
{
|
||||||
|
for(std::vector<std::string>::iterator i = channels.begin(); i != channels.end(); i++)
|
||||||
|
{
|
||||||
|
if (*i == channel)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Channel::HandleNotifyOpcode(WorldPacket &packet)
|
||||||
|
{
|
||||||
|
uint8 code;
|
||||||
|
uint64 guid;
|
||||||
|
|
||||||
|
std::string channel, name;
|
||||||
|
|
||||||
|
packet >> code >> channel;
|
||||||
|
|
||||||
|
switch (code)
|
||||||
|
{
|
||||||
|
// Player joined channel you are on
|
||||||
|
case 0x00:
|
||||||
|
packet >> guid;
|
||||||
|
if(guid){
|
||||||
|
name = _worldSession->plrNameCache.GetName(guid);
|
||||||
|
if (name.empty())
|
||||||
|
{
|
||||||
|
_worldSession->SendQueryPlayerName(guid);
|
||||||
|
name = "Unknown Entity";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logdetail("%s joined channel %s", channel.c_str());
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Player leaved channel you are on
|
||||||
|
case 0x01:
|
||||||
|
packet >> guid;
|
||||||
|
if(guid){
|
||||||
|
name = _worldSession->plrNameCache.GetName(guid);
|
||||||
|
if (name.empty())
|
||||||
|
{
|
||||||
|
_worldSession->SendQueryPlayerName(guid);
|
||||||
|
name = "Unknown Entity";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logdetail("%s leaved channel %s", channel.c_str());
|
||||||
|
break;
|
||||||
|
|
||||||
|
// You joined channel successfully
|
||||||
|
case 0x02:
|
||||||
|
log("Joined channel %s", channel.c_str());
|
||||||
|
channels.push_back(channel);
|
||||||
|
break;
|
||||||
|
|
||||||
|
// You leaved channel successfully
|
||||||
|
case 0x03:
|
||||||
|
for(std::vector<std::string>::iterator i = channels.begin(); i != channels.end(); i++)
|
||||||
|
{
|
||||||
|
if(*i == channel)
|
||||||
|
{
|
||||||
|
channels.erase(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log("Left channel %s", channel.c_str());
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Wrong password while trying to join channel
|
||||||
|
case 0x04:
|
||||||
|
log("Could not join channel %s (Wrong password)", channel.c_str());
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Not on channel while trying to write to channel etc.
|
||||||
|
case 0x05:
|
||||||
|
log("You are not on channel %s", channel.c_str());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Even more channel notices to handle
|
||||||
|
/*
|
||||||
|
printf("Channel notice not handled! Code: %d - Channel name: %s\nData:\n", code, channel.c_str());
|
||||||
|
packet.textlike();
|
||||||
|
printf("\n");
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -6,13 +6,6 @@
|
|||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
struct ChannelStruct
|
|
||||||
{
|
|
||||||
std::string channel;
|
|
||||||
std::string password;
|
|
||||||
bool joined;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Channel
|
class Channel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -30,7 +23,7 @@ public:
|
|||||||
// TODO: Add Kick/Ban/Mode/Owner/Mute/Invite and all that stuff
|
// TODO: Add Kick/Ban/Mode/Owner/Mute/Invite and all that stuff
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<ChannelStruct>channels;
|
std::vector<std::string> channels;
|
||||||
WorldSession *_worldSession;
|
WorldSession *_worldSession;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -8,7 +8,8 @@
|
|||||||
#include "WorldSocket.h"
|
#include "WorldSocket.h"
|
||||||
#include "NameTables.h"
|
#include "NameTables.h"
|
||||||
#include "RealmSocket.h"
|
#include "RealmSocket.h"
|
||||||
#include "../Chat.h"
|
#include "Chat.h"
|
||||||
|
#include "Channel.h"
|
||||||
|
|
||||||
#include "WorldSession.h"
|
#include "WorldSession.h"
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ WorldSession::WorldSession(PseuInstance *in)
|
|||||||
_myGUID=0; // i dont have a guid yet
|
_myGUID=0; // i dont have a guid yet
|
||||||
plrNameCache.ReadFromFile(); // load names/guids of known players
|
plrNameCache.ReadFromFile(); // load names/guids of known players
|
||||||
_deleteme = false;
|
_deleteme = false;
|
||||||
|
_channels = new Channel(this);
|
||||||
//...
|
//...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,6 +39,7 @@ WorldSession::~WorldSession()
|
|||||||
}
|
}
|
||||||
_OnLeaveWorld();
|
_OnLeaveWorld();
|
||||||
|
|
||||||
|
delete _channels;
|
||||||
//delete _socket; the socket will be deleted by its handler!!
|
//delete _socket; the socket will be deleted by its handler!!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,6 +139,7 @@ OpcodeHandler *WorldSession::_GetOpcodeHandlerTable() const
|
|||||||
{SMSG_PONG, &WorldSession::_HandlePongOpcode},
|
{SMSG_PONG, &WorldSession::_HandlePongOpcode},
|
||||||
{SMSG_TRADE_STATUS, &WorldSession::_HandleTradeStatusOpcode},
|
{SMSG_TRADE_STATUS, &WorldSession::_HandleTradeStatusOpcode},
|
||||||
{SMSG_GROUP_INVITE, &WorldSession::_HandleGroupInviteOpcode},
|
{SMSG_GROUP_INVITE, &WorldSession::_HandleGroupInviteOpcode},
|
||||||
|
{SMSG_CHANNEL_NOTIFY, &WorldSession::_HandleChannelNotifyOpcode},
|
||||||
|
|
||||||
// movement opcodes
|
// movement opcodes
|
||||||
{MSG_MOVE_SET_FACING, &WorldSession::_HandleMovementOpcode},
|
{MSG_MOVE_SET_FACING, &WorldSession::_HandleMovementOpcode},
|
||||||
@ -353,14 +357,17 @@ void WorldSession::_HandleMessageChatOpcode(WorldPacket& recvPacket)
|
|||||||
uint8 type=0;
|
uint8 type=0;
|
||||||
uint32 lang=0;
|
uint32 lang=0;
|
||||||
uint64 target_guid=0;
|
uint64 target_guid=0;
|
||||||
uint32 msglen=0;
|
uint32 msglen=0,unk;
|
||||||
std::string msg,ext;
|
std::string msg,channel="";
|
||||||
bool isCmd=false;
|
bool isCmd=false;
|
||||||
|
|
||||||
recvPacket >> type >> lang;
|
recvPacket >> type >> lang;
|
||||||
|
|
||||||
if (type == CHAT_MSG_CHANNEL)
|
if (type == CHAT_MSG_CHANNEL)
|
||||||
recvPacket >> ext; // extract channel name
|
{
|
||||||
|
recvPacket >> channel; // extract channel name
|
||||||
|
recvPacket >> unk;
|
||||||
|
}
|
||||||
|
|
||||||
recvPacket >> target_guid;
|
recvPacket >> target_guid;
|
||||||
std::string plrname;
|
std::string plrname;
|
||||||
@ -380,12 +387,21 @@ void WorldSession::_HandleMessageChatOpcode(WorldPacket& recvPacket)
|
|||||||
recvPacket >> target_guid;
|
recvPacket >> target_guid;
|
||||||
|
|
||||||
recvPacket >> msglen >> msg;
|
recvPacket >> msglen >> msg;
|
||||||
if (type == CHAT_MSG_SYSTEM){
|
if (type == CHAT_MSG_SYSTEM)
|
||||||
|
{
|
||||||
log("SYSMSG: \"%s\"",msg.c_str());
|
log("SYSMSG: \"%s\"",msg.c_str());
|
||||||
} else if (type==CHAT_MSG_WHISPER ){
|
}
|
||||||
log("W:WHISP: %s [%s]: %s",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
|
else if (type==CHAT_MSG_WHISPER )
|
||||||
} else {
|
{
|
||||||
log("W:CHAT: %s [%s]: %s",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
|
log("WHISP: %s [%s]: %s",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
|
||||||
|
}
|
||||||
|
else if (type==CHAT_MSG_CHANNEL )
|
||||||
|
{
|
||||||
|
log("CHANNEL [%s]: %s [%s]: %s",channel.c_str(),plrname.c_str(),LookupName(lang,langNames),msg.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log("CHAT: %s [%s]: %s",plrname.c_str(),LookupName(lang,langNames),msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(target_guid!=_myGUID && msg.length()>1 && msg.at(0)=='-' && GetInstance()->GetConf()->allowgamecmd)
|
if(target_guid!=_myGUID && msg.length()>1 && msg.at(0)=='-' && GetInstance()->GetConf()->allowgamecmd)
|
||||||
@ -528,3 +544,8 @@ void WorldSession::_HandleTelePortAckOpcode(WorldPacket& recvPacket)
|
|||||||
response << uint32(0) << uint32(0) << x << y << z << o << uint32(0);
|
response << uint32(0) << uint32(0) << x << y << z << o << uint32(0);
|
||||||
SendWorldPacket(response);
|
SendWorldPacket(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldSession::_HandleChannelNotifyOpcode(WorldPacket& recvPacket)
|
||||||
|
{
|
||||||
|
_channels->HandleNotifyOpcode(recvPacket);
|
||||||
|
}
|
||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
class WorldSocket;
|
class WorldSocket;
|
||||||
class WorldPacket;
|
class WorldPacket;
|
||||||
class PingerThread;
|
class Channel;
|
||||||
|
|
||||||
struct OpcodeHandler
|
struct OpcodeHandler
|
||||||
{
|
{
|
||||||
@ -46,6 +46,7 @@ public:
|
|||||||
void SetFollowTarget(uint64 guid);
|
void SetFollowTarget(uint64 guid);
|
||||||
uint64 GetFollowTarget(void) { return _followGUID; }
|
uint64 GetFollowTarget(void) { return _followGUID; }
|
||||||
uint64 GetGuid(void) { return _myGUID; }
|
uint64 GetGuid(void) { return _myGUID; }
|
||||||
|
Channel *GetChannels(void) { return _channels; }
|
||||||
|
|
||||||
|
|
||||||
// CMSGConstructor
|
// CMSGConstructor
|
||||||
@ -75,8 +76,9 @@ private:
|
|||||||
void _HandlePongOpcode(WorldPacket& recvPacket);
|
void _HandlePongOpcode(WorldPacket& recvPacket);
|
||||||
void _HandleTradeStatusOpcode(WorldPacket& recvPacket);
|
void _HandleTradeStatusOpcode(WorldPacket& recvPacket);
|
||||||
void _HandleGroupInviteOpcode(WorldPacket& recvPacket);
|
void _HandleGroupInviteOpcode(WorldPacket& recvPacket);
|
||||||
|
|
||||||
void _HandleTelePortAckOpcode(WorldPacket& recvPacket);
|
void _HandleTelePortAckOpcode(WorldPacket& recvPacket);
|
||||||
|
void _HandleChannelNotifyOpcode(WorldPacket& recvPacket);
|
||||||
|
|
||||||
|
|
||||||
PlayerEnum _player; // The connected character
|
PlayerEnum _player; // The connected character
|
||||||
|
|
||||||
@ -85,6 +87,7 @@ private:
|
|||||||
ZThread::LockedQueue<WorldPacket*,ZThread::FastMutex> pktQueue;
|
ZThread::LockedQueue<WorldPacket*,ZThread::FastMutex> pktQueue;
|
||||||
bool _valid,_authed,_logged,_deleteme; // world status
|
bool _valid,_authed,_logged,_deleteme; // world status
|
||||||
SocketHandler _sh; // handles the WorldSocket
|
SocketHandler _sh; // handles the WorldSocket
|
||||||
|
Channel *_channels;
|
||||||
uint64 _targetGUID,_followGUID,_myGUID;
|
uint64 _targetGUID,_followGUID,_myGUID;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -263,6 +263,12 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="World"
|
Name="World"
|
||||||
Filter="">
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\Channel.cpp">
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Client\World\Channel.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Client\World\CMSGConstructor.cpp">
|
RelativePath=".\Client\World\CMSGConstructor.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
@ -38,11 +38,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if COMPILER == COMPILER_MICROSOFT
|
#if COMPILER == COMPILER_MICROSOFT
|
||||||
# pragma warning( disable : 4267 ) // conversion from 'size_t' to 'int', possible loss of data
|
# pragma warning( disable : 4267 ) // conversion from 'size_t' to 'int', possible loss of data
|
||||||
# pragma warning( disable : 4786 ) // identifier was truncated to '255' characters in the debug information
|
# pragma warning( disable : 4786 ) // identifier was truncated to '255' characters in the debug information
|
||||||
#ifndef _DEBUG
|
# pragma warning( disable : 4800 ) // conversion to bool, performance warning
|
||||||
# pragma warning( disable : 4244 ) // conversion from 'uint64' to 'int16', possible loss of data
|
# pragma warning( disable : 4244 ) // conversion from 'uint64' to 'int16', possible loss of data
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
|
|||||||
@ -2,10 +2,3 @@ realm login:
|
|||||||
- use the correct IP in CLIENT_LOGON_CHALLENGE, and not 127.0.0.1
|
- use the correct IP in CLIENT_LOGON_CHALLENGE, and not 127.0.0.1
|
||||||
- use correct timezone, maybe settable via conf file later on
|
- use correct timezone, maybe settable via conf file later on
|
||||||
- define the crc_hash as it should be
|
- define the crc_hash as it should be
|
||||||
|
|
||||||
controller:
|
|
||||||
- complete recoding
|
|
||||||
|
|
||||||
shared:
|
|
||||||
-fix CircularBuffer::IncreaseSize() (its BUGGED and corrupts the data)
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user