Skip to content
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

Closed
wants to merge 13 commits into from
Closed

Scripts/ScarletEnclave: Grand Theft Palomino (quest 12680) improvements #20897

wants to merge 13 commits into from

Conversation

burbur
Copy link

@burbur burbur commented Nov 17, 2017

Changes proposed:

Quest 12680 - Grand Theft Palomino corrections:

  • Quest credit can only be taken if near Salanar.
  • Player is dismounted after using spell 52264 - Deliver Stolen Horse.
  • Dark Rider of Acherus does not despawn anymore after the cast of spell 52267 - Despawn Horse.
  • Dark Rider of Acherus aestetich corrections: now he moves towards the horse, say the text and apply the visual effect to the horse after the player uses 52264 - Deliver Stolen Horse to complete the quest.

Target branch(es):

  • 3.3.5
  • master

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.

@ghost ghost changed the title Grand Theft Palomino (Quest 12680) corrections. Scripts/ScarletEnclave: Grand Theft Palomino (quest 12680) improvements Nov 17, 2017
@@ -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();
Copy link

@ghost ghost Nov 17, 2017

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.

@Aokromes
Copy link
Member

TrinityCore/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp:705:17: fatal error: use of undeclared identifier 'TargetGUID'

            TargetGUID = who->GetGUID();

            ^

return ValidateSpellInfo({ SPELL_DELIVER_STOLEN_HORSE, SPELL_EFFECT_STOLEN_HORSE });
}

void CheckHitSalanar(SpellEffIndex effIndex)
Copy link

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*/)

Copy link
Author

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;
Copy link
Member

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

Copy link
Author

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);
Copy link
Member

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())
Copy link
Member

@Keader Keader Nov 17, 2017

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())
Copy link
Member

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

Copy link
Author

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


void HitSalanarCheck(SpellEffIndex /*effIndex*/)
{
// Can only hit Salanar due to TARGET_UNIT_NEARBY_ENTRY
Copy link
Contributor

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

Copy link
Author

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?

Copy link
Contributor

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

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.

@ghost ghost deleted a comment from Aokromes Nov 22, 2017
@ghost ghost deleted a comment from burbur Nov 22, 2017
@ghost ghost deleted a comment from burbur Nov 22, 2017
@ghost
Copy link

ghost commented Nov 22, 2017

Removed 2 of my own comments together with 3 redundant & outdated ones (already fixed, but not hidden b/c outside of change).

@burbur
Copy link
Author

burbur commented Nov 22, 2017

Thank you @tkrokli!

Since it's my first pull request, what are the next steps?

@ghost
Copy link

ghost commented Nov 22, 2017

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.

@burbur
Copy link
Author

burbur commented Nov 22, 2017

Nono, the cosmetic part is working (I mean the part about the horse calling the Dark Rider of Acherus)!
In the previous comment I told that, even with the patch by @joschiwald, the spell script is needed to call all the functions that are already there.

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)
Copy link

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)

Copy link

@ghost ghost Dec 16, 2017

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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tab->spaces

@Aokromes
Copy link
Member

@burbur can you fix requested changes?

@jackpoz
Copy link
Member

jackpoz commented Dec 24, 2017

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();
Copy link
Contributor

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())
Copy link
Contributor

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');
Copy link
Contributor

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

Copy link

@ghost ghost Dec 24, 2017

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,
Copy link
Member

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) ?

@jackpoz
Copy link
Member

jackpoz commented Dec 24, 2017

@burbur please check the comments in this PR

}
case EVENT_START_MOVE:
me->SetTarget(_horseGUID);
me->SetSpeedRate(MOVE_RUN, 0.4f);
Copy link
Member

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 ?

@jackpoz
Copy link
Member

jackpoz commented Jan 12, 2018

Ask here to reopen the PR if anyone wants to work on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants