mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 05:21:29 +00:00
[Doors] Improvements to door manipulation (#2370)
This commit is contained in:
parent
aa2b7f8947
commit
b79e1947f1
@ -4265,7 +4265,7 @@ void Client::Handle_OP_ClickDoor(const EQApplicationPacket *app)
|
|||||||
fmt::format(
|
fmt::format(
|
||||||
"Door ({}) [{}]",
|
"Door ({}) [{}]",
|
||||||
currentdoor->GetEntityID(),
|
currentdoor->GetEntityID(),
|
||||||
Saylink::Create("#door edit", false, "#door edit")
|
Saylink::Create("#door edit", true, "#door edit")
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -8523,7 +8523,7 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app)
|
|||||||
response = row[0];
|
response = row[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((response).size() > 0) {
|
if (!response.empty()) {
|
||||||
if (!mod_saylink(response, silentsaylink)) {
|
if (!mod_saylink(response, silentsaylink)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -8531,43 +8531,21 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app)
|
|||||||
if (GetTarget() && GetTarget()->IsNPC()) {
|
if (GetTarget() && GetTarget()->IsNPC()) {
|
||||||
if (silentsaylink) {
|
if (silentsaylink) {
|
||||||
parse->EventNPC(EVENT_SAY, GetTarget()->CastToNPC(), this, response, 0);
|
parse->EventNPC(EVENT_SAY, GetTarget()->CastToNPC(), this, response, 0);
|
||||||
|
|
||||||
if (response[0] == '#' && parse->PlayerHasQuestSub(EVENT_COMMAND)) {
|
|
||||||
parse->EventPlayer(EVENT_COMMAND, this, response, 0);
|
|
||||||
}
|
|
||||||
#ifdef BOTS
|
|
||||||
else if (response[0] == '^' && parse->PlayerHasQuestSub(EVENT_BOT_COMMAND)) {
|
|
||||||
parse->EventPlayer(EVENT_BOT_COMMAND, this, response, 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else {
|
|
||||||
parse->EventPlayer(EVENT_SAY, this, response, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Message(Chat::LightGray, "You say, '%s'", response.c_str());
|
Message(Chat::LightGray, "You say, '%s'", response.c_str());
|
||||||
ChannelMessageReceived(8, 0, 100, response.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChannelMessageReceived(ChatChannel_Say, 0, 100, response.c_str());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (silentsaylink) {
|
ChannelMessageReceived(ChatChannel_Say, 0, 100, response.c_str());
|
||||||
if (response[0] == '#' && parse->PlayerHasQuestSub(EVENT_COMMAND)) {
|
if (!silentsaylink) {
|
||||||
parse->EventPlayer(EVENT_COMMAND, this, response, 0);
|
|
||||||
}
|
|
||||||
#ifdef BOTS
|
|
||||||
else if (response[0] == '^' && parse->PlayerHasQuestSub(EVENT_BOT_COMMAND)) {
|
|
||||||
parse->EventPlayer(EVENT_BOT_COMMAND, this, response, 0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else {
|
|
||||||
parse->EventPlayer(EVENT_SAY, this, response, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Message(Chat::LightGray, "You say, '%s'", response.c_str());
|
Message(Chat::LightGray, "You say, '%s'", response.c_str());
|
||||||
ChannelMessageReceived(8, 0, 100, response.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8584,7 +8562,6 @@ void Client::Handle_OP_ItemLinkClick(const EQApplicationPacket *app)
|
|||||||
SendItemPacket(0, inst, ItemPacketViewLink);
|
SendItemPacket(0, inst, ItemPacketViewLink);
|
||||||
safe_delete(inst);
|
safe_delete(inst);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app)
|
void Client::Handle_OP_ItemLinkResponse(const EQApplicationPacket *app)
|
||||||
|
|||||||
529
zone/doors.cpp
529
zone/doors.cpp
@ -43,71 +43,72 @@ extern EntityList entity_list;
|
|||||||
extern WorldServer worldserver;
|
extern WorldServer worldserver;
|
||||||
|
|
||||||
Doors::Doors(const DoorsRepository::Doors &door) :
|
Doors::Doors(const DoorsRepository::Doors &door) :
|
||||||
close_timer(5000),
|
m_close_timer(5000),
|
||||||
m_Position(door.pos_x, door.pos_y, door.pos_z, door.heading),
|
m_position(door.pos_x, door.pos_y, door.pos_z, door.heading),
|
||||||
m_Destination(door.dest_x, door.dest_y, door.dest_z, door.dest_heading)
|
m_destination(door.dest_x, door.dest_y, door.dest_z, door.dest_heading)
|
||||||
{
|
{
|
||||||
strn0cpy(zone_name, door.zone.c_str(), sizeof(zone_name));
|
strn0cpy(m_zone_name, door.zone.c_str(), sizeof(m_zone_name));
|
||||||
strn0cpy(door_name, door.name.c_str(), sizeof(door_name));
|
strn0cpy(m_door_name, door.name.c_str(), sizeof(m_door_name));
|
||||||
strn0cpy(destination_zone_name, door.dest_zone.c_str(), sizeof(destination_zone_name));
|
strn0cpy(m_destination_zone_name, door.dest_zone.c_str(), sizeof(m_destination_zone_name));
|
||||||
|
|
||||||
database_id = door.id;
|
m_database_id = door.id;
|
||||||
door_id = door.doorid;
|
m_door_id = door.doorid;
|
||||||
incline = door.incline;
|
m_incline = door.incline;
|
||||||
open_type = door.opentype;
|
m_open_type = door.opentype;
|
||||||
guild_id = door.guild;
|
m_guild_id = door.guild;
|
||||||
lockpick = door.lockpick;
|
m_lockpick = door.lockpick;
|
||||||
key_item_id = door.keyitem;
|
m_key_item_id = door.keyitem;
|
||||||
no_key_ring = door.nokeyring;
|
m_no_key_ring = door.nokeyring;
|
||||||
trigger_door = door.triggerdoor;
|
m_trigger_door = door.triggerdoor;
|
||||||
trigger_type = door.triggertype;
|
m_trigger_type = door.triggertype;
|
||||||
triggered = false;
|
triggered = false;
|
||||||
door_param = door.door_param;
|
m_door_param = door.door_param;
|
||||||
size = door.size;
|
m_size = door.size;
|
||||||
invert_state = door.invert_state;
|
m_invert_state = door.invert_state;
|
||||||
destination_instance_id = door.dest_instance;
|
m_destination_instance_id = door.dest_instance;
|
||||||
is_ldon_door = door.is_ldon_door;
|
m_is_ldon_door = door.is_ldon_door;
|
||||||
m_dz_switch_id = door.dz_switch_id;
|
m_dz_switch_id = door.dz_switch_id;
|
||||||
client_version_mask = door.client_version_mask;
|
m_client_version_mask = door.client_version_mask;
|
||||||
|
|
||||||
SetOpenState(false);
|
SetOpenState(false);
|
||||||
|
|
||||||
close_timer.Disable();
|
m_close_timer.Disable();
|
||||||
|
|
||||||
disable_timer = (door.disable_timer == 1 ? true : false);
|
m_disable_timer = (door.disable_timer == 1 ? true : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Doors::Doors(const char *model, const glm::vec4 &position, uint8 open_type, uint16 size) :
|
Doors::Doors(const char *model, const glm::vec4 &position, uint8 open_type, uint16 size) :
|
||||||
close_timer(5000),
|
m_close_timer(5000),
|
||||||
m_Position(position),
|
m_position(position),
|
||||||
m_Destination(glm::vec4()){
|
m_destination(glm::vec4())
|
||||||
|
{
|
||||||
|
|
||||||
strn0cpy(zone_name, zone->GetShortName(), 32);
|
strn0cpy(m_zone_name, zone->GetShortName(), 32);
|
||||||
strn0cpy(door_name, model, 32);
|
strn0cpy(m_door_name, model, 32);
|
||||||
strn0cpy(destination_zone_name, "NONE", 32);
|
strn0cpy(m_destination_zone_name, "NONE", 32);
|
||||||
|
|
||||||
database_id = (uint32) content_db.GetDoorsCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion());
|
m_database_id = (uint32) content_db.GetDoorsCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion());
|
||||||
door_id = (uint8) content_db.GetDoorsDBCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion());
|
m_door_id = (uint8) content_db.GetDoorsDBCountPlusOne(zone->GetShortName(), zone->GetInstanceVersion());
|
||||||
|
|
||||||
open_type = open_type;
|
m_open_type = open_type;
|
||||||
size = size;
|
m_size = size;
|
||||||
incline = 0;
|
m_incline = 0;
|
||||||
guild_id = 0;
|
m_guild_id = 0;
|
||||||
lockpick = 0;
|
m_lockpick = 0;
|
||||||
key_item_id = 0;
|
m_key_item_id = 0;
|
||||||
no_key_ring = 0;
|
m_no_key_ring = 0;
|
||||||
trigger_door = 0;
|
m_trigger_door = 0;
|
||||||
trigger_type = 0;
|
m_trigger_type = 0;
|
||||||
triggered = false;
|
triggered = false;
|
||||||
door_param = 0;
|
m_door_param = 0;
|
||||||
invert_state = 0;
|
m_invert_state = 0;
|
||||||
is_ldon_door = 0;
|
m_is_ldon_door = 0;
|
||||||
client_version_mask = 4294967295u;
|
m_client_version_mask = 4294967295u;
|
||||||
disable_timer = 0;
|
m_disable_timer = 0;
|
||||||
destination_instance_id = 0;
|
m_destination_instance_id = 0;
|
||||||
|
|
||||||
SetOpenState(false);
|
SetOpenState(false);
|
||||||
close_timer.Disable();
|
m_close_timer.Disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -117,57 +118,58 @@ Doors::~Doors()
|
|||||||
|
|
||||||
bool Doors::Process()
|
bool Doors::Process()
|
||||||
{
|
{
|
||||||
if (close_timer.Enabled() && close_timer.Check() && IsDoorOpen()) {
|
if (m_close_timer.Enabled() && m_close_timer.Check() && IsDoorOpen()) {
|
||||||
if (open_type == 40 || GetTriggerType() == 1) {
|
if (m_open_type == 40 || GetTriggerType() == 1) {
|
||||||
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
||||||
MoveDoor_Struct *md = (MoveDoor_Struct *) outapp->pBuffer;
|
MoveDoor_Struct *md = (MoveDoor_Struct *) outapp->pBuffer;
|
||||||
md->doorid = door_id;
|
md->doorid = m_door_id;
|
||||||
md->action = invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR;
|
md->action = m_invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR;
|
||||||
entity_list.QueueClients(0, outapp);
|
entity_list.QueueClients(0, outapp);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
}
|
}
|
||||||
|
|
||||||
triggered = false;
|
triggered = false;
|
||||||
close_timer.Disable();
|
m_close_timer.Disable();
|
||||||
SetOpenState(false);
|
SetOpenState(false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Doors::HandleClick(Client* sender, uint8 trigger) {
|
void Doors::HandleClick(Client *sender, uint8 trigger)
|
||||||
|
{
|
||||||
Log(Logs::Detail, Logs::Doors,
|
Log(Logs::Detail, Logs::Doors,
|
||||||
"%s clicked door %s (dbid %d, eqid %d) at %s",
|
"%s clicked door %s (dbid %d, eqid %d) at %s",
|
||||||
sender->GetName(),
|
sender->GetName(),
|
||||||
door_name,
|
m_door_name,
|
||||||
database_id,
|
m_database_id,
|
||||||
door_id,
|
m_door_id,
|
||||||
to_string(m_Position).c_str()
|
to_string(m_position).c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
Log(Logs::Detail, Logs::Doors,
|
Log(Logs::Detail, Logs::Doors,
|
||||||
"incline %d, open_type %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d",
|
"incline %d, open_type %d, lockpick %d, key %d, nokeyring %d, trigger %d type %d, param %d",
|
||||||
incline,
|
m_incline,
|
||||||
open_type,
|
m_open_type,
|
||||||
lockpick,
|
m_lockpick,
|
||||||
key_item_id,
|
m_key_item_id,
|
||||||
no_key_ring,
|
m_no_key_ring,
|
||||||
trigger_door,
|
m_trigger_door,
|
||||||
trigger_type,
|
m_trigger_type,
|
||||||
door_param
|
m_door_param
|
||||||
);
|
);
|
||||||
|
|
||||||
Log(Logs::Detail, Logs::Doors,
|
Log(Logs::Detail, Logs::Doors,
|
||||||
"disable_timer '%s',size %d, invert %d, dest: %s %s",
|
"disable_timer '%s',size %d, invert %d, dest: %s %s",
|
||||||
(disable_timer ? "true" : "false"),
|
(m_disable_timer ? "true" : "false"),
|
||||||
size,
|
m_size,
|
||||||
invert_state,
|
m_invert_state,
|
||||||
destination_zone_name,
|
m_destination_zone_name,
|
||||||
to_string(m_Destination).c_str()
|
to_string(m_destination).c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
||||||
auto *move_door_packet = (MoveDoor_Struct *) outapp->pBuffer;
|
auto *move_door_packet = (MoveDoor_Struct *) outapp->pBuffer;
|
||||||
move_door_packet->doorid = door_id;
|
move_door_packet->doorid = m_door_id;
|
||||||
|
|
||||||
if (IsLDoNDoor()) {
|
if (IsLDoNDoor()) {
|
||||||
if (sender) {
|
if (sender) {
|
||||||
@ -177,7 +179,8 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
sender->MessageString(Chat::Red, DUNGEON_SEALED);
|
sender->MessageString(Chat::Red, DUNGEON_SEALED);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sender->KeyRingAdd(RuleI(Adventure, ItemIDToEnablePorts));
|
sender->KeyRingAdd(RuleI(Adventure, ItemIDToEnablePorts));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,11 +211,9 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dz_switch_id != 0)
|
if (m_dz_switch_id != 0) {
|
||||||
{
|
|
||||||
sender->UpdateTasksOnTouchSwitch(m_dz_switch_id);
|
sender->UpdateTasksOnTouchSwitch(m_dz_switch_id);
|
||||||
if (sender->TryMovePCDynamicZoneSwitch(m_dz_switch_id))
|
if (sender->TryMovePCDynamicZoneSwitch(m_dz_switch_id)) {
|
||||||
{
|
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -249,12 +250,14 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
* Door is only triggered by an object
|
* Door is only triggered by an object
|
||||||
*/
|
*/
|
||||||
if (trigger == 1) {
|
if (trigger == 1) {
|
||||||
if (!IsDoorOpen() || (open_type == 58)) {
|
if (!IsDoorOpen() || (m_open_type == 58)) {
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
||||||
} else {
|
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
|
||||||
}
|
}
|
||||||
} else {
|
else {
|
||||||
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -267,15 +270,17 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
*/
|
*/
|
||||||
bool is_guild_door = (GetGuildID() > 0) && (GetGuildID() == sender->GuildID());
|
bool is_guild_door = (GetGuildID() > 0) && (GetGuildID() == sender->GuildID());
|
||||||
bool is_door_not_locked = ((required_key_item == 0) && (GetLockpick() == 0) && (GetGuildID() == 0));
|
bool is_door_not_locked = ((required_key_item == 0) && (GetLockpick() == 0) && (GetGuildID() == 0));
|
||||||
bool is_door_open_and_open_able = (IsDoorOpen() && (open_type == 58));
|
bool is_door_open_and_open_able = (IsDoorOpen() && (m_open_type == 58));
|
||||||
|
|
||||||
if (is_door_not_locked || is_door_open_and_open_able || is_guild_door) {
|
if (is_door_not_locked || is_door_open_and_open_able || is_guild_door) {
|
||||||
if (!IsDoorOpen() || (GetOpenType() == 58)) {
|
if (!IsDoorOpen() || (GetOpenType() == 58)) {
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
||||||
} else {
|
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
|
||||||
}
|
}
|
||||||
} else {
|
else {
|
||||||
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guild Doors
|
* Guild Doors
|
||||||
@ -284,9 +289,10 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
std::string guild_name;
|
std::string guild_name;
|
||||||
char door_message[240];
|
char door_message[240];
|
||||||
|
|
||||||
if (guild_mgr.GetGuildNameByID(guild_id, guild_name)) {
|
if (guild_mgr.GetGuildNameByID(m_guild_id, guild_name)) {
|
||||||
sprintf(door_message, "Only members of the <%s> guild may enter here", guild_name.c_str());
|
sprintf(door_message, "Only members of the <%s> guild may enter here", guild_name.c_str());
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
strcpy(door_message, "Door is locked by an unknown guild");
|
strcpy(door_message, "Door is locked by an unknown guild");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,10 +315,11 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
if (sender->GetGM()) {
|
if (sender->GetGM()) {
|
||||||
sender->MessageString(Chat::LightBlue, DOORS_GM);
|
sender->MessageString(Chat::LightBlue, DOORS_GM);
|
||||||
|
|
||||||
if (!IsDoorOpen() || (open_type == 58)) {
|
if (!IsDoorOpen() || (m_open_type == 58)) {
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
||||||
} else {
|
}
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
else {
|
||||||
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -334,10 +341,11 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
|
|
||||||
sender->Message(Chat::LightBlue, "You got it open!");
|
sender->Message(Chat::LightBlue, "You got it open!");
|
||||||
|
|
||||||
if (!IsDoorOpen() || (open_type == 58)) {
|
if (!IsDoorOpen() || (m_open_type == 58)) {
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
||||||
} else {
|
}
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
else {
|
||||||
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -366,22 +374,28 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
|
|
||||||
if (!IsDoorOpen()) {
|
if (!IsDoorOpen()) {
|
||||||
sender->CheckIncreaseSkill(EQ::skills::SkillPickLock, nullptr, 1);
|
sender->CheckIncreaseSkill(EQ::skills::SkillPickLock, nullptr, 1);
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? OPEN_DOOR
|
||||||
|
: OPEN_INVDOOR);
|
||||||
sender->MessageString(Chat::LightBlue, DOORS_SUCCESSFUL_PICK);
|
sender->MessageString(Chat::LightBlue, DOORS_SUCCESSFUL_PICK);
|
||||||
} else {
|
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
|
||||||
}
|
}
|
||||||
} else {
|
else {
|
||||||
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? CLOSE_DOOR
|
||||||
|
: CLOSE_INVDOOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
sender->MessageString(Chat::LightBlue, DOORS_INSUFFICIENT_SKILL);
|
sender->MessageString(Chat::LightBlue, DOORS_INSUFFICIENT_SKILL);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sender->MessageString(Chat::LightBlue, DOORS_NO_PICK);
|
sender->MessageString(Chat::LightBlue, DOORS_NO_PICK);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sender->MessageString(Chat::LightBlue, DOORS_CANT_PICK);
|
sender->MessageString(Chat::LightBlue, DOORS_CANT_PICK);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
return;
|
return;
|
||||||
@ -399,12 +413,14 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
if (sender->KeyRingCheck(required_key_item)) {
|
if (sender->KeyRingCheck(required_key_item)) {
|
||||||
player_key = required_key_item;
|
player_key = required_key_item;
|
||||||
sender->Message(Chat::LightBlue, "You got it open!"); // more debug spam
|
sender->Message(Chat::LightBlue, "You got it open!"); // more debug spam
|
||||||
if (!IsDoorOpen() || (open_type == 58)) {
|
if (!IsDoorOpen() || (m_open_type == 58)) {
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
||||||
} else {
|
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
|
||||||
}
|
}
|
||||||
} else {
|
else {
|
||||||
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
sender->MessageString(Chat::LightBlue, DOORS_LOCKED);
|
sender->MessageString(Chat::LightBlue, DOORS_LOCKED);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
return;
|
return;
|
||||||
@ -413,17 +429,21 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entity_list.QueueClients(sender, outapp, false);
|
entity_list.QueueClients(sender, outapp, false);
|
||||||
if (!IsDoorOpen() || (open_type == 58)) {
|
if (!IsDoorOpen() || (m_open_type == 58)) {
|
||||||
if (!disable_timer)
|
if (!m_disable_timer) {
|
||||||
close_timer.Start();
|
m_close_timer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
if(strncmp(destination_zone_name, "NONE", strlen("NONE")) == 0)
|
if (strncmp(m_destination_zone_name, "NONE", strlen("NONE")) == 0) {
|
||||||
SetOpenState(true);
|
SetOpenState(true);
|
||||||
} else {
|
}
|
||||||
close_timer.Disable();
|
}
|
||||||
if (!disable_timer)
|
else {
|
||||||
|
m_close_timer.Disable();
|
||||||
|
if (!m_disable_timer) {
|
||||||
SetOpenState(false);
|
SetOpenState(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Everything past this point assumes we opened the door
|
* Everything past this point assumes we opened the door
|
||||||
@ -432,7 +452,8 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
* we return because we don't want people using teleports on an unlocked door (exploit!)
|
* we return because we don't want people using teleports on an unlocked door (exploit!)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((move_door_packet->action == CLOSE_DOOR && invert_state == 0) || (move_door_packet->action == CLOSE_INVDOOR && invert_state == 1)) {
|
if ((move_door_packet->action == CLOSE_DOOR && m_invert_state == 0) ||
|
||||||
|
(move_door_packet->action == CLOSE_INVDOOR && m_invert_state == 1)) {
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -444,15 +465,18 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
if (trigger_door_entity && !trigger_door_entity->triggered) {
|
if (trigger_door_entity && !trigger_door_entity->triggered) {
|
||||||
triggered = true;
|
triggered = true;
|
||||||
trigger_door_entity->HandleClick(sender, 1);
|
trigger_door_entity->HandleClick(sender, 1);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
triggered = false;
|
triggered = false;
|
||||||
}
|
}
|
||||||
} else if ((GetTriggerDoorID() != 0) && (GetTriggerType() != 1)) {
|
}
|
||||||
|
else if ((GetTriggerDoorID() != 0) && (GetTriggerType() != 1)) {
|
||||||
Doors *trigger_door_entity = entity_list.FindDoor(GetTriggerDoorID());
|
Doors *trigger_door_entity = entity_list.FindDoor(GetTriggerDoorID());
|
||||||
if (trigger_door_entity && !trigger_door_entity->triggered) {
|
if (trigger_door_entity && !trigger_door_entity->triggered) {
|
||||||
triggered = true;
|
triggered = true;
|
||||||
trigger_door_entity->HandleClick(sender, 0);
|
trigger_door_entity->HandleClick(sender, 0);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
triggered = false;
|
triggered = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -460,75 +484,77 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
/**
|
/**
|
||||||
* Teleport door
|
* Teleport door
|
||||||
*/
|
*/
|
||||||
if (((open_type == 57) || (open_type == 58)) &&
|
if (((m_open_type == 57) || (m_open_type == 58)) &&
|
||||||
(strncmp(destination_zone_name, "NONE", strlen("NONE")) != 0)) {
|
(strncmp(m_destination_zone_name, "NONE", strlen("NONE")) != 0)) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If click destination is same zone and doesn't require a key
|
* If click destination is same zone and doesn't require a key
|
||||||
*/
|
*/
|
||||||
if ((strncmp(destination_zone_name, zone_name, strlen(zone_name)) == 0) && (!required_key_item)) {
|
if ((strncmp(m_destination_zone_name, m_zone_name, strlen(m_zone_name)) == 0) && (!required_key_item)) {
|
||||||
if (!disable_add_to_key_ring) {
|
if (!disable_add_to_key_ring) {
|
||||||
sender->KeyRingAdd(player_key);
|
sender->KeyRingAdd(player_key);
|
||||||
}
|
}
|
||||||
sender->MovePC(
|
sender->MovePC(
|
||||||
zone->GetZoneID(),
|
zone->GetZoneID(),
|
||||||
zone->GetInstanceID(),
|
zone->GetInstanceID(),
|
||||||
m_Destination.x,
|
m_destination.x,
|
||||||
m_Destination.y,
|
m_destination.y,
|
||||||
m_Destination.z,
|
m_destination.z,
|
||||||
m_Destination.w
|
m_destination.w
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* If requires a key
|
* If requires a key
|
||||||
*/
|
*/
|
||||||
else if (
|
else if (
|
||||||
(!IsDoorOpen() || open_type == 58) &&
|
(!IsDoorOpen() || m_open_type == 58) &&
|
||||||
(required_key_item && ((required_key_item == player_key) || sender->GetGM()))
|
(required_key_item && ((required_key_item == player_key) || sender->GetGM()))
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (!disable_add_to_key_ring) {
|
if (!disable_add_to_key_ring) {
|
||||||
sender->KeyRingAdd(player_key);
|
sender->KeyRingAdd(player_key);
|
||||||
}
|
}
|
||||||
if (ZoneID(destination_zone_name) == zone->GetZoneID()) {
|
if (ZoneID(m_destination_zone_name) == zone->GetZoneID()) {
|
||||||
sender->MovePC(
|
sender->MovePC(
|
||||||
zone->GetZoneID(),
|
zone->GetZoneID(),
|
||||||
zone->GetInstanceID(),
|
zone->GetInstanceID(),
|
||||||
m_Destination.x,
|
m_destination.x,
|
||||||
m_Destination.y,
|
m_destination.y,
|
||||||
m_Destination.z,
|
m_destination.z,
|
||||||
m_Destination.w
|
m_destination.w
|
||||||
);
|
);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sender->MovePC(
|
sender->MovePC(
|
||||||
ZoneID(destination_zone_name),
|
ZoneID(m_destination_zone_name),
|
||||||
static_cast<uint32>(destination_instance_id),
|
static_cast<uint32>(m_destination_instance_id),
|
||||||
m_Destination.x,
|
m_destination.x,
|
||||||
m_Destination.y,
|
m_destination.y,
|
||||||
m_Destination.z,
|
m_destination.z,
|
||||||
m_Destination.w
|
m_destination.w
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!IsDoorOpen() || open_type == 58) && (!required_key_item)) {
|
if ((!IsDoorOpen() || m_open_type == 58) && (!required_key_item)) {
|
||||||
if (ZoneID(destination_zone_name) == zone->GetZoneID()) {
|
if (ZoneID(m_destination_zone_name) == zone->GetZoneID()) {
|
||||||
sender->MovePC(
|
sender->MovePC(
|
||||||
zone->GetZoneID(),
|
zone->GetZoneID(),
|
||||||
zone->GetInstanceID(),
|
zone->GetInstanceID(),
|
||||||
m_Destination.x,
|
m_destination.x,
|
||||||
m_Destination.y,
|
m_destination.y,
|
||||||
m_Destination.z,
|
m_destination.z,
|
||||||
m_Destination.w
|
m_destination.w
|
||||||
);
|
);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sender->MovePC(
|
sender->MovePC(
|
||||||
ZoneID(destination_zone_name),
|
ZoneID(m_destination_zone_name),
|
||||||
static_cast<uint32>(destination_instance_id),
|
static_cast<uint32>(m_destination_instance_id),
|
||||||
m_Destination.x,
|
m_destination.x,
|
||||||
m_Destination.y,
|
m_destination.y,
|
||||||
m_Destination.z,
|
m_destination.z,
|
||||||
m_Destination.w
|
m_destination.w
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -538,33 +564,38 @@ void Doors::HandleClick(Client* sender, uint8 trigger) {
|
|||||||
void Doors::Open(Mob *sender, bool alt_mode)
|
void Doors::Open(Mob *sender, bool alt_mode)
|
||||||
{
|
{
|
||||||
if (sender) {
|
if (sender) {
|
||||||
if (GetTriggerType() == 255 || GetTriggerDoorID() > 0 || GetLockpick() != 0 || GetKeyItem() != 0 || open_type == 59 || open_type == 58 || !sender->IsNPC()) { // this object isnt triggered or door is locked - NPCs should not open locked doors!
|
if (GetTriggerType() == 255 || GetTriggerDoorID() > 0 || GetLockpick() != 0 || GetKeyItem() != 0 ||
|
||||||
|
m_open_type == 59 || m_open_type == 58 ||
|
||||||
|
!sender->IsNPC()) { // this object isnt triggered or door is locked - NPCs should not open locked doors!
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
||||||
MoveDoor_Struct *md = (MoveDoor_Struct *) outapp->pBuffer;
|
MoveDoor_Struct *md = (MoveDoor_Struct *) outapp->pBuffer;
|
||||||
md->doorid = door_id;
|
md->doorid = m_door_id;
|
||||||
md->action = invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR;
|
md->action = m_invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR;
|
||||||
entity_list.QueueCloseClients(sender, outapp, false, 200);
|
entity_list.QueueCloseClients(sender, outapp, false, 200);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
|
|
||||||
if (!alt_mode) { // original function
|
if (!alt_mode) { // original function
|
||||||
if (!is_open) {
|
if (!m_is_open) {
|
||||||
if (!disable_timer)
|
if (!m_disable_timer) {
|
||||||
close_timer.Start();
|
m_close_timer.Start();
|
||||||
is_open = true;
|
}
|
||||||
|
m_is_open = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
close_timer.Disable();
|
m_close_timer.Disable();
|
||||||
if (!disable_timer)
|
if (!m_disable_timer) {
|
||||||
is_open = false;
|
m_is_open = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // alternative function
|
else { // alternative function
|
||||||
if (!disable_timer)
|
if (!m_disable_timer) {
|
||||||
close_timer.Start();
|
m_close_timer.Start();
|
||||||
is_open = true;
|
}
|
||||||
|
m_is_open = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -573,106 +604,123 @@ void Doors::ForceOpen(Mob *sender, bool alt_mode)
|
|||||||
{
|
{
|
||||||
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
||||||
MoveDoor_Struct *md = (MoveDoor_Struct *) outapp->pBuffer;
|
MoveDoor_Struct *md = (MoveDoor_Struct *) outapp->pBuffer;
|
||||||
md->doorid = door_id;
|
md->doorid = m_door_id;
|
||||||
md->action = invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR;
|
md->action = m_invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR;
|
||||||
entity_list.QueueClients(sender, outapp, false);
|
entity_list.QueueClients(sender, outapp, false);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
|
|
||||||
if (!alt_mode) { // original function
|
if (!alt_mode) { // original function
|
||||||
if (!is_open) {
|
if (!m_is_open) {
|
||||||
if (!disable_timer)
|
if (!m_disable_timer) {
|
||||||
close_timer.Start();
|
m_close_timer.Start();
|
||||||
is_open = true;
|
}
|
||||||
|
m_is_open = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
close_timer.Disable();
|
m_close_timer.Disable();
|
||||||
if (!disable_timer)
|
if (!m_disable_timer) {
|
||||||
is_open = false;
|
m_is_open = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // alternative function
|
else { // alternative function
|
||||||
if (!disable_timer)
|
if (!m_disable_timer) {
|
||||||
close_timer.Start();
|
m_close_timer.Start();
|
||||||
is_open = true;
|
}
|
||||||
|
m_is_open = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Doors::ForceClose(Mob *sender, bool alt_mode) {
|
void Doors::ForceClose(Mob *sender, bool alt_mode)
|
||||||
|
{
|
||||||
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
||||||
MoveDoor_Struct *move_door_packet;
|
MoveDoor_Struct *move_door_packet;
|
||||||
move_door_packet = (MoveDoor_Struct *) outapp->pBuffer;
|
move_door_packet = (MoveDoor_Struct *) outapp->pBuffer;
|
||||||
move_door_packet->doorid = door_id;
|
move_door_packet->doorid = m_door_id;
|
||||||
move_door_packet->action = invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR; // change from original (open to close)
|
move_door_packet->action = m_invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR; // change from original (open to close)
|
||||||
entity_list.QueueClients(sender, outapp, false);
|
entity_list.QueueClients(sender, outapp, false);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
|
|
||||||
if (!alt_mode) { // original function
|
if (!alt_mode) { // original function
|
||||||
if (!is_open) {
|
if (!m_is_open) {
|
||||||
if (!disable_timer)
|
if (!m_disable_timer) {
|
||||||
close_timer.Start();
|
m_close_timer.Start();
|
||||||
is_open = true;
|
}
|
||||||
} else {
|
m_is_open = true;
|
||||||
close_timer.Disable();
|
}
|
||||||
is_open = false;
|
else {
|
||||||
|
m_close_timer.Disable();
|
||||||
|
m_is_open = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // alternative function
|
||||||
|
if (m_is_open) {
|
||||||
|
m_close_timer.Trigger();
|
||||||
}
|
}
|
||||||
} else { // alternative function
|
|
||||||
if (is_open)
|
|
||||||
close_timer.Trigger();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Doors::ToggleState(Mob *sender)
|
void Doors::ToggleState(Mob *sender)
|
||||||
{
|
{
|
||||||
if(GetTriggerDoorID() > 0 || GetLockpick() != 0 || GetKeyItem() != 0 || open_type == 58 || open_type == 40) { // borrowed some NPCOpen criteria
|
if (GetTriggerDoorID() > 0 || GetLockpick() != 0 || GetKeyItem() != 0 || m_open_type == 58 ||
|
||||||
|
m_open_type == 40) { // borrowed some NPCOpen criteria
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
auto outapp = new EQApplicationPacket(OP_MoveDoor, sizeof(MoveDoor_Struct));
|
||||||
MoveDoor_Struct *move_door_packet;
|
MoveDoor_Struct *move_door_packet;
|
||||||
move_door_packet = (MoveDoor_Struct *) outapp->pBuffer;
|
move_door_packet = (MoveDoor_Struct *) outapp->pBuffer;
|
||||||
move_door_packet->doorid = door_id;
|
move_door_packet->doorid = m_door_id;
|
||||||
|
|
||||||
if(!is_open) {
|
if (!m_is_open) {
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? OPEN_DOOR : OPEN_INVDOOR);
|
||||||
is_open=true;
|
m_is_open = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
move_door_packet->action = static_cast<uint8>(invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
move_door_packet->action = static_cast<uint8>(m_invert_state == 0 ? CLOSE_DOOR : CLOSE_INVDOOR);
|
||||||
is_open=false;
|
m_is_open = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity_list.QueueClients(sender, outapp, false);
|
entity_list.QueueClients(sender, outapp, false);
|
||||||
safe_delete(outapp);
|
safe_delete(outapp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 ZoneDatabase::GetDoorsCount(uint32* oMaxID, const char *zone_name, int16 version) {
|
int32 ZoneDatabase::GetDoorsCount(uint32 *oMaxID, const char *zone_name, int16 version)
|
||||||
|
{
|
||||||
|
|
||||||
std::string query = StringFormat("SELECT MAX(id), count(*) FROM doors "
|
std::string query = StringFormat(
|
||||||
|
"SELECT MAX(id), count(*) FROM doors "
|
||||||
"WHERE zone = '%s' AND (version = %u OR version = -1)",
|
"WHERE zone = '%s' AND (version = %u OR version = -1)",
|
||||||
zone_name, version);
|
zone_name, version
|
||||||
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (results.RowCount() != 1)
|
if (results.RowCount() != 1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
if (!oMaxID)
|
if (!oMaxID) {
|
||||||
return atoi(row[1]);
|
return atoi(row[1]);
|
||||||
|
}
|
||||||
|
|
||||||
if (row[0])
|
if (row[0]) {
|
||||||
*oMaxID = atoi(row[0]);
|
*oMaxID = atoi(row[0]);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
*oMaxID = 0;
|
*oMaxID = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return atoi(row[1]);
|
return atoi(row[1]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 ZoneDatabase::GetDoorsCountPlusOne(const char *zone_name, int16 version) {
|
int32 ZoneDatabase::GetDoorsCountPlusOne(const char *zone_name, int16 version)
|
||||||
|
{
|
||||||
std::string query = StringFormat(
|
std::string query = StringFormat(
|
||||||
"SELECT MAX(id) FROM doors WHERE zone = '%s' AND version = %u",
|
"SELECT MAX(id) FROM doors WHERE zone = '%s' AND version = %u",
|
||||||
zone_name,
|
zone_name,
|
||||||
@ -683,36 +731,43 @@ int32 ZoneDatabase::GetDoorsCountPlusOne(const char *zone_name, int16 version) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (results.RowCount() != 1)
|
if (results.RowCount() != 1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
if (!row[0])
|
if (!row[0]) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return atoi(row[0]) + 1;
|
return atoi(row[0]) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version) {
|
int32 ZoneDatabase::GetDoorsDBCountPlusOne(const char *zone_name, int16 version)
|
||||||
|
{
|
||||||
|
|
||||||
uint32 oMaxID = 0;
|
uint32 oMaxID = 0;
|
||||||
|
|
||||||
std::string query = StringFormat("SELECT MAX(doorid) FROM doors "
|
std::string query = StringFormat(
|
||||||
|
"SELECT MAX(doorid) FROM doors "
|
||||||
"WHERE zone = '%s' AND (version = %u OR version = -1)",
|
"WHERE zone = '%s' AND (version = %u OR version = -1)",
|
||||||
zone_name, version);
|
zone_name, version
|
||||||
|
);
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success()) {
|
if (!results.Success()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (results.RowCount() != 1)
|
if (results.RowCount() != 1) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
auto row = results.begin();
|
auto row = results.begin();
|
||||||
|
|
||||||
if (!row[0])
|
if (!row[0]) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return atoi(row[0]) + 1;
|
return atoi(row[0]) + 1;
|
||||||
}
|
}
|
||||||
@ -721,7 +776,8 @@ std::vector<DoorsRepository::Doors> ZoneDatabase::LoadDoors(const std::string& z
|
|||||||
{
|
{
|
||||||
LogInfo("Loading Doors from database");
|
LogInfo("Loading Doors from database");
|
||||||
|
|
||||||
auto door_entries = DoorsRepository::GetWhere(*this, fmt::format(
|
auto door_entries = DoorsRepository::GetWhere(
|
||||||
|
*this, fmt::format(
|
||||||
"zone = '{}' AND (version = {} OR version = -1) {} ORDER BY doorid ASC",
|
"zone = '{}' AND (version = {} OR version = -1) {} ORDER BY doorid ASC",
|
||||||
zone_name, version, ContentFilterCriteria::apply()));
|
zone_name, version, ContentFilterCriteria::apply()));
|
||||||
|
|
||||||
@ -733,49 +789,56 @@ std::vector<DoorsRepository::Doors> ZoneDatabase::LoadDoors(const std::string& z
|
|||||||
void Doors::SetLocation(float x, float y, float z)
|
void Doors::SetLocation(float x, float y, float z)
|
||||||
{
|
{
|
||||||
entity_list.DespawnAllDoors();
|
entity_list.DespawnAllDoors();
|
||||||
m_Position = glm::vec4(x, y, z, m_Position.w);
|
m_position = glm::vec4(x, y, z, m_position.w);
|
||||||
entity_list.RespawnAllDoors();
|
entity_list.RespawnAllDoors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Doors::SetPosition(const glm::vec4& position) {
|
void Doors::SetPosition(const glm::vec4 &position)
|
||||||
|
{
|
||||||
entity_list.DespawnAllDoors();
|
entity_list.DespawnAllDoors();
|
||||||
m_Position = position;
|
m_position = position;
|
||||||
entity_list.RespawnAllDoors();
|
entity_list.RespawnAllDoors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Doors::SetIncline(int in) {
|
void Doors::SetIncline(int in)
|
||||||
|
{
|
||||||
entity_list.DespawnAllDoors();
|
entity_list.DespawnAllDoors();
|
||||||
incline = in;
|
m_incline = in;
|
||||||
entity_list.RespawnAllDoors();
|
entity_list.RespawnAllDoors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Doors::SetInvertState(int in) {
|
void Doors::SetInvertState(int in)
|
||||||
|
{
|
||||||
entity_list.DespawnAllDoors();
|
entity_list.DespawnAllDoors();
|
||||||
invert_state = in;
|
m_invert_state = in;
|
||||||
entity_list.RespawnAllDoors();
|
entity_list.RespawnAllDoors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Doors::SetOpenType(uint8 in) {
|
void Doors::SetOpenType(uint8 in)
|
||||||
|
{
|
||||||
entity_list.DespawnAllDoors();
|
entity_list.DespawnAllDoors();
|
||||||
open_type = in;
|
m_open_type = in;
|
||||||
entity_list.RespawnAllDoors();
|
entity_list.RespawnAllDoors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Doors::SetDoorName(const char* name) {
|
void Doors::SetDoorName(const char *name)
|
||||||
|
{
|
||||||
entity_list.DespawnAllDoors();
|
entity_list.DespawnAllDoors();
|
||||||
memset(door_name, 0, sizeof(door_name));
|
memset(m_door_name, 0, sizeof(m_door_name));
|
||||||
strncpy(door_name, name, sizeof(door_name));
|
strncpy(m_door_name, name, sizeof(m_door_name));
|
||||||
entity_list.RespawnAllDoors();
|
entity_list.RespawnAllDoors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Doors::SetSize(uint16 in) {
|
void Doors::SetSize(uint16 in)
|
||||||
|
{
|
||||||
entity_list.DespawnAllDoors();
|
entity_list.DespawnAllDoors();
|
||||||
size = in;
|
m_size = in;
|
||||||
entity_list.RespawnAllDoors();
|
entity_list.RespawnAllDoors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Doors::SetDisableTimer(bool flag) {
|
void Doors::SetDisableTimer(bool flag)
|
||||||
disable_timer = flag;
|
{
|
||||||
|
m_disable_timer = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Doors::CreateDatabaseEntry()
|
void Doors::CreateDatabaseEntry()
|
||||||
@ -791,7 +854,7 @@ void Doors::CreateDatabaseEntry()
|
|||||||
GetDoorDBID(),
|
GetDoorDBID(),
|
||||||
GetDoorID(),
|
GetDoorID(),
|
||||||
GetDoorName(),
|
GetDoorName(),
|
||||||
m_Position,
|
m_position,
|
||||||
GetOpenType(),
|
GetOpenType(),
|
||||||
static_cast<uint16>(GetGuildID()),
|
static_cast<uint16>(GetGuildID()),
|
||||||
GetLockpick(),
|
GetLockpick(),
|
||||||
@ -805,15 +868,15 @@ void Doors::CreateDatabaseEntry()
|
|||||||
|
|
||||||
float Doors::GetX()
|
float Doors::GetX()
|
||||||
{
|
{
|
||||||
return m_Position.x;
|
return m_position.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Doors::GetY()
|
float Doors::GetY()
|
||||||
{
|
{
|
||||||
return m_Position.y;
|
return m_position.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Doors::GetZ()
|
float Doors::GetZ()
|
||||||
{
|
{
|
||||||
return m_Position.z;
|
return m_position.z;
|
||||||
}
|
}
|
||||||
|
|||||||
102
zone/doors.h
102
zone/doors.h
@ -17,31 +17,31 @@ public:
|
|||||||
Doors(const char *model, const glm::vec4& position, uint8 open_type = 58, uint16 size = 100);
|
Doors(const char *model, const glm::vec4& position, uint8 open_type = 58, uint16 size = 100);
|
||||||
Doors(const DoorsRepository::Doors& door);
|
Doors(const DoorsRepository::Doors& door);
|
||||||
|
|
||||||
bool GetDisableTimer() { return disable_timer; }
|
bool GetDisableTimer() { return m_disable_timer; }
|
||||||
bool IsDoor() const { return true; }
|
bool IsDoor() const { return true; }
|
||||||
bool IsDoorOpen() { return is_open; }
|
bool IsDoorOpen() { return m_is_open; }
|
||||||
bool Process();
|
bool Process();
|
||||||
bool triggered;
|
bool triggered;
|
||||||
char *GetDoorName() { return door_name; }
|
char *GetDoorName() { return m_door_name; }
|
||||||
const glm::vec4 GetDestination() const { return m_Destination; }
|
const glm::vec4 GetDestination() const { return m_destination; }
|
||||||
const glm::vec4 &GetPosition() const { return m_Position; }
|
const glm::vec4 &GetPosition() const { return m_position; }
|
||||||
int GetDzSwitchID() const { return m_dz_switch_id; }
|
int GetDzSwitchID() const { return m_dz_switch_id; }
|
||||||
int GetIncline() { return incline; }
|
int GetIncline() { return m_incline; }
|
||||||
int GetInvertState() { return invert_state; }
|
int GetInvertState() { return m_invert_state; }
|
||||||
uint8 GetDoorID() { return door_id; }
|
uint8 GetDoorID() { return m_door_id; }
|
||||||
uint8 GetNoKeyring() { return no_key_ring; }
|
uint8 GetNoKeyring() { return m_no_key_ring; }
|
||||||
uint8 GetOpenType() { return open_type; }
|
uint8 GetOpenType() { return m_open_type; }
|
||||||
uint8 GetTriggerDoorID() { return trigger_door; }
|
uint8 GetTriggerDoorID() { return m_trigger_door; }
|
||||||
uint8 GetTriggerType() { return trigger_type; }
|
uint8 GetTriggerType() { return m_trigger_type; }
|
||||||
uint8 IsLDoNDoor() { return is_ldon_door; }
|
uint8 IsLDoNDoor() { return m_is_ldon_door; }
|
||||||
uint16 GetLockpick() { return lockpick; }
|
uint16 GetLockpick() { return m_lockpick; }
|
||||||
uint16 GetSize() { return size; }
|
uint16 GetSize() { return m_size; }
|
||||||
uint32 GetClientVersionMask() { return client_version_mask; }
|
uint32 GetClientVersionMask() { return m_client_version_mask; }
|
||||||
uint32 GetDoorDBID() { return database_id; }
|
uint32 GetDoorDBID() { return m_database_id; }
|
||||||
uint32 GetDoorParam() { return door_param; }
|
uint32 GetDoorParam() { return m_door_param; }
|
||||||
uint32 GetEntityID() { return entity_id; }
|
uint32 GetEntityID() { return m_entity_id; }
|
||||||
uint32 GetGuildID() { return guild_id; }
|
uint32 GetGuildID() { return m_guild_id; }
|
||||||
uint32 GetKeyItem() { return key_item_id; }
|
uint32 GetKeyItem() { return m_key_item_id; }
|
||||||
void CreateDatabaseEntry();
|
void CreateDatabaseEntry();
|
||||||
void ForceClose(Mob *sender, bool alt_mode = false);
|
void ForceClose(Mob *sender, bool alt_mode = false);
|
||||||
void ForceOpen(Mob *sender, bool alt_mode = false);
|
void ForceOpen(Mob *sender, bool alt_mode = false);
|
||||||
@ -49,14 +49,14 @@ public:
|
|||||||
void Open(Mob *sender, bool alt_mode = false);
|
void Open(Mob *sender, bool alt_mode = false);
|
||||||
void SetDisableTimer(bool flag);
|
void SetDisableTimer(bool flag);
|
||||||
void SetDoorName(const char *name);
|
void SetDoorName(const char *name);
|
||||||
void SetEntityID(uint32 entity) { entity_id = entity; }
|
void SetEntityID(uint32 entity) { m_entity_id = entity; }
|
||||||
void SetIncline(int in);
|
void SetIncline(int in);
|
||||||
void SetInvertState(int in);
|
void SetInvertState(int in);
|
||||||
void SetKeyItem(uint32 in) { key_item_id = in; }
|
void SetKeyItem(uint32 in) { m_key_item_id = in; }
|
||||||
void SetLocation(float x, float y, float z);
|
void SetLocation(float x, float y, float z);
|
||||||
void SetLockpick(uint16 in) { lockpick = in; }
|
void SetLockpick(uint16 in) { m_lockpick = in; }
|
||||||
void SetNoKeyring(uint8 in) { no_key_ring = in; }
|
void SetNoKeyring(uint8 in) { m_no_key_ring = in; }
|
||||||
void SetOpenState(bool st) { is_open = st; }
|
void SetOpenState(bool st) { m_is_open = st; }
|
||||||
void SetOpenType(uint8 in);
|
void SetOpenType(uint8 in);
|
||||||
void SetPosition(const glm::vec4 &position);
|
void SetPosition(const glm::vec4 &position);
|
||||||
void SetSize(uint16 size);
|
void SetSize(uint16 size);
|
||||||
@ -68,31 +68,31 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint32 database_id;
|
uint32 m_database_id;
|
||||||
uint8 door_id;
|
uint8 m_door_id;
|
||||||
char zone_name[32];
|
char m_zone_name[32];
|
||||||
char door_name[32];
|
char m_door_name[32];
|
||||||
glm::vec4 m_Position;
|
glm::vec4 m_position;
|
||||||
int incline;
|
int m_incline;
|
||||||
uint8 open_type;
|
uint8 m_open_type;
|
||||||
uint32 guild_id;
|
uint32 m_guild_id;
|
||||||
uint16 lockpick;
|
uint16 m_lockpick;
|
||||||
uint32 key_item_id;
|
uint32 m_key_item_id;
|
||||||
uint8 no_key_ring;
|
uint8 m_no_key_ring;
|
||||||
uint8 trigger_door;
|
uint8 m_trigger_door;
|
||||||
uint8 trigger_type;
|
uint8 m_trigger_type;
|
||||||
uint32 door_param;
|
uint32 m_door_param;
|
||||||
uint16 size;
|
uint16 m_size;
|
||||||
int invert_state;
|
int m_invert_state;
|
||||||
uint32 entity_id;
|
uint32 m_entity_id;
|
||||||
bool disable_timer;
|
bool m_disable_timer;
|
||||||
bool is_open;
|
bool m_is_open;
|
||||||
Timer close_timer;
|
Timer m_close_timer;
|
||||||
char destination_zone_name[16];
|
char m_destination_zone_name[16];
|
||||||
int destination_instance_id;
|
int m_destination_instance_id;
|
||||||
glm::vec4 m_Destination;
|
glm::vec4 m_destination;
|
||||||
uint8 is_ldon_door;
|
uint8 m_is_ldon_door;
|
||||||
int m_dz_switch_id = 0;
|
int m_dz_switch_id = 0;
|
||||||
uint32 client_version_mask;
|
uint32 m_client_version_mask;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -34,80 +34,10 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// option
|
|
||||||
if (arg1.empty()) {
|
|
||||||
DoorManipulation::CommandHeader(c);
|
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
"#door create <modelname> | Creates a door from a model. (Example IT78 creates a campfire)"
|
|
||||||
);
|
|
||||||
c->Message(Chat::White, "#door setinvertstate [0|1] | Sets selected door invert state");
|
|
||||||
c->Message(Chat::White, "#door setincline <incline> | Sets selected door incline");
|
|
||||||
c->Message(Chat::White, "#door opentype <opentype> | Sets selected door opentype");
|
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
|
||||||
"#door model <modelname> | Changes door model for selected door or select from [{}] or [{}]",
|
|
||||||
Saylink::Create("#door showmodelszone", false, "local zone"),
|
|
||||||
Saylink::Create("#door showmodelsglobal", false, "global")
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
"#door showmodelsfromfile <file.eqg|file.s3d> | Shows models from s3d or eqg file. Example tssequip.eqg or wallet01.eqg"
|
|
||||||
);
|
|
||||||
|
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
|
||||||
"{} | Shows available models in the current zone that you are in",
|
|
||||||
Saylink::Create("#door showmodelszone", false, "#door showmodelszone")
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
|
||||||
"{} | Shows available models globally by first listing all global model files",
|
|
||||||
Saylink::Create("#door showmodelsglobal", false, "#door showmodelsglobal")
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
c->Message(Chat::White, "#door save | Creates database entry for selected door");
|
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
|
||||||
"{} - Brings up editing interface for selected door",
|
|
||||||
Saylink::Create("#door edit", false, "#door edit")
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
|
||||||
"{} - lists doors in zone",
|
|
||||||
Saylink::Create("#list doors", false, "#list doors")
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// edit menu
|
// edit menu
|
||||||
if (arg1 == "edit") {
|
if (arg1 == "edit") {
|
||||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||||
if (door) {
|
if (door) {
|
||||||
c->Message(
|
|
||||||
Chat::White,
|
|
||||||
fmt::format(
|
|
||||||
"Door Selected ID [{}] Name [{}] OpenType [{}] Invertstate [{} | {}/{}] ",
|
|
||||||
c->GetDoorToolEntityId(),
|
|
||||||
door->GetDoorName(),
|
|
||||||
door->GetOpenType(),
|
|
||||||
door->GetInvertState(),
|
|
||||||
Saylink::Create("#door setinvertstate 0", false, "0"),
|
|
||||||
Saylink::Create("#door setinvertstate 1", false, "1")
|
|
||||||
).c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
const std::string move_x_action = "move_x";
|
const std::string move_x_action = "move_x";
|
||||||
const std::string move_y_action = "move_y";
|
const std::string move_y_action = "move_y";
|
||||||
@ -115,189 +45,6 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
const std::string move_h_action = "move_h";
|
const std::string move_h_action = "move_h";
|
||||||
const std::string set_size_action = "set_size";
|
const std::string set_size_action = "set_size";
|
||||||
|
|
||||||
std::vector<std::string> move_options = {
|
|
||||||
move_x_action,
|
|
||||||
move_y_action,
|
|
||||||
move_z_action,
|
|
||||||
move_h_action,
|
|
||||||
set_size_action
|
|
||||||
};
|
|
||||||
std::vector<std::string> move_x_options_positive;
|
|
||||||
std::vector<std::string> move_x_options_negative;
|
|
||||||
std::vector<std::string> move_y_options_positive;
|
|
||||||
std::vector<std::string> move_y_options_negative;
|
|
||||||
std::vector<std::string> move_z_options_positive;
|
|
||||||
std::vector<std::string> move_z_options_negative;
|
|
||||||
std::vector<std::string> move_h_options_positive;
|
|
||||||
std::vector<std::string> move_h_options_negative;
|
|
||||||
std::vector<std::string> set_size_options_positive;
|
|
||||||
std::vector<std::string> set_size_options_negative;
|
|
||||||
for (const auto &move_option : move_options) {
|
|
||||||
if (move_option == move_x_action) {
|
|
||||||
move_x_options_positive.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} .25", move_option),
|
|
||||||
false,
|
|
||||||
".25"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
for (int move_index = 0; move_index <= 15; move_index += 5) {
|
|
||||||
int value = (move_index == 0 ? 1 : move_index);
|
|
||||||
move_x_options_positive.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} {}", move_option, value),
|
|
||||||
false,
|
|
||||||
fmt::format("{}", std::abs(value))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int move_index = -15; move_index <= 0; move_index += 5) {
|
|
||||||
int value = (move_index == 0 ? 1 : move_index);
|
|
||||||
move_x_options_negative.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} {}", move_option, value),
|
|
||||||
false,
|
|
||||||
fmt::format("{}", std::abs(value))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
move_x_options_negative.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} -.25", move_option),
|
|
||||||
false,
|
|
||||||
".25"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (move_option == move_y_action) {
|
|
||||||
move_y_options_positive.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} .25", move_option),
|
|
||||||
false,
|
|
||||||
".25"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
for (int move_index = 0; move_index <= 15; move_index += 5) {
|
|
||||||
int value = (move_index == 0 ? 1 : move_index);
|
|
||||||
move_y_options_positive.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} {}", move_option, value),
|
|
||||||
false,
|
|
||||||
fmt::format("{}", std::abs(value))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int move_index = -15; move_index <= 0; move_index += 5) {
|
|
||||||
int value = (move_index == 0 ? -1 : move_index);
|
|
||||||
move_y_options_negative.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} {}", move_option, value),
|
|
||||||
false,
|
|
||||||
fmt::format("{}", std::abs(value))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
move_y_options_negative.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} -.25", move_option),
|
|
||||||
false,
|
|
||||||
".25"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (move_option == move_z_action) {
|
|
||||||
move_z_options_positive.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} .25", move_option),
|
|
||||||
false,
|
|
||||||
".25"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
for (int move_index = 0; move_index <= 15; move_index += 5) {
|
|
||||||
int value = (move_index == 0 ? 1 : move_index);
|
|
||||||
move_z_options_positive.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} {}", move_option, value),
|
|
||||||
false,
|
|
||||||
fmt::format("{}", std::abs(value))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int move_index = -15; move_index <= 0; move_index += 5) {
|
|
||||||
int value = (move_index == 0 ? -1 : move_index);
|
|
||||||
move_z_options_negative.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} {}", move_option, value),
|
|
||||||
false,
|
|
||||||
fmt::format("{}", std::abs(value))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
move_z_options_negative.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} -.25", move_option),
|
|
||||||
false,
|
|
||||||
".25"
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else if (move_option == move_h_action) {
|
|
||||||
for (int move_index = 0; move_index <= 50; move_index += 5) {
|
|
||||||
int value = (move_index == 0 ? 1 : move_index);
|
|
||||||
move_h_options_positive.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} {}", move_option, value),
|
|
||||||
false,
|
|
||||||
fmt::format("{}", std::abs(value))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int move_index = -50; move_index <= 0; move_index += 5) {
|
|
||||||
int value = (move_index == 0 ? -1 : move_index);
|
|
||||||
move_h_options_negative.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} {}", move_option, value),
|
|
||||||
false,
|
|
||||||
fmt::format("{}", std::abs(value))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (move_option == set_size_action) {
|
|
||||||
for (int move_index = 0; move_index <= 100; move_index += 10) {
|
|
||||||
int value = (move_index == 0 ? 1 : move_index);
|
|
||||||
set_size_options_positive.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} {}", move_option, value),
|
|
||||||
false,
|
|
||||||
fmt::format("{}", std::abs(value))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int move_index = -100; move_index <= 0; move_index += 10) {
|
|
||||||
int value = (move_index == 0 ? -1 : move_index);
|
|
||||||
set_size_options_negative.emplace_back(
|
|
||||||
Saylink::Create(
|
|
||||||
fmt::format("#door edit {} {}", move_option, value),
|
|
||||||
false,
|
|
||||||
fmt::format("{}", std::abs(value))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// we're passing a move action here
|
// we're passing a move action here
|
||||||
if (!arg3.empty() && Strings::IsNumber(arg3)) {
|
if (!arg3.empty() && Strings::IsNumber(arg3)) {
|
||||||
float x_move = 0.0f;
|
float x_move = 0.0f;
|
||||||
@ -336,7 +83,6 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
door_position.w = door_position.w + h_move;
|
door_position.w = door_position.w + h_move;
|
||||||
door->SetPosition(door_position);
|
door->SetPosition(door_position);
|
||||||
door->SetSize(door->GetSize() + set_size);
|
door->SetSize(door->GetSize() + set_size);
|
||||||
}
|
|
||||||
|
|
||||||
// spawn and move helpers
|
// spawn and move helpers
|
||||||
uint16 helper_mob_x_negative = 0;
|
uint16 helper_mob_x_negative = 0;
|
||||||
@ -362,7 +108,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -X
|
// -X
|
||||||
glm::vec4 door_position = door->GetPosition();
|
door_position = door->GetPosition();
|
||||||
if (helper_mob_x_negative == 0) {
|
if (helper_mob_x_negative == 0) {
|
||||||
door_position.x = door_position.x - 15;
|
door_position.x = door_position.x - 15;
|
||||||
helper_mob_x_negative = NPC::SpawnNodeNPC("-X", "", door_position)->GetID();
|
helper_mob_x_negative = NPC::SpawnNodeNPC("-X", "", door_position)->GetID();
|
||||||
@ -405,6 +151,126 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
n->GMMove(door->GetX(), door->GetY() + 15, door->GetZ(), n->GetHeading());
|
n->GMMove(door->GetX(), door->GetY() + 15, door->GetZ(), n->GetHeading());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"Door Selected ID [{}] Name [{}] OpenType [{}] Invertstate [{} | {}/{}] ",
|
||||||
|
c->GetDoorToolEntityId(),
|
||||||
|
door->GetDoorName(),
|
||||||
|
door->GetOpenType(),
|
||||||
|
door->GetInvertState(),
|
||||||
|
Saylink::Create("#door setinvertstate 0", true, "0"),
|
||||||
|
Saylink::Create("#door setinvertstate 1", true, "1")
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<std::string> move_options = {
|
||||||
|
move_x_action,
|
||||||
|
move_y_action,
|
||||||
|
move_z_action,
|
||||||
|
move_h_action,
|
||||||
|
set_size_action
|
||||||
|
};
|
||||||
|
std::vector<std::string> move_x_options_positive;
|
||||||
|
std::vector<std::string> move_x_options_negative;
|
||||||
|
std::vector<std::string> move_y_options_positive;
|
||||||
|
std::vector<std::string> move_y_options_negative;
|
||||||
|
std::vector<std::string> move_z_options_positive;
|
||||||
|
std::vector<std::string> move_z_options_negative;
|
||||||
|
std::vector<std::string> move_h_options_positive;
|
||||||
|
std::vector<std::string> move_h_options_negative;
|
||||||
|
std::vector<std::string> set_size_options_positive;
|
||||||
|
std::vector<std::string> set_size_options_negative;
|
||||||
|
|
||||||
|
std::vector<std::string> xyz_values = {
|
||||||
|
".1", "1", "5", "10", "25", "50", "100"
|
||||||
|
};
|
||||||
|
|
||||||
|
// build positive options x/y/z
|
||||||
|
for (const auto &v: xyz_values) {
|
||||||
|
for (const auto &o: move_options) {
|
||||||
|
if (o == move_x_action) {
|
||||||
|
move_x_options_positive.emplace_back(
|
||||||
|
Saylink::Create(fmt::format("#door edit {} {}", o, v), true, v)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (o == move_y_action) {
|
||||||
|
move_y_options_positive.emplace_back(
|
||||||
|
Saylink::Create(fmt::format("#door edit {} {}", o, v), true, v)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (o == move_z_action) {
|
||||||
|
move_z_options_positive.emplace_back(
|
||||||
|
Saylink::Create(fmt::format("#door edit {} {}", o, v), true, v)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// loop through vector in reverse order
|
||||||
|
// build negative options x/y/z
|
||||||
|
for (auto v = xyz_values.rbegin(); v != xyz_values.rend(); ++v) {
|
||||||
|
for (const auto &o: move_options) {
|
||||||
|
if (o == move_x_action) {
|
||||||
|
move_x_options_negative.emplace_back(
|
||||||
|
Saylink::Create(fmt::format("#door edit {} -{}", o, *v), true, *v)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (o == move_y_action) {
|
||||||
|
move_y_options_negative.emplace_back(
|
||||||
|
Saylink::Create(fmt::format("#door edit {} -{}", o, *v), true, *v)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if (o == move_z_action) {
|
||||||
|
move_z_options_negative.emplace_back(
|
||||||
|
Saylink::Create(fmt::format("#door edit {} -{}", o, *v), true, *v)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> heading_values = {
|
||||||
|
"1", "5", "32.5", "63.75", "130",
|
||||||
|
};
|
||||||
|
|
||||||
|
// build positive options h
|
||||||
|
for (const auto &v: heading_values) {
|
||||||
|
move_h_options_positive.emplace_back(
|
||||||
|
Saylink::Create(fmt::format("#door edit {} {}", move_h_action, v), true, v)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// loop through vector in reverse order
|
||||||
|
// build negative options h
|
||||||
|
for (auto v = heading_values.rbegin(); v != heading_values.rend(); ++v) {
|
||||||
|
move_h_options_negative.emplace_back(
|
||||||
|
Saylink::Create(fmt::format("#door edit {} -{}", move_h_action, *v), true, *v)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> size_values = {
|
||||||
|
"1", "5", "10", "25", "50", "100", "1000"
|
||||||
|
};
|
||||||
|
|
||||||
|
// build positive options size
|
||||||
|
for (const auto &v: size_values) {
|
||||||
|
set_size_options_positive.emplace_back(
|
||||||
|
Saylink::Create(fmt::format("#door edit {} {}", set_size_action, v), true, v)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// loop through vector in reverse order
|
||||||
|
// build negative options size
|
||||||
|
for (auto v = size_values.rbegin(); v != size_values.rend(); ++v) {
|
||||||
|
set_size_options_negative.emplace_back(
|
||||||
|
Saylink::Create(fmt::format("#door edit {} -{}", set_size_action, *v), true, *v)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
c->Message(
|
c->Message(
|
||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
@ -412,17 +278,17 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
door->GetDoorName(),
|
door->GetDoorName(),
|
||||||
Saylink::Create(
|
Saylink::Create(
|
||||||
"#door save",
|
"#door save",
|
||||||
false,
|
true,
|
||||||
"Save"
|
"Save"
|
||||||
),
|
),
|
||||||
Saylink::Create(
|
Saylink::Create(
|
||||||
"#door changemodelqueue",
|
"#door changemodelqueue",
|
||||||
false,
|
true,
|
||||||
"Change Model"
|
"Change Model"
|
||||||
),
|
),
|
||||||
Saylink::Create(
|
Saylink::Create(
|
||||||
"#door setinclineinc",
|
"#door setinclineinc",
|
||||||
false,
|
true,
|
||||||
"Incline"
|
"Incline"
|
||||||
)
|
)
|
||||||
).c_str()
|
).c_str()
|
||||||
@ -505,8 +371,8 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
Chat::White,
|
Chat::White,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"#door model <modelname> | Changes door model for selected door or select from [{}] or [{}]",
|
"#door model <modelname> | Changes door model for selected door or select from [{}] or [{}]",
|
||||||
Saylink::Create("#door showmodelszone", false, "local zone"),
|
Saylink::Create("#door showmodelszone", true, "local zone"),
|
||||||
Saylink::Create("#door showmodelsglobal", false, "global")
|
Saylink::Create("#door showmodelsglobal", true, "global")
|
||||||
).c_str()
|
).c_str()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -527,7 +393,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// incline
|
// invertstate
|
||||||
if (arg1 == "setinvertstate" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
if (arg1 == "setinvertstate" && !arg2.empty() && Strings::IsNumber(arg2)) {
|
||||||
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
Doors *door = entity_list.GetDoorsByID(c->GetDoorToolEntityId());
|
||||||
if (door) {
|
if (door) {
|
||||||
@ -551,6 +417,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
door->SetIncline(door->GetIncline() + std::atoi(arg2.c_str()));
|
door->SetIncline(door->GetIncline() + std::atoi(arg2.c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg1 == "setinclineinc") {
|
if (arg1 == "setinclineinc") {
|
||||||
std::map<float, std::string> incline_values = {
|
std::map<float, std::string> incline_values = {
|
||||||
{.01, "Upright"},
|
{.01, "Upright"},
|
||||||
@ -574,7 +441,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
"#door setincline {}",
|
"#door setincline {}",
|
||||||
incline_value.first
|
incline_value.first
|
||||||
),
|
),
|
||||||
false,
|
true,
|
||||||
incline_value.second
|
incline_value.second
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -588,7 +455,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
"#door setinclineinc {}",
|
"#door setinclineinc {}",
|
||||||
incline_value
|
incline_value
|
||||||
),
|
),
|
||||||
false,
|
true,
|
||||||
itoa(std::abs(incline_value))
|
itoa(std::abs(incline_value))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -602,7 +469,7 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
"#door setinclineinc {}",
|
"#door setinclineinc {}",
|
||||||
incline_value
|
incline_value
|
||||||
),
|
),
|
||||||
false,
|
true,
|
||||||
itoa(std::abs(incline_value))
|
itoa(std::abs(incline_value))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -680,6 +547,64 @@ void DoorManipulation::CommandHandler(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
DisplayObjectResultToClient(c, game_objects);
|
DisplayObjectResultToClient(c, game_objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// help menu
|
||||||
|
if (arg1.empty()) {
|
||||||
|
DoorManipulation::CommandHeader(c);
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
"#door create <modelname> | Creates a door from a model. (Example IT78 creates a campfire)"
|
||||||
|
);
|
||||||
|
c->Message(Chat::White, "#door setinvertstate [0|1] | Sets selected door invert state");
|
||||||
|
c->Message(Chat::White, "#door setincline <incline> | Sets selected door incline");
|
||||||
|
c->Message(Chat::White, "#door opentype <opentype> | Sets selected door opentype");
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"#door model <modelname> | Changes door model for selected door or select from [{}] or [{}]",
|
||||||
|
Saylink::Create("#door showmodelszone", true, "local zone"),
|
||||||
|
Saylink::Create("#door showmodelsglobal", true, "global")
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
"#door showmodelsfromfile <file.eqg|file.s3d> | Shows models from s3d or eqg file. Example tssequip.eqg or wallet01.eqg"
|
||||||
|
);
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{} | Shows available models in the current zone that you are in",
|
||||||
|
Saylink::Create("#door showmodelszone", true, "#door showmodelszone")
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{} | Shows available models globally by first listing all global model files",
|
||||||
|
Saylink::Create("#door showmodelsglobal", true, "#door showmodelsglobal")
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
c->Message(Chat::White, "#door save | Creates database entry for selected door");
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{} - Brings up editing interface for selected door",
|
||||||
|
Saylink::Create("#door edit", true, "#door edit")
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
c->Message(
|
||||||
|
Chat::White,
|
||||||
|
fmt::format(
|
||||||
|
"{} - lists doors in zone",
|
||||||
|
Saylink::Create("#list doors", true, "#list doors")
|
||||||
|
).c_str()
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoorManipulation::CommandHeader(Client *c)
|
void DoorManipulation::CommandHeader(Client *c)
|
||||||
@ -702,7 +627,7 @@ void DoorManipulation::DisplayObjectResultToClient(
|
|||||||
"[{}] ",
|
"[{}] ",
|
||||||
Saylink::Create(
|
Saylink::Create(
|
||||||
fmt::format("#door model {}", g.object_name),
|
fmt::format("#door model {}", g.object_name),
|
||||||
false,
|
true,
|
||||||
g.object_name
|
g.object_name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -750,7 +675,7 @@ void DoorManipulation::DisplayModelsFromFileResults(
|
|||||||
"[{}] ",
|
"[{}] ",
|
||||||
Saylink::Create(
|
Saylink::Create(
|
||||||
fmt::format("#door showmodelsfromfile {}", g.file_from),
|
fmt::format("#door showmodelsfromfile {}", g.file_from),
|
||||||
false,
|
true,
|
||||||
g.file_from
|
g.file_from
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
*/
|
*/
|
||||||
void NpcScaleManager::ScaleNPC(NPC *npc)
|
void NpcScaleManager::ScaleNPC(NPC *npc)
|
||||||
{
|
{
|
||||||
if (npc->IsSkipAutoScale()) {
|
if (npc->IsSkipAutoScale() || npc->GetNPCTypeID() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user