New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scripts/ScarletEnclave: Grand Theft Palomino (quest 12680) improvements #20897
Conversation
@@ -1244,6 +1276,7 @@ void AddSC_the_scarlet_enclave_c1() | |||
new npc_eye_of_acherus(); | |||
new npc_death_knight_initiate(); | |||
new npc_salanar_the_horseman(); | |||
new spell_deliver_stolen_horse(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please replace that <tab>
with 4 spaces.
TrinityCore/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp:705:17: fatal error: use of undeclared identifier 'TargetGUID'
|
return ValidateSpellInfo({ SPELL_DELIVER_STOLEN_HORSE, SPELL_EFFECT_STOLEN_HORSE }); | ||
} | ||
|
||
void CheckHitSalanar(SpellEffIndex effIndex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp:806:44:
fatal error: unused parameter 'effIndex' [-Wunused-parameter]
void CheckHitSalanar(SpellEffIndex effIndex)
^
1 error generated.
This parameter needs to be commented out:
void CheckHitSalanar(SpellEffIndex /*effIndex*/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right, I'll comment it out when I'm back from work this evening!
Hope it's all 8)
uint32 Phase; | ||
bool Intro; | ||
ObjectGuid TargetGUID; | ||
ObjectGuid HorseGUID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_horseGUID;
_events;
private members need has _ prefix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, just renamed the previous ones, without the underscore :)
|
||
events.ScheduleEvent(EVENT_START_MOVE, 0); | ||
events.ScheduleEvent(EVENT_DESPAWN_HORSE, 5000); | ||
events.ScheduleEvent(EVENT_END_SCRIPT, 12000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use std::chrono , like:
events.ScheduleEvent(EVENT_END_SCRIPT, Seconds(12));
void HitSalanarCheck(SpellEffIndex /*effIndex*/) | ||
{ | ||
// Can only hit Salanar due to TARGET_UNIT_NEARBY_ENTRY | ||
if (Unit* salanar = GetHitUnit()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this spell can hit only units (cant hit objects) GetHitUnit() will be never null in this hook.
if (Player* player = GetHitPlayer()) | ||
player->RemoveAurasDueToSpell(SPELL_EFFECT_STOLEN_HORSE); | ||
|
||
if (Unit* caster = GetCaster()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SpellScripts caster is never null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes i know.. But since in every script there are a lot of checks I used them too. Same for the other.
I can change it anyway!
OnEffectHitTarget += SpellEffectFn(spell_deliver_stolen_horse_SpellScript::HitTargetCheck, EFFECT_1, SPELL_EFFECT_KILL_CREDIT2); | ||
} | ||
|
||
bool _salanarNear; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not initialized
Use this hook to initialize it: https://github.com/TrinityCore/TrinityCore/blob/3.3.5/src/server/game/Spells/SpellScript.h#L136-L138
|
||
void HitSalanarCheck(SpellEffIndex /*effIndex*/) | ||
{ | ||
// Can only hit Salanar due to TARGET_UNIT_NEARBY_ENTRY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the right way would be to abort spells with nearby targets which don't find any target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense but I had no idea on how to do it.
Which hook is the best for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joschiwald could you please help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right, I've thought that it was already implemented!
Anyway the second part of the spellscript is needed to implement the cosmetic part of the quest.
Removed 2 of my own comments together with 3 redundant & outdated ones (already fixed, but not hidden b/c outside of change). |
Thank you @tkrokli! Since it's my first pull request, what are the next steps? |
Mainly make sure you follow up if there are any unanswered or unsolved issues in the PR. If there are issues you can't do anything about (outside the scope of this PR), document it in your Original Post under "Known issues and TODO list". You may want to add something about that "cosmetic part of the quest" which you can't fix yet. Post a comment about your final test results at the current state of the PR. |
Nono, the cosmetic part is working (I mean the part about the horse calling the Dark Rider of Acherus)! At this moment the quest is working and it includes the cosmetic final part of the quest, where the Dark Rider of Acherus is moving towards the horse, say his sentence and then cast the whirlwind on the horse, despawning him! There's nothing more! |
return GetCaster()->GetEntry() == NPC_HAVENSHIRE_STALLION || GetCaster()->GetEntry() == NPC_HAVENSHIRE_MARE || GetCaster()->GetEntry() == NPC_HAVENSHIRE_COLT; | ||
} | ||
|
||
void HitTargetCheck(SpellEffIndex effIndex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp:814:43:
fatal error: unused parameter 'effIndex' [-Wunused-parameter]
void HitTargetCheck(SpellEffIndex effIndex)
^
comment out the unused parameter.
} | ||
|
||
void InitDespawnHorse(Unit* who) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant white space (tabs even). please remove.
|
||
void InitDespawnHorse(Unit* who) | ||
void SpellHitTarget(Unit* target, SpellInfo const* spell) override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tab->spaces
@burbur can you fix requested changes? |
Build fixed, tabs removed. what's left before we can merge it ? |
|
||
if (TempSummon* summon = me->ToTempSummon()) | ||
if (Unit* summoner = summon->GetSummoner()) | ||
_horseGUID = summoner->GetGUID(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i believe you don't have a summoner on the first reset
|
||
void HitTargetCheck(SpellEffIndex /*effIndex*/) | ||
{ | ||
if (Player* player = GetHitPlayer()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gethitunit not good enough?
(51592, 'spell_gen_despawn_self'), | ||
(51910, 'spell_gen_despawn_self'), | ||
(52264, 'spell_deliver_stolen_horse'), | ||
(54420, 'spell_gen_despawn_self'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't delete all these spell_gen_despawn_self and readd them again, just delete what is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in this case, an exception can be made from the rule of "only delete entries in spell_script_names
by ScriptName
" -- so we only delete + insert 52267 spell_gen_despawn_self
by spell_id
in addition to regular handling of spell_deliver_stolen_horse
?
edit: Never mind, it has been a while since I looked into this and the only point of this was to unlink 52267 and link spell_deliver_stolen_horse
. Will fix.
- only perform necessary changes, not redo all the spell IDs
SPELL_DESPAWN_HORSE = 51918 | ||
SPELL_DESPAWN_HORSE = 52267, | ||
|
||
EVENT_START_MOVE = 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never use 0 as Event ID, 0 is used by ExecuteEvent() to mean "no events was executed".
This makes me doubt about the quality of the whole PR. By looking at the code it feels like the EVENT_START_MOVE event is executed over and over and over. Did you debug your code to see what it was doing (with breakpoints and other debugging tools) ?
@burbur please check the comments in this PR |
} | ||
case EVENT_START_MOVE: | ||
me->SetTarget(_horseGUID); | ||
me->SetSpeedRate(MOVE_RUN, 0.4f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what kind of magic number is 0.4f ?
Ask here to reopen the PR if anyone wants to work on it |
Changes proposed:
Quest 12680 - Grand Theft Palomino corrections:
Target branch(es):
Issues addressed: Closes #20844
Tests performed: (Does it build, tested in-game, etc.)
Does it build, tested-in-game, quest rewarded.
Known issues and TODO list:
No issues found.
Thanks to @tkrokli for the sql formatting.