Implement and fix find for half the available types; will need cleanup and some more of the types implemented.

This commit is contained in:
KimLS
2024-11-27 22:33:39 -08:00
parent 17e922b026
commit 1354f73771
14 changed files with 114 additions and 70 deletions
+19 -30
View File
@@ -11995,15 +11995,13 @@ void Client::MaxSkills()
}
}
void Client::SendPath(Mob* target)
{
void Client::SendPath(Mob* target) {
if (!target) {
EQApplicationPacket outapp(OP_FindPersonReply, 0);
QueuePacket(&outapp);
return;
}
if (
!RuleB(Pathing, Find) &&
RuleB(Bazaar, EnableWarpToTrader) &&
@@ -12011,7 +12009,7 @@ void Client::SendPath(Mob* target)
(
target->CastToClient()->IsTrader() ||
target->CastToClient()->IsBuyer()
)
)
) {
Message(
Chat::Yellow,
@@ -12031,6 +12029,17 @@ void Client::SendPath(Mob* target)
return;
}
glm::vec3 target_loc(
target->GetX(),
target->GetY(),
target->GetZ() + (target->GetSize() < 6.0 ? 6 : target->GetSize()) * HEAD_POSITION
);
SendPath(target_loc);
}
void Client::SendPath(const glm::vec3& loc)
{
std::vector<FindPerson_Point> points;
if (!RuleB(Pathing, Find) || !zone->pathing) {
@@ -12041,9 +12050,9 @@ void Client::SendPath(Mob* target)
a.x = GetX();
a.y = GetY();
a.z = GetZ();
b.x = target->GetX();
b.y = target->GetY();
b.z = target->GetZ();
b.x = loc.x;
b.y = loc.y;
b.z = loc.z;
points.push_back(a);
points.push_back(b);
@@ -12056,9 +12065,9 @@ void Client::SendPath(Mob* target)
);
glm::vec3 path_end(
target->GetX(),
target->GetY(),
target->GetZ() + (target->GetSize() < 6.0 ? 6 : target->GetSize()) * HEAD_POSITION
loc.x,
loc.y,
loc.z
);
bool partial = false;
@@ -12081,18 +12090,6 @@ void Client::SendPath(Mob* target)
bool leads_to_teleporter = false;
auto v = path_list.back();
p.x = v.pos.x;
p.y = v.pos.y;
p.z = v.pos.z;
points.push_back(p);
p.x = GetX();
p.y = GetY();
p.z = GetZ();
points.push_back(p);
for (const auto &n: path_list) {
if (n.teleport) {
leads_to_teleporter = true;
@@ -12108,14 +12105,6 @@ void Client::SendPath(Mob* target)
++point_number;
}
if (!leads_to_teleporter) {
p.x = target->GetX();
p.y = target->GetY();
p.z = target->GetZ();
points.push_back(p);
}
}
SendPathPacket(points);
+1
View File
@@ -869,6 +869,7 @@ public:
int GetAccountAge();
void SendPath(Mob* target);
void SendPath(const glm::vec3 &loc);
bool IsDiscovered(uint32 itemid);
void DiscoverItem(uint32 itemid);
+33 -2
View File
@@ -6477,9 +6477,40 @@ void Client::Handle_OP_FindPersonRequest(const EQApplicationPacket *app)
else {
auto* t = (FindPersonRequest_Struct*)app->pBuffer;
auto* m = entity_list.GetMob(t->npc_id);
switch (t->type) {
case FindLocationType::LocationPlayer: {
auto* m = entity_list.GetMob(t->id);
SendPath(m);
break;
}
case FindLocationType::LocationSwitch:
{
auto *d = entity_list.GetDoorsByDoorID(t->id);
if (d == nullptr) {
Message(Chat::Red, "Switch for find not found.");
return;
}
SendPath(m);
glm::vec3 door_loc;
door_loc.x = d->GetX();
door_loc.y = d->GetY();
door_loc.z = d->GetZ();
SendPath(door_loc);
break;
}
case FindLocationType::LocationLocation:
{
glm::vec3 target_pos;
target_pos.x = t->target_pos.x;
target_pos.y = t->target_pos.y;
target_pos.z = t->target_pos.z;
SendPath(target_pos);
break;
}
default:
break;
}
}
}
+10 -13
View File
@@ -72,22 +72,19 @@ void Client::SendPathPacket(const std::vector<FindPerson_Point> &points) {
Message(Chat::System, "Total points %u", points.size());
}
int len = sizeof(FindPersonResult_Struct) + (points.size() + 1) * sizeof(FindPerson_Point);
int len = (points.size() + 1) * sizeof(FindPerson_Point);
auto outapp = new EQApplicationPacket(OP_FindPersonReply, len);
FindPersonResult_Struct* fpr = (FindPersonResult_Struct*)outapp->pBuffer;
std::vector<FindPerson_Point>::iterator cur, end;
cur = points.begin();
end = points.end();
unsigned int r;
for (r = 0; cur != end; ++cur, r++) {
fpr->path[r] = *cur;
auto& last = points.back();
outapp->WriteFloat(last.y);
outapp->WriteFloat(last.x);
outapp->WriteFloat(last.z);
for (auto& p : points) {
outapp->WriteFloat(p.y);
outapp->WriteFloat(p.x);
outapp->WriteFloat(p.z);
}
//put the last element into the destination field
--cur;
fpr->path[r] = *cur;
fpr->dest = *cur;
FastQueuePacket(&outapp);
})