Modcraft - The community dedicated to quality WoW modding!

Wrath of the Lich King Modding => Miscellaneous => Topic started by: Nupper on September 07, 2016, 03:15:58 am

Title: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: Nupper on September 07, 2016, 03:15:58 am
Changes Made
Player.cpp
Before:
Code: [Select]
bool Player::CanFlyInZone(uint32 mapid, uint32 zone) const
{
    // continent checked in SpellInfo::CheckLocation at cast and area update
    uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
    return v_map != 571 || HasSpell(54197); // 54197 = Cold Weather Flying
}
After
Code: [Select]
bool Player::CanFlyInZone(uint32 mapid, uint32 zone) const
{
    // continent checked in SpellInfo::CheckLocation at cast and area update
    uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
    return v_map != 571 || HasSpell(54197); // 54197 = Cold Weather Flying
    return v_map != 869 || HasSpell(93333); // 93333 = Flight Master's License
}

Spell_generic.Cpp.
First part
Before
Code: [Select]
enum Mounts
{
    SPELL_COLD_WEATHER_FLYING           = 54197,

    // Magic Broom
    SPELL_MAGIC_BROOM_60                = 42680,
    SPELL_MAGIC_BROOM_100               = 42683,
    SPELL_MAGIC_BROOM_150               = 42667,
    SPELL_MAGIC_BROOM_280               = 42668,

    // Headless Horseman's Mount
    SPELL_HEADLESS_HORSEMAN_MOUNT_60    = 51621,
    SPELL_HEADLESS_HORSEMAN_MOUNT_100   = 48024,
    SPELL_HEADLESS_HORSEMAN_MOUNT_150   = 51617,
    SPELL_HEADLESS_HORSEMAN_MOUNT_280   = 48023,

    // Winged Steed of the Ebon Blade
    SPELL_WINGED_STEED_150              = 54726,
    SPELL_WINGED_STEED_280              = 54727,

    // Big Love Rocket
    SPELL_BIG_LOVE_ROCKET_0             = 71343,
    SPELL_BIG_LOVE_ROCKET_60            = 71344,
    SPELL_BIG_LOVE_ROCKET_100           = 71345,
    SPELL_BIG_LOVE_ROCKET_150           = 71346,
    SPELL_BIG_LOVE_ROCKET_310           = 71347,

    // Invincible
    SPELL_INVINCIBLE_60                 = 72281,
    SPELL_INVINCIBLE_100                = 72282,
    SPELL_INVINCIBLE_150                = 72283,
    SPELL_INVINCIBLE_310                = 72284,

    // Blazing Hippogryph
    SPELL_BLAZING_HIPPOGRYPH_150        = 74854,
    SPELL_BLAZING_HIPPOGRYPH_280        = 74855,

    // Celestial Steed
    SPELL_CELESTIAL_STEED_60            = 75619,
    SPELL_CELESTIAL_STEED_100           = 75620,
    SPELL_CELESTIAL_STEED_150           = 75617,
    SPELL_CELESTIAL_STEED_280           = 75618,
    SPELL_CELESTIAL_STEED_310           = 76153,

    // X-53 Touring Rocket
    SPELL_X53_TOURING_ROCKET_150        = 75957,
    SPELL_X53_TOURING_ROCKET_280        = 75972,
    SPELL_X53_TOURING_ROCKET_310        = 76154
};
After
Code: [Select]
enum Mounts
{
    SPELL_COLD_WEATHER_FLYING           = 54197,
    SPELL_OSHOTH_FLYING     = 93333,

    // Magic Broom
    SPELL_MAGIC_BROOM_60                = 42680,
    SPELL_MAGIC_BROOM_100               = 42683,
    SPELL_MAGIC_BROOM_150               = 42667,
    SPELL_MAGIC_BROOM_280               = 42668,

    // Headless Horseman's Mount
    SPELL_HEADLESS_HORSEMAN_MOUNT_60    = 51621,
    SPELL_HEADLESS_HORSEMAN_MOUNT_100   = 48024,
    SPELL_HEADLESS_HORSEMAN_MOUNT_150   = 51617,
    SPELL_HEADLESS_HORSEMAN_MOUNT_280   = 48023,

    // Winged Steed of the Ebon Blade
    SPELL_WINGED_STEED_150              = 54726,
    SPELL_WINGED_STEED_280              = 54727,

    // Big Love Rocket
    SPELL_BIG_LOVE_ROCKET_0             = 71343,
    SPELL_BIG_LOVE_ROCKET_60            = 71344,
    SPELL_BIG_LOVE_ROCKET_100           = 71345,
    SPELL_BIG_LOVE_ROCKET_150           = 71346,
    SPELL_BIG_LOVE_ROCKET_310           = 71347,

    // Invincible
    SPELL_INVINCIBLE_60                 = 72281,
    SPELL_INVINCIBLE_100                = 72282,
    SPELL_INVINCIBLE_150                = 72283,
    SPELL_INVINCIBLE_310                = 72284,

    // Blazing Hippogryph
    SPELL_BLAZING_HIPPOGRYPH_150        = 74854,
    SPELL_BLAZING_HIPPOGRYPH_280        = 74855,

    // Celestial Steed
    SPELL_CELESTIAL_STEED_60            = 75619,
    SPELL_CELESTIAL_STEED_100           = 75620,
    SPELL_CELESTIAL_STEED_150           = 75617,
    SPELL_CELESTIAL_STEED_280           = 75618,
    SPELL_CELESTIAL_STEED_310           = 76153,

    // X-53 Touring Rocket
    SPELL_X53_TOURING_ROCKET_150        = 75957,
    SPELL_X53_TOURING_ROCKET_280        = 75972,
    SPELL_X53_TOURING_ROCKET_310        = 76154
};
Second part
Before
Code: [Select]
// Triggered spell id dependent on riding skill and zone
                    bool canFly = false;
                    uint32 map = GetVirtualMapForMapAndZone(target->GetMapId(), target->GetZoneId());
if (map == 530 || (map == 571 && target->HasSpell(SPELL_COLD_WEATHER_FLYING)))
                        canFly = true;
After
Code: [Select]
// Triggered spell id dependent on riding skill and zone
                    bool canFly = false;
                    uint32 map = GetVirtualMapForMapAndZone(target->GetMapId(), target->GetZoneId());
if (map == 530 || (map == 571 && target->HasSpell(SPELL_COLD_WEATHER_FLYING) || (map == 869 && target->HasSpell(SPELL_OSHOTH_FLYING))))
                        canFly = true;

What happons (Without or With spell) You mount but you dismount when you change Area.
The Spell Should be Required but it still mounts if you don't have.

MapID: 869
Spell: 93333
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: schlumpf on September 07, 2016, 09:01:10 am
Quote from: "Nupper"
Changes Made
Player.cpp
Code: [Select]
bool Player::CanFlyInZone(uint32 mapid, uint32 zone) const
{
    // continent checked in SpellInfo::CheckLocation at cast and area update
    uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
    return v_map != 571 || HasSpell(54197); // 54197 = Cold Weather Flying
    return v_map != 869 || HasSpell(93333); // 93333 = Flight Master's License
}
You return twice. This can't be correct. Haven't read the other changes. Also, prefer posting changes as diff, not just how the new file looks. People usually don't know how it looked before, so spotting your changes is hard.
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: Nupper on September 07, 2016, 10:40:59 am
Quote from: "schlumpf"
Quote from: "Nupper"
Changes Made
Player.cpp
Code: [Select]
bool Player::CanFlyInZone(uint32 mapid, uint32 zone) const
{
    // continent checked in SpellInfo::CheckLocation at cast and area update
    uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
    return v_map != 571 || HasSpell(54197); // 54197 = Cold Weather Flying
    return v_map != 869 || HasSpell(93333); // 93333 = Flight Master's License
}
You return twice. This can't be correct. Haven't read the other changes. Also, prefer posting changes as diff, not just how the new file looks. People usually don't know how it looked before, so spotting your changes is hard.

Updated.
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: schlumpf on September 07, 2016, 11:33:31 am
You still return twice. Also,

Code: [Select]
if (map == 530 || (map == 571 && target->HasSpell(SPELL_COLD_WEATHER_FLYING) || (map == 869 && target->HasSpell(SPELL_OSHOTH_FLYING))))
has the new condition inserted at the wrong place making it

Code: [Select]
expansion01|| (northrend && has_coldweather || (your_map && has_your_spell))
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: Nupper on September 07, 2016, 01:04:11 pm
Quote from: "schlumpf"
You still return twice. Also,

Code: [Select]
if (map == 530 || (map == 571 && target->HasSpell(SPELL_COLD_WEATHER_FLYING) || (map == 869 && target->HasSpell(SPELL_OSHOTH_FLYING))))
has the new condition inserted at the wrong place making it

Code: [Select]
expansion01|| (northrend && has_coldweather || (your_map && has_your_spell))

How do i make it not return twice.
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: schlumpf on September 07, 2016, 06:10:53 pm
Don't write return twice?!
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: Nupper on September 08, 2016, 12:20:00 am
Quote from: "schlumpf"
Don't write return twice?!

I Fixed issue where the mount dismounts upon changing area....but it still mounts without the require spell
its ment to function like Cold Weather flying but for the new map.
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: schlumpf on September 08, 2016, 12:55:39 am
You have given exactly 0 information that anyone could use to help you :)
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: Nupper on September 08, 2016, 12:52:31 pm
Quote from: "schlumpf"
You have given exactly 0 information that anyone could use to help you :)

Think cold Weather flying...Apply that to a new mapID and Spell thats how i would like it to function.
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: schlumpf on September 08, 2016, 02:08:03 pm
Quote
I Fixed issue where the mount dismounts upon changing area

What did you do? Did you change  the two things I pointed out? How does it look now?
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: Nupper on September 08, 2016, 04:08:26 pm
Quote from: "schlumpf"
Quote
I Fixed issue where the mount dismounts upon changing area

What did you do? Did you change  the two things I pointed out? How does it look now?

 I listed the map as Continent in DBCstructure...This fixed issue with it dismounting when changing area change..
The last issue we currently have is that we want the Flying to require "Flight Master's Liscense" to fly in mapID 869.
Currently you can dismount with or without it.

"Flight Master's Liscense" = Spell ID: 93333
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: schlumpf on September 08, 2016, 04:39:36 pm
You really are horrible at answering questions.
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: Nupper on September 08, 2016, 05:32:18 pm
Quote from: "schlumpf"
You really are horrible at answering questions.
I have known that for some time.

Changes
Player.CPP
Code: [Select]
{
    // continent checked in SpellInfo::CheckLocation at cast and area update
    uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
v_map != 571 || HasSpell(54197); // 54197 = Cold Weather Flying
return v_map != 869 || HasSpell(93333); // 93333 = Flight Master License
}

Spell_Generic.cpp
Code: [Select]
                   // Triggered spell id dependent on riding skill and zone
                    bool canFly = false;
                    uint32 map = GetVirtualMapForMapAndZone(target->GetMapId(), target->GetZoneId());
if (map == 530 || (map == 571 && target->HasSpell(SPELL_COLD_WEATHER_FLYING || (map == 869 && target->HasSpell(SPELL_OSHOTH_FLYING)))))
                        canFly = true;
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: schlumpf on September 08, 2016, 06:10:53 pm
So that first thing now _only_ checks the new one, no longer northrend and cold weather flying. The second function now checks if the player is in expansion01 or in northrend and has the spell 1.
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: Nupper on September 08, 2016, 06:36:24 pm
Quote from: "schlumpf"
So that first thing now _only_ checks the new one, no longer northrend and cold weather flying. The second function now checks if the player is in expansion01 or in northrend and has the spell 1.
The map name for 869 is Oshoth.
I am still curious on how to get it to check both.
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: Ascathos on September 08, 2016, 08:16:21 pm
Quote from: "Nupper"
Quote from: "schlumpf"
You really are horrible at answering questions.
I have known that for some time.

Changes
Player.CPP
Code: [Select]
{
    // continent checked in SpellInfo::CheckLocation at cast and area update
    uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
v_map != 571 || HasSpell(54197); // 54197 = Cold Weather Flying
return v_map != 869 || HasSpell(93333); // 93333 = Flight Master License
}
This gets me all cringy. Does this even compile ? How the fuck does it compile ?
Also, still most misleading name ever.

Code: [Select]
{
    // continent checked in SpellInfo::CheckLocation at cast and area update
    uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
    return (v_map != 571 || HasSpell(54197)) || (v_map != 869 || HasSpell(93333));
}
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: Nupper on September 08, 2016, 09:18:11 pm
Quote from: "Ascathos"
Quote from: "Nupper"
Quote from: "schlumpf"
You really are horrible at answering questions.
I have known that for some time.

Changes
Player.CPP
Code: [Select]
{
    // continent checked in SpellInfo::CheckLocation at cast and area update
    uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
v_map != 571 || HasSpell(54197); // 54197 = Cold Weather Flying
return v_map != 869 || HasSpell(93333); // 93333 = Flight Master License
}
This gets me all cringy. Does this even compile ? How the fuck does it compile ?
Also, still most misleading name ever.

Code: [Select]
{
    // continent checked in SpellInfo::CheckLocation at cast and area update
    uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
    return (v_map != 571 || HasSpell(54197)) || (v_map != 869 || HasSpell(93333));
}

I My fault?
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: Nupper on September 08, 2016, 09:26:37 pm
Strange it still Mounts and Flys without the spell.
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: Ascathos on September 08, 2016, 09:50:02 pm
The function name was declared at some point by someone. And it's still misleading as fuck.

You could try

[code]return (v_map == 571 && HasSpell(54197)) || (v_map == 869 && HasSpell(93333));[/code9
Title: Re: [QUESTION] [Trinitycore]Flying Mounts Spell Requirements
Post by: Nupper on September 08, 2016, 10:02:11 pm
Quote from: "Ascathos"
The function name was declared at some point by someone. And it's still misleading as fuck.

You could try

[code]return (v_map == 571 && HasSpell(54197)) || (v_map == 869 && HasSpell(93333));[/code9

it somewhat works now...you try and fly it dismounts and when you have the ability it flys...just not message saying you cannot fly.