Ru-MaNGOS

Ru-MaNGOS (http://mangos.ytdb.ru/index.php)
-   Принятые патчи (http://mangos.ytdb.ru/forumdisplay.php?f=5)
-   -   [12018] [patch][spell=51519]Death Knight Initiate Visual (http://mangos.ytdb.ru/showthread.php?t=5523)

virusav 19.06.2012 19:25

[12018] [patch][spell=51519]Death Knight Initiate Visual
 
Вложений: 1
Спелл 51519 должен менять модель в зависимости от расы и пола.
Патч во вложении.
Дублирую:
Код:

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 4e88889..848198b 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -7338,6 +7338,34 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx)
 
                    return;
                }
+                case 51519:                                // Death Knight Initiate Visual
+                {
+                    if (!unitTarget)
+                        return;
+
+                    uint8 gender = unitTarget->getGender();
+                    uint8 race = unitTarget->getRace();
+                    uint32 spellId = 0;
+                    switch (race)
+                    {
+                        case RACE_HUMAN:            spellId = (gender == GENDER_MALE ? 51520 : 51534); break;
+                        case RACE_DWARF:            spellId = (gender == GENDER_MALE ? 51538 : 51537); break;
+                        case RACE_NIGHTELF:        spellId = (gender == GENDER_MALE ? 51535 : 51536); break;
+                        case RACE_GNOME:            spellId = (gender == GENDER_MALE ? 51539 : 51540); break;
+                        case RACE_DRAENEI:          spellId = (gender == GENDER_MALE ? 51541 : 51542); break;
+                        case RACE_ORC:              spellId = (gender == GENDER_MALE ? 51543 : 51544); break;
+                        case RACE_UNDEAD:          spellId = (gender == GENDER_MALE ? 51549 : 51550); break;
+                        case RACE_TAUREN:          spellId = (gender == GENDER_MALE ? 51547 : 51548); break;
+                        case RACE_TROLL:            spellId = (gender == GENDER_MALE ? 51546 : 51545); break;
+                        case RACE_BLOODELF:        spellId = (gender == GENDER_MALE ? 51551 : 51552); break;
+                        default:
+                            return;
+                    }
+                    if (spellId)
+                        unitTarget->CastSpell(unitTarget, spellId, true);
+
+                    return;
+                }
                case 51770:                                // Emblazon Runeblade
                {
                    Unit* caster = GetAffectiveCaster();


schmoozerd 20.06.2012 20:16

Small note: with this implemented we need to remove the hacks from the sd2 scripts.
I assume you tested without them?

virusav 21.06.2012 09:10

Я тестировал на чистом ядре, без СД2.
I tested it on a clean kernel without SD2.

schmoozerd 21.06.2012 19:55

Actualy this patch seems to be wrong:

Код:

    // equal to player Race field, but creature does not have race
    SetByteValue(UNIT_FIELD_BYTES_0, 0, 0);

NPCs have no race, hence the fix won't work!

virusav 22.06.2012 09:37

Если спелл кастует игрок, то меняем условие
Код:

if (!unitTarget)
на
Код:

if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)

Amaru 22.06.2012 10:14

Цитата:

Сообщение от schmoozerd (Сообщение 27731)
Actualy this patch seems to be wrong:

Код:

    // equal to player Race field, but creature does not have race
    SetByteValue(UNIT_FIELD_BYTES_0, 0, 0);

NPCs have no race, hence the fix won't work!

Why then getRace is on Unit level ?

schmoozerd 22.06.2012 20:44

maybe it was unclear in the beginning if npcs can have a race.
and it uses UNIT_FIELD_BYTES_1(0), so it is with some reason on unit-level.

About this patch.
I see no other way then to use the way sd2 handles this (by display-id) - which could be ported to mangos-code.
This would actually be nicer as it would then be a script-effect. But move something rather ugly to mangos.

Hence I think the ugly code is better left in sd2 even if it must be considered a hack there :(

Vladimir 23.06.2012 01:05

Код:

struct CreatureDisplayInfoExtraEntry
{
    uint32 DisplayExtraId; // 0 m_ID CreatureDisplayInfoEntry::m_extendedDisplayInfoID
    uint32 Race; // 1 m_DisplayRaceID

You can get race by display id with extanded info

[Added]
In fact, in DBCStores.h exist special function for this:
Код:

MANGOS_DLL_SPEC uint32 GetCreatureModelRace(uint32 model_id);

schmoozerd 24.06.2012 20:41

In [12018] Thank you ;)


Текущее время: 00:55. Часовой пояс GMT +3.

ru-mangos.ru - Русское сообщество MaNGOS