mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-29 16:42:25 +00:00
[Quest API] (Performance) Check event EVENT_COMBINE, EVENT_COMBINE_SUCCESS, EVENT_COMBINE_FAILURE, or EVENT_COMBINE_VALIDATE exist before export and execute (#2896)
* [Quest API] Optionally parse EVENT_COMBINE_SUCCESS and EVENT_COMBINE_FAILURE - Optionally parse these events instead of always doing so. * Update tradeskills.cpp * Update tradeskills.cpp
This commit is contained in:
parent
9f619859d1
commit
3d6b0e5f74
@ -373,11 +373,13 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
|
|||||||
|
|
||||||
DBTradeskillRecipe_Struct spec;
|
DBTradeskillRecipe_Struct spec;
|
||||||
|
|
||||||
if (parse->EventPlayer(EVENT_COMBINE, user, std::to_string(in_combine->container_slot), 0) == 1) {
|
if (parse->PlayerHasQuestSub(EVENT_COMBINE)) {
|
||||||
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
|
if (parse->EventPlayer(EVENT_COMBINE, user, std::to_string(in_combine->container_slot), 0) == 1) {
|
||||||
user->QueuePacket(outapp);
|
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
|
||||||
safe_delete(outapp);
|
user->QueuePacket(outapp);
|
||||||
return;
|
safe_delete(outapp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!content_db.GetTradeRecipe(container, c_type, some_id, user->CharacterID(), &spec)) {
|
if (!content_db.GetTradeRecipe(container, c_type, some_id, user->CharacterID(), &spec)) {
|
||||||
@ -446,13 +448,17 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
|
|||||||
}
|
}
|
||||||
|
|
||||||
// final check for any additional quest requirements .. "check_zone" in this case - exported as variable [validate_type]
|
// final check for any additional quest requirements .. "check_zone" in this case - exported as variable [validate_type]
|
||||||
std::string export_string = fmt::format("check_zone {}", zone->GetZoneID());
|
if (parse->PlayerHasQuestSub(EVENT_COMBINE_VALIDATE)) {
|
||||||
if (parse->EventPlayer(EVENT_COMBINE_VALIDATE, user, export_string, spec.recipe_id) != 0) {
|
if (parse->EventPlayer(EVENT_COMBINE_VALIDATE, user, fmt::format("check_zone {}", zone->GetZoneID()), spec.recipe_id) != 0) {
|
||||||
user->Message(Chat::Emote, "You cannot make this combine because the location requirement has not been met.");
|
user->Message(
|
||||||
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
|
Chat::Emote,
|
||||||
user->QueuePacket(outapp);
|
"You cannot make this combine because the location requirement has not been met."
|
||||||
safe_delete(outapp);
|
);
|
||||||
return;
|
auto outapp = new EQApplicationPacket(OP_TradeSkillCombine, 0);
|
||||||
|
user->QueuePacket(outapp);
|
||||||
|
safe_delete(outapp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send acknowledgement packets to client
|
// Send acknowledgement packets to client
|
||||||
@ -509,24 +515,29 @@ void Object::HandleCombine(Client* user, const NewCombine_Struct* in_combine, Ob
|
|||||||
.recipe_id = spec.recipe_id,
|
.recipe_id = spec.recipe_id,
|
||||||
.recipe_name = spec.name,
|
.recipe_name = spec.name,
|
||||||
.made_count = spec.madecount,
|
.made_count = spec.madecount,
|
||||||
.tradeskill_id = (uint32)spec.tradeskill
|
.tradeskill_id = (uint32) spec.tradeskill
|
||||||
};
|
};
|
||||||
RecordPlayerEventLogWithClient(user, PlayerEvent::COMBINE_SUCCESS, e);
|
RecordPlayerEventLogWithClient(user, PlayerEvent::COMBINE_SUCCESS, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
parse->EventPlayer(EVENT_COMBINE_SUCCESS, user, spec.name, spec.recipe_id);
|
if (parse->PlayerHasQuestSub(EVENT_COMBINE_SUCCESS)) {
|
||||||
} else {
|
parse->EventPlayer(EVENT_COMBINE_SUCCESS, user, spec.name, spec.recipe_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (player_event_logs.IsEventEnabled(PlayerEvent::COMBINE_FAILURE)) {
|
if (player_event_logs.IsEventEnabled(PlayerEvent::COMBINE_FAILURE)) {
|
||||||
auto e = PlayerEvent::CombineEvent{
|
auto e = PlayerEvent::CombineEvent{
|
||||||
.recipe_id = spec.recipe_id,
|
.recipe_id = spec.recipe_id,
|
||||||
.recipe_name = spec.name,
|
.recipe_name = spec.name,
|
||||||
.made_count = spec.madecount,
|
.made_count = spec.madecount,
|
||||||
.tradeskill_id = (uint32)spec.tradeskill
|
.tradeskill_id = (uint32) spec.tradeskill
|
||||||
};
|
};
|
||||||
RecordPlayerEventLogWithClient(user, PlayerEvent::COMBINE_FAILURE, e);
|
RecordPlayerEventLogWithClient(user, PlayerEvent::COMBINE_FAILURE, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
parse->EventPlayer(EVENT_COMBINE_FAILURE, user, spec.name, spec.recipe_id);
|
if (parse->PlayerHasQuestSub(EVENT_COMBINE_FAILURE)) {
|
||||||
|
parse->EventPlayer(EVENT_COMBINE_FAILURE, user, spec.name, spec.recipe_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,9 +712,13 @@ void Object::HandleAutoCombine(Client* user, const RecipeAutoCombine_Struct* rac
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
parse->EventPlayer(EVENT_COMBINE_SUCCESS, user, spec.name, spec.recipe_id);
|
if (parse->PlayerHasQuestSub(EVENT_COMBINE_SUCCESS)) {
|
||||||
|
parse->EventPlayer(EVENT_COMBINE_SUCCESS, user, spec.name, spec.recipe_id);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
parse->EventPlayer(EVENT_COMBINE_FAILURE, user, spec.name, spec.recipe_id);
|
if (parse->PlayerHasQuestSub(EVENT_COMBINE_FAILURE)) {
|
||||||
|
parse->EventPlayer(EVENT_COMBINE_FAILURE, user, spec.name, spec.recipe_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user