Quest chains: a test that the next step's Accept goes to its giver after a turn-in
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
|
||||
use benilla_protocol::field::FIELD_UNIT_HEALTH;
|
||||
use benilla_protocol::messages::{
|
||||
GossipOption, NpcTextBlock, QuestDetails, QuestGiverList, QuestListEntry, TradeStatus,
|
||||
GossipOption, NpcTextBlock, QuestComplete, QuestDetails, QuestGiverList, QuestListEntry,
|
||||
QuestOfferReward, TradeStatus,
|
||||
};
|
||||
use benilla_protocol::{EntityKind, SessionEvent};
|
||||
use benilla_ui::script::UiScript;
|
||||
@@ -186,6 +187,67 @@ fn a_quest_detail_after_a_greeting_accepts_with_the_givers_guid() {
|
||||
);
|
||||
}
|
||||
|
||||
/// A turn-in, then the chain's next step in the same packet batch, as vmangos sends
|
||||
/// `SMSG_QUESTGIVER_QUEST_COMPLETE` right before `_QUEST_DETAILS`: the turn-in's `QUEST_FINISHED`
|
||||
/// reaches the stock `OnHide`'s `CloseQuest()` after the next panel opened, and leaves it, so its
|
||||
/// Accept goes to the giver.
|
||||
#[test]
|
||||
fn a_chains_next_step_after_a_turn_in_accepts_with_the_givers_guid() {
|
||||
let _data = benilla_formats::wow_data_or_skip!();
|
||||
let mut c = client(
|
||||
&[r"Interface\FrameXML\QuestFrame.xml"],
|
||||
&[(NPC, EntityKind::Unit)],
|
||||
);
|
||||
c.frame(vec![vec![SessionEvent::QuestOffer(QuestOfferReward {
|
||||
npc: NPC,
|
||||
quest_id: 458,
|
||||
title: "The Woodland Protector".into(),
|
||||
offer_text: "Well done.".into(),
|
||||
auto_finish: 0,
|
||||
choices: Vec::new(),
|
||||
rewards: Vec::new(),
|
||||
money: 0,
|
||||
quest_flags: 0,
|
||||
reward_spell: 0,
|
||||
})]]);
|
||||
assert!(visible(&mut c, "QuestFrame"));
|
||||
c.sent();
|
||||
c.frame(vec![
|
||||
vec![SessionEvent::QuestComplete(QuestComplete {
|
||||
quest_id: 458,
|
||||
xp: 40,
|
||||
money: 0,
|
||||
items: Vec::new(),
|
||||
})],
|
||||
vec![SessionEvent::QuestDetail(QuestDetails {
|
||||
npc: NPC,
|
||||
quest_id: 459,
|
||||
title: "The Woodland Protector".into(),
|
||||
details: "Seek out the grell.".into(),
|
||||
objectives: String::new(),
|
||||
auto_finish: 0,
|
||||
choices: Vec::new(),
|
||||
rewards: Vec::new(),
|
||||
money: 0,
|
||||
reward_spell: 0,
|
||||
})],
|
||||
]);
|
||||
c.frame(vec![]);
|
||||
assert!(visible(&mut c, "QuestFrame"), "the next step's panel is up");
|
||||
c.sent();
|
||||
let _: () = c.eval("AcceptQuest()");
|
||||
assert_eq!(
|
||||
c.sent(),
|
||||
[format!(
|
||||
"{:?}",
|
||||
ClientCommand::QuestgiverAccept {
|
||||
npc: NPC,
|
||||
quest: 459
|
||||
}
|
||||
)]
|
||||
);
|
||||
}
|
||||
|
||||
/// A menu from a second NPC in a later frame: its register closes the first's menu inside the
|
||||
/// handler (`0x4e1fa0`), whose `GOSSIP_CLOSED` hides the stock frame (`GossipFrame.lua:19`), and
|
||||
/// `OnHide`'s `CloseGossip()` re-enters a core that finds its cell zero; the second menu stays, so
|
||||
|
||||
Reference in New Issue
Block a user