Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
cs_npc.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/* ScriptData
7Name: npc_commandscript
8%Complete: 100
9Comment: All npc related commands
10Category: commandscripts
11EndScriptData */
12
13#include "Chat.h"
14#include "CreatureAI.h"
15#include "CreatureGroups.h"
16#include "Language.h"
17#include "ObjectMgr.h"
18#include "Pet.h"
19#include "Player.h"
20#include "ScriptMgr.h"
21#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
22#include "Transport.h"
23
24template<typename E, typename T = char const*>
26{
29};
30
31#define CREATE_NAMED_ENUM(VALUE) { VALUE, STRINGIZE(VALUE) }
32
33#define NPCFLAG_COUNT 29
34
36{
66};
67
104
140
142{
143public:
144 npc_commandscript() : CommandScript("npc_commandscript") { }
145
146 std::vector<ChatCommand> GetCommands() const OVERRIDE
147 {
148 static std::vector<ChatCommand> npcAddCommandTable =
149 {
154 //{ "weapon", rbac::RBAC_PERM_COMMAND_NPC_ADD_WEAPON, false, &HandleNpcAddWeaponCommand, "", NULL },
156 };
157 static std::vector<ChatCommand> npcDeleteCommandTable =
158 {
161 };
162 static std::vector<ChatCommand> npcFollowCommandTable =
163 {
166 };
167 static std::vector<ChatCommand> npcSetCommandTable =
168 {
182 //{ "name", rbac::RBAC_PERM_COMMAND_NPC_SET_NAME, false, &HandleNpcSetNameCommand, "", NULL },
183 //{ "subname", rbac::RBAC_PERM_COMMAND_NPC_SET_SUBNAME, false, &HandleNpcSetSubNameCommand, "", NULL },
184 };
185 static std::vector<ChatCommand> npcCommandTable =
186 {
196 { "add", rbac::RBAC_PERM_COMMAND_NPC_ADD, false, NULL, "", npcAddCommandTable },
197 { "delete", rbac::RBAC_PERM_COMMAND_NPC_DELETE, false, NULL, "", npcDeleteCommandTable },
198 { "follow", rbac::RBAC_PERM_COMMAND_NPC_FOLLOW, false, NULL, "", npcFollowCommandTable },
199 { "set", rbac::RBAC_PERM_COMMAND_NPC_SET, false, NULL, "", npcSetCommandTable },
200 };
201 static std::vector<ChatCommand> commandTable =
202 {
203 { "npc", rbac::RBAC_PERM_COMMAND_NPC, false, NULL, "", npcCommandTable },
204 };
205 return commandTable;
206 }
207
208 //add spawn of creature
209 static bool HandleNpcAddCommand(ChatHandler* handler, char const* args)
210 {
211 if (!*args)
212 return false;
213
214 char* charID = handler->extractKeyFromLink((char*)args, "Hcreature_entry");
215 if (!charID)
216 return false;
217
218 char* team = strtok(NULL, " ");
219 int32 teamval = 0;
220 if (team)
221 teamval = atoi(team);
222
223 if (teamval < 0)
224 teamval = 0;
225
226 uint32 id = atoi(charID);
227 if (!sObjectMgr->GetCreatureTemplate(id))
228 return false;
229
230 Player* chr = handler->GetSession()->GetPlayer();
231 float x = chr->GetPositionX();
232 float y = chr->GetPositionY();
233 float z = chr->GetPositionZ();
234 float o = chr->GetOrientation();
235 Map* map = chr->GetMap();
236
237 if (Transport* trans = chr->GetTransport())
238 {
239 uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT);
240 CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid);
241 data.id = id;
242 data.posX = chr->GetTransOffsetX();
243 data.posY = chr->GetTransOffsetY();
244 data.posZ = chr->GetTransOffsetZ();
245 data.orientation = chr->GetTransOffsetO();
246
247 Creature* creature = trans->CreateNPCPassenger(guid, &data);
248
249 creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode());
250
251 sObjectMgr->AddCreatureToGrid(guid, &data);
252 return true;
253 }
254
255 Creature* creature = new Creature();
256 if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, id, 0, (uint32)teamval, x, y, z, o))
257 {
258 delete creature;
259 return false;
260 }
261
262 for (auto phase : chr->GetPhases())
263 creature->SetPhased(phase, false, true);
264
265 creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()));
266
267 uint32 db_guid = creature->GetDBTableGUIDLow();
268
269 // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
270 if (!creature->LoadCreatureFromDB(db_guid, map))
271 {
272 delete creature;
273 return false;
274 }
275
276 sObjectMgr->AddCreatureToGrid(db_guid, sObjectMgr->GetCreatureData(db_guid));
277 return true;
278 }
279
280 //add item in vendorlist
281 static bool HandleNpcAddVendorItemCommand(ChatHandler* handler, char const* args)
282 {
283 if (!*args)
284 return false;
285
286 const uint8 type = 1; // FIXME: make type (1 item, 2 currency) an argument
287
288 char* pitem = handler->extractKeyFromLink((char*)args, "Hitem");
289 if (!pitem)
290 {
292 handler->SetSentErrorMessage(true);
293 return false;
294 }
295
296 int32 item_int = atol(pitem);
297 if (item_int <= 0)
298 return false;
299
300 uint32 itemId = item_int;
301
302 char* fmaxcount = strtok(NULL, " "); //add maxcount, default: 0
303 uint32 maxcount = 0;
304 if (fmaxcount)
305 maxcount = atol(fmaxcount);
306
307 char* fincrtime = strtok(NULL, " "); //add incrtime, default: 0
308 uint32 incrtime = 0;
309 if (fincrtime)
310 incrtime = atol(fincrtime);
311
312 char* fextendedcost = strtok(NULL, " "); //add ExtendedCost, default: 0
313 uint32 extendedcost = fextendedcost ? atol(fextendedcost) : 0;
314 Creature* vendor = handler->getSelectedCreature();
315 if (!vendor)
316 {
318 handler->SetSentErrorMessage(true);
319 return false;
320 }
321
322 uint32 vendor_entry = vendor->GetEntry();
323
324 if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, type, handler->GetSession()->GetPlayer()))
325 {
326 handler->SetSentErrorMessage(true);
327 return false;
328 }
329
330 sObjectMgr->AddVendorItem(vendor_entry, itemId, maxcount, incrtime, extendedcost, type);
331
332 ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
333
334 handler->PSendSysMessage(LANG_ITEM_ADDED_TO_LIST, itemId, itemTemplate->Name1.c_str(), maxcount, incrtime, extendedcost);
335 return true;
336 }
337
338 //add move for creature
339 static bool HandleNpcAddMoveCommand(ChatHandler* handler, char const* args)
340 {
341 if (!*args)
342 return false;
343
344 char* guidStr = strtok((char*)args, " ");
345 char* waitStr = strtok((char*)NULL, " ");
346
347 uint32 lowGuid = atoi((char*)guidStr);
348
349 Creature* creature = NULL;
350
351 /* FIXME: impossible without entry
352 if (lowguid)
353 creature = ObjectAccessor::GetCreature(*handler->GetSession()->GetPlayer(), MAKE_GUID(lowguid, HIGHGUID_UNIT));
354 */
355
356 // attempt check creature existence by DB data
357 if (!creature)
358 {
359 CreatureData const* data = sObjectMgr->GetCreatureData(lowGuid);
360 if (!data)
361 {
363 handler->SetSentErrorMessage(true);
364 return false;
365 }
366 }
367 else
368 {
369 // obtain real GUID for DB operations
370 lowGuid = creature->GetDBTableGUIDLow();
371 }
372
373 int wait = waitStr ? atoi(waitStr) : 0;
374
375 if (wait < 0)
376 wait = 0;
377
378 // Update movement type
380
382 stmt->setUInt32(1, lowGuid);
383
384 WorldDatabase.Execute(stmt);
385
386 if (creature && creature->GetWaypointPath())
387 {
389 creature->GetMotionMaster()->Initialize();
390 if (creature->IsAlive()) // dead creature will reset movement generator at respawn
391 {
393 creature->Respawn(true);
394 }
395 creature->SaveToDB();
396 }
397
399
400 return true;
401 }
402
403 static bool HandleNpcSetAllowMovementCommand(ChatHandler* handler, char const* /*args*/)
404 {
405 if (sWorld->getAllowMovement())
406 {
407 sWorld->SetAllowMovement(false);
409 }
410 else
411 {
412 sWorld->SetAllowMovement(true);
414 }
415 return true;
416 }
417
418 static bool HandleNpcSetEntryCommand(ChatHandler* handler, char const* args)
419 {
420 if (!*args)
421 return false;
422
423 uint32 newEntryNum = atoi(args);
424 if (!newEntryNum)
425 return false;
426
427 Unit* unit = handler->getSelectedUnit();
428 if (!unit || unit->GetTypeId() != TypeID::TYPEID_UNIT)
429 {
431 handler->SetSentErrorMessage(true);
432 return false;
433 }
434 Creature* creature = unit->ToCreature();
435 if (creature->UpdateEntry(newEntryNum))
436 handler->SendSysMessage(LANG_DONE);
437 else
438 handler->SendSysMessage(LANG_ERROR);
439 return true;
440 }
441
442 //change level of creature or pet
443 static bool HandleNpcSetLevelCommand(ChatHandler* handler, char const* args)
444 {
445 if (!*args)
446 return false;
447
448 uint8 lvl = (uint8)atoi((char*)args);
449 if (lvl < 1 || lvl > sWorld->getIntConfig(WorldIntConfigs::CONFIG_MAX_PLAYER_LEVEL) + 3)
450 {
452 handler->SetSentErrorMessage(true);
453 return false;
454 }
455
456 Creature* creature = handler->getSelectedCreature();
457 if (!creature)
458 {
460 handler->SetSentErrorMessage(true);
461 return false;
462 }
463
464 if (creature->IsPet())
465 {
466 if (((Pet*)creature)->getPetType() == PetType::HUNTER_PET)
467 {
468 creature->SetUInt32Value(UNIT_FIELD_PET_NEXT_LEVEL_EXPERIENCE, sObjectMgr->GetXPForLevel(lvl) / 4);
470 }
471 ((Pet*)creature)->GivePetLevel(lvl);
472 }
473 else
474 {
475 creature->SetMaxHealth(100 + 30 * lvl);
476 creature->SetHealth(100 + 30 * lvl);
477 creature->SetLevel(lvl);
478 creature->SaveToDB();
479 }
480
481 return true;
482 }
483
484 static bool HandleNpcDeleteCommand(ChatHandler* handler, char const* args)
485 {
486 Creature* unit = NULL;
487
488 if (*args)
489 {
490 // number or [name] Shift-click form |color|Hcreature:creature_guid|h[name]|h|r
491 char* cId = handler->extractKeyFromLink((char*)args, "Hcreature");
492 if (!cId)
493 return false;
494
495 uint32 lowguid = atoi(cId);
496 if (!lowguid)
497 return false;
498
499 if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid))
500 unit = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT));
501 }
502 else
503 unit = handler->getSelectedCreature();
504
505 if (!unit || unit->IsPet() || unit->IsTotem())
506 {
508 handler->SetSentErrorMessage(true);
509 return false;
510 }
511
512 // Delete the creature
513 unit->CombatStop();
514 unit->DeleteFromDB();
515 unit->AddObjectToRemoveList();
516
518
519 return true;
520 }
521
522 //del item from vendor list
523 static bool HandleNpcDeleteVendorItemCommand(ChatHandler* handler, char const* args)
524 {
525 if (!*args)
526 return false;
527
528 Creature* vendor = handler->getSelectedCreature();
529 if (!vendor || !vendor->IsVendor())
530 {
532 handler->SetSentErrorMessage(true);
533 return false;
534 }
535
536 char* pitem = handler->extractKeyFromLink((char*)args, "Hitem");
537 if (!pitem)
538 {
540 handler->SetSentErrorMessage(true);
541 return false;
542 }
543 uint32 itemId = atol(pitem);
544
545 const uint8 type = 1; // FIXME: make type (1 item, 2 currency) an argument
546
547 if (!sObjectMgr->RemoveVendorItem(vendor->GetEntry(), itemId, type))
548 {
549 handler->PSendSysMessage(LANG_ITEM_NOT_IN_LIST, itemId);
550 handler->SetSentErrorMessage(true);
551 return false;
552 }
553
554 ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
555
556 handler->PSendSysMessage(LANG_ITEM_DELETED_FROM_LIST, itemId, itemTemplate->Name1.c_str());
557 return true;
558 }
559
560 //set faction of creature
561 static bool HandleNpcSetFactionIdCommand(ChatHandler* handler, char const* args)
562 {
563 if (!*args)
564 return false;
565
566 uint32 factionId = (uint32)atoi((char*)args);
567
568 if (!sFactionTemplateStore.LookupEntry(factionId))
569 {
570 handler->PSendSysMessage(LANG_WRONG_FACTION, factionId);
571 handler->SetSentErrorMessage(true);
572 return false;
573 }
574
575 Creature* creature = handler->getSelectedCreature();
576
577 if (!creature)
578 {
580 handler->SetSentErrorMessage(true);
581 return false;
582 }
583
584 creature->setFaction(factionId);
585
586 // Faction is set in creature_template - not inside creature
587
588 // Update in memory..
589 if (CreatureTemplate const* cinfo = creature->GetCreatureTemplate())
590 {
591 const_cast<CreatureTemplate*>(cinfo)->faction_A = factionId;
592 const_cast<CreatureTemplate*>(cinfo)->faction_H = factionId;
593 }
594
595 // ..and DB
596 PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_FACTION);
597
598 stmt->setUInt16(0, uint16(factionId));
599 stmt->setUInt16(1, uint16(factionId));
600 stmt->setUInt32(2, creature->GetEntry());
601
602 WorldDatabase.Execute(stmt);
603
604 return true;
605 }
606
607 //set npcflag of creature
608 static bool HandleNpcSetFlagCommand(ChatHandler* handler, char const* args)
609 {
610 if (!*args)
611 return false;
612
613 uint32 npcFlags = (uint32)atoi((char*)args);
614
615 Creature* creature = handler->getSelectedCreature();
616
617 if (!creature)
618 {
620 handler->SetSentErrorMessage(true);
621 return false;
622 }
623
624 creature->SetUInt32Value(UNIT_FIELD_NPC_FLAGS, npcFlags);
625
626 PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_NPCFLAG);
627
628 stmt->setUInt32(0, npcFlags);
629 stmt->setUInt32(1, creature->GetEntry());
630
631 WorldDatabase.Execute(stmt);
632
634
635 return true;
636 }
637
638 //set data of creature for testing scripting
639 static bool HandleNpcSetDataCommand(ChatHandler* handler, char const* args)
640 {
641 if (!*args)
642 return false;
643
644 char* arg1 = strtok((char*)args, " ");
645 char* arg2 = strtok((char*)NULL, "");
646
647 if (!arg1 || !arg2)
648 return false;
649
650 uint32 data_1 = (uint32)atoi(arg1);
651 uint32 data_2 = (uint32)atoi(arg2);
652
653 if (!data_1 || !data_2)
654 return false;
655
656 Creature* creature = handler->getSelectedCreature();
657
658 if (!creature)
659 {
661 handler->SetSentErrorMessage(true);
662 return false;
663 }
664
665 creature->AI()->SetData(data_1, data_2);
666 std::string AIorScript = creature->GetAIName() != "" ? "AI type: " + creature->GetAIName() : (creature->GetScriptName() != "" ? "Script Name: " + creature->GetScriptName() : "No AI or Script Name Set");
667 handler->PSendSysMessage(LANG_NPC_SETDATA, creature->GetGUID(), creature->GetEntry(), creature->GetName().c_str(), data_1, data_2, AIorScript.c_str());
668 return true;
669 }
670
671 //npc follow handling
672 static bool HandleNpcFollowCommand(ChatHandler* handler, char const* /*args*/)
673 {
674 Player* player = handler->GetSession()->GetPlayer();
675 Creature* creature = handler->getSelectedCreature();
676
677 if (!creature)
678 {
680 handler->SetSentErrorMessage(true);
681 return false;
682 }
683
684 // Follow player - Using pet's default dist and angle
685 creature->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, creature->GetFollowAngle());
686
687 handler->PSendSysMessage(LANG_CREATURE_FOLLOW_YOU_NOW, creature->GetName().c_str());
688 return true;
689 }
690
691 static bool HandleNpcInfoCommand(ChatHandler* handler, char const* /*args*/)
692 {
693 Creature* target = handler->getSelectedCreature();
694
695 if (!target)
696 {
698 handler->SetSentErrorMessage(true);
699 return false;
700 }
701
702 CreatureTemplate const* cInfo = target->GetCreatureTemplate();
703
704 uint32 faction = target->getFaction();
705 uint32 npcflags = target->GetUInt32Value(UNIT_FIELD_NPC_FLAGS);
706 uint32 mechanicImmuneMask = cInfo->MechanicImmuneMask;
707 uint32 displayid = target->GetDisplayId();
708 uint32 nativeid = target->GetNativeDisplayId();
709 uint32 Entry = target->GetEntry();
710
711 int64 curRespawnDelay = target->GetRespawnTimeEx() - time(NULL);
712 if (curRespawnDelay < 0)
713 curRespawnDelay = 0;
714 std::string curRespawnDelayStr = secsToTimeString(uint64(curRespawnDelay), true);
715 std::string defRespawnDelayStr = secsToTimeString(target->GetRespawnDelay(), true);
716
717 handler->PSendSysMessage(LANG_NPCINFO_CHAR, target->GetDBTableGUIDLow(), target->GetGUIDLow(), faction, npcflags, Entry, displayid, nativeid);
718 handler->PSendSysMessage(LANG_NPCINFO_LEVEL, target->getLevel());
720 handler->PSendSysMessage(LANG_NPCINFO_HEALTH, target->GetCreateHealth(), target->GetMaxHealth(), target->GetHealth());
721
723 for (uint8 i = 0; i < MAX_UNIT_FLAGS; ++i)
724 if (target->GetUInt32Value(UNIT_FIELD_FLAGS) & unitFlags[i].Value)
725 handler->PSendSysMessage("%s (0x%X)", unitFlags[i].Name, unitFlags[i].Value);
726
728
729 handler->PSendSysMessage(LANG_COMMAND_RAWPAWNTIMES, defRespawnDelayStr.c_str(), curRespawnDelayStr.c_str());
730 handler->PSendSysMessage(LANG_NPCINFO_LOOT, cInfo->lootid, cInfo->pickpocketLootId, cInfo->SkinLootId);
733 handler->PSendSysMessage(LANG_NPCINFO_ARMOR, target->GetArmor());
734 handler->PSendSysMessage(LANG_NPCINFO_POSITION, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
735 handler->PSendSysMessage(LANG_NPCINFO_AIINFO, target->GetAIName().c_str(), target->GetScriptName().c_str());
736
737 for (uint8 i = 0; i < NPCFLAG_COUNT; i++)
738 if (npcflags & npcFlagTexts[i].Value)
739 handler->PSendSysMessage(npcFlagTexts[i].Name);
740
741 handler->PSendSysMessage(LANG_NPCINFO_MECHANIC_IMMUNE, mechanicImmuneMask);
742 for (uint8 i = 0; i < MAX_MECHANIC; ++i)
743 if ((mechanicImmuneMask << 1) & mechanicImmunes[i].Value)
744 handler->PSendSysMessage("%s (0x%X)", mechanicImmunes[i].Name, mechanicImmunes[i].Value);
745
746 return true;
747 }
748
749 static bool HandleNpcNearCommand(ChatHandler* handler, char const* args)
750 {
751 float distance = (!*args) ? 10.0f : float((atof(args)));
752 uint32 count = 0;
753
754 Player* player = handler->GetSession()->GetPlayer();
755
756 PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_CREATURE_NEAREST);
757 stmt->setFloat(0, player->GetPositionX());
758 stmt->setFloat(1, player->GetPositionY());
759 stmt->setFloat(2, player->GetPositionZ());
760 stmt->setUInt32(3, player->GetMapId());
761 stmt->setFloat(4, player->GetPositionX());
762 stmt->setFloat(5, player->GetPositionY());
763 stmt->setFloat(6, player->GetPositionZ());
764 stmt->setFloat(7, distance * distance);
765 PreparedQueryResult result = WorldDatabase.Query(stmt);
766
767 if (result)
768 {
769 do
770 {
771 Field* fields = result->Fetch();
772 uint32 guid = fields[0].GetUInt32();
773 uint32 entry = fields[1].GetUInt32();
774 float x = fields[2].GetFloat();
775 float y = fields[3].GetFloat();
776 float z = fields[4].GetFloat();
777 uint16 mapId = fields[5].GetUInt16();
778
779 CreatureTemplate const* creatureTemplate = sObjectMgr->GetCreatureTemplate(entry);
780 if (!creatureTemplate)
781 continue;
782
783 handler->PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, creatureTemplate->Name.c_str(), x, y, z, mapId);
784
785 ++count;
786 } while (result->NextRow());
787 }
788
789 handler->PSendSysMessage(LANG_COMMAND_NEAR_NPC_MESSAGE, distance, count);
790
791 return true;
792 }
793
794 //move selected creature
795 static bool HandleNpcMoveCommand(ChatHandler* handler, char const* args)
796 {
797 uint32 lowguid = 0;
798
799 Creature* creature = handler->getSelectedCreature();
800
801 if (!creature)
802 {
803 // number or [name] Shift-click form |color|Hcreature:creature_guid|h[name]|h|r
804 char* cId = handler->extractKeyFromLink((char*)args, "Hcreature");
805 if (!cId)
806 return false;
807
808 lowguid = atoi(cId);
809
810 /* FIXME: impossible without entry
811 if (lowguid)
812 creature = ObjectAccessor::GetCreature(*handler->GetSession()->GetPlayer(), MAKE_GUID(lowguid, HIGHGUID_UNIT));
813 */
814
815 // Attempting creature load from DB data
816 if (!creature)
817 {
818 CreatureData const* data = sObjectMgr->GetCreatureData(lowguid);
819 if (!data)
820 {
822 handler->SetSentErrorMessage(true);
823 return false;
824 }
825
826 uint32 map_id = data->mapid;
827
828 if (handler->GetSession()->GetPlayer()->GetMapId() != map_id)
829 {
831 handler->SetSentErrorMessage(true);
832 return false;
833 }
834 }
835 else
836 {
837 lowguid = creature->GetDBTableGUIDLow();
838 }
839 }
840 else
841 {
842 lowguid = creature->GetDBTableGUIDLow();
843 }
844
845 float x = handler->GetSession()->GetPlayer()->GetPositionX();
846 float y = handler->GetSession()->GetPlayer()->GetPositionY();
847 float z = handler->GetSession()->GetPlayer()->GetPositionZ();
848 float o = handler->GetSession()->GetPlayer()->GetOrientation();
849
850 if (creature)
851 {
852 if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetDBTableGUIDLow()))
853 {
854 const_cast<CreatureData*>(data)->posX = x;
855 const_cast<CreatureData*>(data)->posY = y;
856 const_cast<CreatureData*>(data)->posZ = z;
857 const_cast<CreatureData*>(data)->orientation = o;
858 }
859 creature->SetPosition(x, y, z, o);
860 creature->GetMotionMaster()->Initialize();
861 if (creature->IsAlive()) // dead creature will reset movement generator at respawn
862 {
864 creature->Respawn();
865 }
866 }
867
868 PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_POSITION);
869
870 stmt->setFloat(0, x);
871 stmt->setFloat(1, y);
872 stmt->setFloat(2, z);
873 stmt->setFloat(3, o);
874 stmt->setUInt32(4, lowguid);
875
876 WorldDatabase.Execute(stmt);
877
879 return true;
880 }
881
882 //play npc emote
883 static bool HandleNpcPlayEmoteCommand(ChatHandler* handler, char const* args)
884 {
885 uint32 emote = atoi((char*)args);
886
887 Creature* target = handler->getSelectedCreature();
888 if (!target)
889 {
891 handler->SetSentErrorMessage(true);
892 return false;
893 }
894
896
897 return true;
898 }
899
900 //set model of creature
901 static bool HandleNpcSetModelCommand(ChatHandler* handler, char const* args)
902 {
903 if (!*args)
904 return false;
905
906 uint32 displayId = (uint32)atoi((char*)args);
907
908 Creature* creature = handler->getSelectedCreature();
909
910 if (!creature || creature->IsPet())
911 {
913 handler->SetSentErrorMessage(true);
914 return false;
915 }
916
917 creature->SetDisplayId(displayId);
918 creature->SetNativeDisplayId(displayId);
919
920 creature->SaveToDB();
921
922 return true;
923 }
924
937 static bool HandleNpcSetMoveTypeCommand(ChatHandler* handler, char const* args)
938 {
939 if (!*args)
940 return false;
941
942 // 3 arguments:
943 // GUID (optional - you can also select the creature)
944 // stay|random|way (determines the kind of movement)
945 // NODEL (optional - tells the system NOT to delete any waypoints)
946 // this is very handy if you want to do waypoints, that are
947 // later switched on/off according to special events (like escort
948 // quests, etc)
949 char* guid_str = strtok((char*)args, " ");
950 char* type_str = strtok((char*)NULL, " ");
951 char* dontdel_str = strtok((char*)NULL, " ");
952
953 bool doNotDelete = false;
954
955 if (!guid_str)
956 return false;
957
958 uint32 lowguid = 0;
959 Creature* creature = NULL;
960
961 if (dontdel_str)
962 {
963 //SF_LOG_ERROR("misc", "DEBUG: All 3 params are set");
964
965 // All 3 params are set
966 // GUID
967 // type
968 // doNotDEL
969 if (stricmp(dontdel_str, "NODEL") == 0)
970 {
971 //SF_LOG_ERROR("misc", "DEBUG: doNotDelete = true;");
972 doNotDelete = true;
973 }
974 }
975 else
976 {
977 // Only 2 params - but maybe NODEL is set
978 if (type_str)
979 {
980 SF_LOG_ERROR("misc", "DEBUG: Only 2 params ");
981 if (stricmp(type_str, "NODEL") == 0)
982 {
983 //SF_LOG_ERROR("misc", "DEBUG: type_str, NODEL ");
984 doNotDelete = true;
985 type_str = NULL;
986 }
987 }
988 }
989
990 if (!type_str) // case .setmovetype $move_type (with selected creature)
991 {
992 type_str = guid_str;
993 creature = handler->getSelectedCreature();
994 if (!creature || creature->IsPet())
995 return false;
996 lowguid = creature->GetDBTableGUIDLow();
997 }
998 else // case .setmovetype #creature_guid $move_type (with selected creature)
999 {
1000 lowguid = atoi((char*)guid_str);
1001
1002 /* impossible without entry
1003 if (lowguid)
1004 creature = ObjectAccessor::GetCreature(*handler->GetSession()->GetPlayer(), MAKE_GUID(lowguid, HIGHGUID_UNIT));
1005 */
1006
1007 // attempt check creature existence by DB data
1008 if (!creature)
1009 {
1010 CreatureData const* data = sObjectMgr->GetCreatureData(lowguid);
1011 if (!data)
1012 {
1014 handler->SetSentErrorMessage(true);
1015 return false;
1016 }
1017 }
1018 else
1019 {
1020 lowguid = creature->GetDBTableGUIDLow();
1021 }
1022 }
1023
1024 // now lowguid is low guid really existed creature
1025 // and creature point (maybe) to this creature or NULL
1026
1027 MovementGeneratorType move_type;
1028
1029 std::string type = type_str;
1030
1031 if (type == "stay")
1032 move_type = IDLE_MOTION_TYPE;
1033 else if (type == "random")
1034 move_type = RANDOM_MOTION_TYPE;
1035 else if (type == "way")
1036 move_type = WAYPOINT_MOTION_TYPE;
1037 else
1038 return false;
1039
1040 // update movement type
1041 //if (doNotDelete == false)
1042 // WaypointMgr.DeletePath(lowguid);
1043
1044 if (creature)
1045 {
1046 // update movement type
1047 if (doNotDelete == false)
1048 creature->LoadPath(0);
1049
1050 creature->SetDefaultMovementType(move_type);
1051 creature->GetMotionMaster()->Initialize();
1052 if (creature->IsAlive()) // dead creature will reset movement generator at respawn
1053 {
1055 creature->Respawn();
1056 }
1057 creature->SaveToDB();
1058 }
1059 if (doNotDelete == false)
1060 {
1061 handler->PSendSysMessage(LANG_MOVE_TYPE_SET, type_str);
1062 }
1063 else
1064 {
1065 handler->PSendSysMessage(LANG_MOVE_TYPE_SET_NODEL, type_str);
1066 }
1067
1068 return true;
1069 }
1070
1071 //npc phase handling
1072 //change phase of creature
1073 static bool HandleNpcSetPhaseGroup(ChatHandler* handler, char const* args)
1074 {
1075 if (!*args)
1076 return false;
1077
1078 uint32 phaseGroupId = (uint32)atoi((char*)args);
1079
1080 Creature* creature = handler->getSelectedCreature();
1081 if (!creature || creature->IsPet())
1082 {
1084 handler->SetSentErrorMessage(true);
1085 return false;
1086 }
1087
1088 creature->ClearPhases();
1089
1090 for (uint32 id : GetPhasesForGroup(phaseGroupId))
1091 creature->SetPhased(id, false, true); // don't send update here for multiple phases, only send it once after adding all phases
1092
1093 creature->UpdateObjectVisibility();
1094
1095 creature->SaveToDB();
1096
1097 return true;
1098 }
1099
1100 //npc phase handling
1101 //change phase of creature
1102 static bool HandleNpcSetPhaseCommand(ChatHandler* handler, char const* args)
1103 {
1104 if (!*args)
1105 return false;
1106
1107 uint32 phase = (uint32)atoi((char*)args);
1108
1109 Creature* creature = handler->getSelectedCreature();
1110 if (!creature || creature->IsPet())
1111 {
1113 handler->SetSentErrorMessage(true);
1114 return false;
1115 }
1116
1117 creature->ClearPhases();
1118 creature->SetPhased(phase, true, true);
1119
1120 creature->SaveToDB();
1121
1122 return true;
1123 }
1124
1125 //set spawn dist of creature
1126 static bool HandleNpcSetSpawnDistCommand(ChatHandler* handler, char const* args)
1127 {
1128 if (!*args)
1129 return false;
1130
1131 float option = (float)(atof((char*)args));
1132 if (option < 0.0f)
1133 {
1135 return false;
1136 }
1137
1139 if (option > 0.0f)
1140 mtype = RANDOM_MOTION_TYPE;
1141
1142 Creature* creature = handler->getSelectedCreature();
1143 uint32 guidLow = 0;
1144
1145 if (creature)
1146 guidLow = creature->GetDBTableGUIDLow();
1147 else
1148 return false;
1149
1150 creature->SetRespawnRadius((float)option);
1151 creature->SetDefaultMovementType(mtype);
1152 creature->GetMotionMaster()->Initialize();
1153 if (creature->IsAlive()) // dead creature will reset movement generator at respawn
1154 {
1156 creature->Respawn();
1157 }
1158
1160
1161 stmt->setFloat(0, option);
1162 stmt->setUInt8(1, uint8(mtype));
1163 stmt->setUInt32(2, guidLow);
1164
1165 WorldDatabase.Execute(stmt);
1166
1167 handler->PSendSysMessage(LANG_COMMAND_SPAWNDIST, option);
1168 return true;
1169 }
1170
1171 //spawn time handling
1172 static bool HandleNpcSetSpawnTimeCommand(ChatHandler* handler, char const* args)
1173 {
1174 if (!*args)
1175 return false;
1176
1177 char* stime = strtok((char*)args, " ");
1178
1179 if (!stime)
1180 return false;
1181
1182 int spawnTime = atoi((char*)stime);
1183
1184 if (spawnTime < 0)
1185 {
1187 handler->SetSentErrorMessage(true);
1188 return false;
1189 }
1190
1191 Creature* creature = handler->getSelectedCreature();
1192 uint32 guidLow = 0;
1193
1194 if (creature)
1195 guidLow = creature->GetDBTableGUIDLow();
1196 else
1197 return false;
1198
1200
1201 stmt->setUInt32(0, uint32(spawnTime));
1202 stmt->setUInt32(1, guidLow);
1203
1204 WorldDatabase.Execute(stmt);
1205
1206 creature->SetRespawnDelay((uint32)spawnTime);
1207 handler->PSendSysMessage(LANG_COMMAND_SPAWNTIME, spawnTime);
1208
1209 return true;
1210 }
1211
1212 static bool HandleNpcSayCommand(ChatHandler* handler, char const* args)
1213 {
1214 if (!*args)
1215 return false;
1216
1217 Creature* creature = handler->getSelectedCreature();
1218 if (!creature)
1219 {
1221 handler->SetSentErrorMessage(true);
1222 return false;
1223 }
1224
1225 creature->MonsterSay(args, Language::LANG_UNIVERSAL, NULL);
1226
1227 // make some emotes
1228 char lastchar = args[strlen(args) - 1];
1229 switch (lastchar)
1230 {
1231 case '?': creature->HandleEmoteCommand(EMOTE_ONESHOT_QUESTION); break;
1232 case '!': creature->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); break;
1233 default: creature->HandleEmoteCommand(EMOTE_ONESHOT_TALK); break;
1234 }
1235
1236 return true;
1237 }
1238
1239 //show text emote by creature in chat
1240 static bool HandleNpcTextEmoteCommand(ChatHandler* handler, char const* args)
1241 {
1242 if (!*args)
1243 return false;
1244
1245 Creature* creature = handler->getSelectedCreature();
1246
1247 if (!creature)
1248 {
1250 handler->SetSentErrorMessage(true);
1251 return false;
1252 }
1253
1254 creature->MonsterTextEmote(args, 0);
1255
1256 return true;
1257 }
1258
1259 //npc unfollow handling
1260 static bool HandleNpcUnFollowCommand(ChatHandler* handler, char const* /*args*/)
1261 {
1262 Player* player = handler->GetSession()->GetPlayer();
1263 Creature* creature = handler->getSelectedCreature();
1264
1265 if (!creature)
1266 {
1268 handler->SetSentErrorMessage(true);
1269 return false;
1270 }
1271
1272 if (/*creature->GetMotionMaster()->empty() ||*/
1274 {
1275 handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str());
1276 handler->SetSentErrorMessage(true);
1277 return false;
1278 }
1279
1280 FollowMovementGenerator<Creature> const* mgen = static_cast<FollowMovementGenerator<Creature> const*>((creature->GetMotionMaster()->top()));
1281
1282 if (mgen->GetTarget() != player)
1283 {
1284 handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU, creature->GetName().c_str());
1285 handler->SetSentErrorMessage(true);
1286 return false;
1287 }
1288
1289 // reset movement
1290 creature->GetMotionMaster()->MovementExpired(true);
1291
1292 handler->PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU_NOW, creature->GetName().c_str());
1293 return true;
1294 }
1295
1296 // make npc whisper to player
1297 static bool HandleNpcWhisperCommand(ChatHandler* handler, char const* args)
1298 {
1299 if (!*args)
1300 return false;
1301
1302 char* receiver_str = strtok((char*)args, " ");
1303 char* text = strtok(NULL, "");
1304
1305 Creature* creature = handler->getSelectedCreature();
1306 if (!creature || !receiver_str || !text)
1307 return false;
1308
1309 uint64 receiver_guid = atol(receiver_str);
1310
1311 // check online security
1312 Player* receiver = ObjectAccessor::FindPlayer(receiver_guid);
1313 if (handler->HasLowerSecurity(receiver, 0))
1314 return false;
1315
1316 creature->MonsterWhisper(text, receiver);
1317 return true;
1318 }
1319
1320 static bool HandleNpcYellCommand(ChatHandler* handler, char const* args)
1321 {
1322 if (!*args)
1323 return false;
1324
1325 Creature* creature = handler->getSelectedCreature();
1326 if (!creature)
1327 {
1329 handler->SetSentErrorMessage(true);
1330 return false;
1331 }
1332
1333 creature->MonsterYell(args, Language::LANG_UNIVERSAL, NULL);
1334
1335 // make an emote
1337
1338 return true;
1339 }
1340
1341 // add creature, temp only
1342 static bool HandleNpcAddTempSpawnCommand(ChatHandler* handler, char const* args)
1343 {
1344 if (!*args)
1345 return false;
1346
1347 char* charID = handler->extractKeyFromLink((char*)args, "Hcreature_entry");
1348 if (!charID)
1349 return false;
1350
1351 Player* chr = handler->GetSession()->GetPlayer();
1352
1353 uint32 id = atoi(charID);
1354 if (!id)
1355 return false;
1356
1357 if (!sObjectMgr->GetCreatureTemplate(id))
1358 return false;
1359
1361
1362 return true;
1363 }
1364
1365 //npc tame handling
1366 static bool HandleNpcTameCommand(ChatHandler* handler, char const* /*args*/)
1367 {
1368 Creature* creatureTarget = handler->getSelectedCreature();
1369 if (!creatureTarget || creatureTarget->IsPet())
1370 {
1372 handler->SetSentErrorMessage(true);
1373 return false;
1374 }
1375
1376 Player* player = handler->GetSession()->GetPlayer();
1377
1378 if (player->GetPetGUID())
1379 {
1381 handler->SetSentErrorMessage(true);
1382 return false;
1383 }
1384
1385 CreatureTemplate const* cInfo = creatureTarget->GetCreatureTemplate();
1386
1387 if (!cInfo->IsTameable(player->CanTameExoticPets()))
1388 {
1390 handler->SetSentErrorMessage(true);
1391 return false;
1392 }
1393
1394 // Everything looks OK, create new pet
1395 Pet* pet = player->CreateTamedPetFrom(creatureTarget);
1396 if (!pet)
1397 {
1399 handler->SetSentErrorMessage(true);
1400 return false;
1401 }
1402
1403 // place pet before player
1404 float x, y, z;
1405 player->GetClosePoint(x, y, z, creatureTarget->GetObjectSize(), CONTACT_DISTANCE);
1406 pet->Relocate(x, y, z, M_PI - player->GetOrientation());
1407
1408 // set pet to defensive mode by default (some classes can't control controlled pets in fact).
1410
1411 // calculate proper level
1412 uint8 level = (creatureTarget->getLevel() < (player->getLevel() - 5)) ? (player->getLevel() - 5) : creatureTarget->getLevel();
1413
1414 // prepare visual effect for levelup
1415 pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
1416
1417 // add to world
1418 pet->GetMap()->AddToMap(pet->ToCreature());
1419
1420 // visual effect for levelup
1421 pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
1422
1423 // caster have pet now
1424 player->SetMinion(pet, true);
1425
1427 player->PetSpellInitialize();
1428
1429 return true;
1430 }
1431
1432 static bool HandleNpcAddFormationCommand(ChatHandler* handler, char const* args)
1433 {
1434 if (!*args)
1435 return false;
1436
1437 uint32 leaderGUID = (uint32)atoi((char*)args);
1438 Creature* creature = handler->getSelectedCreature();
1439
1440 if (!creature || !creature->GetDBTableGUIDLow())
1441 {
1443 handler->SetSentErrorMessage(true);
1444 return false;
1445 }
1446
1447 uint32 lowguid = creature->GetDBTableGUIDLow();
1448 if (creature->GetFormation())
1449 {
1450 handler->PSendSysMessage("Selected creature is already member of group %u", creature->GetFormation()->GetId());
1451 return false;
1452 }
1453
1454 if (!lowguid)
1455 return false;
1456
1457 Player* chr = handler->GetSession()->GetPlayer();
1458 FormationInfo* group_member;
1459
1460 group_member = new FormationInfo;
1461 group_member->follow_angle = (creature->GetAngle(chr) - chr->GetOrientation()) * 180 / M_PI;
1462 group_member->follow_dist = sqrtf(pow(chr->GetPositionX() - creature->GetPositionX(), int(2)) + pow(chr->GetPositionY() - creature->GetPositionY(), int(2)));
1463 group_member->leaderGUID = leaderGUID;
1464 group_member->groupAI = 0;
1465
1466 sFormationMgr->CreatureGroupMap[lowguid] = group_member;
1467 creature->SearchFormation();
1468
1469 PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_INS_CREATURE_FORMATION);
1470
1471 stmt->setUInt32(0, leaderGUID);
1472 stmt->setUInt32(1, lowguid);
1473 stmt->setFloat(2, group_member->follow_dist);
1474 stmt->setFloat(3, group_member->follow_angle);
1475 stmt->setUInt32(4, uint32(group_member->groupAI));
1476
1477 WorldDatabase.Execute(stmt);
1478
1479 handler->PSendSysMessage("Creature %u added to formation with leader %u", lowguid, leaderGUID);
1480
1481 return true;
1482 }
1483
1484 static bool HandleNpcSetLinkCommand(ChatHandler* handler, char const* args)
1485 {
1486 if (!*args)
1487 return false;
1488
1489 uint32 linkguid = (uint32)atoi((char*)args);
1490
1491 Creature* creature = handler->getSelectedCreature();
1492
1493 if (!creature)
1494 {
1496 handler->SetSentErrorMessage(true);
1497 return false;
1498 }
1499
1500 if (!creature->GetDBTableGUIDLow())
1501 {
1502 handler->PSendSysMessage("Selected creature %u isn't in creature table", creature->GetGUIDLow());
1503 handler->SetSentErrorMessage(true);
1504 return false;
1505 }
1506
1507 if (!sObjectMgr->SetCreatureLinkedRespawn(creature->GetDBTableGUIDLow(), linkguid))
1508 {
1509 handler->PSendSysMessage("Selected creature can't link with guid '%u'", linkguid);
1510 handler->SetSentErrorMessage(true);
1511 return false;
1512 }
1513
1514 handler->PSendSysMessage("LinkGUID '%u' added to creature with DBTableGUID: '%u'", linkguid, creature->GetDBTableGUIDLow());
1515 return true;
1516 }
1517
1519 static bool HandleNpcAddWeaponCommand(ChatHandler* /*handler*/, char const* /*args*/)
1520 {
1521 /*if (!*args)
1522 return false;
1523
1524 uint64 guid = handler->GetSession()->GetPlayer()->GetSelection();
1525 if (guid == 0)
1526 {
1527 handler->SendSysMessage(LANG_NO_SELECTION);
1528 return true;
1529 }
1530
1531 Creature* creature = ObjectAccessor::GetCreature(*handler->GetSession()->GetPlayer(), guid);
1532
1533 if (!creature)
1534 {
1535 handler->SendSysMessage(LANG_SELECT_CREATURE);
1536 return true;
1537 }
1538
1539 char* pSlotID = strtok((char*)args, " ");
1540 if (!pSlotID)
1541 return false;
1542
1543 char* pItemID = strtok(NULL, " ");
1544 if (!pItemID)
1545 return false;
1546
1547 uint32 ItemID = atoi(pItemID);
1548 uint32 SlotID = atoi(pSlotID);
1549
1550 ItemTemplate* tmpItem = sObjectMgr->GetItemTemplate(ItemID);
1551
1552 bool added = false;
1553 if (tmpItem)
1554 {
1555 switch (SlotID)
1556 {
1557 case 1:
1558 creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, ItemID);
1559 added = true;
1560 break;
1561 case 2:
1562 creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY_01, ItemID);
1563 added = true;
1564 break;
1565 case 3:
1566 creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY_02, ItemID);
1567 added = true;
1568 break;
1569 default:
1570 handler->PSendSysMessage(LANG_ITEM_SLOT_NOT_EXIST, SlotID);
1571 added = false;
1572 break;
1573 }
1574
1575 if (added)
1576 handler->PSendSysMessage(LANG_ITEM_ADDED_TO_SLOT, ItemID, tmpItem->Name1, SlotID);
1577 }
1578 else
1579 {
1580 handler->PSendSysMessage(LANG_ITEM_NOT_FOUND, ItemID);
1581 return true;
1582 }
1583 */
1584 return true;
1585 }
1586
1587 static bool HandleNpcSetNameCommand(ChatHandler* /*handler*/, char const* /*args*/)
1588 {
1589 /* Temp. disabled
1590 if (!*args)
1591 return false;
1592
1593 if (strlen((char*)args)>75)
1594 {
1595 handler->PSendSysMessage(LANG_TOO_LONG_NAME, strlen((char*)args)-75);
1596 return true;
1597 }
1598
1599 for (uint8 i = 0; i < strlen(args); ++i)
1600 {
1601 if (!isalpha(args[i]) && args[i] != ' ')
1602 {
1603 handler->SendSysMessage(LANG_CHARS_ONLY);
1604 return false;
1605 }
1606 }
1607
1608 uint64 guid;
1609 guid = handler->GetSession()->GetPlayer()->GetSelection();
1610 if (guid == 0)
1611 {
1612 handler->SendSysMessage(LANG_NO_SELECTION);
1613 return true;
1614 }
1615
1616 Creature* creature = ObjectAccessor::GetCreature(*handler->GetSession()->GetPlayer(), guid);
1617
1618 if (!creature)
1619 {
1620 handler->SendSysMessage(LANG_SELECT_CREATURE);
1621 return true;
1622 }
1623
1624 creature->SetName(args);
1625 uint32 idname = sObjectMgr->AddCreatureTemplate(creature->GetName());
1626 creature->SetUInt32Value(OBJECT_FIELD_ENTRY_ID, idname);
1627
1628 creature->SaveToDB();
1629 */
1630
1631 return true;
1632 }
1633
1634 static bool HandleNpcSetSubNameCommand(ChatHandler* /*handler*/, char const* /*args*/)
1635 {
1636 /* Temp. disabled
1637
1638 if (!*args)
1639 args = "";
1640
1641 if (strlen((char*)args)>75)
1642 {
1643 handler->PSendSysMessage(LANG_TOO_LONG_SUBNAME, strlen((char*)args)-75);
1644 return true;
1645 }
1646
1647 for (uint8 i = 0; i < strlen(args); i++)
1648 {
1649 if (!isalpha(args[i]) && args[i] != ' ')
1650 {
1651 handler->SendSysMessage(LANG_CHARS_ONLY);
1652 return false;
1653 }
1654 }
1655 uint64 guid;
1656 guid = handler->GetSession()->GetPlayer()->GetSelection();
1657 if (guid == 0)
1658 {
1659 handler->SendSysMessage(LANG_NO_SELECTION);
1660 return true;
1661 }
1662
1663 Creature* creature = ObjectAccessor::GetCreature(*handler->GetSession()->GetPlayer(), guid);
1664
1665 if (!creature)
1666 {
1667 handler->SendSysMessage(LANG_SELECT_CREATURE);
1668 return true;
1669 }
1670
1671 uint32 idname = sObjectMgr->AddCreatureSubName(creature->GetName(), args, creature->GetUInt32Value(UNIT_FIELD_DISPLAY_ID));
1672 creature->SetUInt32Value(OBJECT_FIELD_ENTRY_ID, idname);
1673
1674 creature->SaveToDB();
1675 */
1676 return true;
1677 }
1678};
1679
1681{
1682 new npc_commandscript();
1683}
#define M_PI
Definition Common.h:192
#define sFormationMgr
std::set< uint32 > const & GetPhasesForGroup(uint32 group)
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
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
std::int64_t int64
Definition Define.h:72
std::uint16_t uint16
Definition Define.h:78
@ LANG_NPCINFO_EQUIPMENT
Definition Language.h:1104
@ LANG_NPC_SETDATA
Definition Language.h:553
@ LANG_NPCINFO_BMAUCTIONEER
Definition Language.h:796
@ LANG_NPCINFO_INNKEEPER
Definition Language.h:780
@ LANG_NPCINFO_VENDOR_REAGENT
Definition Language.h:775
@ LANG_SELECT_CREATURE
Definition Language.h:13
@ LANG_NPCINFO_VAULTKEEPER
Definition Language.h:794
@ LANG_NPCINFO_TRAINER_PROFESSION
Definition Language.h:771
@ LANG_NPCINFO_GOSSIP
Definition Language.h:768
@ LANG_CREATURE_NON_TAMEABLE
Definition Language.h:350
@ LANG_CREATURE_NOT_FOLLOW_YOU
Definition Language.h:348
@ LANG_ERROR
Definition Language.h:59
@ LANG_NPCINFO_TRAINER
Definition Language.h:541
@ LANG_NPCINFO_QUESTGIVER
Definition Language.h:769
@ LANG_CREATURE_FOLLOW_YOU_NOW
Definition Language.h:347
@ LANG_NPCINFO_VENDOR_AMMO
Definition Language.h:772
@ LANG_YOU_ALREADY_HAVE_PET
Definition Language.h:351
@ LANG_NPCINFO_GUILD_BANKER
Definition Language.h:787
@ LANG_WAYPOINT_ADDED
Definition Language.h:237
@ LANG_NPCINFO_LOOT
Definition Language.h:538
@ LANG_NPCINFO_VENDOR
Definition Language.h:540
@ LANG_CREATURE_MOVE_ENABLED
Definition Language.h:379
@ LANG_NPCINFO_POSITION
Definition Language.h:539
@ LANG_NPCINFO_UNIT_FIELD_FLAGS
Definition Language.h:1106
@ LANG_COMMAND_SPAWNDIST
Definition Language.h:302
@ LANG_VALUE_SAVED_REJOIN
Definition Language.h:267
@ LANG_COMMAND_CREATUREMOVED
Definition Language.h:278
@ LANG_MOVE_TYPE_SET
Definition Language.h:263
@ LANG_NPCINFO_AIINFO
Definition Language.h:1099
@ LANG_COMMAND_DELCREATMESSAGE
Definition Language.h:277
@ LANG_CREATURE_NOT_FOLLOW_YOU_NOW
Definition Language.h:349
@ LANG_WRONG_FACTION
Definition Language.h:133
@ LANG_NPCINFO_TABARDDESIGNER
Definition Language.h:783
@ LANG_COMMAND_CREATUREATSAMEMAP
Definition Language.h:279
@ LANG_NPCINFO_FLIGHTMASTER
Definition Language.h:777
@ LANG_COMMAND_NEAR_NPC_MESSAGE
Old ones now free:
Definition Language.h:556
@ LANG_NPCINFO_SPIRITGUIDE
Definition Language.h:779
@ LANG_NPCINFO_TRANSMOGRIFIER
Definition Language.h:793
@ LANG_NPCINFO_VENDOR_POISON
Definition Language.h:774
@ LANG_COMMAND_NEEDITEMSEND
Definition Language.h:286
@ LANG_NPCINFO_HEALTH
Definition Language.h:536
@ LANG_NPCINFO_TRAINER_CLASS
Definition Language.h:770
@ LANG_COMMAND_VENDORSELECTION
Definition Language.h:285
@ LANG_CREATURE_MOVE_DISABLED
Definition Language.h:378
@ LANG_ITEM_ADDED_TO_LIST
Definition Language.h:206
@ LANG_NPCINFO_AUCTIONEER
Definition Language.h:785
@ LANG_NPCINFO_VENDOR_FOOD
Definition Language.h:773
@ LANG_NPCINFO_BANKER
Definition Language.h:781
@ LANG_COMMAND_SPAWNTIME
Definition Language.h:303
@ LANG_NPCINFO_PETITIONER
Definition Language.h:782
@ LANG_NPCINFO_CHAR
Definition Language.h:534
@ LANG_NPCINFO_BATTLEMASTER
Definition Language.h:784
@ LANG_NPCINFO_SPELLCLICK
Definition Language.h:788
@ LANG_ITEM_DELETED_FROM_LIST
Definition Language.h:208
@ LANG_MOVE_TYPE_SET_NODEL
Definition Language.h:264
@ LANG_NPCINFO_STABLEMASTER
Definition Language.h:786
@ LANG_NPCINFO_PHASEMASK
Definition Language.h:1088
@ LANG_COMMAND_CREATGUIDNOTFOUND
Definition Language.h:294
@ LANG_NPCINFO_REFORGER
Definition Language.h:792
@ LANG_BAD_VALUE
Definition Language.h:117
@ LANG_NPCINFO_LEVEL
Definition Language.h:535
@ LANG_NPCINFO_PLAYER_VEHICLE
Definition Language.h:790
@ LANG_ITEM_NOT_IN_LIST
Definition Language.h:209
@ LANG_NPCINFO_WILDPET_CAPTURABLE
Definition Language.h:795
@ LANG_DONE
Definition Language.h:56
@ LANG_CREATURE_LIST_CHAT
Definition Language.h:506
@ LANG_NPCINFO_FLAGS2
Definition Language.h:537
@ LANG_COMMAND_RAWPAWNTIMES
Definition Language.h:586
@ LANG_NPCINFO_ARMOR
Definition Language.h:1089
@ LANG_NPCINFO_SPIRITHEALER
Definition Language.h:778
@ LANG_NPCINFO_DUNGEON_ID
Definition Language.h:542
@ LANG_NPCINFO_REPAIR
Definition Language.h:776
@ LANG_NPCINFO_MECHANIC_IMMUNE
Definition Language.h:1105
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
MovementGeneratorType
@ IDLE_MOTION_TYPE
@ WAYPOINT_MOTION_TYPE
@ FOLLOW_MOTION_TYPE
@ RANDOM_MOTION_TYPE
@ TYPEID_UNIT
Definition Object.h:54
@ TEMPSUMMON_CORPSE_DESPAWN
Definition Object.h:72
#define CONTACT_DISTANCE
Definition Object.h:20
@ HIGHGUID_UNIT
uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h)
#define sObjectMgr
Definition ObjectMgr.h:1617
@ PET_SAVE_AS_CURRENT
Definition PetDefines.h:22
#define PET_FOLLOW_DIST
Definition PetDefines.h:57
@ HUNTER_PET
Definition PetDefines.h:12
Skyfire::AutoPtr< PreparedResultSet, Skyfire::Mutex > PreparedQueryResult
Definition QueryResult.h:94
@ EMOTE_ONESHOT_EXCLAMATION
@ EMOTE_ONESHOT_QUESTION
@ EMOTE_ONESHOT_SHOUT
@ EMOTE_ONESHOT_TALK
@ MECHANIC_SLOW_ATTACK
@ MECHANIC_DISARM
@ MECHANIC_NONE
@ MECHANIC_ENRAGED
@ MECHANIC_MOUNT
@ MECHANIC_FEAR
@ MECHANIC_INVULNERABILITY
@ MECHANIC_DISORIENTED
@ MECHANIC_KNOCKOUT
@ MECHANIC_CHARM
@ MECHANIC_TURN
@ MECHANIC_STUN
@ MECHANIC_FREEZE
@ MECHANIC_INTERRUPT
@ MECHANIC_ROOT
@ MECHANIC_BANDAGE
@ MECHANIC_GRIP
@ MECHANIC_WOUNDED
@ MECHANIC_SLEEP
@ MECHANIC_BLEED
@ MECHANIC_POLYMORPH
@ MECHANIC_BANISH
@ MAX_MECHANIC
@ MECHANIC_DAZE
@ MECHANIC_IMMUNE_SHIELD
@ MECHANIC_SNARE
@ MECHANIC_SILENCE
@ MECHANIC_SHACKLE
@ MECHANIC_SAPPED
@ MECHANIC_DISTRACT
@ MECHANIC_DISCOVERY
@ MECHANIC_SHIELD
@ MECHANIC_HORROR
@ MECHANIC_INFECTED
@ UNIT_NPC_FLAG_REFORGER
Definition Unit.h:713
@ UNIT_NPC_FLAG_WILDPET_CAPTURABLE
Definition Unit.h:716
@ UNIT_NPC_FLAG_VENDOR_AMMO
Definition Unit.h:695
@ UNIT_NPC_FLAG_TABARDDESIGNER
Definition Unit.h:706
@ UNIT_NPC_FLAG_BANKER
Definition Unit.h:704
@ UNIT_NPC_FLAG_AUCTIONEER
Definition Unit.h:708
@ UNIT_NPC_FLAG_VENDOR_POISON
Definition Unit.h:697
@ UNIT_NPC_FLAG_GUILD_BANKER
Definition Unit.h:710
@ UNIT_NPC_FLAG_VENDOR
Definition Unit.h:694
@ UNIT_NPC_FLAG_STABLEMASTER
Definition Unit.h:709
@ UNIT_NPC_FLAG_VENDOR_REAGENT
Definition Unit.h:698
@ UNIT_NPC_FLAG_GOSSIP
Definition Unit.h:687
@ UNIT_NPC_FLAG_BATTLEMASTER
Definition Unit.h:707
@ UNIT_NPC_FLAG_VENDOR_FOOD
Definition Unit.h:696
@ UNIT_NPC_FLAG_QUESTGIVER
Definition Unit.h:688
@ UNIT_NPC_FLAG_INNKEEPER
Definition Unit.h:703
@ UNIT_NPC_FLAG_SPELLCLICK
Definition Unit.h:711
@ UNIT_NPC_FLAG_TRANSMOGRIFIER
Definition Unit.h:714
@ UNIT_NPC_FLAG_PLAYER_VEHICLE
Definition Unit.h:712
@ UNIT_NPC_FLAG_BMAH
Definition Unit.h:717
@ UNIT_NPC_FLAG_FLIGHTMASTER
Definition Unit.h:700
@ UNIT_NPC_FLAG_TRAINER_CLASS
Definition Unit.h:692
@ UNIT_NPC_FLAG_VAULTKEEPER
Definition Unit.h:715
@ UNIT_NPC_FLAG_TRAINER_PROFESSION
Definition Unit.h:693
@ UNIT_NPC_FLAG_REPAIR
Definition Unit.h:699
@ UNIT_NPC_FLAG_TRAINER
Definition Unit.h:691
@ UNIT_NPC_FLAG_PETITIONER
Definition Unit.h:705
@ UNIT_NPC_FLAG_SPIRITGUIDE
Definition Unit.h:702
@ UNIT_NPC_FLAG_SPIRITHEALER
Definition Unit.h:701
@ JUST_DIED
Definition Unit.h:504
@ REACT_DEFENSIVE
Definition Unit.h:1157
@ UNIT_FLAG_TAXI_FLIGHT
Definition Unit.h:645
@ UNIT_FLAG_STUNNED
Definition Unit.h:643
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ MAX_UNIT_FLAGS
Definition Unit.h:657
@ UNIT_FLAG_UNK_6
Definition Unit.h:631
@ UNIT_FLAG_IN_COMBAT
Definition Unit.h:644
@ UNIT_FLAG_PREPARATION
Definition Unit.h:630
@ UNIT_FLAG_IMMUNE_TO_NPC
Definition Unit.h:634
@ UNIT_FLAG_PVP
Definition Unit.h:637
@ UNIT_FLAG_DISABLE_POWERS
Definition Unit.h:654
@ UNIT_FLAG_SERVER_CONTROLLED
Definition Unit.h:625
@ UNIT_FLAG_UNK_31
Definition Unit.h:656
@ UNIT_FLAG_DISARMED
Definition Unit.h:646
@ UNIT_FLAG_PACIFIED
Definition Unit.h:642
@ UNIT_FLAG_PVP_ATTACKABLE
Definition Unit.h:628
@ UNIT_FLAG_CONFUSED
Definition Unit.h:647
@ UNIT_FLAG_DISABLE_MOVE
Definition Unit.h:627
@ UNIT_FLAG_FLEEING
Definition Unit.h:648
@ UNIT_FLAG_NOT_SELECTABLE
Definition Unit.h:650
@ UNIT_FLAG_RENAME
Definition Unit.h:629
@ UNIT_FLAG_LOOTING
Definition Unit.h:635
@ UNIT_FLAG_IMMUNE_TO_PC
Definition Unit.h:633
@ UNIT_FLAG_NOT_ATTACKABLE_1
Definition Unit.h:632
@ UNIT_FLAG_SILENCED
Definition Unit.h:638
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition Unit.h:649
@ UNIT_FLAG_SKINNABLE
Definition Unit.h:651
@ UNIT_FLAG_UNK_15
Definition Unit.h:640
@ UNIT_FLAG_UNK_16
Definition Unit.h:641
@ UNIT_FLAG_MOUNT
Definition Unit.h:652
@ UNIT_FLAG_PET_IN_COMBAT
Definition Unit.h:636
@ UNIT_FLAG_UNK_28
Definition Unit.h:653
@ UNIT_FLAG_UNK_14
Definition Unit.h:639
@ UNIT_FLAG_SHEATHE
Definition Unit.h:655
@ UNIT_FIELD_FLAGS2
@ UNIT_FIELD_PET_EXPERIENCE
@ UNIT_FIELD_LEVEL
@ UNIT_FIELD_NPC_FLAGS
@ UNIT_FIELD_FLAGS
@ UNIT_FIELD_PET_NEXT_LEVEL_EXPERIENCE
@ UNIT_FIELD_NPC_EMOTESTATE
@ OBJECT_FIELD_DYNAMIC_FLAGS
std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly)
Definition Util.cpp:127
@ WORLD_UPD_CREATURE_POSITION
@ WORLD_UPD_CREATURE_NPCFLAG
@ WORLD_SEL_CREATURE_NEAREST
@ WORLD_INS_CREATURE_FORMATION
@ WORLD_UPD_CREATURE_MOVEMENT_TYPE
@ WORLD_UPD_CREATURE_SPAWN_TIME_SECS
@ WORLD_UPD_CREATURE_SPAWN_DISTANCE
@ WORLD_UPD_CREATURE_FACTION
bool HasLowerSecurity(Player *target, uint64 guid, bool strong=false)
Definition Chat.cpp:78
Unit * getSelectedUnit()
Definition Chat.cpp:841
WorldSession * GetSession()
Definition Chat.h:43
Creature * getSelectedCreature()
Definition Chat.cpp:865
char * extractKeyFromLink(char *text, char const *linkType, char **something1=NULL)
Definition Chat.cpp:873
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
Definition Chat.cpp:221
void SetSentErrorMessage(bool val)
Definition Chat.h:114
virtual void SendSysMessage(const char *str)
Definition Chat.cpp:153
CommandScript(const char *name)
uint32 GetId() const
int8 GetOriginalEquipmentId() const
Definition Creature.h:512
void Respawn(bool force=false)
void SetRespawnRadius(float dist)
Definition Creature.h:606
uint32 GetDBTableGUIDLow() const
Definition Creature.h:445
bool UpdateEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData *data=NULL)
Definition Creature.cpp:356
virtual void DeleteFromDB()
uint32 GetWaypointPath() const
Definition Creature.h:636
void SetDisplayId(uint32 modelId) OVERRIDE
void SetReactState(ReactStates st)
Definition Creature.h:460
void SetRespawnDelay(uint32 delay)
Definition Creature.h:603
void SetPosition(float x, float y, float z, float o)
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:524
uint32 GetRespawnDelay() const
Definition Creature.h:602
std::string GetAIName() const
CreatureGroup * GetFormation()
Definition Creature.h:643
void SearchFormation()
Definition Creature.cpp:216
std::string GetScriptName() const
bool Create(uint32 guidlow, Map *map, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData *data=NULL)
Definition Creature.cpp:740
uint8 GetCurrentEquipmentId() const
Definition Creature.h:513
void SaveToDB()
Definition Creature.cpp:934
bool LoadCreatureFromDB(uint32 guid, Map *map, bool addToMap=true)
void setDeathState(DeathState s) OVERRIDE
time_t GetRespawnTimeEx() const
CreatureAI * AI() const
Definition Creature.h:483
void SetDefaultMovementType(MovementGeneratorType mgt)
Definition Creature.h:590
void LoadPath(uint32 pathid)
Definition Creature.h:637
Definition Field.h:16
uint16 GetUInt16() const
Definition Field.h:69
float GetFloat() const
Definition Field.h:177
uint32 GetUInt32() const
Definition Field.h:105
Definition Map.h:238
bool AddToMap(T *)
Definition Map.cpp:504
uint8 GetSpawnMode() const
Definition Map.h:358
Creature * GetCreature(uint64 guid)
Definition Map.cpp:3179
uint32 GetId(void) const
Definition Map.h:300
MovementGeneratorType GetCurrentMovementGeneratorType() const
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE)
void MovementExpired(bool reset=true)
static Player * FindPlayer(uint64)
uint64 GetGUID() const
Definition Object.h:119
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:325
uint32 GetGUIDLow() const
Definition Object.h:120
TypeID GetTypeId() const
Definition Object.h:131
uint32 GetEntry() const
Definition Object.h:125
Creature * ToCreature()
Definition Object.h:207
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:1038
Definition Pet.h:28
void SavePetToDB(PetSaveMode mode)
Definition Pet.cpp:365
bool CanTameExoticPets() const
Definition Player.h:2624
void PetSpellInitialize()
Definition Player.cpp:15884
void setFloat(const uint8 index, const float value)
void setUInt16(const uint8 index, const uint16 value)
void setUInt32(const uint8 index, const uint32 value)
void setUInt8(const uint8 index, const uint8 value)
virtual void SetData(uint32, uint32)
Definition UnitAI.h:128
Definition Unit.h:1367
void SetMinion(Minion *minion, bool apply)
Definition Unit.cpp:2432
void setFaction(uint32 faction)
Definition Unit.h:1699
void CombatStop(bool includingCast=false)
void ClearPhases(bool update=false)
Definition Unit.cpp:7511
void UpdateObjectVisibility(bool forced=true) override
Definition Unit.cpp:7567
uint32 getFaction() const
Definition Unit.h:1695
bool SetPhased(uint32 id, bool update, bool apply) OVERRIDE
Definition Unit.cpp:7516
Pet * CreateTamedPetFrom(Creature *creatureTarget, uint32 spell_id=0)
Definition Unit.cpp:6255
MotionMaster * GetMotionMaster()
Definition Unit.h:2605
uint64 GetPetGUID() const
Definition Unit.h:2087
bool IsPet() const
Definition Unit.h:1511
uint32 GetMaxHealth() const
Definition Unit.h:1604
bool IsAlive() const
Definition Unit.h:2032
void SetHealth(uint32 val)
Definition Unit.cpp:5162
uint32 GetDisplayId() const
Definition Unit.h:2490
uint32 GetNativeDisplayId() const
Definition Unit.h:2495
uint32 GetHealth() const
Definition Unit.h:1600
uint32 GetCreateHealth() const
Definition Unit.h:2321
void SetNativeDisplayId(uint32 modelId)
Definition Unit.h:2500
uint32 GetArmor() const
Definition Unit.h:1581
virtual float GetFollowAngle() const
Definition Unit.h:2788
void HandleEmoteCommand(uint32 anim_id)
void SetMaxHealth(uint32 val)
Definition Unit.cpp:5206
bool IsVendor() const
Definition Unit.h:1825
uint8 getLevel() const
Definition Unit.h:1528
void SetLevel(uint8 lvl)
Definition Unit.cpp:5150
bool IsTotem() const
Definition Unit.h:1519
uint32 GetMapId() const
Definition Object.h:546
uint32 GetPhaseMask() const
Definition Object.h:643
Map * GetMap() const
Definition Object.h:740
std::set< uint32 > const & GetPhases() const
Definition Object.h:647
float GetTransOffsetX() const
Definition Object.h:798
uint32 GetInstanceId() const
Definition Object.h:638
float GetTransOffsetY() const
Definition Object.h:799
std::string const & GetName() const
Definition Object.h:664
float GetTransOffsetZ() const
Definition Object.h:800
void AddObjectToRemoveList()
Definition Object.cpp:2550
Transport * GetTransport() const
Definition Object.h:797
void MonsterWhisper(const char *text, Player const *target, bool IsBossWhisper=false)
Definition Object.cpp:2461
void MonsterSay(const char *text, Language language, WorldObject const *target)
Definition Object.cpp:2383
void MonsterTextEmote(const char *text, WorldObject const *target, bool IsBossEmote=false)
Definition Object.cpp:2440
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float angle=0) const
Definition Object.cpp:3070
void MonsterYell(const char *text, Language language, WorldObject const *target)
Definition Object.cpp:2411
float GetTransOffsetO() const
Definition Object.h:801
float GetObjectSize() const
Definition Object.cpp:3100
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TempSummonType::TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition Object.cpp:2703
Player * GetPlayer() const
static bool HandleNpcTextEmoteCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:1240
static bool HandleNpcNearCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:749
static bool HandleNpcAddFormationCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:1432
static bool HandleNpcAddMoveCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:339
static bool HandleNpcSetFactionIdCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:561
static bool HandleNpcSetSpawnTimeCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:1172
static bool HandleNpcAddCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:209
std::vector< ChatCommand > GetCommands() const OVERRIDE
Definition cs_npc.cpp:146
static bool HandleNpcSetSubNameCommand(ChatHandler *, char const *)
Definition cs_npc.cpp:1634
static bool HandleNpcWhisperCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:1297
static bool HandleNpcSetLinkCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:1484
static bool HandleNpcTameCommand(ChatHandler *handler, char const *)
Definition cs_npc.cpp:1366
static bool HandleNpcSetMoveTypeCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:937
static bool HandleNpcSetPhaseCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:1102
static bool HandleNpcFollowCommand(ChatHandler *handler, char const *)
Definition cs_npc.cpp:672
static bool HandleNpcAddVendorItemCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:281
static bool HandleNpcSetLevelCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:443
static bool HandleNpcSetEntryCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:418
static bool HandleNpcInfoCommand(ChatHandler *handler, char const *)
Definition cs_npc.cpp:691
static bool HandleNpcSetDataCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:639
static bool HandleNpcYellCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:1320
static bool HandleNpcMoveCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:795
static bool HandleNpcSetNameCommand(ChatHandler *, char const *)
Definition cs_npc.cpp:1587
static bool HandleNpcSetSpawnDistCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:1126
static bool HandleNpcSetModelCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:901
static bool HandleNpcAddWeaponCommand(ChatHandler *, char const *)
Definition cs_npc.cpp:1519
static bool HandleNpcUnFollowCommand(ChatHandler *handler, char const *)
Definition cs_npc.cpp:1260
static bool HandleNpcSetPhaseGroup(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:1073
static bool HandleNpcAddTempSpawnCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:1342
static bool HandleNpcSetAllowMovementCommand(ChatHandler *handler, char const *)
Definition cs_npc.cpp:403
static bool HandleNpcSetFlagCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:608
static bool HandleNpcPlayEmoteCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:883
static bool HandleNpcSayCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:1212
static bool HandleNpcDeleteCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:484
static bool HandleNpcDeleteVendorItemCommand(ChatHandler *handler, char const *args)
Definition cs_npc.cpp:523
EnumName< NPCFlags, int32 > const npcFlagTexts[NPCFLAG_COUNT]
Definition cs_npc.cpp:35
EnumName< UnitFlags > const unitFlags[MAX_UNIT_FLAGS]
Definition cs_npc.cpp:105
#define CREATE_NAMED_ENUM(VALUE)
Definition cs_npc.cpp:31
void AddSC_npc_commandscript()
Definition cs_npc.cpp:1680
#define NPCFLAG_COUNT
Definition cs_npc.cpp:33
EnumName< Mechanics > const mechanicImmunes[MAX_MECHANIC]
Definition cs_npc.cpp:68
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition Main.cpp:40
#define sWorld
Definition World.h:910
@ CONFIG_MAX_PLAYER_LEVEL
Definition World.h:224
@ RBAC_PERM_COMMAND_NPC_SET_LEVEL
Definition RBAC.h:473
@ RBAC_PERM_COMMAND_NPC_PLAYEMOTE
Definition RBAC.h:484
@ RBAC_PERM_COMMAND_NPC_FOLLOW
Definition RBAC.h:466
@ RBAC_PERM_COMMAND_NPC_INFO
Definition RBAC.h:481
@ RBAC_PERM_COMMAND_NPC_TEXTEMOTE
Definition RBAC.h:486
@ RBAC_PERM_COMMAND_NPC_ADD_FORMATION
Definition RBAC.h:460
@ RBAC_PERM_COMMAND_NPC_ADD
Definition RBAC.h:459
@ RBAC_PERM_COMMAND_NPC_SET
Definition RBAC.h:468
@ RBAC_PERM_COMMAND_NPC_NEAR
Definition RBAC.h:482
@ RBAC_PERM_COMMAND_NPC_SET_SPAWNDIST
Definition RBAC.h:478
@ RBAC_PERM_COMMAND_NPC_SET_PHASE
Definition RBAC.h:477
@ RBAC_PERM_COMMAND_NPC_DELETE
Definition RBAC.h:464
@ RBAC_PERM_COMMAND_NPC_SET_ENTRY
Definition RBAC.h:470
@ RBAC_PERM_COMMAND_NPC_TAME
Definition RBAC.h:489
@ RBAC_PERM_COMMAND_NPC_MOVE
Definition RBAC.h:483
@ RBAC_PERM_COMMAND_NPC_ADD_ITEM
Definition RBAC.h:461
@ RBAC_PERM_COMMAND_NPC_SET_SPAWNTIME
Definition RBAC.h:479
@ RBAC_PERM_COMMAND_NPC
Definition RBAC.h:458
@ RBAC_PERM_COMMAND_NPC_SET_FACTIONID
Definition RBAC.h:471
@ RBAC_PERM_COMMAND_NPC_SET_MOVETYPE
Definition RBAC.h:476
@ RBAC_PERM_COMMAND_NPC_SET_DATA
Definition RBAC.h:480
@ RBAC_PERM_COMMAND_NPC_SET_ALLOWMOVE
Definition RBAC.h:469
@ RBAC_PERM_COMMAND_NPC_SET_MODEL
Definition RBAC.h:475
@ RBAC_PERM_COMMAND_NPC_ADD_MOVE
Definition RBAC.h:462
@ RBAC_PERM_COMMAND_NPC_SET_LINK
Definition RBAC.h:474
@ RBAC_PERM_COMMAND_NPC_FOLLOW_STOP
Definition RBAC.h:467
@ RBAC_PERM_COMMAND_NPC_WHISPER
Definition RBAC.h:487
@ RBAC_PERM_COMMAND_NPC_SET_FLAG
Definition RBAC.h:472
@ RBAC_PERM_COMMAND_NPC_YELL
Definition RBAC.h:488
@ RBAC_PERM_COMMAND_NPC_SAY
Definition RBAC.h:485
@ RBAC_PERM_COMMAND_NPC_ADD_TEMP
Definition RBAC.h:463
@ RBAC_PERM_COMMAND_NPC_DELETE_ITEM
Definition RBAC.h:465
uint32 id
Definition Creature.h:260
float orientation
Definition Creature.h:269
uint16 mapid
Definition Creature.h:261
uint32 SkinLootId
Definition Creature.h:109
uint32 MechanicImmuneMask
Definition Creature.h:128
std::string Name
Definition Creature.h:71
uint32 pickpocketLootId
Definition Creature.h:108
bool IsTameable(bool canTameExotic) const
Definition Creature.h:153
std::string Name1
float GetAngle(Position const *pos) const
Definition Object.cpp:1860
float GetPositionZ() const
Definition Object.h:330
float GetOrientation() const
Definition Object.h:331
float GetPositionX() const
Definition Object.h:328
float GetPositionY() const
Definition Object.h:329
void Relocate(float x, float y)
Definition Object.h:302