Comms stuff

This commit is contained in:
KimLS
2019-06-08 21:49:51 -07:00
parent c5f739cbda
commit c1484a698c
20 changed files with 281 additions and 128 deletions
+23 -2
View File
@@ -1199,6 +1199,8 @@ void TaskManager::SendTaskSelector(Client *c, Mob *mob, int TaskCount, int *Task
auto outapp = new EQApplicationPacket(OP_OpenNewTasksWindow, buf);
DumpPacket(outapp, true);
c->QueuePacket(outapp);
safe_delete(outapp);
@@ -1284,6 +1286,8 @@ void TaskManager::SendTaskSelectorNew(Client *c, Mob *mob, int TaskCount, int *T
auto outapp = new EQApplicationPacket(OP_OpenNewTasksWindow, buf);
DumpPacket(outapp, true);
c->QueuePacket(outapp);
safe_delete(outapp);
@@ -2550,7 +2554,7 @@ void Client::SendTaskComplete(int TaskIndex) {
tcs->unknown04 = 0x00000002;
Log.LogDebugType(Logs::Detail, Logs::Tasks, "SendTasksComplete");
DumpPacket(outapp); fflush(stdout);
DumpPacket(outapp, true); fflush(stdout);
QueuePacket(outapp);
safe_delete(outapp);
@@ -2631,6 +2635,7 @@ void ClientTaskState::SendTaskHistory(Client *c, int TaskIndex) {
}
}
DumpPacket(outapp, true);
c->QueuePacket(outapp);
safe_delete(outapp);
@@ -2656,6 +2661,7 @@ void Client::SendTaskActivityComplete(int TaskID, int ActivityID, int TaskIndex,
tac->task_completed = 0x00000001;
tac->stage_complete = TaskIncomplete;
DumpPacket(outapp, true);
QueuePacket(outapp);
safe_delete(outapp);
@@ -2685,6 +2691,8 @@ void Client::SendTaskFailed(int TaskID, int TaskIndex, TaskType type)
Log(Logs::General, Logs::Tasks, "[UPDATE] TaskFailed");
DumpPacket(outapp, true);
QueuePacket(outapp);
safe_delete(outapp);
}
@@ -2740,6 +2748,7 @@ void TaskManager::SendCompletedTasksToClient(Client *c, ClientTaskState *State)
buf = buf + 4;
}
DumpPacket(outapp, true);
c->QueuePacket(outapp);
safe_delete(outapp);
@@ -2764,6 +2773,8 @@ void TaskManager::SendTaskActivityShort(Client *c, int TaskID, int ActivityID, i
outapp->WriteUInt32(0);
outapp->WriteUInt32(0xffffffff);
outapp->WriteUInt8(0);
DumpPacket(outapp, true);
c->FastQueuePacket(&outapp);
return;
@@ -2781,7 +2792,7 @@ void TaskManager::SendTaskActivityShort(Client *c, int TaskID, int ActivityID, i
tass->ActivityType = 0xffffffff;
tass->unknown4 = 0x00000000;
DumpPacket(outapp, true);
c->QueuePacket(outapp);
safe_delete(outapp);
}
@@ -2843,6 +2854,8 @@ void TaskManager::SendTaskActivityLong(Client *c, int TaskID, int ActivityID, in
auto outapp = new EQApplicationPacket(OP_TaskActivity, buf);
DumpPacket(outapp, true);
c->QueuePacket(outapp);
safe_delete(outapp);
@@ -2903,6 +2916,8 @@ void TaskManager::SendTaskActivityNew(Client *c, int TaskID, int ActivityID, int
auto outapp = new EQApplicationPacket(OP_TaskActivity, buf);
DumpPacket(outapp, true);
c->QueuePacket(outapp);
safe_delete(outapp);
@@ -3070,6 +3085,8 @@ void TaskManager::SendActiveTaskDescription(Client *c, int TaskID, ClientTaskInf
tdt->Points = 0x00000000; // Points Count TODO: this does have a visible affect on the client ...
tdt->has_reward_selection = 0; // TODO: new rewards window
DumpPacket(outapp, true);
c->QueuePacket(outapp);
safe_delete(outapp);
}
@@ -3194,6 +3211,8 @@ void ClientTaskState::CancelTask(Client *c, int SequenceNumber, TaskType type, b
Log(Logs::General, Logs::Tasks, "[UPDATE] CancelTask");
DumpPacket(outapp, true);
c->QueuePacket(outapp);
safe_delete(outapp);
@@ -3805,6 +3824,8 @@ void SharedTaskState::SendMembersList(Client *to) const
auto outapp = new EQApplicationPacket(OP_SharedTaskMemberList, buf);
DumpPacket(outapp, true);
to->QueuePacket(outapp);
safe_delete(outapp);
}
+45 -36
View File
@@ -79,33 +79,43 @@ WorldServer::~WorldServer() {
void WorldServer::Connect()
{
m_connection.reset(new EQ::Net::ServertalkClient(Config->WorldIP, Config->WorldTCPPort, false, "Zone", Config->SharedKey));
m_connection->OnConnect([this](EQ::Net::ServertalkClient *client) {
OnConnected();
});
m_connection->OnMessage(std::bind(&WorldServer::HandleMessage, this, std::placeholders::_1, std::placeholders::_2));
}
bool WorldServer::SendPacket(ServerPacket *pack)
{
m_connection->SendPacket(pack);
return true;
}
std::string WorldServer::GetIP() const
{
return m_connection->Handle()->RemoteIP();
}
uint16 WorldServer::GetPort() const
{
return m_connection->Handle()->RemotePort();
m_connection.reset(new EQ::WorldConnection("Zone"));
m_connection->SetOnConnectedHandler(std::bind(&WorldServer::OnConnected, this));
m_connection->SetOnMessageHandler(std::bind(&WorldServer::HandleMessage, this, std::placeholders::_1, std::placeholders::_2));
}
bool WorldServer::Connected() const
{
return m_connection->Connected();
if (m_connection) {
return m_connection->Connected();
}
return false;
}
void WorldServer::SendPacket(ServerPacket *pack)
{
if (m_connection) {
m_connection->SendPacket(pack);
}
}
std::string WorldServer::GetIP() const
{
if (m_connection) {
return m_connection->GetIP();
}
return std::string();
}
uint16 WorldServer::GetPort() const
{
if (m_connection) {
return m_connection->GetPort();
}
return 0;
}
void WorldServer::SetZoneData(uint32 iZoneID, uint32 iInstanceID) {
@@ -2026,9 +2036,9 @@ bool WorldServer::SendChannelMessage(Client* from, const char* to, uint8 chan_nu
scm->queued = 0;
strcpy(scm->message, buffer);
bool ret = SendPacket(pack);
SendPacket(pack);
safe_delete(pack);
return ret;
return true;
}
bool WorldServer::SendEmoteMessage(const char* to, uint32 to_guilddbid, uint32 type, const char* message, ...) {
@@ -2064,9 +2074,9 @@ bool WorldServer::SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to
sem->minstatus = to_minstatus;
strcpy(sem->message, buffer);
bool ret = SendPacket(pack);
SendPacket(pack);
safe_delete(pack);
return ret;
return true;
}
bool WorldServer::SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32 MacroNumber, uint32 GroupOrRaidID) {
@@ -2101,15 +2111,19 @@ bool WorldServer::SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32
svm->MacroNumber = MacroNumber;
bool Ret = SendPacket(pack);
SendPacket(pack);
safe_delete(pack);
return Ret;
return true;
}
bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 dbid, uint16 opcode)
{
if (!Connected()) {
return false;
}
Log(Logs::Detail, Logs::Spells, "WorldServer::RezzPlayer rezzexp is %i (0 is normal for RezzComplete", rezzexp);
auto pack = new ServerPacket(ServerOP_RezzPlayer, sizeof(RezzPlayer_Struct));
RezzPlayer_Struct* sem = (RezzPlayer_Struct*)pack->pBuffer;
@@ -2117,14 +2131,9 @@ bool WorldServer::RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32
sem->rez = *(Resurrect_Struct*)rpack->pBuffer;
sem->exp = rezzexp;
sem->dbid = dbid;
bool ret = SendPacket(pack);
if (ret)
Log(Logs::Detail, Logs::Spells, "Sending player rezz packet to world spellid:%i", sem->rez.spellid);
else
Log(Logs::Detail, Logs::Spells, "NOT Sending player rezz packet to world");
SendPacket(pack);
safe_delete(pack);
return ret;
return true;
}
void WorldServer::SendReloadTasks(int Command, int TaskID) {
+5 -5
View File
@@ -18,8 +18,8 @@
#ifndef WORLDSERVER_H
#define WORLDSERVER_H
#include "../common/eq_packet_structs.h"
#include "../common/net/servertalk_client_connection.h"
#include "../common/world_connection.h"
#include <memory>
class ServerPacket;
class EQApplicationPacket;
@@ -31,10 +31,10 @@ public:
~WorldServer();
void Connect();
bool SendPacket(ServerPacket* pack);
bool Connected() const;
void SendPacket(ServerPacket* pack);
std::string GetIP() const;
uint16 GetPort() const;
bool Connected() const;
void HandleMessage(uint16 opcode, const EQ::Net::Packet &p);
@@ -72,7 +72,7 @@ private:
uint32 cur_groupid;
uint32 last_groupid;
std::unique_ptr<EQ::Net::ServertalkClient> m_connection;
std::unique_ptr<EQ::WorldConnection> m_connection;
};
#endif