TrinityCore
cs_npc.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/* ScriptData
19Name: npc_commandscript
20%Complete: 100
21Comment: All npc related commands
22Category: commandscripts
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "Chat.h"
27#include "ChatCommand.h"
28#include "CreatureAI.h"
29#include "CreatureGroups.h"
30#include "DatabaseEnv.h"
31#include "DB2Stores.h"
33#include "GameTime.h"
34#include "Language.h"
35#include "Loot.h"
36#include "Map.h"
37#include "MotionMaster.h"
38#include "MovementDefines.h"
39#include "ObjectAccessor.h"
40#include "ObjectMgr.h"
41#include "Pet.h"
42#include "PhasingHandler.h"
43#include "Player.h"
44#include "RBAC.h"
45#include "SmartEnum.h"
46#include "SpellMgr.h"
47#include "Transport.h"
48#include "World.h"
49#include "WorldSession.h"
50
51using namespace Trinity::ChatCommands;
52
55
56// shared with cs_gobject.cpp, definitions are at the bottom of this file
57bool HandleNpcSpawnGroup(ChatHandler* handler, std::vector<Variant<uint32, EXACT_SEQUENCE("force"), EXACT_SEQUENCE("ignorerespawn")>> const& opts);
58bool HandleNpcDespawnGroup(ChatHandler* handler, std::vector<Variant<uint32, EXACT_SEQUENCE("removerespawntime")>> const& opts);
59
61{
62public:
63 npc_commandscript() : CommandScript("npc_commandscript") { }
64
66 {
67 static ChatCommandTable npcAddCommandTable =
68 {
73// { "weapon", HandleNpcAddWeaponCommand, rbac::RBAC_PERM_COMMAND_NPC_ADD_WEAPON, Console::No },
75 };
76 static ChatCommandTable npcSetCommandTable =
77 {
90 };
91 static ChatCommandTable npcCommandTable =
92 {
93 { "add", npcAddCommandTable },
94 { "set", npcSetCommandTable },
104 { "spawngroup", HandleNpcSpawnGroup, rbac::RBAC_PERM_COMMAND_NPC_SPAWNGROUP, Console::No },
105 { "despawngroup", HandleNpcDespawnGroup, rbac::RBAC_PERM_COMMAND_NPC_DESPAWNGROUP, Console::No },
109 { "follow stop", HandleNpcUnFollowCommand, rbac::RBAC_PERM_COMMAND_NPC_FOLLOW, Console::No },
112 };
113 static ChatCommandTable commandTable =
114 {
115 { "npc", npcCommandTable },
116 };
117 return commandTable;
118 }
119
120 //add spawn of creature
122 {
123 if (!sObjectMgr->GetCreatureTemplate(id))
124 return false;
125
126 Player* chr = handler->GetSession()->GetPlayer();
127 Map* map = chr->GetMap();
128
129 if (Transport* trans = dynamic_cast<Transport*>(chr->GetTransport()))
130 {
131 ObjectGuid::LowType guid = sObjectMgr->GenerateCreatureSpawnId();
132 CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid);
133 data.spawnId = guid;
134 data.spawnGroupData = sObjectMgr->GetDefaultSpawnGroup();
135 data.id = id;
137 if (Creature* creature = trans->CreateNPCPassenger(guid, &data))
138 {
139 creature->SaveToDB(trans->GetGOInfo()->moTransport.SpawnMap, { map->GetDifficultyID() });
140 sObjectMgr->AddCreatureToGrid(&data);
141 }
142 return true;
143 }
144
145 Creature* creature = Creature::CreateCreature(id, map, chr->GetPosition());
146 if (!creature)
147 return false;
148
150 creature->SaveToDB(map->GetId(), { map->GetDifficultyID() });
151
152 ObjectGuid::LowType db_guid = creature->GetSpawnId();
153
154 // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells()
155 // current "creature" variable is deleted and created fresh new, otherwise old values might trigger asserts or cause undefined behavior
156 creature->CleanupsBeforeDelete();
157 delete creature;
158
159 creature = Creature::CreateCreatureFromDB(db_guid, map, true, true);
160 if (!creature)
161 return false;
162
163 sObjectMgr->AddCreatureToGrid(sObjectMgr->GetCreatureData(db_guid));
164 return true;
165 }
166
167 //add item in vendorlist
169 {
170 if (!item)
171 {
173 handler->SetSentErrorMessage(true);
174 return false;
175 }
176
177 Creature* vendor = handler->getSelectedCreature();
178 if (!vendor)
179 {
181 handler->SetSentErrorMessage(true);
182 return false;
183 }
184
185 uint32 itemId = item->GetId();
186 uint32 maxcount = mc.value_or(0);
187 uint32 incrtime = it.value_or(0);
188 uint32 extendedcost = ec.value_or(0);
189 uint32 vendor_entry = vendor->GetEntry();
190
191 VendorItem vItem;
192 vItem.item = itemId;
193 vItem.maxcount = maxcount;
194 vItem.incrtime = incrtime;
195 vItem.ExtendedCost = extendedcost;
197
198 if (bonusListIDs)
199 for (std::string_view token : Trinity::Tokenize(*bonusListIDs, ';', false))
200 if (Optional<int32> bonusListID = Trinity::StringTo<int32>(token))
201 vItem.BonusListIDs.push_back(*bonusListID);
202
203 if (!sObjectMgr->IsVendorItemValid(vendor_entry, vItem, handler->GetSession()->GetPlayer()))
204 {
205 handler->SetSentErrorMessage(true);
206 return false;
207 }
208
209 sObjectMgr->AddVendorItem(vendor_entry, vItem);
210
211 handler->PSendSysMessage(LANG_ITEM_ADDED_TO_LIST, itemId, item->GetDefaultLocaleName(), maxcount, incrtime, extendedcost);
212 return true;
213 }
214
215 //add move for creature
217 {
218 // attempt check creature existence by DB data
219 CreatureData const* data = sObjectMgr->GetCreatureData(lowGuid);
220 if (!data)
221 {
222 handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, std::to_string(*lowGuid).c_str());
223 handler->SetSentErrorMessage(true);
224 return false;
225 }
226
227 // Update movement type
229
231 stmt->setUInt64(1, lowGuid);
232
233 WorldDatabase.Execute(stmt);
234
236
237 return true;
238 }
239
241 {
242 if (sWorld->getAllowMovement())
243 {
244 sWorld->SetAllowMovement(false);
246 }
247 else
248 {
249 sWorld->SetAllowMovement(true);
251 }
252 return true;
253 }
254
255 static bool HandleNpcSetEntryCommand(ChatHandler* handler, CreatureEntry newEntryNum)
256 {
257 if (!newEntryNum)
258 return false;
259
260 Unit* unit = handler->getSelectedUnit();
261 if (!unit || unit->GetTypeId() != TYPEID_UNIT)
262 {
264 handler->SetSentErrorMessage(true);
265 return false;
266 }
267 Creature* creature = unit->ToCreature();
268 if (creature->UpdateEntry(newEntryNum))
269 handler->SendSysMessage(LANG_DONE);
270 else
271 handler->SendSysMessage(LANG_ERROR);
272 return true;
273 }
274
275 //change level of creature or pet
276 static bool HandleNpcSetLevelCommand(ChatHandler* handler, uint8 lvl)
277 {
278 if (lvl < 1 || lvl > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) + 3)
279 {
281 handler->SetSentErrorMessage(true);
282 return false;
283 }
284
285 Creature* creature = handler->getSelectedCreature();
286 if (!creature || creature->IsPet())
287 {
289 handler->SetSentErrorMessage(true);
290 return false;
291 }
292
293 creature->SetMaxHealth(100 + 30*lvl);
294 creature->SetHealth(100 + 30*lvl);
295 creature->SetLevel(lvl);
296 creature->SaveToDB();
297
298 return true;
299 }
300
302 {
303 ObjectGuid::LowType spawnId;
304 if (spawnIdArg)
305 spawnId = *spawnIdArg;
306 else
307 {
308 Creature* creature = handler->getSelectedCreature();
309 if (!creature || creature->IsPet() || creature->IsTotem())
310 {
312 handler->SetSentErrorMessage(true);
313 return false;
314 }
315 if (TempSummon* summon = creature->ToTempSummon())
316 {
317 summon->UnSummon();
319 return true;
320 }
321 spawnId = creature->GetSpawnId();
322 }
323
324 if (Creature::DeleteFromDB(spawnId))
325 {
327 return true;
328 }
329 else
330 {
331 handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, std::to_string(spawnId).c_str());
332 handler->SetSentErrorMessage(true);
333 return false;
334 }
335 }
336
337 //del item from vendor list
339 {
340 Creature* vendor = handler->getSelectedCreature();
341 if (!vendor || !vendor->IsVendor())
342 {
344 handler->SetSentErrorMessage(true);
345 return false;
346 }
347
348 if (!item)
349 {
351 handler->SetSentErrorMessage(true);
352 return false;
353 }
354
355 uint32 itemId = item->GetId();
356 if (!sObjectMgr->RemoveVendorItem(vendor->GetEntry(), ITEM_VENDOR_TYPE_ITEM, itemId))
357 {
358 handler->PSendSysMessage(LANG_ITEM_NOT_IN_LIST, itemId);
359 handler->SetSentErrorMessage(true);
360 return false;
361 }
362
364 return true;
365 }
366
367 //set faction of creature
368 static bool HandleNpcSetFactionIdCommand(ChatHandler* handler, uint32 factionId)
369 {
370 if (!sFactionTemplateStore.LookupEntry(factionId))
371 {
372 handler->PSendSysMessage(LANG_WRONG_FACTION, factionId);
373 handler->SetSentErrorMessage(true);
374 return false;
375 }
376
377 Creature* creature = handler->getSelectedCreature();
378
379 if (!creature)
380 {
382 handler->SetSentErrorMessage(true);
383 return false;
384 }
385
386 creature->SetFaction(factionId);
387
388 // Faction is set in creature_template - not inside creature
389
390 // Update in memory..
391 if (CreatureTemplate const* cinfo = creature->GetCreatureTemplate())
392 const_cast<CreatureTemplate*>(cinfo)->faction = factionId;
393
394 // ..and DB
396
397 stmt->setUInt16(0, uint16(factionId));
398 stmt->setUInt32(1, creature->GetEntry());
399
400 WorldDatabase.Execute(stmt);
401
402 return true;
403 }
404
405 //set npcflag of creature
406 static bool HandleNpcSetFlagCommand(ChatHandler* handler, NPCFlags npcFlags, NPCFlags2 npcFlags2)
407 {
408 Creature* creature = handler->getSelectedCreature();
409
410 if (!creature)
411 {
413 handler->SetSentErrorMessage(true);
414 return false;
415 }
416
417 creature->ReplaceAllNpcFlags(npcFlags);
418 creature->ReplaceAllNpcFlags2(npcFlags2);
419
421
422 stmt->setUInt64(0, uint64(npcFlags) | (uint64(npcFlags2) << 32));
423 stmt->setUInt32(1, creature->GetEntry());
424
425 WorldDatabase.Execute(stmt);
426
428
429 return true;
430 }
431
432 //set data of creature for testing scripting
433 static bool HandleNpcSetDataCommand(ChatHandler* handler, uint32 data_1, uint32 data_2)
434 {
435 Creature* creature = handler->getSelectedCreature();
436
437 if (!creature)
438 {
440 handler->SetSentErrorMessage(true);
441 return false;
442 }
443
444 creature->AI()->SetData(data_1, data_2);
445 std::string AIorScript = !creature->GetAIName().empty() ? "AI type: " + creature->GetAIName() : (!creature->GetScriptName().empty() ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
446 handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID().ToString().c_str(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str());
447 return true;
448 }
449
450 //npc follow handling
452 {
453 Player* player = handler->GetSession()->GetPlayer();
454 Creature* creature = handler->getSelectedCreature();
455
456 if (!creature)
457 {
459 handler->SetSentErrorMessage(true);
460 return false;
461 }
462
463 // Follow player - Using pet's default dist and angle
464 creature->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, creature->GetFollowAngle());
465
466 handler->PSendSysMessage(LANG_CREATURE_FOLLOW_YOU_NOW, creature->GetName().c_str());
467 return true;
468 }
469
470 static bool HandleNpcInfoCommand(ChatHandler* handler)
471 {
472 Creature* target = handler->getSelectedCreature();
473
474 if (!target)
475 {
477 handler->SetSentErrorMessage(true);
478 return false;
479 }
480
481 CreatureTemplate const* cInfo = target->GetCreatureTemplate();
482
483 uint32 faction = target->GetFaction();
484 uint64 npcflags;
485 memcpy(&npcflags, target->m_unitData->NpcFlags.begin(), sizeof(npcflags));
486 uint64 mechanicImmuneMask = 0;
488 mechanicImmuneMask = immunities->Mechanic.to_ullong();
489 uint32 displayid = target->GetDisplayId();
490 uint32 nativeid = target->GetNativeDisplayId();
491 uint32 entry = target->GetEntry();
492
494
495 if (curRespawnDelay < 0)
496 curRespawnDelay = 0;
497 std::string curRespawnDelayStr = secsToTimeString(uint64(curRespawnDelay), TimeFormat::ShortText);
498 std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(), TimeFormat::ShortText);
499
500 handler->PSendSysMessage(LANG_NPCINFO_CHAR, target->GetName().c_str(), std::to_string(target->GetSpawnId()).c_str(), target->GetGUID().ToString().c_str(), entry, faction, std::to_string(npcflags).c_str(), displayid, nativeid);
501 if (target->GetCreatureData() && target->GetCreatureData()->spawnGroupData->groupId)
502 {
503 SpawnGroupTemplateData const* const groupData = target->GetCreatureData()->spawnGroupData;
504 handler->PSendSysMessage(LANG_SPAWNINFO_GROUP_ID, groupData->name.c_str(), groupData->groupId, groupData->flags, target->GetMap()->IsSpawnGroupActive(groupData->groupId));
505 }
507 handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->GetLevel());
509 handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), std::to_string(target->GetMaxHealth()).c_str(), std::to_string(target->GetHealth()).c_str());
511
513 for (UnitFlags flag : EnumUtils::Iterate<UnitFlags>())
514 if (target->HasUnitFlag(flag))
515 handler->PSendSysMessage("%s (0x%X)", EnumUtils::ToTitle(flag), flag);
516
518 for (UnitFlags2 flag : EnumUtils::Iterate<UnitFlags2>())
519 if (target->HasUnitFlag2(flag))
520 handler->PSendSysMessage("%s (0x%X)", EnumUtils::ToTitle(flag), flag);
521
523 for (UnitFlags3 flag : EnumUtils::Iterate<UnitFlags3>())
524 if (target->HasUnitFlag3(flag))
525 handler->PSendSysMessage("%s (0x%X)", EnumUtils::ToTitle(flag), flag);
526
528 handler->PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(), curRespawnDelayStr.c_str());
529
530 CreatureDifficulty const* creatureDifficulty = target->GetCreatureDifficulty();
531 handler->PSendSysMessage(LANG_NPCINFO_LOOT, creatureDifficulty->LootID, creatureDifficulty->PickPocketLootID, creatureDifficulty->SkinLootID);
532
534
535 if (CreatureData const* data = sObjectMgr->GetCreatureData(target->GetSpawnId()))
536 {
537 handler->PSendSysMessage(LANG_NPCINFO_PHASES, data->phaseId, data->phaseGroup);
538 PhasingHandler::PrintToChat(handler, target);
539 }
540
541 handler->PSendSysMessage(LANG_NPCINFO_ARMOR, target->GetArmor());
542 handler->PSendSysMessage(LANG_NPCINFO_POSITION, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
543 handler->PSendSysMessage(LANG_OBJECTINFO_AIINFO, target->GetAIName().c_str(), target->GetScriptName().c_str());
547 if (CreatureAI const* ai = target->AI())
550 for (CreatureFlagsExtra flag : EnumUtils::Iterate<CreatureFlagsExtra>())
551 if (cInfo->flags_extra & flag)
552 handler->PSendSysMessage("%s (0x%X)", EnumUtils::ToTitle(flag), flag);
553
554 handler->PSendSysMessage(LANG_NPCINFO_NPC_FLAGS, target->m_unitData->NpcFlags[0]);
555 for (NPCFlags flag : EnumUtils::Iterate<NPCFlags>())
556 if (target->HasNpcFlag(flag))
557 handler->PSendSysMessage("* %s (0x%X)", EnumUtils::ToTitle(flag), flag);
558
559 for (NPCFlags2 flag : EnumUtils::Iterate<NPCFlags2>())
560 if (target->HasNpcFlag2(flag))
561 handler->PSendSysMessage("* %s (0x%X)", EnumUtils::ToTitle(flag), flag);
562
563 handler->PSendSysMessage(LANG_NPCINFO_MECHANIC_IMMUNE, Trinity::StringFormat("0x{:X}", mechanicImmuneMask).c_str());
564 for (Mechanics m : EnumUtils::Iterate<Mechanics>())
565 if (m && (mechanicImmuneMask & (UI64LIT(1) << m)))
566 handler->PSendSysMessage("%s (0x%X)", EnumUtils::ToTitle(m), m);
567
568 return true;
569 }
570
572 {
573 float distance = dist.value_or(10.0f);
574 uint32 count = 0;
575
576 Player* player = handler->GetSession()->GetPlayer();
577
579 stmt->setFloat(0, player->GetPositionX());
580 stmt->setFloat(1, player->GetPositionY());
581 stmt->setFloat(2, player->GetPositionZ());
582 stmt->setUInt32(3, player->GetMapId());
583 stmt->setFloat(4, player->GetPositionX());
584 stmt->setFloat(5, player->GetPositionY());
585 stmt->setFloat(6, player->GetPositionZ());
586 stmt->setFloat(7, distance * distance);
587 PreparedQueryResult result = WorldDatabase.Query(stmt);
588
589 if (result)
590 {
591 do
592 {
593 Field* fields = result->Fetch();
594 ObjectGuid::LowType guid = fields[0].GetUInt64();
595 uint32 entry = fields[1].GetUInt32();
596 float x = fields[2].GetFloat();
597 float y = fields[3].GetFloat();
598 float z = fields[4].GetFloat();
599 uint16 mapId = fields[5].GetUInt16();
600
601 CreatureTemplate const* creatureTemplate = sObjectMgr->GetCreatureTemplate(entry);
602 if (!creatureTemplate)
603 continue;
604
605 handler->PSendSysMessage(LANG_CREATURE_LIST_CHAT, std::to_string(guid).c_str(), std::to_string(guid).c_str(), creatureTemplate->Name.c_str(), x, y, z, mapId, "", "");
606
607 ++count;
608 }
609 while (result->NextRow());
610 }
611
612 handler->PSendSysMessage(LANG_COMMAND_NEAR_NPC_MESSAGE, distance, count);
613
614 return true;
615 }
616
617 //move selected creature
619 {
620 Creature* creature = handler->getSelectedCreature();
621 Player const* player = handler->GetSession()->GetPlayer();
622 if (!player)
623 return false;
624
625 if (!spawnid && !creature)
626 return false;
627
628 ObjectGuid::LowType lowguid = spawnid ? *spawnid : creature->GetSpawnId();
629 // Attempting creature load from DB data
630 CreatureData const* data = sObjectMgr->GetCreatureData(lowguid);
631 if (!data)
632 {
633 handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, std::to_string(lowguid).c_str());
634 handler->SetSentErrorMessage(true);
635 return false;
636 }
637
638 if (player->GetMapId() != data->mapId)
639 {
640 handler->PSendSysMessage(LANG_COMMAND_CREATUREATSAMEMAP, std::to_string(lowguid).c_str());
641 handler->SetSentErrorMessage(true);
642 return false;
643 }
644
645 // update position in memory
646 sObjectMgr->RemoveCreatureFromGrid(data);
647 const_cast<CreatureData*>(data)->spawnPoint.Relocate(*player);
648 sObjectMgr->AddCreatureToGrid(data);
649
650 // update position in DB
652 stmt->setFloat(0, player->GetPositionX());
653 stmt->setFloat(1, player->GetPositionY());
654 stmt->setFloat(2, player->GetPositionZ());
655 stmt->setFloat(3, player->GetOrientation());
656 stmt->setUInt64(4, lowguid);
657 WorldDatabase.Execute(stmt);
658
659 // respawn selected creature at the new location
660 if (creature)
661 creature->DespawnOrUnsummon(0s, 1s);
662
664 return true;
665 }
666
667 //play npc emote
668 static bool HandleNpcPlayEmoteCommand(ChatHandler* handler, uint32 emote)
669 {
670 Creature* target = handler->getSelectedCreature();
671 if (!target)
672 {
674 handler->SetSentErrorMessage(true);
675 return false;
676 }
677
678 target->SetEmoteState(Emote(emote));
679
680 return true;
681 }
682
683 //set model of creature
684 static bool HandleNpcSetModelCommand(ChatHandler* handler, uint32 displayId)
685 {
686 Creature* creature = handler->getSelectedCreature();
687
688 if (!creature || creature->IsPet())
689 {
691 handler->SetSentErrorMessage(true);
692 return false;
693 }
694
695 if (!sCreatureDisplayInfoStore.LookupEntry(displayId))
696 {
698 handler->SetSentErrorMessage(true);
699 return false;
700 }
701
702 creature->SetDisplayId(displayId, true);
703
704 creature->SaveToDB();
705
706 return true;
707 }
708
722 {
723 // 3 arguments:
724 // GUID (optional - you can also select the creature)
725 // stay|random|way (determines the kind of movement)
726 // NODEL (optional - tells the system NOT to delete any waypoints)
727 // this is very handy if you want to do waypoints, that are
728 // later switched on/off according to special events (like escort
729 // quests, etc)
730
731 bool doNotDelete = nodel.has_value();
732
733 ObjectGuid::LowType lowguid = UI64LIT(0);
734 Creature* creature = nullptr;
735
736 if (!lowGuid) // case .setmovetype $move_type (with selected creature)
737 {
738 creature = handler->getSelectedCreature();
739 if (!creature || creature->IsPet())
740 return false;
741 lowguid = creature->GetSpawnId();
742 }
743 else // case .setmovetype #creature_guid $move_type (with selected creature)
744 {
745 lowguid = *lowGuid;
746
747 if (lowguid)
748 creature = handler->GetCreatureFromPlayerMapByDbGuid(lowguid);
749
750 // attempt check creature existence by DB data
751 if (!creature)
752 {
753 CreatureData const* data = sObjectMgr->GetCreatureData(lowguid);
754 if (!data)
755 {
756 handler->PSendSysMessage(LANG_COMMAND_CREATGUIDNOTFOUND, std::to_string(lowguid).c_str());
757 handler->SetSentErrorMessage(true);
758 return false;
759 }
760 }
761 else
762 {
763 lowguid = creature->GetSpawnId();
764 }
765 }
766
767 // now lowguid is low guid really existed creature
768 // and creature point (maybe) to this creature or nullptr
769
770 MovementGeneratorType move_type;
771 switch (type.index())
772 {
773 case 0:
774 move_type = IDLE_MOTION_TYPE;
775 break;
776 case 1:
777 move_type = RANDOM_MOTION_TYPE;
778 break;
779 case 2:
780 move_type = WAYPOINT_MOTION_TYPE;
781 break;
782 default:
783 return false;
784 }
785
786 // update movement type
787 //if (doNotDelete == false)
788 // WaypointMgr.DeletePath(lowguid);
789
790 if (creature)
791 {
792 // update movement type
793 if (doNotDelete == false)
794 creature->LoadPath(0);
795
796 creature->SetDefaultMovementType(move_type);
797 creature->GetMotionMaster()->Initialize();
798 if (creature->IsAlive()) // dead creature will reset movement generator at respawn
799 {
800 creature->setDeathState(JUST_DIED);
801 creature->Respawn();
802 }
803 creature->SaveToDB();
804 }
805 if (doNotDelete == false)
806 {
808 }
809 else
810 {
812 }
813
814 return true;
815 }
816
817 //npc phase handling
818 //change phase of creature
819 static bool HandleNpcSetPhaseGroup(ChatHandler* handler, char const* args)
820 {
821 if (!*args)
822 return false;
823
824 int32 phaseGroupId = atoi(args);
825
826 Creature* creature = handler->getSelectedCreature();
827 if (!creature || creature->IsPet())
828 {
830 handler->SetSentErrorMessage(true);
831 return false;
832 }
833
835 PhasingHandler::AddPhaseGroup(creature, phaseGroupId, true);
836 creature->SetDBPhase(-phaseGroupId);
837
838 creature->SaveToDB();
839
840 return true;
841 }
842
843 //npc phase handling
844 //change phase of creature
845 static bool HandleNpcSetPhaseCommand(ChatHandler* handler, uint32 phaseID)
846 {
847 if (phaseID == 0)
848 {
850 handler->SetSentErrorMessage(true);
851 return false;
852 }
853
854 Creature* creature = handler->getSelectedCreature();
855 if (!creature || creature->IsPet())
856 {
858 handler->SetSentErrorMessage(true);
859 return false;
860 }
861
863 PhasingHandler::AddPhase(creature, phaseID, true);
864 creature->SetDBPhase(phaseID);
865
866 creature->SaveToDB();
867
868 return true;
869 }
870
871 //set spawn dist of creature
872 static bool HandleNpcSetWanderDistanceCommand(ChatHandler* handler, float option)
873 {
874 if (option < 0.0f)
875 {
877 return false;
878 }
879
881 if (option > 0.0f)
882 mtype = RANDOM_MOTION_TYPE;
883
884 Creature* creature = handler->getSelectedCreature();
885 ObjectGuid::LowType guidLow = UI64LIT(0);
886
887 if (creature)
888 guidLow = creature->GetSpawnId();
889 else
890 return false;
891
892 creature->SetWanderDistance((float)option);
893 creature->SetDefaultMovementType(mtype);
894 creature->GetMotionMaster()->Initialize();
895 if (creature->IsAlive()) // dead creature will reset movement generator at respawn
896 {
897 creature->setDeathState(JUST_DIED);
898 creature->Respawn();
899 }
900
902
903 stmt->setFloat(0, option);
904 stmt->setUInt8(1, uint8(mtype));
905 stmt->setUInt64(2, guidLow);
906
907 WorldDatabase.Execute(stmt);
908
910 return true;
911 }
912
913 //spawn time handling
914 static bool HandleNpcSetSpawnTimeCommand(ChatHandler* handler, uint32 spawnTime)
915 {
916 Creature* creature = handler->getSelectedCreature();
917 if (!creature)
918 return false;
919
921 stmt->setUInt32(0, spawnTime);
922 stmt->setUInt64(1, creature->GetSpawnId());
923 WorldDatabase.Execute(stmt);
924
925 creature->SetRespawnDelay(spawnTime);
926 handler->PSendSysMessage(LANG_COMMAND_SPAWNTIME, spawnTime);
927
928 return true;
929 }
930
931 static bool HandleNpcSayCommand(ChatHandler* handler, Tail text)
932 {
933 if (text.empty())
934 return false;
935
936 Creature* creature = handler->getSelectedCreature();
937 if (!creature)
938 {
940 handler->SetSentErrorMessage(true);
941 return false;
942 }
943
944 creature->Say(text, LANG_UNIVERSAL);
945
946 // make some emotes
947 switch (text.back())
948 {
949 case '?': creature->HandleEmoteCommand(EMOTE_ONESHOT_QUESTION); break;
950 case '!': creature->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); break;
951 default: creature->HandleEmoteCommand(EMOTE_ONESHOT_TALK); break;
952 }
953
954 return true;
955 }
956
957 //show text emote by creature in chat
958 static bool HandleNpcTextEmoteCommand(ChatHandler* handler, Tail text)
959 {
960 if (text.empty())
961 return false;
962
963 Creature* creature = handler->getSelectedCreature();
964
965 if (!creature)
966 {
968 handler->SetSentErrorMessage(true);
969 return false;
970 }
971
972 creature->TextEmote(text);
973
974 return true;
975 }
976
977 // npc unfollow handling
979 {
980 Player* player = handler->GetSession()->GetPlayer();
981 Creature* creature = handler->getSelectedCreature();
982
983 if (!creature)
984 {
986 handler->SetSentErrorMessage(true);
987 return false;
988 }
989
990 MovementGenerator* movement = creature->GetMotionMaster()->GetMovementGenerator([player](MovementGenerator const* a) -> bool
991 {
993 {
994 FollowMovementGenerator const* followMovement = dynamic_cast<FollowMovementGenerator const*>(a);
995 return followMovement && followMovement->GetTarget() == player;
996 }
997 return false;
998 });
999
1000 if (!movement)
1001 {
1002 handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str());
1003 handler->SetSentErrorMessage(true);
1004 return false;
1005 }
1006
1007 creature->GetMotionMaster()->Remove(movement);
1008 handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU_NOW, creature->GetName().c_str());
1009 return true;
1010 }
1011
1012 // make npc whisper to player
1013 static bool HandleNpcWhisperCommand(ChatHandler* handler, Variant<Hyperlink<player>, std::string_view> recv, Tail text)
1014 {
1015 if (text.empty())
1016 return false;
1017
1018 Creature* creature = handler->getSelectedCreature();
1019 if (!creature)
1020 {
1022 handler->SetSentErrorMessage(true);
1023 return false;
1024 }
1025
1026 // check online security
1027 Player* receiver = ObjectAccessor::FindPlayerByName(recv);
1028 if (handler->HasLowerSecurity(receiver, ObjectGuid::Empty))
1029 return false;
1030
1031 creature->Whisper(text, LANG_UNIVERSAL, receiver);
1032 return true;
1033 }
1034
1035 static bool HandleNpcYellCommand(ChatHandler* handler, Tail text)
1036 {
1037 if (text.empty())
1038 return false;
1039
1040 Creature* creature = handler->getSelectedCreature();
1041 if (!creature)
1042 {
1044 handler->SetSentErrorMessage(true);
1045 return false;
1046 }
1047
1048 creature->Yell(text, LANG_UNIVERSAL);
1049
1050 // make an emote
1052
1053 return true;
1054 }
1055
1056 // add creature, temp only
1058 {
1059 bool loot = false;
1060 if (lootStr)
1061 {
1062 if (StringEqualI(*lootStr, "loot"))
1063 loot = true;
1064 else if (StringEqualI(*lootStr, "noloot"))
1065 loot = false;
1066 else
1067 return false;
1068 }
1069
1070 Player* chr = handler->GetSession()->GetPlayer();
1071 if (!sObjectMgr->GetCreatureTemplate(id))
1072 return false;
1073
1075
1076 return true;
1077 }
1078
1079 //npc tame handling
1080 static bool HandleNpcTameCommand(ChatHandler* handler)
1081 {
1082 Creature* creatureTarget = handler->getSelectedCreature();
1083 if (!creatureTarget || creatureTarget->IsPet())
1084 {
1086 handler->SetSentErrorMessage (true);
1087 return false;
1088 }
1089
1090 Player* player = handler->GetSession()->GetPlayer();
1091
1092 if (!player->GetPetGUID().IsEmpty())
1093 {
1095 handler->SetSentErrorMessage (true);
1096 return false;
1097 }
1098
1099 CreatureTemplate const* cInfo = creatureTarget->GetCreatureTemplate();
1100
1101 if (!cInfo->IsTameable (player->CanTameExoticPets(), creatureTarget->GetCreatureDifficulty()))
1102 {
1104 handler->SetSentErrorMessage (true);
1105 return false;
1106 }
1107
1108 // Everything looks OK, create new pet
1109 Pet* pet = player->CreateTamedPetFrom(creatureTarget);
1110 if (!pet)
1111 {
1113 handler->SetSentErrorMessage (true);
1114 return false;
1115 }
1116
1117 // place pet before player
1118 float x, y, z;
1119 player->GetClosePoint (x, y, z, creatureTarget->GetCombatReach(), CONTACT_DISTANCE);
1120 pet->Relocate(x, y, z, float(M_PI) - player->GetOrientation());
1121
1122 // set pet to defensive mode by default (some classes can't control controlled pets in fact).
1124
1125 // calculate proper level
1126 uint8 level = std::max<uint8>(player->GetLevel()-5, creatureTarget->GetLevel());
1127
1128 // prepare visual effect for levelup
1129 pet->SetLevel(level - 1);
1130
1131 // add to world
1132 pet->GetMap()->AddToMap(pet->ToCreature());
1133
1134 // visual effect for levelup
1135 pet->SetLevel(level);
1136
1137 // caster have pet now
1138 player->SetMinion(pet, true);
1139
1141 player->PetSpellInitialize();
1142
1143 return true;
1144 }
1145
1147 {
1148 Creature* creatureTarget = handler->getSelectedCreature();
1149 if (!creatureTarget || creatureTarget->IsPet())
1150 {
1152 handler->SetSentErrorMessage(true);
1153 return false;
1154 }
1155
1156 if (!creatureTarget->IsAIEnabled())
1157 {
1159 handler->SetSentErrorMessage(true);
1160 return false;
1161 }
1162
1163 if (force)
1164 creatureTarget->ClearUnitState(UNIT_STATE_EVADE);
1165 creatureTarget->AI()->EnterEvadeMode(why.value_or(EvadeReason::Other));
1166
1167 return true;
1168 }
1169
1170 static void _ShowLootEntry(ChatHandler* handler, uint32 itemId, uint8 itemCount, bool alternateString = false)
1171 {
1172 ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
1173 char const* name = nullptr;
1174 if (itemTemplate)
1175 name = itemTemplate->GetName(handler->GetSessionDbcLocale());
1176 if (!name)
1177 name = "Unknown item";
1179 itemCount, ItemQualityColors[itemTemplate ? static_cast<ItemQualities>(itemTemplate->GetQuality()) : ITEM_QUALITY_POOR], itemId, name, itemId);
1180 }
1181
1182 static void _IterateNotNormalLootMap(ChatHandler* handler, NotNormalLootItemMap const& map, std::vector<LootItem> const& items)
1183 {
1184 for (NotNormalLootItemMap::value_type const& pair : map)
1185 {
1186 if (!pair.second)
1187 continue;
1188 Player const* player = ObjectAccessor::FindConnectedPlayer(pair.first);
1189 handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_SUBLABEL, player ? player->GetName() : Trinity::StringFormat("Offline player (GUID {})", pair.first.ToString()), pair.second->size());
1190
1191 for (auto it = pair.second->cbegin(); it != pair.second->cend(); ++it)
1192 {
1193 LootItem const& item = items[it->LootListId];
1194 if (!(it->is_looted) && !item.is_looted)
1195 _ShowLootEntry(handler, item.itemid, item.count, true);
1196 }
1197 }
1198 }
1200 {
1201 Creature* creatureTarget = handler->getSelectedCreature();
1202 if (!creatureTarget || creatureTarget->IsPet())
1203 {
1205 handler->SetSentErrorMessage(true);
1206 return false;
1207 }
1208
1209 Loot const* loot = creatureTarget->m_loot.get();
1210 if (!creatureTarget->isDead() || !loot || loot->isLooted())
1211 {
1212 handler->PSendSysMessage(LANG_COMMAND_NOT_DEAD_OR_NO_LOOT, creatureTarget->GetName().c_str());
1213 handler->SetSentErrorMessage(true);
1214 return false;
1215 }
1216
1217 handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_HEADER, creatureTarget->GetName().c_str(), creatureTarget->GetEntry());
1218 handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_MONEY, loot->gold / GOLD, (loot->gold % GOLD) / SILVER, loot->gold % SILVER);
1219
1220 if (!all)
1221 {
1222 handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_LABEL, "Standard items", loot->items.size());
1223 for (LootItem const& item : loot->items)
1224 if (!item.is_looted)
1225 _ShowLootEntry(handler, item.itemid, item.count);
1226 }
1227 else
1228 {
1229 handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_LABEL, "Standard items", loot->items.size());
1230 for (LootItem const& item : loot->items)
1231 if (!item.is_looted && !item.freeforall && item.conditions.IsEmpty())
1232 _ShowLootEntry(handler, item.itemid, item.count);
1233
1234 if (!loot->GetPlayerFFAItems().empty())
1235 {
1236 handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_LABEL_2, "FFA items per allowed player");
1237 _IterateNotNormalLootMap(handler, loot->GetPlayerFFAItems(), loot->items);
1238 }
1239 }
1240
1241 return true;
1242 }
1243
1245 {
1246 Creature* creature = handler->getSelectedCreature();
1247
1248 if (!creature || !creature->GetSpawnId())
1249 {
1251 handler->SetSentErrorMessage(true);
1252 return false;
1253 }
1254
1255 ObjectGuid::LowType lowguid = creature->GetSpawnId();
1256 if (creature->GetFormation())
1257 {
1258 handler->PSendSysMessage("Selected creature is already member of group " UI64FMTD, creature->GetFormation()->GetLeaderSpawnId());
1259 return false;
1260 }
1261
1262 if (!lowguid)
1263 return false;
1264
1265 Player* chr = handler->GetSession()->GetPlayer();
1266
1267 float followAngle = (creature->GetAbsoluteAngle(chr) - chr->GetOrientation()) * 180.0f / float(M_PI);
1268 float followDist = std::sqrt(std::pow(chr->GetPositionX() - creature->GetPositionX(), 2.f) + std::pow(chr->GetPositionY() - creature->GetPositionY(), 2.f));
1269 uint32 groupAI = 0;
1270 sFormationMgr->AddFormationMember(lowguid, followAngle, followDist, leaderGUID, groupAI);
1271 creature->SearchFormation();
1272
1274 stmt->setUInt64(0, leaderGUID);
1275 stmt->setUInt64(1, lowguid);
1276 stmt->setFloat (2, followAngle);
1277 stmt->setFloat (3, followDist);
1278 stmt->setUInt32(4, groupAI);
1279
1280 WorldDatabase.Execute(stmt);
1281
1282 handler->PSendSysMessage("Creature " UI64FMTD " added to formation with leader " UI64FMTD, lowguid, leaderGUID);
1283
1284 return true;
1285 }
1286
1288 {
1289 Creature* creature = handler->getSelectedCreature();
1290
1291 if (!creature)
1292 {
1294 handler->SetSentErrorMessage(true);
1295 return false;
1296 }
1297
1298 if (!creature->GetSpawnId())
1299 {
1300 handler->PSendSysMessage("Selected %s isn't in creature table", creature->GetGUID().ToString().c_str());
1301 handler->SetSentErrorMessage(true);
1302 return false;
1303 }
1304
1305 if (!sObjectMgr->SetCreatureLinkedRespawn(creature->GetSpawnId(), linkguid))
1306 {
1307 handler->PSendSysMessage("Selected creature can't link with guid '" UI64FMTD "'", linkguid);
1308 handler->SetSentErrorMessage(true);
1309 return false;
1310 }
1311
1312 handler->PSendSysMessage("LinkGUID '" UI64FMTD "' added to creature with DBTableGUID: '" UI64FMTD "'", linkguid, creature->GetSpawnId());
1313 return true;
1314 }
1315
1317 static bool HandleNpcAddWeaponCommand([[maybe_unused]] ChatHandler* handler, [[maybe_unused]] uint32 SlotID, [[maybe_unused]] ItemTemplate const* tmpItem)
1318 {
1319 /*
1320 if (!tmpItem)
1321 return;
1322
1323 uint64 guid = handler->GetSession()->GetPlayer()->GetSelection();
1324 if (guid == 0)
1325 {
1326 handler->SendSysMessage(LANG_NO_SELECTION);
1327 handler->SetSentErrorMessage(true);
1328 return false;
1329 }
1330
1331 Creature* creature = ObjectAccessor::GetCreature(*handler->GetSession()->GetPlayer(), guid);
1332
1333 if (!creature)
1334 {
1335 handler->SendSysMessage(LANG_SELECT_CREATURE);
1336 handler->SetSentErrorMessage(true);
1337 return false;
1338 }
1339
1340 switch (SlotID)
1341 {
1342 case 1:
1343 creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, tmpItem->ItemId);
1344 break;
1345 case 2:
1346 creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY_01, tmpItem->ItemId);
1347 break;
1348 case 3:
1349 creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY_02, tmpItem->ItemId);
1350 break;
1351 default:
1352 handler->PSendSysMessage(LANG_ITEM_SLOT_NOT_EXIST, SlotID);
1353 handler->SetSentErrorMessage(true);
1354 return false;
1355 }
1356
1357 handler->PSendSysMessage(LANG_ITEM_ADDED_TO_SLOT, tmpItem->ItemID, tmpItem->Name1, SlotID);
1358 */
1359 return true;
1360 }
1361};
1362
1364{
1365 new npc_commandscript();
1366}
1367
1368bool HandleNpcSpawnGroup(ChatHandler* handler, std::vector<Variant<uint32, EXACT_SEQUENCE("force"), EXACT_SEQUENCE("ignorerespawn")>> const& opts)
1369{
1370 if (opts.empty())
1371 return false;
1372
1373 bool ignoreRespawn = false;
1374 bool force = false;
1375 uint32 groupId = 0;
1376
1377 // Decode arguments
1378 for (auto const& variant : opts)
1379 {
1380 switch (variant.index())
1381 {
1382 case 0:
1383 groupId = variant.get<uint32>();
1384 break;
1385 case 1:
1386 force = true;
1387 break;
1388 case 2:
1389 ignoreRespawn = true;
1390 break;
1391 }
1392 }
1393
1394 Player* player = handler->GetSession()->GetPlayer();
1395
1396 std::vector <WorldObject*> creatureList;
1397 if (!player->GetMap()->SpawnGroupSpawn(groupId, ignoreRespawn, force, &creatureList))
1398 {
1399 handler->PSendSysMessage(LANG_SPAWNGROUP_BADGROUP, groupId);
1400 handler->SetSentErrorMessage(true);
1401 return false;
1402 }
1403
1404 handler->PSendSysMessage(LANG_SPAWNGROUP_SPAWNCOUNT, creatureList.size());
1405
1406 return true;
1407}
1408
1409bool HandleNpcDespawnGroup(ChatHandler* handler, std::vector<Variant<uint32, EXACT_SEQUENCE("removerespawntime")>> const& opts)
1410{
1411 if (opts.empty())
1412 return false;
1413
1414 bool deleteRespawnTimes = false;
1415 uint32 groupId = 0;
1416
1417 // Decode arguments
1418 for (auto const& variant : opts)
1419 {
1420 if (variant.holds_alternative<uint32>())
1421 groupId = variant.get<uint32>();
1422 else
1423 deleteRespawnTimes = true;
1424 }
1425
1426 Player* player = handler->GetSession()->GetPlayer();
1427
1428 size_t n = 0;
1429 if (!player->GetMap()->SpawnGroupDespawn(groupId, deleteRespawnTimes, &n))
1430 {
1431 handler->PSendSysMessage(LANG_SPAWNGROUP_BADGROUP, groupId);
1432 handler->SetSentErrorMessage(true);
1433 return false;
1434 }
1435 handler->PSendSysMessage("Despawned a total of %zu objects.", n);
1436
1437 return true;
1438}
#define EXACT_SEQUENCE(str)
#define M_PI
Definition: Common.h:115
CreatureFlagsExtra
Definition: CreatureData.h:333
#define sFormationMgr
DB2Storage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore("CreatureDisplayInfo.db2", &CreatureDisplayInfoLoadInfo::Instance)
DB2Storage< FactionTemplateEntry > sFactionTemplateStore("FactionTemplate.db2", &FactionTemplateLoadInfo::Instance)
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
#define UI64FMTD
Definition: Define.h:126
uint8_t uint8
Definition: Define.h:144
#define STRING_VIEW_FMT_ARG(str)
Definition: Define.h:135
int64_t int64
Definition: Define.h:137
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
#define UI64LIT(N)
Definition: Define.h:127
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
@ ITEM_VENDOR_TYPE_ITEM
Definition: ItemDefines.h:203
@ LANG_NPCINFO_EQUIPMENT
Definition: Language.h:1092
@ LANG_NPC_SETDATA
Definition: Language.h:633
@ LANG_OBJECTINFO_STRINGIDS
Definition: Language.h:1153
@ LANG_COMMAND_NPC_SHOWLOOT_ENTRY
Definition: Language.h:343
@ LANG_OBJECTINFO_AIINFO
Definition: Language.h:1087
@ LANG_SELECT_CREATURE
Definition: Language.h:32
@ LANG_SPAWNGROUP_SPAWNCOUNT
Definition: Language.h:1140
@ LANG_CREATURE_NON_TAMEABLE
Definition: Language.h:399
@ LANG_CREATURE_NOT_FOLLOW_YOU
Definition: Language.h:397
@ LANG_ERROR
Definition: Language.h:78
@ LANG_CREATURE_FOLLOW_YOU_NOW
Definition: Language.h:396
@ LANG_YOU_ALREADY_HAVE_PET
Definition: Language.h:400
@ LANG_WAYPOINT_ADDED
Definition: Language.h:282
@ LANG_NPCINFO_LOOT
Definition: Language.h:618
@ LANG_OBJECTINFO_AITYPE
Definition: Language.h:1147
@ LANG_CREATURE_NOT_AI_ENABLED
Definition: Language.h:1237
@ LANG_CREATURE_MOVE_ENABLED
Definition: Language.h:459
@ LANG_NPCINFO_DYNAMIC_FLAGS
Definition: Language.h:617
@ LANG_COMMAND_NOT_DEAD_OR_NO_LOOT
Definition: Language.h:340
@ LANG_NPCINFO_POSITION
Definition: Language.h:619
@ LANG_NPCINFO_UNIT_FIELD_FLAGS
Definition: Language.h:1094
@ LANG_VALUE_SAVED_REJOIN
Definition: Language.h:312
@ LANG_COMMAND_CREATUREMOVED
Definition: Language.h:323
@ LANG_MOVE_TYPE_SET
Definition: Language.h:308
@ LANG_NPCINFO_REACTSTATE
Definition: Language.h:1074
@ LANG_COMMAND_DELCREATMESSAGE
Definition: Language.h:322
@ LANG_CREATURE_NOT_FOLLOW_YOU_NOW
Definition: Language.h:398
@ LANG_WRONG_FACTION
Definition: Language.h:165
@ LANG_COMMAND_CREATUREATSAMEMAP
Definition: Language.h:324
@ LANG_COMMAND_NEAR_NPC_MESSAGE
Old ones now free:
Definition: Language.h:636
@ LANG_COMMAND_NEEDITEMSEND
Definition: Language.h:331
@ LANG_NPCINFO_UNIT_FIELD_FLAGS_2
Definition: Language.h:1148
@ LANG_COMMAND_NPC_SHOWLOOT_ENTRY_2
Definition: Language.h:347
@ LANG_NPCINFO_HEALTH
Definition: Language.h:616
@ LANG_COMMAND_VENDORSELECTION
Definition: Language.h:330
@ LANG_COMMAND_NPC_SHOWLOOT_SUBLABEL
Definition: Language.h:346
@ LANG_NPCINFO_PHASES
Definition: Language.h:1076
@ LANG_CREATURE_MOVE_DISABLED
Definition: Language.h:458
@ LANG_NPCINFO_NPC_FLAGS
Definition: Language.h:1150
@ LANG_ITEM_ADDED_TO_LIST
Definition: Language.h:251
@ LANG_NPCINFO_MOVEMENT_DATA
Definition: Language.h:1229
@ LANG_COMMAND_SPAWNTIME
Definition: Language.h:352
@ LANG_NPCINFO_CHAR
Definition: Language.h:614
@ LANG_ITEM_DELETED_FROM_LIST
Definition: Language.h:253
@ LANG_MOVE_TYPE_SET_NODEL
Definition: Language.h:309
@ LANG_COMMAND_INVALID_PARAM
Definition: Language.h:365
@ LANG_SPAWNINFO_GROUP_ID
Definition: Language.h:1134
@ LANG_COMMAND_WANDER_DISTANCE
Definition: Language.h:351
@ LANG_COMMAND_CREATGUIDNOTFOUND
Definition: Language.h:339
@ LANG_BAD_VALUE
Definition: Language.h:149
@ LANG_NPCINFO_UNIT_FIELD_FLAGS_3
Definition: Language.h:1149
@ LANG_NPCINFO_LEVEL
Definition: Language.h:615
@ LANG_ITEM_NOT_IN_LIST
Definition: Language.h:254
@ LANG_NPCINFO_FLAGS_EXTRA
Definition: Language.h:1230
@ LANG_DONE
Definition: Language.h:75
@ LANG_CREATURE_LIST_CHAT
Definition: Language.h:586
@ LANG_SPAWNINFO_COMPATIBILITY_MODE
Definition: Language.h:1135
@ LANG_COMMAND_RAWPAWNTIMES
Definition: Language.h:666
@ LANG_COMMAND_NPC_SHOWLOOT_LABEL
Definition: Language.h:342
@ LANG_NPCINFO_ARMOR
Definition: Language.h:1077
@ LANG_SPAWNGROUP_BADGROUP
Definition: Language.h:1139
@ LANG_COMMAND_NPC_SHOWLOOT_LABEL_2
Definition: Language.h:345
@ LANG_COMMAND_NPC_SHOWLOOT_HEADER
Definition: Language.h:341
@ LANG_NPCINFO_DUNGEON_ID
Definition: Language.h:622
@ LANG_NPCINFO_MECHANIC_IMMUNE
Definition: Language.h:1093
@ LANG_COMMAND_NPC_SHOWLOOT_MONEY
Definition: Language.h:344
@ LANG_PHASE_NOTFOUND
Definition: Language.h:1062
std::unordered_map< ObjectGuid, std::unique_ptr< NotNormalLootItemList > > NotNormalLootItemMap
Definition: Loot.h:232
MovementGeneratorType
@ IDLE_MOTION_TYPE
@ WAYPOINT_MOTION_TYPE
@ FOLLOW_MOTION_TYPE
@ RANDOM_MOTION_TYPE
@ TEMPSUMMON_CORPSE_DESPAWN
Definition: ObjectDefines.h:67
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: ObjectDefines.h:68
#define CONTACT_DISTANCE
Definition: ObjectDefines.h:23
@ TYPEID_UNIT
Definition: ObjectGuid.h:40
#define sObjectMgr
Definition: ObjectMgr.h:1946
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
#define PET_FOLLOW_DIST
Definition: PetDefines.h:97
@ PET_SAVE_AS_CURRENT
Definition: PetDefines.h:43
Role Based Access Control related classes definition.
uint32 constexpr ItemQualityColors[MAX_ITEM_QUALITY]
@ LANG_UNIVERSAL
Emote
@ EMOTE_ONESHOT_EXCLAMATION
@ EMOTE_ONESHOT_QUESTION
@ EMOTE_ONESHOT_SHOUT
@ EMOTE_ONESHOT_TALK
ItemQualities
@ ITEM_QUALITY_POOR
Mechanics
@ SILVER
@ GOLD
UnitFlags2
Definition: UnitDefines.h:193
@ REACT_DEFENSIVE
Definition: UnitDefines.h:507
NPCFlags
Non Player Character flags.
Definition: UnitDefines.h:295
UnitFlags3
Definition: UnitDefines.h:245
NPCFlags2
Definition: UnitDefines.h:335
char const * DescribeReactState(ReactStates state)
Definition: UnitDefines.h:512
UnitFlags
Definition: UnitDefines.h:143
@ JUST_DIED
Definition: Unit.h:247
@ UNIT_STATE_EVADE
Definition: Unit.h:277
bool StringEqualI(std::string_view a, std::string_view b)
Definition: Util.cpp:891
std::string secsToTimeString(uint64 timeInSecs, TimeFormat timeFormat, bool hoursOnly)
Definition: Util.cpp:115
@ WORLD_UPD_CREATURE_POSITION
Definition: WorldDatabase.h:48
@ WORLD_UPD_CREATURE_NPCFLAG
Definition: WorldDatabase.h:47
@ WORLD_SEL_CREATURE_NEAREST
Definition: WorldDatabase.h:73
@ WORLD_INS_CREATURE_FORMATION
Definition: WorldDatabase.h:51
@ WORLD_UPD_CREATURE_MOVEMENT_TYPE
Definition: WorldDatabase.h:45
@ WORLD_UPD_CREATURE_SPAWN_TIME_SECS
Definition: WorldDatabase.h:50
@ WORLD_UPD_CREATURE_WANDER_DISTANCE
Definition: WorldDatabase.h:49
@ WORLD_UPD_CREATURE_FACTION
Definition: WorldDatabase.h:46
Unit * getSelectedUnit()
Definition: Chat.cpp:212
WorldSession * GetSession()
Definition: Chat.h:42
virtual LocaleConstant GetSessionDbcLocale() const
Definition: Chat.cpp:592
Creature * GetCreatureFromPlayerMapByDbGuid(ObjectGuid::LowType lowguid)
Definition: Chat.cpp:397
void PSendSysMessage(const char *fmt, Args &&... args)
Definition: Chat.h:57
bool HasLowerSecurity(Player *target, ObjectGuid guid, bool strong=false)
Definition: Chat.cpp:63
Creature * getSelectedCreature()
Definition: Chat.cpp:236
void SetSentErrorMessage(bool val)
Definition: Chat.h:114
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:113
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
ObjectGuid::LowType GetLeaderSpawnId() const
int8 GetOriginalEquipmentId() const
Definition: Creature.h:240
void Respawn(bool force=false)
Definition: Creature.cpp:2303
void setDeathState(DeathState s) override
Definition: Creature.cpp:2197
static Creature * CreateCreatureFromDB(ObjectGuid::LowType spawnId, Map *map, bool addToMap=true, bool allowDuplicate=false)
Definition: Creature.cpp:1199
bool GetRespawnCompatibilityMode() const
Definition: Creature.h:408
std::unique_ptr< Loot > m_loot
Definition: Creature.h:277
CreatureDifficulty const * GetCreatureDifficulty() const
Definition: Creature.h:252
static Creature * CreateCreature(uint32 entry, Map *map, Position const &pos, uint32 vehId=0)
Definition: Creature.cpp:1177
void SetReactState(ReactStates st)
Definition: Creature.h:160
void SetRespawnDelay(uint32 delay)
Definition: Creature.h:338
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
bool UpdateEntry(uint32 entry, CreatureData const *data=nullptr, bool updateLevel=true)
Definition: Creature.cpp:577
CreatureData const * GetCreatureData() const
Definition: Creature.h:251
ObjectGuid::LowType GetSpawnId() const
Definition: Creature.h:98
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:250
uint32 GetRespawnDelay() const
Definition: Creature.h:337
static bool DeleteFromDB(ObjectGuid::LowType spawnId)
Definition: Creature.cpp:2005
std::array< std::string_view, 3 > const & GetStringIds() const
Definition: Creature.h:260
CreatureGroup * GetFormation()
Definition: Creature.h:391
void SearchFormation()
Definition: Creature.cpp:375
void SetDisplayId(uint32 displayId, bool setNative=false) override
Definition: Creature.cpp:3402
ReactStates GetReactState() const
Definition: Creature.h:161
void SetWanderDistance(float dist)
Definition: Creature.h:341
std::string GetScriptName() const
Definition: Creature.cpp:3151
uint8 GetCurrentEquipmentId() const
Definition: Creature.h:241
void SaveToDB()
Definition: Creature.cpp:1417
CreatureMovementData const & GetMovementTemplate() const
Definition: Creature.cpp:2939
time_t GetRespawnTimeEx() const
Definition: Creature.cpp:2868
std::string const & GetAIName() const
Definition: Creature.cpp:3146
CreatureAI * AI() const
Definition: Creature.h:214
void SetDefaultMovementType(MovementGeneratorType mgt)
Definition: Creature.h:150
void LoadPath(uint32 pathid)
Definition: Creature.h:382
static char const * ToTitle(Enum value)
Definition: SmartEnum.h:123
Class used to access individual fields of database query result.
Definition: Field.h:90
uint64 GetUInt64() const
Definition: Field.cpp:78
uint16 GetUInt16() const
Definition: Field.cpp:46
float GetFloat() const
Definition: Field.cpp:94
uint32 GetUInt32() const
Definition: Field.cpp:62
Definition: Map.h:189
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
Definition: Map.cpp:2348
bool AddToMap(T *)
Definition: Map.cpp:550
time_t GetCreatureRespawnTime(ObjectGuid::LowType spawnId) const
Definition: Map.h:485
bool IsSpawnGroupActive(uint32 groupId) const
Definition: Map.cpp:2474
bool SpawnGroupDespawn(uint32 groupId, bool deleteRespawnTimes=false, size_t *count=nullptr)
Definition: Map.cpp:2437
uint32 GetId() const
Definition: Map.cpp:3228
void Initialize()
void MoveFollow(Unit *target, float dist, ChaseAngle angle, Optional< Milliseconds > duration={}, MovementSlot slot=MOTION_SLOT_ACTIVE)
MovementGenerator * GetMovementGenerator(std::function< bool(MovementGenerator const *)> const &filter, MovementSlot slot=MOTION_SLOT_ACTIVE) const
void Remove(MovementGenerator *movement, MovementSlot slot=MOTION_SLOT_ACTIVE)
virtual MovementGeneratorType GetMovementGeneratorType() const =0
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
bool IsEmpty() const
Definition: ObjectGuid.h:319
std::string ToString() const
Definition: ObjectGuid.cpp:554
uint64 LowType
Definition: ObjectGuid.h:278
static Creature * ToCreature(Object *o)
Definition: Object.h:219
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
uint32 GetDynamicFlags() const
Definition: Object.h:167
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
Definition: Pet.h:40
void SavePetToDB(PetSaveMode mode)
Definition: Pet.cpp:452
static void PrintToChat(ChatHandler *chat, WorldObject const *target)
static void AddPhase(WorldObject *object, uint32 phaseId, bool updateVisibility)
static void AddPhaseGroup(WorldObject *object, uint32 phaseGroupId, bool updateVisibility)
static void InheritPhaseShift(WorldObject *target, WorldObject const *source)
static void ResetPhaseShift(WorldObject *object)
bool CanTameExoticPets() const
Definition: Player.h:2305
void PetSpellInitialize()
Definition: Player.cpp:21879
void setFloat(const uint8 index, const float value)
void setUInt8(const uint8 index, const uint8 value)
void setUInt32(const uint8 index, const uint32 value)
void setUInt16(const uint8 index, const uint16 value)
void setUInt64(const uint8 index, const uint64 value)
static CreatureImmunities const * GetCreatureImmunities(int32 creatureImmunitiesId)
Definition: SpellMgr.cpp:677
virtual void SetData(uint32, uint32)
Definition: UnitAI.h:74
Definition: Unit.h:627
void ClearUnitState(uint32 f)
Definition: Unit.h:733
void SetMinion(Minion *minion, bool apply)
Definition: Unit.cpp:6062
void SetHealth(uint64 val)
Definition: Unit.cpp:9346
bool HasUnitFlag3(UnitFlags3 flags) const
Definition: Unit.h:842
void ReplaceAllNpcFlags2(NPCFlags2 flags)
Definition: Unit.h:990
virtual void Say(std::string_view text, Language language, WorldObject const *target=nullptr)
Definition: Unit.cpp:13562
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
Definition: Unit.h:1814
void SetFaction(uint32 faction) override
Definition: Unit.h:859
virtual void Yell(std::string_view text, Language language, WorldObject const *target=nullptr)
Definition: Unit.cpp:13567
Pet * CreateTamedPetFrom(Creature *creatureTarget, uint32 spell_id=0)
Definition: Unit.cpp:10441
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool IsPet() const
Definition: Unit.h:740
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:832
void CleanupsBeforeDelete(bool finalCleanup=true) override
Definition: Unit.cpp:9697
bool HasUnitFlag2(UnitFlags2 flags) const
Definition: Unit.h:837
bool IsAlive() const
Definition: Unit.h:1164
float GetCombatReach() const override
Definition: Unit.h:694
TempSummon * ToTempSummon()
Definition: Unit.h:1756
bool HasNpcFlag2(NPCFlags2 flags) const
Definition: Unit.h:987
void SetEmoteState(Emote emote)
Definition: Unit.h:852
uint32 GetDisplayId() const
Definition: Unit.h:1567
bool IsAIEnabled() const
Definition: Unit.h:658
uint32 GetNativeDisplayId() const
Definition: Unit.h:1570
uint64 GetMaxHealth() const
Definition: Unit.h:777
uint64 GetHealth() const
Definition: Unit.h:776
uint32 GetFaction() const override
Definition: Unit.h:858
virtual void TextEmote(std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
Definition: Unit.cpp:13572
uint32 GetCreateHealth() const
Definition: Unit.h:1394
bool HasNpcFlag(NPCFlags flags) const
Definition: Unit.h:981
uint32 GetArmor() const
Definition: Unit.h:762
void SetMaxHealth(uint64 val)
Definition: Unit.cpp:9377
virtual float GetFollowAngle() const
Definition: Unit.h:1744
void SetLevel(uint8 lvl, bool sendUpdate=true)
Definition: Unit.cpp:9329
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition: Unit.cpp:1598
bool IsVendor() const
Definition: Unit.h:992
bool IsTotem() const
Definition: Unit.h:742
void ReplaceAllNpcFlags(NPCFlags flags)
Definition: Unit.h:984
virtual void Whisper(std::string_view text, Language language, Player *target, bool isBossWhisper=false)
Definition: Unit.cpp:13577
uint8 GetLevel() const
Definition: Unit.h:746
ObjectGuid GetPetGUID() const
Definition: Unit.h:1176
bool isDead() const
Definition: Unit.h:1166
constexpr uint32 GetMapId() const
Definition: Position.h:201
Map * GetMap() const
Definition: Object.h:624
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0) const
Definition: Object.cpp:3403
float GetTransOffsetX() const
Definition: Object.h:751
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:2025
TransportBase * GetTransport() const
Definition: Object.h:750
uint32 GetInstanceId() const
Definition: Object.h:521
float GetTransOffsetY() const
Definition: Object.h:752
std::string const & GetName() const
Definition: Object.h:555
float GetTransOffsetZ() const
Definition: Object.h:753
float GetTransOffsetO() const
Definition: Object.h:754
void SetDBPhase(int32 p)
Definition: Object.h:543
Player * GetPlayer() const
static bool HandleNpcAddFormationCommand(ChatHandler *handler, ObjectGuid::LowType leaderGUID)
Definition: cs_npc.cpp:1244
static bool HandleNpcSetWanderDistanceCommand(ChatHandler *handler, float option)
Definition: cs_npc.cpp:872
static bool HandleNpcAddCommand(ChatHandler *handler, CreatureEntry id)
Definition: cs_npc.cpp:121
static bool HandleNpcTameCommand(ChatHandler *handler)
Definition: cs_npc.cpp:1080
static bool HandleNpcTextEmoteCommand(ChatHandler *handler, Tail text)
Definition: cs_npc.cpp:958
static void _IterateNotNormalLootMap(ChatHandler *handler, NotNormalLootItemMap const &map, std::vector< LootItem > const &items)
Definition: cs_npc.cpp:1182
static bool HandleNpcDeleteCommand(ChatHandler *handler, Optional< CreatureSpawnId > spawnIdArg)
Definition: cs_npc.cpp:301
static bool HandleNpcSetModelCommand(ChatHandler *handler, uint32 displayId)
Definition: cs_npc.cpp:684
static bool HandleNpcYellCommand(ChatHandler *handler, Tail text)
Definition: cs_npc.cpp:1035
static bool HandleNpcSetFlagCommand(ChatHandler *handler, NPCFlags npcFlags, NPCFlags2 npcFlags2)
Definition: cs_npc.cpp:406
static bool HandleNpcFollowCommand(ChatHandler *handler)
Definition: cs_npc.cpp:451
static bool HandleNpcSetSpawnTimeCommand(ChatHandler *handler, uint32 spawnTime)
Definition: cs_npc.cpp:914
static bool HandleNpcAddVendorItemCommand(ChatHandler *handler, ItemTemplate const *item, Optional< uint32 > mc, Optional< uint32 > it, Optional< uint32 > ec, Optional< std::string_view > bonusListIDs)
Definition: cs_npc.cpp:168
static bool HandleNpcPlayEmoteCommand(ChatHandler *handler, uint32 emote)
Definition: cs_npc.cpp:668
static bool HandleNpcSetMoveTypeCommand(ChatHandler *handler, Optional< CreatureSpawnId > lowGuid, Variant< EXACT_SEQUENCE("stay"), EXACT_SEQUENCE("random"), EXACT_SEQUENCE("way")> type, Optional< EXACT_SEQUENCE("nodel")> nodel)
Definition: cs_npc.cpp:721
static bool HandleNpcUnFollowCommand(ChatHandler *handler)
Definition: cs_npc.cpp:978
static bool HandleNpcSetLevelCommand(ChatHandler *handler, uint8 lvl)
Definition: cs_npc.cpp:276
static bool HandleNpcSetAllowMovementCommand(ChatHandler *handler)
Definition: cs_npc.cpp:240
static bool HandleNpcShowLootCommand(ChatHandler *handler, Optional< EXACT_SEQUENCE("all")> all)
Definition: cs_npc.cpp:1199
static bool HandleNpcSetPhaseCommand(ChatHandler *handler, uint32 phaseID)
Definition: cs_npc.cpp:845
static bool HandleNpcSayCommand(ChatHandler *handler, Tail text)
Definition: cs_npc.cpp:931
static bool HandleNpcInfoCommand(ChatHandler *handler)
Definition: cs_npc.cpp:470
static bool HandleNpcAddWeaponCommand(ChatHandler *handler, uint32 SlotID, ItemTemplate const *tmpItem)
Definition: cs_npc.cpp:1317
static bool HandleNpcNearCommand(ChatHandler *handler, Optional< float > dist)
Definition: cs_npc.cpp:571
static bool HandleNpcDeleteVendorItemCommand(ChatHandler *handler, ItemTemplate const *item)
Definition: cs_npc.cpp:338
static bool HandleNpcEvadeCommand(ChatHandler *handler, Optional< EvadeReason > why, Optional< EXACT_SEQUENCE("force")> force)
Definition: cs_npc.cpp:1146
static bool HandleNpcSetDataCommand(ChatHandler *handler, uint32 data_1, uint32 data_2)
Definition: cs_npc.cpp:433
static void _ShowLootEntry(ChatHandler *handler, uint32 itemId, uint8 itemCount, bool alternateString=false)
Definition: cs_npc.cpp:1170
static bool HandleNpcSetPhaseGroup(ChatHandler *handler, char const *args)
Definition: cs_npc.cpp:819
static bool HandleNpcSetLinkCommand(ChatHandler *handler, ObjectGuid::LowType linkguid)
Definition: cs_npc.cpp:1287
static bool HandleNpcWhisperCommand(ChatHandler *handler, Variant< Hyperlink< player >, std::string_view > recv, Tail text)
Definition: cs_npc.cpp:1013
ChatCommandTable GetCommands() const override
Definition: cs_npc.cpp:65
static bool HandleNpcMoveCommand(ChatHandler *handler, Optional< CreatureSpawnId > spawnid)
Definition: cs_npc.cpp:618
static bool HandleNpcSetFactionIdCommand(ChatHandler *handler, uint32 factionId)
Definition: cs_npc.cpp:368
static bool HandleNpcSetEntryCommand(ChatHandler *handler, CreatureEntry newEntryNum)
Definition: cs_npc.cpp:255
static bool HandleNpcAddMoveCommand(ChatHandler *handler, CreatureSpawnId lowGuid)
Definition: cs_npc.cpp:216
static bool HandleNpcAddTempSpawnCommand(ChatHandler *handler, Optional< std::string_view > lootStr, CreatureEntry id)
Definition: cs_npc.cpp:1057
bool HandleNpcSpawnGroup(ChatHandler *handler, std::vector< Variant< uint32, EXACT_SEQUENCE("force"), EXACT_SEQUENCE("ignorerespawn")> > const &opts)
Definition: cs_npc.cpp:1368
void AddSC_npc_commandscript()
Definition: cs_npc.cpp:1363
bool HandleNpcDespawnGroup(ChatHandler *handler, std::vector< Variant< uint32, EXACT_SEQUENCE("removerespawntime")> > const &opts)
Definition: cs_npc.cpp:1409
#define sWorld
Definition: World.h:931
@ CONFIG_MAX_PLAYER_LEVEL
Definition: World.h:259
time_t GetGameTime()
Definition: GameTime.cpp:44
TC_GAME_API Player * FindPlayerByName(std::string_view name)
TC_GAME_API Player * FindConnectedPlayer(ObjectGuid const &)
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:49
std::string ToString(Type &&val, Params &&... params)
TC_COMMON_API std::vector< std::string_view > Tokenize(std::string_view str, char sep, bool keepEmpty)
Definition: Util.cpp:56
std::string GetTypeName()
Definition: Util.h:514
std::string StringFormat(FormatString< Args... > fmt, Args &&... args)
Default TC string format function.
Definition: StringFormat.h:38
@ RBAC_PERM_COMMAND_NPC_SET_LEVEL
Definition: RBAC.h:457
@ RBAC_PERM_COMMAND_NPC_PLAYEMOTE
Definition: RBAC.h:468
@ RBAC_PERM_COMMAND_NPC_FOLLOW
Definition: RBAC.h:450
@ RBAC_PERM_COMMAND_NPC_EVADE
Definition: RBAC.h:708
@ RBAC_PERM_COMMAND_NPC_INFO
Definition: RBAC.h:465
@ RBAC_PERM_COMMAND_NPC_TEXTEMOTE
Definition: RBAC.h:470
@ RBAC_PERM_COMMAND_NPC_ADD_FORMATION
Definition: RBAC.h:444
@ RBAC_PERM_COMMAND_NPC_ADD
Definition: RBAC.h:443
@ RBAC_PERM_COMMAND_NPC_NEAR
Definition: RBAC.h:466
@ RBAC_PERM_COMMAND_NPC_SET_SPAWNDIST
Definition: RBAC.h:462
@ RBAC_PERM_COMMAND_NPC_SET_PHASE
Definition: RBAC.h:461
@ RBAC_PERM_COMMAND_NPC_DELETE
Definition: RBAC.h:448
@ RBAC_PERM_COMMAND_NPC_SET_ENTRY
Definition: RBAC.h:454
@ RBAC_PERM_COMMAND_NPC_DESPAWNGROUP
Definition: RBAC.h:727
@ RBAC_PERM_COMMAND_NPC_TAME
Definition: RBAC.h:473
@ RBAC_PERM_COMMAND_NPC_MOVE
Definition: RBAC.h:467
@ RBAC_PERM_COMMAND_NPC_ADD_ITEM
Definition: RBAC.h:445
@ RBAC_PERM_COMMAND_NPC_SET_SPAWNTIME
Definition: RBAC.h:463
@ RBAC_PERM_COMMAND_NPC_SET_FACTIONID
Definition: RBAC.h:455
@ RBAC_PERM_COMMAND_NPC_SET_MOVETYPE
Definition: RBAC.h:460
@ RBAC_PERM_COMMAND_NPC_SPAWNGROUP
Definition: RBAC.h:726
@ RBAC_PERM_COMMAND_NPC_SET_DATA
Definition: RBAC.h:464
@ RBAC_PERM_COMMAND_NPC_SHOWLOOT
Definition: RBAC.h:735
@ RBAC_PERM_COMMAND_NPC_SET_ALLOWMOVE
Definition: RBAC.h:453
@ RBAC_PERM_COMMAND_NPC_SET_MODEL
Definition: RBAC.h:459
@ RBAC_PERM_COMMAND_NPC_ADD_MOVE
Definition: RBAC.h:446
@ RBAC_PERM_COMMAND_NPC_SET_LINK
Definition: RBAC.h:458
@ RBAC_PERM_COMMAND_NPC_WHISPER
Definition: RBAC.h:471
@ RBAC_PERM_COMMAND_NPC_SET_FLAG
Definition: RBAC.h:456
@ RBAC_PERM_COMMAND_NPC_YELL
Definition: RBAC.h:472
@ RBAC_PERM_COMMAND_NPC_SAY
Definition: RBAC.h:469
@ RBAC_PERM_COMMAND_NPC_ADD_TEMP
Definition: RBAC.h:447
@ RBAC_PERM_COMMAND_NPC_DELETE_ITEM
Definition: RBAC.h:449
bool IsEmpty() const
Definition: ConditionMgr.h:390
std::string ToString() const
Definition: Creature.cpp:61
int32 CreatureImmunitiesId
Definition: CreatureData.h:522
std::string Name
Definition: CreatureData.h:483
bool IsTameable(bool canTameExotic, CreatureDifficulty const *creatureDifficulty) const
Definition: CreatureData.h:541
uint32 GetQuality() const
Definition: ItemTemplate.h:779
uint32 GetId() const
Definition: ItemTemplate.h:776
char const * GetName(LocaleConstant locale) const
char const * GetDefaultLocaleName() const
Definition: Loot.h:176
uint32 itemid
Definition: Loot.h:177
uint8 count
Definition: Loot.h:185
bool is_looted
Definition: Loot.h:186
ConditionsReference conditions
Definition: Loot.h:182
bool freeforall
Definition: Loot.h:188
Definition: Loot.h:281
bool isLooted() const
Definition: Loot.h:307
uint32 gold
Definition: Loot.h:285
std::vector< LootItem > items
Definition: Loot.h:284
NotNormalLootItemMap const & GetPlayerFFAItems() const
Definition: Loot.h:282
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
float GetAbsoluteAngle(float x, float y) const
Definition: Position.h:125
constexpr void GetPosition(float &x, float &y) const
Definition: Position.h:81
constexpr void Relocate(float x, float y)
Definition: Position.h:63
constexpr float GetOrientation() const
Definition: Position.h:79
constexpr float GetPositionZ() const
Definition: Position.h:78
uint32 id
Definition: SpawnData.h:104
Position spawnPoint
Definition: SpawnData.h:105
std::string name
Definition: SpawnData.h:68
SpawnGroupFlags flags
Definition: SpawnData.h:70
SpawnGroupTemplateData const * spawnGroupData
Definition: SpawnData.h:96
uint64 spawnId
Definition: SpawnData.h:93
uint32 mapId
Definition: SpawnData.h:94
uint32 ExtendedCost
Definition: CreatureData.h:658
uint32 item
Definition: CreatureData.h:655
uint32 maxcount
Definition: CreatureData.h:656
std::vector< int32 > BonusListIDs
Definition: CreatureData.h:660
uint32 incrtime
Definition: CreatureData.h:657