Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
SpellEffectsSummon.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "AccountMgr.h"
7#include "AreaTrigger.h"
8#include "Battleground.h"
9#include "BattlegroundMgr.h"
10#include "BattlePetMgr.h"
11#include "CellImpl.h"
12#include "Common.h"
13#include "Creature.h"
14#include "CreatureAI.h"
15#include "DatabaseEnv.h"
16#include "DynamicObject.h"
17#include "Formulas.h"
18#include "GameObject.h"
19#include "GameObjectAI.h"
20#include "GossipDef.h"
21#include "GridNotifiers.h"
22#include "GridNotifiersImpl.h"
23#include "Group.h"
24#include "Guild.h"
25#include "GuildMgr.h"
26#include "InstanceScript.h"
27#include "Language.h"
28#include "Log.h"
29#include "MapManager.h"
30#include "ObjectAccessor.h"
31#include "ObjectMgr.h"
32#include "Opcodes.h"
33#include "OutdoorPvPMgr.h"
34#include "PathGenerator.h"
35#include "Pet.h"
36#include "Player.h"
37#include "ReputationMgr.h"
38#include "ScriptMgr.h"
39#include "SharedDefines.h"
40#include "SkillDiscovery.h"
41#include "SkillExtraItems.h"
42#include "SocialMgr.h"
43#include "Spell.h"
44#include "SpellAuraEffects.h"
45#include "SpellAuras.h"
46#include "SpellMgr.h"
47#include "SpellSummonMetadata.h"
48#include "SpellValidation.h"
49#include "TemporarySummon.h"
50#include "Totem.h"
51#include "Unit.h"
52#include "UpdateData.h"
53#include "UpdateMask.h"
54#include "Util.h"
55#include "Vehicle.h"
56#include "VMapFactory.h"
57#include "World.h"
58#include "WorldPacket.h"
59
60#include <algorithm>
61
63{
65 return;
66
67 uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell;
68 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id);
69
70 if (!spellInfo)
71 {
72 SF_LOG_ERROR("spells", "EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id);
73 return;
74 }
75
76 finish();
77
78 m_caster->CastSpell((Unit*)NULL, spellInfo, false);
79}
80
82{
84 return;
85
86 if (m_caster->GetTypeId() != TypeID::TYPEID_PLAYER)
87 return;
88
89 Player* player = m_caster->ToPlayer();
90
91 // applied only to using item
92 if (!m_CastItem)
93 return;
94
95 // ... only to item in own inventory/bank/equip_slot
96 if (m_CastItem->GetOwnerGUID() != player->GetGUID())
97 return;
98
99 uint32 newitemid = m_spellInfo->Effects[effIndex].ItemType;
100 if (!newitemid)
101 return;
102
103 uint16 pos = m_CastItem->GetPos();
104
105 Item* pNewItem = Item::CreateItem(newitemid, 1, player);
106 if (!pNewItem)
107 return;
108
110 if (m_CastItem->GetEnchantmentId(EnchantmentSlot(j)))
111 pNewItem->SetEnchantment(EnchantmentSlot(j), m_CastItem->GetEnchantmentId(EnchantmentSlot(j)), m_CastItem->GetEnchantmentDuration(EnchantmentSlot(j)), m_CastItem->GetEnchantmentCharges(EnchantmentSlot(j)), 0);
112
113 if (m_CastItem->GetUInt32Value(ITEM_FIELD_DURABILITY) < m_CastItem->GetUInt32Value(ITEM_FIELD_MAX_DURABILITY))
114 {
115 double lossPercent = 1 - m_CastItem->GetUInt32Value(ITEM_FIELD_DURABILITY) / double(m_CastItem->GetUInt32Value(ITEM_FIELD_MAX_DURABILITY));
116 player->DurabilityLoss(pNewItem, lossPercent);
117 }
118
119 if (player->IsInventoryPos(pos))
120 {
121 ItemPosCountVec dest;
122 InventoryResult msg = player->CanStoreItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true);
123 if (msg == EQUIP_ERR_OK)
124 {
125 player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
126
127 // prevent crash at access and unexpected charges counting with item update queue corrupt
128 if (m_CastItem == m_targets.GetItemTarget())
129 m_targets.SetItemTarget(NULL);
130
131 m_CastItem = NULL;
132
133 player->StoreItem(dest, pNewItem, true);
134 return;
135 }
136 }
137 else if (player->IsBankPos(pos))
138 {
139 ItemPosCountVec dest;
140 uint8 msg = player->CanBankItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true);
141 if (msg == EQUIP_ERR_OK)
142 {
143 player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
144
145 // prevent crash at access and unexpected charges counting with item update queue corrupt
146 if (m_CastItem == m_targets.GetItemTarget())
147 m_targets.SetItemTarget(NULL);
148
149 m_CastItem = NULL;
150
151 player->BankItem(dest, pNewItem, true);
152 return;
153 }
154 }
155 else if (player->IsEquipmentPos(pos))
156 {
157 uint16 dest;
158
159 player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
160
161 uint8 msg = player->CanEquipItem(m_CastItem->GetSlot(), dest, pNewItem, true);
162
163 if (msg == EQUIP_ERR_OK || msg == EQUIP_ERR_CLIENT_LOCKED_OUT)
164 {
166
167 // prevent crash at access and unexpected charges counting with item update queue corrupt
168 if (m_CastItem == m_targets.GetItemTarget())
169 m_targets.SetItemTarget(NULL);
170
171 m_CastItem = NULL;
172
173 player->EquipItem(dest, pNewItem, true);
174 player->AutoUnequipOffhandIfNeed();
175 return;
176 }
177 }
178
179 // fail
180 delete pNewItem;
181}
182
184{
186 return;
187
188 uint32 entry = m_spellInfo->Effects[effIndex].MiscValue;
189 if (!entry)
190 return;
191
192 SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[effIndex].MiscValueB);
193 if (!properties)
194 {
195 SF_LOG_ERROR("spells", "EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB);
196 return;
197 }
198
199 if (!m_originalCaster)
200 return;
201
202 int32 duration = m_spellInfo->GetDuration();
203 if (Player* modOwner = m_originalCaster->GetSpellModOwner())
204 modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
205
206 TempSummon* summon = NULL;
207
208 // determine how many units should be summoned
209 uint32 numSummons;
210
211 // some spells need to summon many units, for those spells number of summons is stored in effect value
212 // however so far noone found a generic check to find all of those (there's no related data in summonproperties.dbc
213 // and in spell attributes, possibly we need to add a table for those)
214 // so here's a list of MiscValueB values, which is currently most generic check
215 numSummons = Skyfire::Spells::GetSummonCountForProperty(properties->Id, damage);
216
217 switch (properties->Category)
218 {
222 if (properties->Flags & 512)
223 {
224 SummonGuardian(effIndex, entry, properties, numSummons);
225 break;
226 }
227 switch (properties->Type)
228 {
229 case SUMMON_TYPE_PET:
233 SummonGuardian(effIndex, entry, properties, numSummons);
234 break;
235 // Summons a vehicle, but doesn't force anyone to enter it (see SUMMON_CATEGORY_VEHICLE)
238 summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id);
239 break;
243 {
244 summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id);
245 if (!summon || !summon->IsTotem())
246 return;
247
249 damage = m_caster->CountPctFromMaxHealth(healthPct);
250
251 if (damage) // if not spell info, DB values used
252 {
253 summon->SetMaxHealth(damage);
254 summon->SetHealth(damage);
255 }
256 break;
257 }
259 {
260 summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id);
261 if (!summon || !summon->HasUnitTypeMask(UNIT_MASK_MINION))
262 return;
263
264 Player* player = m_caster->ToPlayer();
265 BattlePetMgr* battlePetMgr = player->GetBattlePetMgr();
266
267 BattlePet* battlePet = battlePetMgr->GetBattlePet(battlePetMgr->GetCurrentSummonId());
268 if (!battlePet)
269 return;
270
271 battlePetMgr->SetCurrentSummon(summon);
272
275
276 summon->SetCreateHealth(battlePet->GetMaxHealth());
277 summon->SetMaxHealth(battlePet->GetMaxHealth());
278 summon->SetHealth(battlePet->GetCurrentHealth());
279
282 summon->SetUInt64Value(UNIT_FIELD_CREATED_BY, player->GetGUID());
285
287 summon->SetFacingToObject(player);
288 summon->GetMotionMaster()->Clear(false);
290
291 break;
292 }
293 default:
294 {
295 float radius = m_spellInfo->Effects[effIndex].CalcRadius();
296
298
299 for (uint32 count = 0; count < numSummons; ++count)
300 {
301 Position pos;
302 if (count == 0)
303 pos = *destTarget;
304 else
305 // randomize position for multiple summons
306 m_caster->GetRandomPoint(*destTarget, radius, pos);
307
308 summon = m_originalCaster->SummonCreature(entry, pos, summonType, duration);
309 if (!summon)
310 continue;
311
312 if (properties->Category == SUMMON_CATEGORY_ALLY)
313 {
314 summon->SetOwnerGUID(m_originalCaster->GetGUID());
315 summon->setFaction(m_originalCaster->getFaction());
317 }
318
319 ExecuteLogEffectSummonObject(effIndex, summon);
320 }
321 return;
322 }
323 }//switch
324 break;
326 SummonGuardian(effIndex, entry, properties, numSummons);
327 break;
329 summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id);
330 break;
332 // Summoning spells (usually triggered by npc_spellclick) that spawn a vehicle and that cause the clicker
333 // to cast a ride vehicle spell on the summoned unit.
334 summon = m_originalCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_caster, m_spellInfo->Id);
335 if (!summon || !summon->IsVehicle())
336 return;
337
338 // The spell that this effect will trigger. It has SPELL_AURA_CONTROL_VEHICLE
340 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue());
341 if (spellInfo && spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE))
342 spellId = spellInfo->Id;
343
344 // Hard coded enter vehicle spell
345 m_originalCaster->CastSpell(summon, spellId, true);
346
347 uint32 faction = properties->Faction;
348 if (!faction)
349 faction = m_originalCaster->getFaction();
350
351 summon->setFaction(faction);
352 break;
353 }
354
355 if (summon)
356 {
357 summon->SetCreatorGUID(m_originalCaster->GetGUID());
358 ExecuteLogEffectSummonObject(effIndex, summon);
359 }
360}
361
363{
365 return;
366
367 if (m_caster->GetPetGUID())
368 return;
369
370 if (!unitTarget)
371 return;
372
373 if (unitTarget->GetTypeId() != TypeID::TYPEID_UNIT)
374 return;
375
376 Creature* creatureTarget = unitTarget->ToCreature();
377
378 if (creatureTarget->IsPet())
379 return;
380
381 if (m_caster->getClass() != CLASS_HUNTER)
382 return;
383
384 // cast finish successfully
385 //SendChannelUpdate(0);
386 finish();
387
388 Pet* pet = m_caster->CreateTamedPetFrom(creatureTarget, m_spellInfo->Id);
389 if (!pet) // in very specific state like near world end/etc.
390 return;
391
392 // "kill" original creature
393 creatureTarget->DespawnOrUnsummon();
394
395 uint8 level = (creatureTarget->getLevel() < (m_caster->getLevel() - 5)) ? (m_caster->getLevel() - 5) : creatureTarget->getLevel();
396
397 // prepare visual effect for levelup
398 pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
399
400 // add to world
401 pet->GetMap()->AddToMap(pet->ToCreature());
402
403 // visual effect for levelup
404 pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
405
406 // caster have pet now
407 m_caster->SetMinion(pet, true);
408
409 pet->InitTalentForLevel();
410
411 if (m_caster->GetTypeId() == TypeID::TYPEID_PLAYER)
412 {
414 m_caster->ToPlayer()->PetSpellInitialize();
415 }
416}
417
419{
421 return;
422
423 Player* owner = NULL;
425 {
426 owner = m_originalCaster->ToPlayer();
427 if (!owner && m_originalCaster->ToCreature()->IsTotem())
428 owner = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself();
429 }
430
431 uint32 petentry = m_spellInfo->Effects[effIndex].MiscValue;
432
433 if (!owner)
434 {
435 SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(67);
436 if (properties)
437 SummonGuardian(effIndex, petentry, properties, 1);
438 return;
439 }
440
441 Pet* OldSummon = owner->GetPet();
442
443 // if pet requested type already exist
444 if (OldSummon)
445 {
446 if (petentry == 0 || OldSummon->GetEntry() == petentry)
447 {
448 // pet in corpse state can't be summoned
449 if (OldSummon->isDead())
450 return;
451
452 ASSERT(OldSummon->GetMap() == owner->GetMap());
453
454 //OldSummon->GetMap()->Remove(OldSummon->ToCreature(), false);
455
456 float px, py, pz;
457 owner->GetClosePoint(px, py, pz, OldSummon->GetObjectSize());
458
459 OldSummon->NearTeleportTo(px, py, pz, OldSummon->GetOrientation());
460 //OldSummon->Relocate(px, py, pz, OldSummon->GetOrientation());
461 //OldSummon->SetMap(owner->GetMap());
462 //owner->GetMap()->Add(OldSummon->ToCreature());
463
464 if (owner->GetTypeId() == TypeID::TYPEID_PLAYER && OldSummon->isControlled())
465 owner->ToPlayer()->PetSpellInitialize();
466
467 return;
468 }
469
470 if (owner->GetTypeId() == TypeID::TYPEID_PLAYER)
471 owner->ToPlayer()->RemovePet(OldSummon, (OldSummon->getPetType() == PetType::HUNTER_PET ? PET_SAVE_AS_DELETED : PET_SAVE_NOT_IN_SLOT), false);
472 else
473 return;
474 }
475
476 float x, y, z;
477 owner->GetClosePoint(x, y, z, owner->GetObjectSize());
478 Pet* pet = owner->SummonPet(petentry, x, y, z, owner->GetOrientation(), PetType::SUMMON_PET, 0);
479 if (!pet)
480 return;
481
482 if (m_caster->GetTypeId() == TypeID::TYPEID_UNIT)
483 {
484 if (m_caster->ToCreature()->IsTotem())
486 else
488 }
489
491
492 // generate new name for summon pet
493 std::string new_name = sObjectMgr->GeneratePetName(petentry);
494 if (!new_name.empty())
495 pet->SetName(new_name);
496
497 ExecuteLogEffectSummonObject(effIndex, pet);
498}
499
501{
503 return;
504
505 if (!unitTarget)
506 return;
507
508 if (unitTarget->ToPlayer())
509 {
510 EffectLearnSpell(effIndex);
511 return;
512 }
513 Pet* pet = unitTarget->ToPet();
514 if (!pet)
515 return;
516
517 SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].TriggerSpell);
518 if (!learn_spellproto)
519 return;
520
521 pet->learnSpell(learn_spellproto->Id);
524}
525
527{
529 return;
530
531 uint32 gameobject_id = m_spellInfo->Effects[effIndex].MiscValue;
532
533 GameObject* pGameObj = new GameObject;
534
535 WorldObject* target = focusObject;
536 if (!target)
537 target = m_caster;
538
539 float x, y, z;
540 if (m_targets.HasDst())
541 destTarget->GetPosition(x, y, z);
542 else
543 m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
544
545 Map* map = target->GetMap();
546
547 if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map,
548 x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GOState::GO_STATE_READY))
549 {
550 delete pGameObj;
551 return;
552 }
553
554 int32 duration = m_spellInfo->GetDuration();
555 for (auto phase : m_caster->GetPhases())
556 pGameObj->SetPhased(phase, false, true);
557
558 pGameObj->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
559 pGameObj->SetSpellId(m_spellInfo->Id);
560
561 ExecuteLogEffectSummonObject(effIndex, pGameObj);
562
563 // Wild object not have owner and check clickable by players
564 map->AddToMap(pGameObj);
565
566 if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP)
567 if (Player* player = m_caster->ToPlayer())
568 if (Battleground* bg = player->GetBattleground())
569 bg->SetDroppedFlagGUID(pGameObj->GetGUID(), player->GetTeam() == ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE);
570
571 if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
572 {
573 GameObject* linkedGO = new GameObject;
574 if (linkedGO->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map,
575 x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GOState::GO_STATE_READY))
576 {
577 for (auto phase : m_caster->GetPhases())
578 linkedGO->SetPhased(phase, false, true);
579
580 linkedGO->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
581 linkedGO->SetSpellId(m_spellInfo->Id);
582
583 ExecuteLogEffectSummonObject(effIndex, linkedGO);
584
585 // Wild object not have owner and check clickable by players
586 map->AddToMap(linkedGO);
587 }
588 else
589 {
590 delete linkedGO;
591 linkedGO = NULL;
592 return;
593 }
594 }
595}
596
598{
599 // workaround - this effect should not use target map
601 return;
602
603 if (!unitTarget || unitTarget->GetTypeId() != TypeID::TYPEID_PLAYER)
604 return;
605
606 // Evil Twin (ignore player summon, but hide this for summoner)
607 if (unitTarget->HasAura(23445))
608 return;
609
610 float x, y, z;
611 m_caster->GetPosition(x, y, z);
612 unitTarget->ToPlayer()->SetSummonPoint(m_caster->GetMapId(), x, y, z);
613
614 ObjectGuid SummonerGUID = m_caster->GetGUID();
615
616 WorldPacket data(SMSG_SUMMON_REQUEST, 8 + 4 + 4);
617 data.WriteGuidMask(SummonerGUID, 0, 6, 3, 2, 1, 4, 7, 5);
618 data.WriteGuidBytes(SummonerGUID, 4);
619 data << uint32(m_caster->GetZoneId()); // summoner zone
620 data.WriteGuidBytes(SummonerGUID, 7, 3, 1);
621 data << uint32(MAX_PLAYER_SUMMON_DELAY * IN_MILLISECONDS); // auto decline after msecs
622 data.WriteGuidBytes(SummonerGUID, 2, 6, 5, 0);
623 unitTarget->ToPlayer()->GetSession()->SendPacket(&data);
624}
625
627{
629 return;
630
631 if (!gameObjTarget)
632 return;
633
634 ScriptInfo activateCommand;
636
637 // int32 unk = m_spellInfo->Effects[effIndex].MiscValue; // This is set for EffectActivateObject spells; needs research
638
639 gameObjTarget->GetMap()->ScriptCommandStart(activateCommand, 0, m_caster, gameObjTarget);
640}
641
643{
645 return;
646
647 Player* player = m_caster->ToPlayer();
648 if (!player)
649 return;
650
651 Item* foodItem = itemTarget;
652 if (!foodItem)
653 return;
654
655 Pet* pet = player->GetPet();
656 if (!pet)
657 return;
658
659 if (!pet->IsAlive())
660 return;
661
662 int32 benefit = pet->GetCurrentFoodBenefitLevel(foodItem->GetTemplate()->ItemLevel);
663 if (benefit <= 0)
664 return;
665
666 ExecuteLogEffectDestroyItem(effIndex, foodItem->GetEntry());
667
668 uint32 count = 1;
669 player->DestroyItemCount(foodItem, count, true);
671
672 m_caster->CastCustomSpell(pet, m_spellInfo->Effects[effIndex].TriggerSpell, &benefit, NULL, NULL, true);
673}
674
676{
678 return;
679
680 if (!unitTarget || !unitTarget->IsPet())
681 return;
682
683 Pet* pet = unitTarget->ToPet();
684
685 ExecuteLogEffectUnsummonObject(effIndex, pet);
687}
688
690{
692 return;
693
694 uint32 go_id = m_spellInfo->Effects[effIndex].MiscValue;
695 uint8 slot = m_spellInfo->Effects[effIndex].Effect - SPELL_EFFECT_SUMMON_OBJECT_SLOT1;
696
697 if (uint64 guid = m_caster->m_ObjectSlot[slot])
698 {
699 if (GameObject* obj = m_caster->GetMap()->GetGameObject(guid))
700 {
701 // Recast case - null spell id to make auras not be removed on object remove from world
702 if (m_spellInfo->Id == obj->GetSpellId())
703 obj->SetSpellId(0);
704 m_caster->RemoveGameObject(obj, true);
705 }
706 m_caster->m_ObjectSlot[slot] = 0;
707 }
708
709 GameObject* go = new GameObject();
710
711 float x, y, z;
712 // If dest location if present
713 if (m_targets.HasDst())
714 destTarget->GetPosition(x, y, z);
715 // Summon in random point all other units if location present
716 else
717 m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
718
719 Map* map = m_caster->GetMap();
720 if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map,
721 x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GOState::GO_STATE_READY))
722 {
723 delete go;
724 return;
725 }
726
727 //pGameObj->SetUInt32Value(GAMEOBJECT_FIELD_LEVEL, m_caster->getLevel());
728 int32 duration = m_spellInfo->GetDuration();
729
730 for (auto phase : m_caster->GetPhases())
731 go->SetPhased(phase, false, true);
732
733 go->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
734 go->SetSpellId(m_spellInfo->Id);
735 m_caster->AddGameObject(go);
736
737 ExecuteLogEffectSummonObject(effIndex, go);
738
739 map->AddToMap(go);
740
741 m_caster->m_ObjectSlot[slot] = go->GetGUID();
742}
743
745{
747 return;
748
749 Player* player = m_caster->ToPlayer();
750 if (!player)
751 return;
752
753 Pet* pet = player->GetPet();
754 if (pet && pet->IsAlive())
755 return;
756
757 if (damage < 0)
758 return;
759
760 float x, y, z;
761 player->GetPosition(x, y, z);
762 if (!pet)
763 {
764 player->SummonPet(0, x, y, z, player->GetOrientation(), PetType::SUMMON_PET, 0);
765 pet = player->GetPet();
766 }
767 if (!pet)
768 return;
769
770 player->GetMap()->CreatureRelocation(pet, x, y, z, player->GetOrientation());
771
777
778 //pet->AIM_Initialize();
779 //player->PetSpellInitialize();
781}
782
784{
786 return;
787
788 int32 mana = 0;
789 for (uint8 slot = SUMMON_SLOT_TOTEM; slot < MAX_TOTEM_SLOT; ++slot)
790 {
791 if (!m_caster->m_SummonSlot[slot])
792 continue;
793
794 Creature* totem = m_caster->GetMap()->GetCreature(m_caster->m_SummonSlot[slot]);
795 if (totem && totem->IsTotem())
796 {
798 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
799 if (spellInfo)
800 {
801 //mana += spellInfo->ManaCost;
802 //mana += int32(CalculatePct(m_caster->GetCreateMana(), spellInfo->ManaCostPercentage));
803 }
804 totem->ToTotem()->UnSummon();
805 }
806 }
807 ApplyPct(mana, damage);
808 if (mana)
809 m_caster->CastCustomSpell(m_caster, 39104, &mana, NULL, NULL, true);
810}
811
813{
815 return;
816
817 uint32 name_id = m_spellInfo->Effects[effIndex].MiscValue;
818
819 GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id);
820
821 if (!goinfo)
822 {
823 SF_LOG_ERROR("sql.sql", "Gameobject (Entry: %u) not exist and not created at spell (ID: %u) cast", name_id, m_spellInfo->Id);
824 return;
825 }
826
827 // SPELL_FOCUS GOs (e.g. Basic Campfire 29784): CREATED_BY uses CREATE_OBJECT2 and
828 // crashes the 5.4.8 client (WowClientDB2 OOM). Track for cleanup without owner.
829 bool const spellFocusGo = (goinfo->type == GAMEOBJECT_TYPE_SPELL_FOCUS);
830 if (spellFocusGo)
831 m_caster->RemoveGameObject(m_spellInfo->Id, true);
832
833 float fx, fy, fz;
834
835 if (m_targets.HasDst())
836 destTarget->GetPosition(fx, fy, fz);
837 //FIXME: this can be better check for most objects but still hack
838 else if (m_spellInfo->Effects[effIndex].HasRadius() && m_spellInfo->Speed == 0)
839 {
840 float dis = m_spellInfo->Effects[effIndex].CalcRadius(m_originalCaster);
841 m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis);
842 }
843 else
844 {
845 //GO is always friendly to it's creator, get range for friends
846 float min_dis = m_spellInfo->GetMinRange(true);
847 float max_dis = m_spellInfo->GetMaxRange(true);
848 float dis = (float)rand_norm() * (max_dis - min_dis) + min_dis;
849
850 m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis);
851 }
852
853 Map* cMap = m_caster->GetMap();
854 // if gameobject is summoning object, it should be spawned right on caster's position
856 m_caster->GetPosition(fx, fy, fz);
857
858 GameObject* pGameObj = new GameObject;
859
860 if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap,
861 fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GOState::GO_STATE_READY))
862 {
863 delete pGameObj;
864 return;
865 }
866
867 int32 duration = m_spellInfo->GetDuration();
868
869 for (auto phase : m_caster->GetPhases())
870 pGameObj->SetPhased(phase, false, true);
871
872 switch (goinfo->type)
873 {
875 {
876 m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pGameObj->GetGUID());
877 m_caster->AddGameObject(pGameObj); // will removed at spell cancel
878
879 // end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo))
880 // start time == fish-FISHING_BOBBER_READY_TIME (0..GetDuration(m_spellInfo)-FISHING_BOBBER_READY_TIME)
881 int32 lastSec = 0;
882 switch (std::rand() % 3)
883 {
884 case 0: lastSec = 3; break;
885 case 1: lastSec = 7; break;
886 case 2: lastSec = 13; break;
887 case 3: lastSec = 17; break;
888 }
889
890 duration = duration - lastSec * IN_MILLISECONDS + FISHING_BOBBER_READY_TIME * IN_MILLISECONDS;
891 break;
892 }
894 {
895 if (m_caster->GetTypeId() == TypeID::TYPEID_PLAYER)
896 {
897 pGameObj->AddUniqueUse(m_caster->ToPlayer());
898 m_caster->AddGameObject(pGameObj); // will be removed at spell cancel
899 }
900 break;
901 }
902 case GAMEOBJECT_TYPE_DUEL_ARBITER: // 52991
903 m_caster->AddGameObject(pGameObj);
904 break;
907 default:
908 break;
909 }
910
911 pGameObj->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
912
913 if (!spellFocusGo)
914 pGameObj->SetOwnerGUID(m_caster->GetGUID());
915
916 //pGameObj->SetUInt32Value(GAMEOBJECT_FIELD_LEVEL, m_caster->getLevel());
917 pGameObj->SetSpellId(m_spellInfo->Id);
918
919 ExecuteLogEffectSummonObject(effIndex, pGameObj);
920
921 SF_LOG_DEBUG("spells", "AddObject at SpellEfects.cpp EffectTransmitted");
922 //m_caster->AddGameObject(pGameObj);
923 //m_ObjToDel.push_back(pGameObj);
924
925 cMap->AddToMap(pGameObj);
926
927 if (spellFocusGo)
928 m_caster->TrackGameObject(pGameObj);
929
930 if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
931 {
932 GameObject* linkedGO = new GameObject;
933 if (linkedGO->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap,
934 fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GOState::GO_STATE_READY))
935 {
936 for (auto phase : m_caster->GetPhases())
937 linkedGO->SetPhased(phase, false, true);
938
939 linkedGO->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
940 //linkedGO->SetUInt32Value(GAMEOBJECT_FIELD_LEVEL, m_caster->getLevel());
941 linkedGO->SetSpellId(m_spellInfo->Id);
942 // Linked traps (e.g. Basic Campfire 29784 -> 31442) are environmental;
943 // owner on the trap breaks cozy-fire targeting and can crash the client.
944
945 ExecuteLogEffectSummonObject(effIndex, linkedGO);
946
947 linkedGO->GetMap()->AddToMap(linkedGO);
948 }
949 else
950 {
951 delete linkedGO;
952 linkedGO = NULL;
953 return;
954 }
955 }
956}
957
959{
961 return;
962
963 if (!unitTarget || unitTarget->GetTypeId() != TypeID::TYPEID_PLAYER || unitTarget->GetPetGUID() || unitTarget->getClass() != CLASS_HUNTER)
964 return;
965
966 uint32 creatureEntry = m_spellInfo->Effects[effIndex].MiscValue;
967 Pet* pet = unitTarget->CreateTamedPetFrom(creatureEntry, m_spellInfo->Id);
968 if (!pet)
969 return;
970
971 // relocate
972 float px, py, pz;
973 unitTarget->GetClosePoint(px, py, pz, pet->GetObjectSize(), PET_FOLLOW_DIST, pet->GetFollowAngle());
974 pet->Relocate(px, py, pz, unitTarget->GetOrientation());
975
976 // add to world
977 pet->GetMap()->AddToMap(pet->ToCreature());
978
979 // unitTarget has pet now
980 unitTarget->SetMinion(pet, true);
981
982 pet->InitTalentForLevel();
983
984 if (unitTarget->GetTypeId() == TypeID::TYPEID_PLAYER)
985 {
987 unitTarget->ToPlayer()->PetSpellInitialize();
988 }
989}
990
992{
994 return;
995
996 if (!gameObjTarget)
997 return;
998
999 Unit* caster = m_originalCaster;
1000 if (!caster)
1001 return;
1002
1003 FactionTemplateEntry const* casterFaction = caster->GetFactionTemplateEntry();
1004 FactionTemplateEntry const* targetFaction = sFactionTemplateStore.LookupEntry(gameObjTarget->GetUInt32Value(GAMEOBJECT_FIELD_FACTION_TEMPLATE));
1005 // Do not allow to damage GO's of friendly factions (ie: Wintergrasp Walls/Ulduar Storm Beacons)
1006 if ((casterFaction && targetFaction && !casterFaction->IsFriendlyTo(*targetFaction)) || !targetFaction)
1007 gameObjTarget->ModifyHealth(-damage, caster, GetSpellInfo()->Id);
1008}
1009
1011{
1013 return;
1014
1015 if (!gameObjTarget)
1016 return;
1017
1018 gameObjTarget->ModifyHealth(damage, m_caster);
1019}
1020
1022{
1024 return;
1025
1027 return;
1028
1029 Player* player = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself();
1030 gameObjTarget->SetDestructibleState(GameObjectDestructibleState(m_spellInfo->Effects[effIndex].MiscValue), player, true);
1031}
1032
1033void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numGuardians)
1034{
1035 Unit* caster = m_originalCaster;
1036 if (!caster)
1037 return;
1038
1039 if (caster->IsTotem())
1040 caster = caster->ToTotem()->GetOwner();
1041
1042 // in another case summon new
1043 uint8 level = caster->getLevel();
1044
1045 // level of pet summoned using engineering item based at engineering skill level
1046 if (m_CastItem && caster->GetTypeId() == TypeID::TYPEID_PLAYER)
1047 if (ItemTemplate const* proto = m_CastItem->GetTemplate())
1048 if (proto->RequiredSkill == SKILL_ENGINEERING)
1049 if (uint16 skill202 = caster->ToPlayer()->GetSkillValue(SKILL_ENGINEERING))
1050 level = skill202 / 5;
1051
1052 float radius = 5.0f;
1053 int32 duration = m_spellInfo->GetDuration();
1054
1055 if (Player* modOwner = m_originalCaster->GetSpellModOwner())
1056 modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration);
1057
1058 //TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
1059 Map* map = caster->GetMap();
1060
1061 for (uint32 count = 0; count < numGuardians; ++count)
1062 {
1063 Position pos;
1064 if (count == 0)
1065 pos = *destTarget;
1066 else
1067 // randomize position for multiple summons
1068 m_caster->GetRandomPoint(*destTarget, radius, pos);
1069
1070 TempSummon* summon = map->SummonCreature(entry, pos, properties, duration, caster, m_spellInfo->Id);
1071 if (!summon)
1072 return;
1074 ((Guardian*)summon)->InitStatsForLevel(level);
1075
1076 if (properties && properties->Category == SUMMON_CATEGORY_ALLY)
1077 summon->setFaction(caster->getFaction());
1078
1079 if (summon->HasUnitTypeMask(UNIT_MASK_MINION) && m_targets.HasDst())
1080 ((Minion*)summon)->SetFollowAngle(m_caster->GetAngle(summon));
1081
1082 if (summon->GetEntry() == 27893)
1083 {
1084 if (uint32 weapon = m_caster->GetUInt32Value(PLAYER_FIELD_VISIBLE_ITEMS + 16))
1085 {
1086 summon->SetDisplayId(11686);
1088 }
1089 else
1090 summon->SetDisplayId(1126);
1091 }
1092
1093 summon->AI()->EnterEvadeMode();
1094
1096 }
1097}
1098
1100{
1102 return;
1103
1104 if (!unitTarget || unitTarget->GetTypeId() != TypeID::TYPEID_UNIT ||
1105 !unitTarget->ToCreature()->IsPet() || ((Pet*)unitTarget)->getPetType() != PetType::HUNTER_PET)
1106 return;
1107
1109}
1110
1112{
1114 return;
1115
1116 if (m_caster->GetTypeId() != TypeID::TYPEID_PLAYER || !unitTarget || unitTarget->GetTypeId() != TypeID::TYPEID_PLAYER)
1117 return;
1118
1119 m_caster->CastSpell(unitTarget, m_spellInfo->Effects[effIndex].TriggerSpell, true);
1120}
1121
1123{
1125 return;
1126
1127 Unit* caster = m_caster->GetEntry() == WORLD_TRIGGER ? m_originalCaster : m_caster;
1128 float radius = m_spellInfo->Effects[effIndex].CalcRadius(caster);
1129
1130 DynamicObject* dynObj = new DynamicObject(false);
1132 {
1133 delete dynObj;
1134 return;
1135 }
1136
1137 /*
1138 // trigger entry/miscvalue relation is currently unknown, for now use MiscValue as trigger entry
1139 uint32 triggerEntry = GetSpellInfo()->Effects[effIndex].MiscValue;
1140
1141 AreaTrigger * areaTrigger = new AreaTrigger;
1142 if (!areaTrigger->CreateAreaTrigger(sObjectMgr->GenerateLowGuid(HIGHGUID_AREATRIGGER), triggerEntry, GetCaster(), GetSpellInfo(), pos))
1143 delete areaTrigger;
1144 */
1145}
1146
1148{
1150 return;
1151
1152 Player* player = GetCaster()->ToPlayer();
1153 if (!player)
1154 return;
1155
1156 BattlePetMgr* battlePetMgr = player->GetBattlePetMgr();
1157 if (!battlePetMgr)
1158 return;
1159
1161 return;
1162
1164
1166 player->learnSpell(SPELL_TRACK_PETS, false);
1167 player->learnSpell(SPELL_REVIVE_BATTLE_PETS, false);
1168
1169 for (uint8 i = 0; i < sWorld->getIntConfig(WorldIntConfigs::CONFIG_BATTLE_PET_LOADOUT_UNLOCK_COUNT); i++)
1170 battlePetMgr->UnlockLoadoutSlot(i);
1171
1172 battlePetMgr->SaveToDb();
1173}
1174
1176{
1178 return;
1179
1180 Player* player = GetCaster()->ToPlayer();
1181 if (!player)
1182 return;
1183
1184 BattlePetMgr* battlePetMgr = player->GetBattlePetMgr();
1185 if (!battlePetMgr)
1186 return;
1187
1188 int32 const effectValue = m_spellInfo->Effects[effIndex].CalcValue(m_caster);
1189 uint8 const percent = uint8(std::min<int32>(std::max<int32>(effectValue, 0), 100));
1190 battlePetMgr->HealBattlePets(percent ? percent : 100);
1191 battlePetMgr->SaveToDb();
1192
1195}
@ SPELL_REVIVE_BATTLE_PETS
@ SPELL_BATTLE_PET_TRAINING_PASSIVE
@ SPELL_TRACK_PETS
@ IN_MILLISECONDS
Definition Common.h:125
DBCStorage< SummonPropertiesEntry > sSummonPropertiesStore(SummonPropertiesfmt)
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
std::uint64_t uint64
Definition Define.h:76
std::uint16_t uint16
Definition Define.h:78
@ DYNAMIC_OBJECT_AREA_SPELL
#define ASSERT
Definition Errors.h:29
#define FISHING_BOBBER_READY_TIME
Definition GameObject.h:626
@ GO_STATE_READY
Definition GameObject.h:577
EnchantmentSlot
Definition Item.h:149
@ PERM_ENCHANTMENT_SLOT
Definition Item.h:150
@ TEMP_ENCHANTMENT_SLOT
Definition Item.h:151
InventoryResult
Definition Item.h:27
@ EQUIP_ERR_CLIENT_LOCKED_OUT
Definition Item.h:67
@ EQUIP_ERR_OK
Definition Item.h:28
#define SF_LOG_DEBUG(filterType__,...)
Definition Log.h:134
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
@ MOTION_SLOT_ACTIVE
@ TYPEID_PLAYER
Definition Object.h:55
@ TYPEID_UNIT
Definition Object.h:54
TempSummonType
Definition Object.h:67
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:70
@ TEMPSUMMON_DEAD_DESPAWN
Definition Object.h:74
#define DEFAULT_WORLD_OBJECT_SIZE
Definition Object.h:29
@ HIGHGUID_DYNAMICOBJECT
@ HIGHGUID_GAMEOBJECT
@ SCRIPT_COMMAND_ACTIVATE_OBJECT
Definition ObjectMgr.h:98
#define sObjectMgr
Definition ObjectMgr.h:1617
@ PET_SAVE_AS_DELETED
Definition PetDefines.h:21
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:25
@ PET_SAVE_AS_CURRENT
Definition PetDefines.h:22
#define PET_FOLLOW_DIST
Definition PetDefines.h:57
@ SUMMON_PET
Definition PetDefines.h:11
@ HUNTER_PET
Definition PetDefines.h:12
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:777
@ PLAYER_FLAGS_BATTLE_PET_ENABLED
Definition Player.h:561
@ EQUIPMENT_SLOT_MAINHAND
Definition Player.h:704
#define MAX_PLAYER_SUMMON_DELAY
Definition Player.h:926
@ GAMEOBJECT_TYPE_SPELL_FOCUS
@ GAMEOBJECT_TYPE_DUEL_ARBITER
@ GAMEOBJECT_TYPE_SUMMONING_RITUAL
@ GAMEOBJECT_TYPE_CHEST
@ GAMEOBJECT_TYPE_FISHINGHOLE
@ GAMEOBJECT_TYPE_FLAGDROP
@ GAMEOBJECT_TYPE_FISHINGNODE
SpellEffIndex
@ SPELL_EFFECT_SUMMON_OBJECT_SLOT1
@ UNIT_DYNFLAG_NONE
@ TEAM_ALLIANCE
@ TEAM_HORDE
@ SUMMON_TYPE_VEHICLE2
@ SUMMON_TYPE_LIGHTWELL
@ SUMMON_TYPE_MINION
@ SUMMON_TYPE_GUARDIAN
@ SUMMON_TYPE_STATUE
@ SUMMON_TYPE_PET
@ SUMMON_TYPE_TOTEM
@ SUMMON_TYPE_VEHICLE
@ SUMMON_TYPE_MINIPET
@ SUMMON_TYPE_GUARDIAN2
@ CLASS_HUNTER
GameObjectDestructibleState
@ ALLIANCE
@ SUMMON_CATEGORY_PET
@ SUMMON_CATEGORY_VEHICLE
@ SUMMON_CATEGORY_ALLY
@ SUMMON_CATEGORY_PUPPET
@ SUMMON_CATEGORY_WILD
@ SUMMON_CATEGORY_UNK
@ SKILL_ENGINEERING
@ SPELL_EFFECT_HANDLE_HIT
Definition Spell.h:276
@ SPELL_EFFECT_HANDLE_HIT_TARGET
Definition Spell.h:277
@ SPELL_AURA_CONTROL_VEHICLE
#define sSpellMgr
Definition SpellMgr.h:744
@ UNIT_CAN_BE_RENAMED
Definition Unit.h:268
@ UNIT_MASK_GUARDIAN
Definition Unit.h:807
@ UNIT_MASK_MINION
Definition Unit.h:806
#define WORLD_TRIGGER
Definition Unit.h:20
@ SPELLMOD_DURATION
Definition Unit.h:74
#define SUMMON_SLOT_TOTEM
Definition Unit.h:1340
@ ALIVE
Definition Unit.h:503
#define MAX_TOTEM_SLOT
Definition Unit.h:1341
@ UNIT_STATE_ALL_STATE
Definition Unit.h:550
@ REACT_DEFENSIVE
Definition Unit.h:1157
@ REACT_AGGRESSIVE
Definition Unit.h:1158
@ UNIT_FLAG_IMMUNE_TO_NPC
Definition Unit.h:634
@ UNIT_FLAG_IMMUNE_TO_PC
Definition Unit.h:633
@ UNIT_FLAG_SKINNABLE
Definition Unit.h:651
@ UNIT_FIELD_VIRTUAL_ITEM_ID
@ UNIT_FIELD_CHANNEL_OBJECT
@ UNIT_FIELD_SHAPESHIFT_FORM
@ UNIT_FIELD_LEVEL
@ UNIT_FIELD_BATTLE_PET_COMPANION_NAME_TIMESTAMP
@ UNIT_FIELD_WILD_BATTLE_PET_LEVEL
@ UNIT_FIELD_BATTLE_PET_COMPANION_GUID
@ UNIT_FIELD_NPC_FLAGS
@ UNIT_FIELD_FLAGS
@ UNIT_FIELD_CREATED_BY
@ UNIT_FIELD_CREATED_BY_SPELL
@ OBJECT_FIELD_DYNAMIC_FLAGS
@ ITEM_FIELD_DURABILITY
@ ITEM_FIELD_MAX_DURABILITY
@ GAMEOBJECT_FIELD_FACTION_TEMPLATE
@ PLAYER_FIELD_SUMMONED_BATTLE_PET_GUID
@ PLAYER_FIELD_VISIBLE_ITEMS
@ PLAYER_FIELD_PLAYER_FLAGS
@ PLAYER_FIELD_CURRENT_BATTLE_PET_BREED_QUALITY
double rand_norm(void)
Definition Util.cpp:50
T ApplyPct(T &base, U pct)
Definition Util.h:115
@ VEHICLE_SPELL_RIDE_HARDCODED
uint8 GetLevel() const
Definition BattlePet.h:219
uint8 GetQuality() const
Definition BattlePet.h:225
uint64 GetId() const
Definition BattlePet.h:215
uint16 GetCurrentHealth() const
Definition BattlePet.h:221
uint16 GetMaxHealth() const
Definition BattlePet.h:222
uint32 GetTimestamp() const
Definition BattlePet.h:218
void SetCurrentSummon(TempSummon *summon)
uint64 GetCurrentSummonId() const
BattlePet * GetBattlePet(uint64 id) const
void HealBattlePets(uint8 percent)
void UnlockLoadoutSlot(uint8 slot)
void WriteGuidBytes(const ObjectGuid &guid, Offsets... offsets)
Definition ByteBuffer.h:264
void WriteGuidMask(const ObjectGuid &guid, Offsets... offsets)
Definition ByteBuffer.h:248
virtual void EnterEvadeMode()
void SetDisplayId(uint32 modelId) OVERRIDE
void DespawnOrUnsummon(uint32 msTimeToDespawn=0)
void SetReactState(ReactStates st)
Definition Creature.h:460
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:524
CreatureAI * AI() const
Definition Creature.h:483
bool CreateDynamicObject(uint32 guidlow, Unit *caster, SpellInfo const *spell, Position const &pos, float radius, DynamicObjectType type)
GameObjectTemplate const * GetGOInfo() const
Definition GameObject.h:643
void SetOwnerGUID(uint64 owner)
Definition GameObject.h:665
bool Create(uint32 guidlow, uint32 name_id, Map *map, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit=0)
void SetRespawnTime(int32 respawn)
Definition GameObject.h:699
GameobjectTypes GetGoType() const
Definition GameObject.h:719
bool SetPhased(uint32 id, bool update, bool apply) OVERRIDE
void AddUniqueUse(Player *player)
void SetSpellId(uint32 id)
Definition GameObject.h:682
Definition Item.h:202
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, uint64 caster=0)
Definition Item.cpp:856
ItemTemplate const * GetTemplate() const
Definition Item.cpp:528
static Item * CreateItem(uint32 itemEntry, uint32 count, Player const *player=NULL)
Definition Item.cpp:1012
Definition Map.h:238
void CreatureRelocation(Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail=true)
Definition Map.cpp:909
bool AddToMap(T *)
Definition Map.cpp:504
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=NULL, uint32 duration=0, Unit *summoner=NULL, uint32 spellId=0, uint32 vehId=0)
Definition Object.cpp:2564
Unit * GetOwner() const
float GetFollowAngle() const OVERRIDE
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
void Clear(bool reset=true)
uint64 GetGUID() const
Definition Object.h:119
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:325
Player * ToPlayer()
Definition Object.h:204
TypeID GetTypeId() const
Definition Object.h:131
void SetFlag(uint16 index, uint32 newFlag)
Definition Object.cpp:1261
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:1280
uint32 GetEntry() const
Definition Object.h:125
Creature * ToCreature()
Definition Object.h:207
bool HasFlag(uint16 index, uint32 flag) const
Definition Object.cpp:1309
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:1038
void SetUInt64Value(uint16 index, uint64 value)
Definition Object.cpp:1079
Definition Pet.h:28
Player * GetOwner() const
Definition Pet.cpp:2117
void setDeathState(DeathState s)
Definition Pet.cpp:521
void InitTalentForLevel()
Definition Pet.cpp:1828
void SavePetToDB(PetSaveMode mode)
Definition Pet.cpp:365
PetType getPetType() const
Definition Pet.h:38
bool isControlled() const
Definition Pet.cpp:2135
uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel) const
Definition Pet.cpp:1102
bool learnSpell(uint32 spell_id)
Definition Pet.cpp:1528
static bool IsEquipmentPos(uint16 pos)
Definition Player.h:1536
InventoryResult CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading=true) const
uint16 GetSkillValue(uint32 skill) const
Definition Player.cpp:6563
Item * BankItem(ItemPosCountVec const &dest, Item *pItem, bool update)
BattlePetMgr * GetBattlePetMgr()
Definition Player.h:2573
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap=false) const
void PetSpellInitialize()
Definition Player.cpp:15884
Pet * GetPet() const
Definition Player.cpp:15640
Item * StoreItem(ItemPosCountVec const &pos, Item *pItem, bool update)
void SendSpellCooldown(uint32 spellId, uint32 cooldown)
Definition Player.cpp:17658
void DestroyItem(uint8 bag, uint8 slot, bool update)
static bool IsInventoryPos(uint16 pos)
Definition Player.h:1531
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition Player.cpp:15663
void DurabilityLoss(Item *item, double percent)
Definition Player.cpp:5413
void AutoUnequipOffhandIfNeed(bool force=false)
Definition Player.cpp:19517
Item * EquipItem(uint16 pos, Item *pItem, bool update)
Pet * SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 despwtime)
Definition Player.cpp:22668
void learnSpell(uint32 spell_id, bool dependent)
Definition Player.cpp:4021
void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
uint32 GetSpellCooldownDelay(uint32 spell_id) const
Definition Player.cpp:17504
InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading=true) const
static bool IsBankPos(uint16 pos)
Definition Player.h:1542
SpellInfo const * GetSpellInfo() const
Definition Spell.h:565
void EffectSummonRaFFriend(SpellEffIndex effIndex)
void EffectDismissPet(SpellEffIndex effIndex)
GameObject * gameObjTarget
Definition Spell.h:628
Unit * m_originalCaster
Definition Spell.h:587
void EffectTriggerRitualOfSummoning(SpellEffIndex effIndex)
void EffectTameCreature(SpellEffIndex effIndex)
void SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const *properties, uint32 numSummons)
void EffectSummonType(SpellEffIndex effIndex)
SpellCastTargets m_targets
Definition Spell.h:535
void EffectLearnSpell(SpellEffIndex effIndex)
Unit * GetCaster() const
Definition Spell.h:563
int32 damage
Definition Spell.h:630
void EffectSummonPet(SpellEffIndex effIndex)
void ExecuteLogEffectSummonObject(uint8 effIndex, WorldObject *obj)
Definition Spell.cpp:4970
SpellEffectHandleMode effectHandleMode
Definition Spell.h:631
Unit *const m_caster
Definition Spell.h:581
void EffectActivateObject(SpellEffIndex effIndex)
void EffectSummonPlayer(SpellEffIndex effIndex)
void EffectCreateAreaTrigger(SpellEffIndex effIndex)
Item * itemTarget
Definition Spell.h:627
void EffectSummonDeadPet(SpellEffIndex effIndex)
void EffectGameObjectDamage(SpellEffIndex effIndex)
void EffectLearnPetSpell(SpellEffIndex effIndex)
void EffectSummonChangeItem(SpellEffIndex effIndex)
Unit * unitTarget
Definition Spell.h:626
void ExecuteLogEffectUnsummonObject(uint8 effIndex, WorldObject *obj)
Definition Spell.cpp:4976
void EffectRenamePet(SpellEffIndex effIndex)
void EffectGameObjectRepair(SpellEffIndex effIndex)
void EffectFeedPet(SpellEffIndex effIndex)
void EffectDestroyAllTotems(SpellEffIndex effIndex)
WorldLocation * destTarget
Definition Spell.h:629
void EffectCreateTamedPet(SpellEffIndex effIndex)
void EffectHealBattlePetPct(SpellEffIndex effIndex)
void EffectBattlePetsUnlock(SpellEffIndex effIndex)
void EffectSummonObject(SpellEffIndex effIndex)
void ExecuteLogEffectDestroyItem(uint8 effIndex, uint32 entry)
Definition Spell.cpp:4964
void EffectSummonObjectWild(SpellEffIndex effIndex)
Item * m_CastItem
Definition Spell.h:531
void EffectGameObjectSetDestructionState(SpellEffIndex effIndex)
GameObject * focusObject
Definition Spell.h:640
void finish(bool ok=true)
Definition Spell.cpp:3762
SpellInfo const *const m_spellInfo
Definition Spell.h:530
void EffectTransmitted(SpellEffIndex effIndex)
uint32 Id
Definition SpellInfo.h:160
bool HasAura(AuraType aura) const
void UnSummon(uint32 msTime=0) OVERRIDE
Definition Totem.cpp:77
Definition Unit.h:1367
void ClearUnitState(uint32 f)
Definition Unit.h:1489
bool IsVehicle() const
Definition Unit.h:1523
void setFaction(uint32 faction)
Definition Unit.h:1699
uint32 getFaction() const
Definition Unit.h:1695
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition Unit.cpp:2117
void SetCreateHealth(uint32 val)
Definition Unit.h:2317
Totem * ToTotem()
Definition Unit.h:2812
void SetCreatorGUID(uint64 creator)
Definition Unit.h:2059
MotionMaster * GetMotionMaster()
Definition Unit.h:2605
bool IsPet() const
Definition Unit.h:1511
void SetFacingToObject(WorldObject *object)
Definition Unit.cpp:9124
bool IsAlive() const
Definition Unit.h:2032
void NearTeleportTo(float x, float y, float z, float orientation, bool casting=false)
Definition Unit.cpp:8393
void SetHealth(uint32 val)
Definition Unit.cpp:5162
void SetOwnerGUID(uint64 owner)
Definition Unit.cpp:2314
virtual float GetFollowAngle() const
Definition Unit.h:2788
uint32 HasUnitTypeMask(uint32 mask) const
Definition Unit.h:1495
uint32 CountPctFromMaxHealth(int32 pct) const
Definition Unit.h:1633
void SetMaxHealth(uint32 val)
Definition Unit.cpp:5206
uint8 getLevel() const
Definition Unit.h:1528
bool IsTotem() const
Definition Unit.h:1519
bool isDead() const
Definition Unit.h:2040
Map * GetMap() const
Definition Object.h:740
void SetName(std::string const &newname)
Definition Object.h:665
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float angle=0) const
Definition Object.cpp:3070
float GetObjectSize() const
Definition Object.cpp:3100
@ SMSG_SUMMON_REQUEST
Definition Opcodes.h:1021
#define sWorld
Definition World.h:910
@ CONFIG_BATTLE_PET_LOADOUT_UNLOCK_COUNT
Definition World.h:361
uint32 GetSummonCountForProperty(uint32 summonPropertyId, int32 damage)
uint32 GetTotemSummonHealthPct(uint32 spellId)
bool IsFriendlyTo(FactionTemplateEntry const &entry) const
uint32 GetLinkedGameObjectEntry() const
Definition GameObject.h:459
float GetOrientation() const
Definition Object.h:331
void GetPosition(float &x, float &y) const
Definition Object.h:333
void Relocate(float x, float y)
Definition Object.h:302
ScriptCommands command
Definition ObjectMgr.h:196
uint32 Faction
uint32 Flags
uint32 Type
uint32 Category
uint32 Id