· 8 years ago · Dec 06, 2017, 06:56 PM
1Core/Spell: fix loading & work Shapeshift
2
3diff -r 607701b5dd14 -r fde7c3b921f0 sql/updates/world/2011_09_20_01_spell_dbc.sql
4--- /dev/null Thu Jan 01 00:00:00 1970 +0000
5+++ b/sql/updates/world/2011_09_20_01_spell_dbc.sql Tue Sep 20 22:22:41 2011 +0400
6@@ -0,0 +1,48 @@
7+DROP TABLE IF EXISTS `spell_dbc`;
8+
9+CREATE TABLE `spell_dbc` (
10+ `Id` int(10) unsigned NOT NULL,
11+ `Attributes` int(10) unsigned NOT NULL DEFAULT '0',
12+ `AttributesEx` int(10) unsigned NOT NULL DEFAULT '0',
13+ `AttributesEx2` int(10) unsigned NOT NULL DEFAULT '0',
14+ `AttributesEx3` int(10) unsigned NOT NULL DEFAULT '0',
15+ `AttributesEx4` int(10) unsigned NOT NULL DEFAULT '0',
16+ `AttributesEx5` int(10) unsigned NOT NULL DEFAULT '0',
17+ `AttributesEx6` int(10) unsigned NOT NULL DEFAULT '0',
18+ `AttributesEx7` int(10) unsigned NOT NULL DEFAULT '0',
19+ `AttributesEx8` int(10) unsigned NOT NULL DEFAULT '0',
20+ `CastingTimeIndex` int(10) unsigned NOT NULL DEFAULT '1',
21+ `DurationIndex` int(10) unsigned NOT NULL DEFAULT '0',
22+ `powerType` int(10) unsigned NOT NULL DEFAULT '0',
23+ `rangeIndex` int(10) unsigned NOT NULL DEFAULT '1',
24+ `speed` float NOT NULL DEFAULT '0',
25+ `SpellVisual1` int(10) unsigned NOT NULL DEFAULT '0',
26+ `SpellVisual2` int(10) unsigned NOT NULL DEFAULT '0',
27+ `SpellIconID` int(10) unsigned NOT NULL DEFAULT '0',
28+ `activeIconID` int(10) unsigned NOT NULL DEFAULT '0',
29+ `SchoolMask` int(10) unsigned NOT NULL DEFAULT '0',
30+ `runeCostID` int(10) unsigned NOT NULL DEFAULT '0',
31+ `SpellDifficultyId` int(10) unsigned NOT NULL DEFAULT '0',
32+ `SpellScalingId` int(10) unsigned NOT NULL DEFAULT '0',
33+ `SpellAuraOptionsId` int(10) unsigned NOT NULL DEFAULT '0',
34+ `SpellAuraRestrictionsId` int(10) unsigned NOT NULL DEFAULT '0',
35+ `SpellCastingRequirementsId` int(10) unsigned NOT NULL DEFAULT '0',
36+ `SpellCategoriesId` int(10) unsigned NOT NULL DEFAULT '0',
37+ `SpellClassOptionsId` int(10) unsigned NOT NULL DEFAULT '0',
38+ `SpellCooldownsId` int(10) unsigned NOT NULL DEFAULT '0',
39+ `SpellEquippedItemsId` int(10) unsigned NOT NULL DEFAULT '0',
40+ `SpellInterruptsId` int(10) unsigned NOT NULL DEFAULT '0',
41+ `SpellLevelsId` int(10) unsigned NOT NULL DEFAULT '0',
42+ `SpellPowerId` int(10) unsigned NOT NULL DEFAULT '0',
43+ `SpellReagentsId` int(10) unsigned NOT NULL DEFAULT '0',
44+ `SpellShapeshiftId` int(10) unsigned NOT NULL DEFAULT '0',
45+ `SpellTargetRestrictionsId` int(10) unsigned NOT NULL DEFAULT '0',
46+ `SpellTotemsId` int(10) unsigned NOT NULL DEFAULT '0',
47+ `Comment` text,
48+ PRIMARY KEY (`Id`)
49+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Custom spell.dbc entries';
50+
51+insert into `spell_dbc`(`Id`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`AttributesEx6`,`AttributesEx7`,`AttributesEx8`,`CastingTimeIndex`,`DurationIndex`,`powerType`,`rangeIndex`,`speed`,`SpellVisual1`,`SpellVisual2`,`SpellIconID`,`activeIconID`,`SchoolMask`,`runeCostID`,`SpellDifficultyId`,`SpellScalingId`,`SpellAuraOptionsId`,`SpellAuraRestrictionsId`,`SpellCastingRequirementsId`,`SpellCategoriesId`,`SpellClassOptionsId`,`SpellCooldownsId`,`SpellEquippedItemsId`,`SpellInterruptsId`,`SpellLevelsId`,`SpellPowerId`,`SpellReagentsId`,`SpellShapeshiftId`,`SpellTargetRestrictionsId`,`SpellTotemsId`,`Comment`) values
52+(24899,464,0,0,0,0,0,0,0,0,1,21,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL),
53+(24900,464,0,0,0,0,0,0,0,0,1,21,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL);
54+
55diff -r 607701b5dd14 -r fde7c3b921f0 src/server/game/DataStores/DBCStructure.h
56--- a/src/server/game/DataStores/DBCStructure.h Tue Sep 20 11:47:03 2011 +0400
57+++ b/src/server/game/DataStores/DBCStructure.h Tue Sep 20 22:22:41 2011 +0400
58@@ -1760,7 +1760,7 @@
59 uint32 SpellIconID; // 18 m_spellIconID
60 uint32 activeIconID; // 19 m_activeIconID
61 DBCString SpellName; // 20 m_name_lang
62- uint32 SpellShapeshiftId; // 21 SpellShapeshift.dbc
63+ //DBCString Rank; // 21 m_rank
64 //DBCString Description; // 22 m_description_lang not used
65 //DBCString ToolTip; // 23 m_auraDescription_lang not used
66 uint32 SchoolMask; // 24 m_schoolMask
67@@ -1782,9 +1782,10 @@
68 uint32 SpellLevelsId; // 40 SpellLevels.dbc
69 uint32 SpellPowerId; // 41 SpellPower.dbc
70 uint32 SpellReagentsId; // 42 SpellReagents.dbc
71+ uint32 SpellShapeshiftId; // 43 SpellShapeshift.dbc
72 uint32 SpellTargetRestrictionsId; // 44 SpellTargetRestrictions.dbc
73 uint32 SpellTotemsId; // 45 SpellTotems.dbc
74- //uint32 unk2; // 46
75+ //uint32 ResearchProject; // 46 ResearchProject.dbc
76 };
77
78 struct SpellEntry
79diff -r 607701b5dd14 -r fde7c3b921f0 src/server/game/DataStores/DBCfmt.h
80--- a/src/server/game/DataStores/DBCfmt.h Tue Sep 20 11:47:03 2011 +0400
81+++ b/src/server/game/DataStores/DBCfmt.h Tue Sep 20 22:22:41 2011 +0400
82@@ -116,8 +116,8 @@
83 //const std::string CustomSpellEntryfmt="pppppppppaappapaaaaaaaaapaaaaaaaaaaaaaaaaaaaaaappppaaaaaaaaapaappppappppaaappppppppppppppppppaaapppaaapppppppppaaappppppppppppppppppppppppaaaaaappppaapppaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaappppapaaaa";
84 const char True_SpellEntryfmt[]= "iiiiiiiiiixiiiifiiiisixxiixxixiiiiiiixiiiiixiixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiifffiiiiiiiiiiiiiiiiiifffiiifffiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffffffiiiiiiiiiii";
85 const std::string CustomSpellEntryIndex = "Id";
86-const char SpellEntryfmt[]= "niiiiiiiiixiiiifiiiisixxiixxixiiiiiiixiiiiixiix";
87-const std::string CustomSpellEntryfmt="ppppppppppapppppppppapaappaapapppppppappppppppa";
88+const char SpellEntryfmt[]= "niiiiiiiiixiiiifiiiisxxxiixxixiiiiiiixiiiiiiiix";
89+const std::string CustomSpellEntryfmt="ppppppppppapppppppppaaaappaapapppppppappppppppa";
90 const char SpellAuraOptionsfmt[]="niiii";
91 const std::string CustomSpellAuraOptionsEntryfmt="ppppp";
92 const std::string CustomSpellAuraOptionsEntryIndex="id";
93diff -r 607701b5dd14 -r fde7c3b921f0 src/server/game/Entities/Player/Player.cpp
94--- a/src/server/game/Entities/Player/Player.cpp Tue Sep 20 11:47:03 2011 +0400
95+++ b/src/server/game/Entities/Player/Player.cpp Tue Sep 20 22:22:41 2011 +0400
96@@ -3717,7 +3717,7 @@
97 // note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
98 // talent dependent passives activated at form apply have proper stance data
99 ShapeshiftForm form = GetShapeshiftForm();
100- bool need_cast = (!spellInfo->Stances || (form && (spellInfo->Stances & (1 << (form - 1)))) ||
101+ bool need_cast = (!spellInfo->StancesNot || (form && (spellInfo->StancesNot & (1 << (form - 1)))) ||
102 (!form && (spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT)));
103
104 //Check CasterAuraStates
105diff -r 607701b5dd14 -r fde7c3b921f0 src/server/game/Spells/Auras/SpellAuraEffects.cpp
106--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp Tue Sep 20 11:47:03 2011 +0400
107+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp Tue Sep 20 22:22:41 2011 +0400
108@@ -2898,14 +2898,14 @@
109 SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
110 if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | (1 << 7))))
111 continue;
112- if (spellInfo->Stances & (1 << (GetMiscValue() - 1)))
113+ if (spellInfo->StancesNot & (1 << (GetMiscValue() - 1)))
114 target->CastSpell(target, itr->first, true, NULL, this);
115 }
116 // Leader of the Pack
117 if (target->ToPlayer()->HasSpell(17007))
118 {
119 SpellEntry const *spellInfo = sSpellStore.LookupEntry(24932);
120- if (spellInfo && spellInfo->Stances & (1<<(GetMiscValue()-1)))
121+ if (spellInfo && spellInfo->StancesNot & (1<<(GetMiscValue()-1)))
122 target->CastSpell(target, 24932, true, NULL, this);
123 }
124 // Improved Barkskin - apply/remove armor bonus due to shapeshift
125@@ -3002,15 +3002,6 @@
126 target->CastSpell(target, 66530, true);
127 }
128 }
129-
130- Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras();
131- for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
132- {
133- if (itr->second->GetBase()->IsRemovedOnShapeLost(target))
134- target->RemoveAura(itr);
135- else
136- ++itr;
137- }
138 }
139 }
140
141@@ -3351,6 +3342,18 @@
142
143 modelid = target->GetModelForForm(form);
144
145+ if (!apply)
146+ {
147+ Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras();
148+ for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
149+ {
150+ if (itr->second->GetBase()->IsRemovedOnShapeLost(target))
151+ target->RemoveAura(itr);
152+ else
153+ ++itr;
154+ }
155+ }
156+
157 if (apply)
158 {
159 // remove polymorph before changing display id to keep new display id
160@@ -5356,7 +5359,7 @@
161 return;
162
163 Unit *target = aurApp->GetTarget();
164-
165+
166 Powers powerType = target->getPowerType();
167 if (int32(powerType) != GetMiscValue())
168 return;
169diff -r 607701b5dd14 -r fde7c3b921f0 src/server/game/Spells/Auras/SpellAuras.h
170--- a/src/server/game/Spells/Auras/SpellAuras.h Tue Sep 20 11:47:03 2011 +0400
171+++ b/src/server/game/Spells/Auras/SpellAuras.h Tue Sep 20 22:22:41 2011 +0400
172@@ -140,7 +140,7 @@
173
174 bool IsPassive() const;
175 bool IsDeathPersistent() const;
176- bool IsRemovedOnShapeLost(Unit * target) const { return (GetCasterGUID() == target->GetGUID() && m_spellProto->Stances && !(m_spellProto->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && !(m_spellProto->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT)); }
177+ bool IsRemovedOnShapeLost(Unit * target) const { return (GetCasterGUID() == target->GetGUID() && (m_spellProto->StancesNot) && !(m_spellProto->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && !(m_spellProto->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT)); }
178 bool CanBeSaved() const;
179 bool IsRemoved() const { return m_isRemoved; }
180 bool IsVisible() const;
181diff -r 607701b5dd14 -r fde7c3b921f0 src/server/game/Spells/SpellMgr.cpp
182--- a/src/server/game/Spells/SpellMgr.cpp Tue Sep 20 11:47:03 2011 +0400
183+++ b/src/server/game/Spells/SpellMgr.cpp Tue Sep 20 22:22:41 2011 +0400
184@@ -1164,10 +1164,10 @@
185
186 uint32 stanceMask = (form ? 1 << (form - 1) : 0);
187
188- if (stanceMask & spellInfo->StancesNot) // can explicitly not be casted in this stance
189+ if (stanceMask & spellInfo->Stances) // can explicitly not be casted in this stance
190 return SPELL_FAILED_NOT_SHAPESHIFT;
191
192- if (stanceMask & spellInfo->Stances) // can explicitly be casted in this stance
193+ if (stanceMask & spellInfo->StancesNot) // can explicitly be casted in this stance
194 return SPELL_CAST_OK;
195
196 bool actAsShifted = false;
197@@ -1187,7 +1187,7 @@
198 {
199 if (spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT) // not while shapeshifted
200 return SPELL_FAILED_NOT_SHAPESHIFT;
201- else if (spellInfo->Stances != 0) // needs other shapeshift
202+ else if (spellInfo->StancesNot != 0) // needs other shapeshift
203 return SPELL_FAILED_ONLY_SHAPESHIFT;
204 }
205 else
206@@ -1202,7 +1202,7 @@
207 // TODO: Find a way to disable use of these spells clientside
208 if (shapeInfo && shapeInfo->flags1 & 0x400)
209 {
210- if (!(stanceMask & spellInfo->Stances))
211+ if (!(stanceMask & spellInfo->StancesNot))
212 return SPELL_FAILED_ONLY_SHAPESHIFT;
213 }
214
215@@ -3816,12 +3816,6 @@
216 case 54785:
217 spellInfo->Targets |= TARGET_FLAG_DEST_LOCATION;
218 spellInfo->EffectImplicitTargetA[0] = 6;
219- case 50589:
220- case 77801:
221- case 80398:
222- case 6229:
223- spellInfo->StancesNot = 0;
224- spellInfo->Stances = 1 << (FORM_METAMORPHOSIS - 1);
225 break;
226 // Mark of the wild
227 case 79060:
228@@ -3848,31 +3842,7 @@
229 spellInfo->AttributesEx3 |= SPELL_ATTR3_CAN_PROC_TRIGGERED;
230 count++;
231 break;
232- case 84840: // Venegance(Druid)
233- case 62600: // Savage Defense
234- case 77494: // Savage Defender
235- spellInfo->StancesNot = 0;
236- spellInfo->Stances = 1 << (FORM_BEAR - 1);
237- break;
238- case 24867:
239- case 24864: // Feral Swiftness
240- case 24932: // Leader of the Pack
241- spellInfo->StancesNot = 0;
242- spellInfo->Stances = 1 << (FORM_BEAR - 1) | 1 << (FORM_CAT - 1);
243- break;
244- //case 77493: // Razor Claws
245- // Feral Swiftness
246- case 17002:
247- case 24866:
248- spellInfo->StancesNot = 0;
249- spellInfo->Stances = 1 << (FORM_CAT - 1);
250- break;
251- // Moonkin Aura
252- case 24907:
253- spellInfo->StancesNot = 0;
254- spellInfo->Stances = 1 << (FORM_MOONKIN - 1);
255- break;
256- case 56224: // Glyph of Healthstone
257+ case 56224: // Glyph of Healthstone
258 spellInfo->EffectMiscValue[0] = SPELLMOD_EFFECT1;
259 break;
260 case 51514: // Hex
261@@ -4229,16 +4199,12 @@
262 break;
263 // Master Shapeshifter: missing stance data for forms other than bear - bear version has correct data
264 // To prevent aura staying on target after talent unlearned
265- case 48418:
266- spellInfo->Stances = 1 << (FORM_BEAR - 1);
267- count++;
268- break;
269 case 48420:
270- spellInfo->Stances = 1 << (FORM_CAT - 1);
271+ spellInfo->StancesNot = 1 << (FORM_CAT - 1);
272 count++;
273 break;
274 case 48421:
275- spellInfo->Stances = 1 << (FORM_MOONKIN - 1);
276+ spellInfo->StancesNot = 1 << (FORM_MOONKIN - 1);
277 count++;
278 break;
279 case 47569: // Improved Shadowform (Rank 1)
280@@ -4559,12 +4525,12 @@
281 case 24899:
282 spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AURA;
283 spellInfo->EffectApplyAuraName[0] = SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT;
284- spellInfo->Stances = 1 << (FORM_BEAR - 1);
285+ spellInfo->StancesNot = 1 << (FORM_BEAR - 1);
286 break;
287 case 24900:
288 spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AURA;
289 spellInfo->EffectApplyAuraName[0] = SPELL_AURA_MOD_ATTACK_POWER_PCT;
290- spellInfo->Stances = 1 << (FORM_CAT - 1);
291+ spellInfo->StancesNot = 1 << (FORM_CAT - 1);
292 break;
293 case 17003:
294 case 17004: