mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-16 01:01:30 +00:00
[Quest API] (Performance) Check event exists before export and execute EVENT_AGGRO_SAY, EVENT_SAY, and EVENT_PROXIMITY_SAY (#2882)
* [Quest API] Add optional parsing to EVENT_AGGRO_SAY and EVENT_SAY # Notes - Optionally parse these events instead of always doing so. * Optionally parse EVENT_PROXIMITY_SAY
This commit is contained in:
parent
9e16cd8ae8
commit
f9a87e26c9
@ -1199,7 +1199,9 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
|
||||
entity_list.ChannelMessage(sender, chan_num, language, lang_skill, message);
|
||||
}
|
||||
|
||||
parse->EventPlayer(EVENT_SAY, this, message, language);
|
||||
if (parse->PlayerHasQuestSub(EVENT_SAY)) {
|
||||
parse->EventPlayer(EVENT_SAY, this, message, language);
|
||||
}
|
||||
|
||||
if (sender != this) {
|
||||
break;
|
||||
@ -1220,8 +1222,9 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
|
||||
CheckEmoteHail(t, message);
|
||||
|
||||
if (DistanceNoZ(m_Position, t->GetPosition()) <= RuleI(Range, Say)) {
|
||||
|
||||
parse->EventNPC(EVENT_SAY, t, this, message, language);
|
||||
if (parse->HasQuestSub(t->GetNPCTypeID(), EVENT_SAY)) {
|
||||
parse->EventNPC(EVENT_SAY, t, this, message, language);
|
||||
}
|
||||
|
||||
if (RuleB(TaskSystem, EnableTaskSystem)) {
|
||||
if (UpdateTasksOnSpeakWith(t)) {
|
||||
@ -1230,8 +1233,10 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (DistanceSquaredNoZ(m_Position, t->GetPosition()) <= RuleI(Range, Say)) {
|
||||
parse->EventNPC(EVENT_AGGRO_SAY, t, this, message, language);
|
||||
if (parse->HasQuestSub(t->GetNPCTypeID(), EVENT_AGGRO_SAY)) {
|
||||
if (DistanceSquaredNoZ(m_Position, t->GetPosition()) <= RuleI(Range, Say)) {
|
||||
parse->EventNPC(EVENT_AGGRO_SAY, t, this, message, language);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1239,9 +1244,13 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s
|
||||
else if (GetTarget() && GetTarget()->IsBot() && !IsInvisible(GetTarget())) {
|
||||
if (DistanceNoZ(m_Position, GetTarget()->GetPosition()) <= RuleI(Range, Say)) {
|
||||
if (GetTarget()->IsEngaged()) {
|
||||
parse->EventBot(EVENT_AGGRO_SAY, GetTarget()->CastToBot(), this, message, language);
|
||||
if (parse->BotHasQuestSub(EVENT_AGGRO_SAY)) {
|
||||
parse->EventBot(EVENT_AGGRO_SAY, GetTarget()->CastToBot(), this, message, language);
|
||||
}
|
||||
} else {
|
||||
parse->EventBot(EVENT_SAY, GetTarget()->CastToBot(), this, message, language);
|
||||
if (parse->BotHasQuestSub(EVENT_SAY)) {
|
||||
parse->EventBot(EVENT_SAY, GetTarget()->CastToBot(), this, message, language);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4134,24 +4134,31 @@ void EntityList::ClearAreas()
|
||||
area_list.clear();
|
||||
}
|
||||
|
||||
void EntityList::ProcessProximitySay(const char *Message, Client *c, uint8 language)
|
||||
void EntityList::ProcessProximitySay(const char *message, Client *c, uint8 language)
|
||||
{
|
||||
if (!Message || !c)
|
||||
if (!message || !c) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto iter = proximity_list.begin();
|
||||
for (; iter != proximity_list.end(); ++iter) {
|
||||
NPC *d = (*iter);
|
||||
NPCProximity *l = d->proximity;
|
||||
if (l == nullptr || !l->say)
|
||||
for (const auto& n : proximity_list) {
|
||||
auto* p = n->proximity;
|
||||
if (!p || !p->say) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c->GetX() < l->min_x || c->GetX() > l->max_x
|
||||
|| c->GetY() < l->min_y || c->GetY() > l->max_y
|
||||
|| c->GetZ() < l->min_z || c->GetZ() > l->max_z)
|
||||
if (!parse->HasQuestSub(n->GetNPCTypeID(), EVENT_PROXIMITY_SAY)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
parse->EventNPC(EVENT_PROXIMITY_SAY, d, c, Message, language);
|
||||
if (
|
||||
!EQ::ValueWithin(c->GetX(), p->min_x, p->max_x) ||
|
||||
!EQ::ValueWithin(c->GetY(), p->min_y, p->max_y) ||
|
||||
!EQ::ValueWithin(c->GetZ(), p->min_z, p->max_z)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
parse->EventNPC(EVENT_PROXIMITY_SAY, n, c, message, language);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -263,7 +263,7 @@ public:
|
||||
void RemoveArea(int id);
|
||||
void ClearAreas();
|
||||
void ReloadMerchants();
|
||||
void ProcessProximitySay(const char *Message, Client *c, uint8 language = 0);
|
||||
void ProcessProximitySay(const char *message, Client *c, uint8 language = 0);
|
||||
void SendAATimer(uint32 charid,UseAA_Struct* uaa);
|
||||
Doors *FindDoor(uint8 door_id);
|
||||
Object *FindObject(uint32 object_id);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user