mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-29 18:11:28 +00:00
A few calls added, forget where I was but just pushing so KLS can start looking at the quest stuff
This commit is contained in:
parent
ca86763c2b
commit
509babc2d1
@ -6,7 +6,7 @@ extern WorldServer *worldserver;
|
||||
extern std::map<std::string, std::pair<int, MethodHandler>> authorized_methods;
|
||||
extern std::map<std::string, MethodHandler> unauthorized_methods;
|
||||
|
||||
/* Web Interface */
|
||||
/* Web Interface:register_authorized_methods */
|
||||
void register_authorized_methods()
|
||||
{
|
||||
authorized_methods["WebInterface.Authorize"] = std::make_pair(0, handle_method_token_auth);
|
||||
@ -16,6 +16,8 @@ void register_authorized_methods()
|
||||
authorized_methods["Zone.Unsubscribe"] = std::make_pair(10, handle_method_zone);
|
||||
authorized_methods["Zone.GetInitialEntityPositions"] = std::make_pair(10, handle_method_zone);
|
||||
authorized_methods["Zone.MoveEntity"] = std::make_pair(10, handle_method_zone);
|
||||
authorized_methods["Zone.Action"] = std::make_pair(10, handle_method_zone);
|
||||
authorized_methods["Quest.GetScript"] = std::make_pair(10, handle_method_world);
|
||||
}
|
||||
|
||||
void register_unauthorized_methods()
|
||||
|
||||
@ -206,6 +206,4 @@ int main() {
|
||||
libwebsocket_context_destroy(context);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,3 +1,7 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#include "../common/debug.h"
|
||||
#include "../common/logsys.h"
|
||||
#include "../common/logtypes.h"
|
||||
@ -45,13 +49,16 @@ void RemoteCallResponse(const std::string &connection_id, const std::string &req
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
/* World */
|
||||
/* World:register_remote_call_handlers */
|
||||
void register_remote_call_handlers() {
|
||||
remote_call_methods["World.ListZones"] = handle_rc_list_zones;
|
||||
remote_call_methods["World.GetZoneDetails"] = handle_rc_get_zone_info;
|
||||
remote_call_methods["Zone.Subscribe"] = handle_rc_relay;
|
||||
remote_call_methods["Zone.Unsubscribe"] = handle_rc_relay;
|
||||
remote_call_methods["Zone.GetInitialEntityPositions"] = handle_rc_relay;
|
||||
remote_call_methods["Zone.MoveEntity"] = handle_rc_relay;
|
||||
remote_call_methods["Zone.Action"] = handle_rc_relay;
|
||||
remote_call_methods["Quest.GetScript"] = handle_rc_quest_interface;
|
||||
}
|
||||
|
||||
void handle_rc_list_zones(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms) {
|
||||
@ -156,3 +163,26 @@ void handle_rc_relay(const std::string &method, const std::string &connection_id
|
||||
zs->SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
void handle_rc_quest_interface(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms) {
|
||||
std::string error;
|
||||
std::map<std::string, std::string> res;
|
||||
|
||||
/*
|
||||
if (params.size() != 1) {
|
||||
error = "Expected only one zone_id.";
|
||||
RemoteCallResponse(connection_id, request_id, res, error);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
std::string str;
|
||||
std::ifstream file("quests/global/Waypoint.pl", std::ios::in);
|
||||
if (file) {
|
||||
while (!file.eof()) str.push_back(file.get());
|
||||
}
|
||||
// std::cout << str << '\n';
|
||||
|
||||
res["quest_text"] = str.c_str();
|
||||
RemoteCallResponse(connection_id, request_id, res, error);
|
||||
}
|
||||
@ -30,6 +30,7 @@ void register_remote_call_handlers();
|
||||
void handle_rc_list_zones(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms);
|
||||
void handle_rc_get_zone_info(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms);
|
||||
void handle_rc_relay(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms);
|
||||
void handle_rc_quest_interface(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
#include "../common/features.h"
|
||||
#include "QuestParserCollection.h"
|
||||
#include "water_map.h"
|
||||
#include "remote_call.h"
|
||||
#include "remote_call_subscribe.h"
|
||||
|
||||
extern EntityList entity_list;
|
||||
|
||||
@ -1836,6 +1838,15 @@ void Mob::AI_Event_Engaged(Mob* attacker, bool iYellForHelp) {
|
||||
if(emoteid != 0)
|
||||
CastToNPC()->DoNPCEmote(ENTERCOMBAT,emoteid);
|
||||
CastToNPC()->SetCombatEvent(true);
|
||||
|
||||
/* Web Interface: Combat State NPC */
|
||||
if (RemoteCallSubscriptionHandler::Instance()->IsSubscribed("Combat.States")) {
|
||||
bool wi_aa = true;
|
||||
std::vector<std::string> params;
|
||||
params.push_back(std::to_string((long)GetID()));
|
||||
params.push_back(std::to_string((bool)wi_aa));
|
||||
RemoteCallSubscriptionHandler::Instance()->OnEvent("Combat.States", params);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1867,11 +1878,20 @@ void Mob::AI_Event_NoLongerEngaged() {
|
||||
{
|
||||
if(entity_list.GetNPCByID(this->GetID()))
|
||||
{
|
||||
uint16 emoteid = CastToNPC()->GetEmoteID();
|
||||
parse->EventNPC(EVENT_COMBAT, CastToNPC(), nullptr, "0", 0);
|
||||
if(emoteid != 0)
|
||||
CastToNPC()->DoNPCEmote(LEAVECOMBAT,emoteid);
|
||||
CastToNPC()->SetCombatEvent(false);
|
||||
uint16 emoteid = CastToNPC()->GetEmoteID();
|
||||
parse->EventNPC(EVENT_COMBAT, CastToNPC(), nullptr, "0", 0);
|
||||
if(emoteid != 0)
|
||||
CastToNPC()->DoNPCEmote(LEAVECOMBAT,emoteid);
|
||||
CastToNPC()->SetCombatEvent(false);
|
||||
|
||||
/* Web Interface: Combat State NPC */
|
||||
if (RemoteCallSubscriptionHandler::Instance()->IsSubscribed("Combat.States")) {
|
||||
bool wi_aa = false;
|
||||
std::vector<std::string> params;
|
||||
params.push_back(std::to_string((long)GetID()));
|
||||
params.push_back(std::to_string((bool)wi_aa));
|
||||
RemoteCallSubscriptionHandler::Instance()->OnEvent("Combat.States", params);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
#include "QuestParserCollection.h"
|
||||
#include "water_map.h"
|
||||
#include "worldserver.h"
|
||||
#include "remote_call_subscribe.h"
|
||||
extern WorldServer worldserver;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
@ -2014,7 +2015,8 @@ void NPC::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes attack
|
||||
|
||||
bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack_skill) {
|
||||
mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", killerMob->GetName(), damage, spell, attack_skill);
|
||||
|
||||
bool MadeCorpse = false;
|
||||
uint16 OrigEntID = this->GetID();
|
||||
Mob *oos = nullptr;
|
||||
if(killerMob) {
|
||||
oos = killerMob->GetOwnerOrSelf();
|
||||
@ -2269,6 +2271,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack
|
||||
entity_list.RemoveFromAutoXTargets(this);
|
||||
uint16 emoteid = this->GetEmoteID();
|
||||
Corpse* corpse = new Corpse(this, &itemlist, GetNPCTypeID(), &NPCTypedata,level>54?RuleI(NPC,MajorNPCCorpseDecayTimeMS):RuleI(NPC,MinorNPCCorpseDecayTimeMS));
|
||||
MadeCorpse = true;
|
||||
entity_list.LimitRemoveNPC(this);
|
||||
entity_list.AddCorpse(corpse, GetID());
|
||||
|
||||
@ -2356,6 +2359,15 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack
|
||||
else
|
||||
entity_list.RemoveFromXTargets(this);
|
||||
|
||||
/* Web Interface: Entity Death */
|
||||
if (RemoteCallSubscriptionHandler::Instance()->IsSubscribed("Entity.Events")) {
|
||||
std::vector<std::string> params;
|
||||
params.push_back(std::to_string((long)EntityEvents::Entity_Death));
|
||||
params.push_back(std::to_string((long)OrigEntID));
|
||||
params.push_back(std::to_string((bool)MadeCorpse));
|
||||
RemoteCallSubscriptionHandler::Instance()->OnEvent("Entity.Events", params);
|
||||
}
|
||||
|
||||
// Parse quests even if we're killed by an NPC
|
||||
if(oos) {
|
||||
mod_npc_killed(oos);
|
||||
@ -2383,6 +2395,7 @@ bool NPC::Death(Mob* killerMob, int32 damage, uint16 spell, SkillUseTypes attack
|
||||
char buffer[48] = { 0 };
|
||||
snprintf(buffer, 47, "%d %d %d %d", killerMob ? killerMob->GetID() : 0, damage, spell, static_cast<int>(attack_skill));
|
||||
parse->EventNPC(EVENT_DEATH_COMPLETE, this, oos, buffer, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -1027,16 +1027,16 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app)
|
||||
PlayerPositionUpdateClient_Struct* ppu = (PlayerPositionUpdateClient_Struct*)app->pBuffer;
|
||||
|
||||
/* Web Interface */
|
||||
if (IsClient()) {
|
||||
if (IsClient() && RemoteCallSubscriptionHandler::Instance()->IsSubscribed("Client.Position")) {
|
||||
std::vector<std::string> params;
|
||||
params.push_back(std::to_string((long)zone->GetZoneID()));
|
||||
params.push_back(std::to_string((long)zone->GetInstanceID()));
|
||||
params.push_back(std::to_string((long)GetID()));
|
||||
params.push_back(GetCleanName());
|
||||
params.push_back(std::to_string((double)ppu->x_pos));
|
||||
params.push_back(std::to_string((double)ppu->y_pos));
|
||||
params.push_back(std::to_string((double)ppu->z_pos));
|
||||
params.push_back(std::to_string((double)heading));
|
||||
params.push_back(std::to_string((double)GetClass()));
|
||||
params.push_back(std::to_string((double)GetRace()));
|
||||
RemoteCallSubscriptionHandler::Instance()->OnEvent("Client.Position", params);
|
||||
}
|
||||
|
||||
@ -1311,9 +1311,21 @@ void Client::Handle_OP_AutoAttack(const EQApplicationPacket *app)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Web Interface: Combat State */
|
||||
if (RemoteCallSubscriptionHandler::Instance()->IsSubscribed("Combat.States")) {
|
||||
bool wi_aa = false;
|
||||
if (app->pBuffer[0] == 0){ wi_aa = false; }
|
||||
else if (app->pBuffer[0] == 1){ wi_aa = true; }
|
||||
std::vector<std::string> params;
|
||||
params.push_back(std::to_string((long)GetID()));
|
||||
params.push_back(std::to_string((bool)wi_aa));
|
||||
RemoteCallSubscriptionHandler::Instance()->OnEvent("Combat.States", params);
|
||||
}
|
||||
|
||||
if (app->pBuffer[0] == 0)
|
||||
{
|
||||
auto_attack = false;
|
||||
|
||||
if (IsAIControlled())
|
||||
return;
|
||||
attack_timer.Disable();
|
||||
|
||||
@ -41,6 +41,7 @@ Child of the Mob class.
|
||||
#include "worldserver.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "QuestParserCollection.h"
|
||||
#include "remote_call_subscribe.h"
|
||||
|
||||
extern EntityList entity_list;
|
||||
extern Zone* zone;
|
||||
@ -231,13 +232,11 @@ Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, uint32 in_npctypeid, const NP
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(IsEmpty())
|
||||
{
|
||||
if(IsEmpty()) {
|
||||
corpse_decay_timer.SetTimer(RuleI(NPC,EmptyNPCCorpseDecayTimeMS)+1000);
|
||||
}
|
||||
|
||||
if(in_npc->HasPrivateCorpse())
|
||||
{
|
||||
if(in_npc->HasPrivateCorpse()) {
|
||||
corpse_delay_timer.SetTimer(corpse_decay_timer.GetRemainingTime() + 1000);
|
||||
}
|
||||
|
||||
@ -638,6 +637,14 @@ void Corpse::Bury() {
|
||||
}
|
||||
|
||||
void Corpse::Depop() {
|
||||
/* Web Interface: Corpse Depop */
|
||||
if (RemoteCallSubscriptionHandler::Instance()->IsSubscribed("Entity.Events")) {
|
||||
std::vector<std::string> params;
|
||||
params.push_back(std::to_string((long)EntityEvents::Entity_Corpse_Bury));
|
||||
params.push_back(std::to_string((long)GetID()));
|
||||
RemoteCallSubscriptionHandler::Instance()->OnEvent("Entity.Events", params);
|
||||
}
|
||||
|
||||
if (IsNPCCorpse())
|
||||
p_depop = true;
|
||||
}
|
||||
|
||||
@ -627,6 +627,20 @@ void EntityList::AddNPC(NPC *npc, bool SendSpawnPacket, bool dontqueue)
|
||||
npc->SetID(GetFreeID());
|
||||
parse->EventNPC(EVENT_SPAWN, npc, nullptr, "", 0);
|
||||
|
||||
/* Web Interface: NPC Spawn (Pop) */
|
||||
if (RemoteCallSubscriptionHandler::Instance()->IsSubscribed("NPC.Position")) {
|
||||
std::vector<std::string> params;
|
||||
params.push_back(std::to_string((long)npc->GetID()));
|
||||
params.push_back(npc->GetCleanName());
|
||||
params.push_back(std::to_string((float)npc->GetX()));
|
||||
params.push_back(std::to_string((float)npc->GetY()));
|
||||
params.push_back(std::to_string((float)npc->GetZ()));
|
||||
params.push_back(std::to_string((double)npc->GetHeading()));
|
||||
params.push_back(std::to_string((double)npc->GetClass()));
|
||||
params.push_back(std::to_string((double)npc->GetRace()));
|
||||
RemoteCallSubscriptionHandler::Instance()->OnEvent("NPC.Position", params);
|
||||
}
|
||||
|
||||
uint16 emoteid = npc->GetEmoteID();
|
||||
if (emoteid != 0)
|
||||
npc->DoNPCEmote(ONSPAWN, emoteid);
|
||||
|
||||
@ -1218,14 +1218,14 @@ void Mob::MakeSpawnUpdateNoDelta(PlayerPositionUpdateServer_Struct *spu){
|
||||
|
||||
if(IsNPC()) {
|
||||
std::vector<std::string> params;
|
||||
params.push_back(std::to_string((long)zone->GetZoneID()));
|
||||
params.push_back(std::to_string((long)zone->GetInstanceID()));
|
||||
params.push_back(std::to_string((long)GetID()));
|
||||
params.push_back(GetName());
|
||||
params.push_back(GetCleanName());
|
||||
params.push_back(std::to_string((double)x_pos));
|
||||
params.push_back(std::to_string((double)y_pos));
|
||||
params.push_back(std::to_string((double)z_pos));
|
||||
params.push_back(std::to_string((double)heading));
|
||||
params.push_back(std::to_string((double)GetClass()));
|
||||
params.push_back(std::to_string((double)GetRace()));
|
||||
RemoteCallSubscriptionHandler::Instance()->OnEvent("NPC.Position", params);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,23 +1,25 @@
|
||||
#include "../common/debug.h"
|
||||
#include "../common/EmuTCPConnection.h"
|
||||
#include "../common/logsys.h"
|
||||
#include "../common/logtypes.h"
|
||||
#include "../common/md5.h"
|
||||
#include "../common/EmuTCPConnection.h"
|
||||
#include "../common/packet_functions.h"
|
||||
#include "../common/packet_dump.h"
|
||||
#include "../common/packet_functions.h"
|
||||
#include "../common/servertalk.h"
|
||||
#include "../common/web_interface_utils.h"
|
||||
#include "client.h"
|
||||
#include "entity.h"
|
||||
#include "mob.h"
|
||||
#include "npc.h"
|
||||
#include "QuestParserCollection.h"
|
||||
#include "remote_call.h"
|
||||
#include "remote_call_subscribe.h"
|
||||
#include "worldserver.h"
|
||||
#include "zone.h"
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "mob.h"
|
||||
#include "client.h"
|
||||
#include <string>
|
||||
|
||||
std::map<std::string, RemoteCallHandler> remote_call_methods;
|
||||
|
||||
extern WorldServer worldserver;
|
||||
extern Zone* zone;
|
||||
|
||||
@ -75,12 +77,13 @@ void RemoteCall(const std::string &connection_id, const std::string &method, con
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
/* Zone */
|
||||
/* Zone: register_remote_call_handlers */
|
||||
void register_remote_call_handlers() {
|
||||
remote_call_methods["Zone.Subscribe"] = handle_rc_subscribe;
|
||||
remote_call_methods["Zone.Unsubscribe"] = handle_rc_unsubscribe;
|
||||
remote_call_methods["Zone.Get.Initial.Entity.Positions"] = handle_rc_get_initial_entity_positions;
|
||||
remote_call_methods["Zone.Move.Entity"] = handle_rc_move_entity;
|
||||
remote_call_methods["Zone.GetInitialEntityPositions"] = handle_rc_get_initial_entity_positions;
|
||||
remote_call_methods["Zone.MoveEntity"] = handle_rc_move_entity;
|
||||
remote_call_methods["Zone.Action"] = handle_rc_zone_action;
|
||||
}
|
||||
|
||||
void handle_rc_subscribe(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms) {
|
||||
@ -130,11 +133,11 @@ void handle_rc_get_initial_entity_positions(const std::string &method, const std
|
||||
entity_list.GetNPCList(npc_list);
|
||||
for(std::list<NPC*>::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) {
|
||||
NPC* npc = *itr;
|
||||
res["zone_id"] = std::to_string((long)zone->GetZoneID());
|
||||
res["instance_id"] = std::to_string((long)zone->GetInstanceID());
|
||||
res["ent_id"] = std::to_string((long)npc->GetID());
|
||||
res["race_id"] = std::to_string((long)npc->GetRace());
|
||||
res["class_id"] = std::to_string((long)npc->GetClass());
|
||||
res["type"] = "NPC";
|
||||
res["name"] = npc->GetName();
|
||||
res["name"] = npc->GetCleanName();
|
||||
res["x"] = std::to_string((double)npc->GetX());
|
||||
res["y"] = std::to_string((double)npc->GetY());
|
||||
res["z"] = std::to_string((double)npc->GetZ());
|
||||
@ -145,51 +148,119 @@ void handle_rc_get_initial_entity_positions(const std::string &method, const std
|
||||
entity_list.GetClientList(client_list);
|
||||
for (std::list<Client*>::iterator itr = client_list.begin(); itr != client_list.end(); ++itr) {
|
||||
Client* c = *itr;
|
||||
res["zone_id"] = itoa(zone->GetZoneID());
|
||||
res["instance_id"] = itoa(zone->GetInstanceID());
|
||||
res["ent_id"] = itoa(c->GetID());
|
||||
res["race_id"] = std::to_string((long)c->GetRace());
|
||||
res["class_id"] = std::to_string((long)c->GetClass());
|
||||
res["type"] = "Client";
|
||||
res["name"] = c->GetCleanName();
|
||||
res["name"] = c->GetCleanName();
|
||||
res["x"] = itoa(c->GetX());
|
||||
res["y"] = itoa(c->GetY());
|
||||
res["z"] = itoa(c->GetZ());
|
||||
res["h"] = itoa(c->GetHeading());
|
||||
RemoteCallResponse(connection_id, request_id, res, error);
|
||||
}
|
||||
std::list<Corpse*> corpse_list;
|
||||
entity_list.GetCorpseList(corpse_list);
|
||||
for (std::list<Corpse*>::iterator itr = corpse_list.begin(); itr != corpse_list.end(); ++itr) {
|
||||
Corpse* c = *itr;
|
||||
res["ent_id"] = itoa(c->GetID());
|
||||
res["race_id"] = std::to_string((long)c->GetRace());
|
||||
res["class_id"] = std::to_string((long)c->GetClass());
|
||||
res["type"] = "Corpse";
|
||||
res["name"] = c->GetCleanName();
|
||||
res["x"] = itoa(c->GetX());
|
||||
res["y"] = itoa(c->GetY());
|
||||
res["z"] = itoa(c->GetZ());
|
||||
res["h"] = itoa(c->GetHeading());
|
||||
RemoteCallResponse(connection_id, request_id, res, error);
|
||||
}
|
||||
// std::list<Doors*> door_list;
|
||||
// entity_list.GetDoorsList(door_list);
|
||||
// std::list<Doors*>::iterator iter = door_list.begin();
|
||||
// while (iter != door_list.end()) {
|
||||
// Doors *c = (*iter);
|
||||
// res["ent_id"] = itoa(c->GetID());
|
||||
// res["type"] = "Door";
|
||||
// res["x"] = itoa(c->GetX());
|
||||
// res["y"] = itoa(c->GetY());
|
||||
// res["z"] = itoa(c->GetZ());
|
||||
// res["h"] = itoa(c->GetHeading());
|
||||
// RemoteCallResponse(connection_id, request_id, res, error);
|
||||
// }
|
||||
}
|
||||
|
||||
void handle_rc_move_entity(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms) {
|
||||
std::string error;
|
||||
std::map<std::string, std::string> res;
|
||||
|
||||
if (params.size() != 1) {
|
||||
std::map<std::string, std::string> res;
|
||||
if (params.size() != 5) {
|
||||
error = "Missing function data";
|
||||
std::cout << error << "\n" << std::endl;
|
||||
RemoteCallResponse(connection_id, request_id, res, error);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
printf("params 0 = %s\n", params[0].c_str());
|
||||
printf("params 1 = %s\n", params[1].c_str());
|
||||
printf("params 2 = %s\n", params[2].c_str());
|
||||
printf("params 3 = %s\n", params[3].c_str());
|
||||
return;
|
||||
auto arg_v = explode_string(params[0].c_str(), ':');
|
||||
/*
|
||||
0 = Ent ID
|
||||
1 = X
|
||||
2 = Y
|
||||
3 = Z
|
||||
4 = H
|
||||
*/
|
||||
Mob *ent = entity_list.GetMob(atoi(arg_v[0].c_str()));
|
||||
return;
|
||||
}
|
||||
/* 0 = Ent ID, 1 = X, 2 = Y, 3 = Z, 4 = H */
|
||||
Mob *ent = entity_list.GetMob(atoi(params[0].c_str()));
|
||||
if (ent){
|
||||
if (ent->IsClient()){
|
||||
ent->CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), atoi(arg_v[1].c_str()), atoi(arg_v[2].c_str()), ent->GetGroundZ(atoi(arg_v[1].c_str()), atoi(arg_v[2].c_str())), ent->GetHeading());
|
||||
|
||||
ent->CastToClient()->MovePC(zone->GetZoneID(), zone->GetInstanceID(), atoi(params[1].c_str()), atoi(params[2].c_str()), ent->GetGroundZ(atoi(params[1].c_str()), atoi(params[2].c_str())), ent->GetHeading());
|
||||
}
|
||||
else{
|
||||
ent->GMMove(atoi(arg_v[1].c_str()), atoi(arg_v[2].c_str()), ent->GetGroundZ(atoi(arg_v[1].c_str()), atoi(arg_v[2].c_str())), ent->GetHeading());
|
||||
ent->GMMove(atoi(params[1].c_str()), atoi(params[2].c_str()), ent->GetGroundZ(atoi(params[1].c_str()), atoi(params[2].c_str())), ent->GetHeading());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handle_rc_zone_action(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms) {
|
||||
std::string error;
|
||||
std::map<std::string, std::string> res;
|
||||
|
||||
/* Zone Reload Functions */
|
||||
if (params[0] == "Repop"){ zone->Repop(); }
|
||||
if (params[0] == "ReloadQuests"){ parse->ReloadQuests(); }
|
||||
|
||||
/* Zone Visuals Functions */
|
||||
if (params[0] == "ZoneSky"){
|
||||
for (int z = 0; z < 4; z++) {
|
||||
zone->newzone_data.fog_red[z] = atoi(params[1].c_str());
|
||||
zone->newzone_data.fog_green[z] = atoi(params[2].c_str());
|
||||
zone->newzone_data.fog_blue[z] = atoi(params[3].c_str());
|
||||
zone->newzone_data.sky = 0;
|
||||
}
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
|
||||
memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size);
|
||||
entity_list.QueueClients(0, outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
if (params[0] == "ZoneFogDensity"){
|
||||
zone->newzone_data.fog_density = atof(params[1].c_str());
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
|
||||
memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size);
|
||||
entity_list.QueueClients(0, outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
if (params[0] == "ZoneFogClip"){
|
||||
for (int z = 0; z < 4; z++) {
|
||||
zone->newzone_data.fog_minclip[z] = atoi(params[1].c_str());
|
||||
zone->newzone_data.fog_maxclip[z] = atoi(params[2].c_str());
|
||||
zone->newzone_data.sky = 0;
|
||||
}
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
|
||||
memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size);
|
||||
entity_list.QueueClients(0, outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
if (params[0] == "ZoneClip"){
|
||||
zone->newzone_data.minclip = atoi(params[1].c_str());
|
||||
zone->newzone_data.maxclip = atoi(params[2].c_str());
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_NewZone, sizeof(NewZone_Struct));
|
||||
memcpy(outapp->pBuffer, &zone->newzone_data, outapp->size);
|
||||
entity_list.QueueClients(0, outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
if (params[0] == "ZoneSaveHeaders"){ zone->SaveZoneCFG(); }
|
||||
|
||||
if (params[0] == "Kill"){
|
||||
Mob *ent = entity_list.GetMob(atoi(params[1].c_str()));
|
||||
if (ent){ ent->Kill(); }
|
||||
}
|
||||
}
|
||||
@ -33,6 +33,7 @@ void handle_rc_subscribe(const std::string &method, const std::string &connectio
|
||||
void handle_rc_unsubscribe(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms);
|
||||
void handle_rc_get_initial_entity_positions(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms);
|
||||
void handle_rc_move_entity(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms);
|
||||
void handle_rc_zone_action(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector<std::string> ¶ms);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -107,6 +107,13 @@ void RemoteCallSubscriptionHandler::OnEvent(std::string method, std::vector<std:
|
||||
}
|
||||
}
|
||||
|
||||
bool RemoteCallSubscriptionHandler::IsSubscribed(std::string method){
|
||||
if (registered_events.count(method) == 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void RemoteCallSubscriptionHandler::Process() {
|
||||
//create a check for all these connection ids packet
|
||||
uint32 sz = 12;
|
||||
|
||||
@ -22,6 +22,11 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
enum EntityEvents {
|
||||
Entity_Death = 0,
|
||||
Entity_Corpse_Bury
|
||||
};
|
||||
|
||||
class RemoteCallSubscriptionHandler
|
||||
{
|
||||
public:
|
||||
@ -31,6 +36,7 @@ public:
|
||||
bool Subscribe(std::string connection_id, std::string event_name);
|
||||
bool Unsubscribe(std::string connection_id, std::string event_name);
|
||||
void OnEvent(std::string method, std::vector<std::string> ¶ms);
|
||||
bool IsSubscribed(std::string method);
|
||||
|
||||
void Process();
|
||||
void ClearConnection(std::string connection_id);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user