diff --git a/web_interface/method_handler.cpp b/web_interface/method_handler.cpp index 196e30924..85c6d5712 100644 --- a/web_interface/method_handler.cpp +++ b/web_interface/method_handler.cpp @@ -17,6 +17,8 @@ void register_authorized_methods() 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["Zone.GetEntityAttributes"] = std::make_pair(10, handle_method_zone); + authorized_methods["Zone.SetEntityAttribute"] = std::make_pair(10, handle_method_zone); authorized_methods["World.GetFileContents"] = std::make_pair(10, handle_method_world); authorized_methods["World.SaveFileContents"] = std::make_pair(10, handle_method_world); } diff --git a/world/remote_call.cpp b/world/remote_call.cpp index 7e09fd468..40b0666de 100644 --- a/world/remote_call.cpp +++ b/world/remote_call.cpp @@ -56,6 +56,8 @@ void register_remote_call_handlers() { 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["Zone.GetEntityAttributes"] = handle_rc_relay; + remote_call_methods["Zone.SetEntityAttribute"] = handle_rc_relay; remote_call_methods["World.GetFileContents"] = handle_rc_get_file_contents; remote_call_methods["World.SaveFileContents"] = handle_rc_save_file_contents; } diff --git a/zone/remote_call.cpp b/zone/remote_call.cpp index 96186a08b..950bd34f5 100644 --- a/zone/remote_call.cpp +++ b/zone/remote_call.cpp @@ -83,6 +83,8 @@ void register_remote_call_handlers() { remote_call_methods["Zone.Unsubscribe"] = handle_rc_unsubscribe; remote_call_methods["Zone.GetInitialEntityPositions"] = handle_rc_get_initial_entity_positions; remote_call_methods["Zone.MoveEntity"] = handle_rc_move_entity; + remote_call_methods["Zone.GetEntityAttributes"] = handle_rc_get_entity_attributes; + remote_call_methods["Zone.SetEntityAttribute"] = handle_rc_set_entity_attribute; remote_call_methods["Zone.Action"] = handle_rc_zone_action; } @@ -263,4 +265,46 @@ void handle_rc_zone_action(const std::string &method, const std::string &connect Mob *ent = entity_list.GetMob(atoi(params[1].c_str())); if (ent){ ent->Kill(); } } +} + +void handle_rc_get_entity_attributes(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector ¶ms) { + std::string error; + std::map res; + + if (params.size() != 1) { + error = "Missing function data"; + std::cout << error << "\n" << std::endl; + RemoteCallResponse(connection_id, request_id, res, error); + return; + } + + Mob *ent = entity_list.GetMob(atoi(params[0].c_str())); + if (ent){ + res["ent_id"] = itoa(ent->GetID()); + res["clean_name"] = ent->GetCleanName(); + res["name"] = ent->GetName(); + res["race"] = itoa(ent->GetRace()); + res["class"] = itoa(ent->GetClass()); + RemoteCallResponse(connection_id, request_id, res, error); + } +} + +void handle_rc_set_entity_attribute(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector ¶ms) { + std::string error; + std::map res; + + if (params.size() != 3) { + error = "Missing function data"; + std::cout << error << "\n" << std::endl; + RemoteCallResponse(connection_id, request_id, res, error); + return; + } + + Mob *ent = entity_list.GetMob(atoi(params[0].c_str())); + if (ent){ + if (params[1] == "race"){ + ent->SendIllusionPacket(atoi(params[2].c_str())); + } + } + } \ No newline at end of file diff --git a/zone/remote_call.h b/zone/remote_call.h index f3705fe1f..ca4156fba 100644 --- a/zone/remote_call.h +++ b/zone/remote_call.h @@ -34,6 +34,8 @@ void handle_rc_unsubscribe(const std::string &method, const std::string &connect void handle_rc_get_initial_entity_positions(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector ¶ms); void handle_rc_move_entity(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector ¶ms); void handle_rc_zone_action(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector ¶ms); +void handle_rc_get_entity_attributes(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector ¶ms); +void handle_rc_set_entity_attribute(const std::string &method, const std::string &connection_id, const std::string &request_id, const std::vector ¶ms); #endif