TrinityCore
Loading...
Searching...
No Matches
npc_commandscript Class Reference
+ Inheritance diagram for npc_commandscript:

Public Member Functions

 npc_commandscript ()
 
ChatCommandTable GetCommands () const override
 
- Public Member Functions inherited from ScriptObject
std::string const & GetName () const
 

Static Public Member Functions

static bool HandleNpcAddCommand (ChatHandler *handler, CreatureEntry id)
 
static bool HandleNpcAddVendorItemCommand (ChatHandler *handler, ItemTemplate const *item, Optional< uint32 > mc, Optional< uint32 > it, Optional< uint32 > ec)
 
static bool HandleNpcAddMoveCommand (ChatHandler *handler, CreatureSpawnId lowGuid)
 
static bool HandleNpcSetAllowMovementCommand (ChatHandler *handler)
 
static bool HandleNpcSetEntryCommand (ChatHandler *handler, CreatureEntry newEntryNum)
 
static bool HandleNpcSetLevelCommand (ChatHandler *handler, uint8 lvl)
 
static bool HandleNpcDeleteCommand (ChatHandler *handler, Optional< CreatureSpawnId > spawnIdArg)
 
static bool HandleNpcDeleteVendorItemCommand (ChatHandler *handler, ItemTemplate const *item)
 
static bool HandleNpcSetFactionIdCommand (ChatHandler *handler, uint32 factionId)
 
static bool HandleNpcSetFlagCommand (ChatHandler *handler, NPCFlags npcFlags)
 
static bool HandleNpcSetDataCommand (ChatHandler *handler, uint32 data_1, uint32 data_2)
 
static bool HandleNpcFollowCommand (ChatHandler *handler)
 
static bool HandleNpcInfoCommand (ChatHandler *handler)
 
static bool HandleNpcNearCommand (ChatHandler *handler, Optional< float > dist)
 
static bool HandleNpcMoveCommand (ChatHandler *handler, Optional< CreatureSpawnId > spawnid)
 
static bool HandleNpcPlayEmoteCommand (ChatHandler *handler, Emote emote)
 
static bool HandleNpcSetModelCommand (ChatHandler *handler, uint32 displayId)
 
static bool HandleNpcSetMoveTypeCommand (ChatHandler *handler, Optional< CreatureSpawnId > lowGuid, Variant< EXACT_SEQUENCE("stay"), EXACT_SEQUENCE("random"), EXACT_SEQUENCE("way")> type, Optional< EXACT_SEQUENCE("nodel")> nodel)
 
static bool HandleNpcSetPhaseCommand (ChatHandler *handler, uint32 phasemask)
 
static bool HandleNpcSetWanderDistanceCommand (ChatHandler *handler, float option)
 
static bool HandleNpcSetSpawnTimeCommand (ChatHandler *handler, uint32 spawnTime)
 
static bool HandleNpcSayCommand (ChatHandler *handler, Tail text)
 
static bool HandleNpcTextEmoteCommand (ChatHandler *handler, Tail text)
 
static bool HandleNpcUnFollowCommand (ChatHandler *handler)
 
static bool HandleNpcWhisperCommand (ChatHandler *handler, Variant< Hyperlink< player >, std::string_view > recv, Tail text)
 
static bool HandleNpcYellCommand (ChatHandler *handler, Tail text)
 
static bool HandleNpcAddTempSpawnCommand (ChatHandler *handler, Optional< std::string_view > lootStr, CreatureEntry id)
 
static bool HandleNpcTameCommand (ChatHandler *handler)
 
static bool HandleNpcEvadeCommand (ChatHandler *handler, Optional< CreatureAI::EvadeReason > why, Optional< EXACT_SEQUENCE("force")> force)
 
static void _ShowLootEntry (ChatHandler *handler, uint32 itemId, uint8 itemCount, bool alternateString=false)
 
static void _IterateNotNormalLootMap (ChatHandler *handler, NotNormalLootItemMap const &map, std::vector< LootItem > const &items)
 
static bool HandleNpcShowLootCommand (ChatHandler *handler, Optional< EXACT_SEQUENCE("all")> all)
 
static bool HandleNpcAddFormationCommand (ChatHandler *handler, ObjectGuid::LowType leaderGUID)
 
static bool HandleNpcSetLinkCommand (ChatHandler *handler, ObjectGuid::LowType linkguid)
 
static bool HandleNpcAddWeaponCommand (ChatHandler *handler, uint32 SlotID, ItemTemplate const *tmpItem)
 

Additional Inherited Members

- Protected Member Functions inherited from CommandScript
 CommandScript (char const *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (char const *name)
 
virtual ~ScriptObject ()
 

Detailed Description

Definition at line 56 of file cs_npc.cpp.

Constructor & Destructor Documentation

◆ npc_commandscript()

npc_commandscript::npc_commandscript ( )
inline

Definition at line 59 of file cs_npc.cpp.

Member Function Documentation

◆ _IterateNotNormalLootMap()

static void npc_commandscript::_IterateNotNormalLootMap ( ChatHandler *  handler,
NotNormalLootItemMap const &  map,
std::vector< LootItem > const &  items 
)
inlinestatic

◆ _ShowLootEntry()

static void npc_commandscript::_ShowLootEntry ( ChatHandler *  handler,
uint32  itemId,
uint8  itemCount,
bool  alternateString = false 
)
inlinestatic

◆ GetCommands()

ChatCommandTable npc_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

Definition at line 61 of file cs_npc.cpp.

References HandleNpcAddCommand(), HandleNpcAddFormationCommand(), HandleNpcAddMoveCommand(), HandleNpcAddTempSpawnCommand(), HandleNpcAddVendorItemCommand(), HandleNpcDeleteCommand(), HandleNpcDeleteVendorItemCommand(), HandleNpcDespawnGroup(), HandleNpcEvadeCommand(), HandleNpcFollowCommand(), HandleNpcInfoCommand(), HandleNpcMoveCommand(), HandleNpcNearCommand(), HandleNpcPlayEmoteCommand(), HandleNpcSayCommand(), HandleNpcSetAllowMovementCommand(), HandleNpcSetDataCommand(), HandleNpcSetEntryCommand(), HandleNpcSetFactionIdCommand(), HandleNpcSetFlagCommand(), HandleNpcSetLevelCommand(), HandleNpcSetLinkCommand(), HandleNpcSetModelCommand(), HandleNpcSetMoveTypeCommand(), HandleNpcSetPhaseCommand(), HandleNpcSetSpawnTimeCommand(), HandleNpcSetWanderDistanceCommand(), HandleNpcShowLootCommand(), HandleNpcSpawnGroup(), HandleNpcTameCommand(), HandleNpcTextEmoteCommand(), HandleNpcUnFollowCommand(), HandleNpcWhisperCommand(), HandleNpcYellCommand(), rbac::RBAC_PERM_COMMAND_NPC_ADD, rbac::RBAC_PERM_COMMAND_NPC_ADD_FORMATION, rbac::RBAC_PERM_COMMAND_NPC_ADD_ITEM, rbac::RBAC_PERM_COMMAND_NPC_ADD_MOVE, rbac::RBAC_PERM_COMMAND_NPC_ADD_TEMP, rbac::RBAC_PERM_COMMAND_NPC_DELETE, rbac::RBAC_PERM_COMMAND_NPC_DELETE_ITEM, rbac::RBAC_PERM_COMMAND_NPC_DESPAWNGROUP, rbac::RBAC_PERM_COMMAND_NPC_EVADE, rbac::RBAC_PERM_COMMAND_NPC_FOLLOW, rbac::RBAC_PERM_COMMAND_NPC_INFO, rbac::RBAC_PERM_COMMAND_NPC_MOVE, rbac::RBAC_PERM_COMMAND_NPC_NEAR, rbac::RBAC_PERM_COMMAND_NPC_PLAYEMOTE, rbac::RBAC_PERM_COMMAND_NPC_SAY, rbac::RBAC_PERM_COMMAND_NPC_SET_ALLOWMOVE, rbac::RBAC_PERM_COMMAND_NPC_SET_DATA, rbac::RBAC_PERM_COMMAND_NPC_SET_ENTRY, rbac::RBAC_PERM_COMMAND_NPC_SET_FACTIONID, rbac::RBAC_PERM_COMMAND_NPC_SET_FLAG, rbac::RBAC_PERM_COMMAND_NPC_SET_LEVEL, rbac::RBAC_PERM_COMMAND_NPC_SET_LINK, rbac::RBAC_PERM_COMMAND_NPC_SET_MODEL, rbac::RBAC_PERM_COMMAND_NPC_SET_MOVETYPE, rbac::RBAC_PERM_COMMAND_NPC_SET_PHASE, rbac::RBAC_PERM_COMMAND_NPC_SET_SPAWNDIST, rbac::RBAC_PERM_COMMAND_NPC_SET_SPAWNTIME, rbac::RBAC_PERM_COMMAND_NPC_SHOWLOOT, rbac::RBAC_PERM_COMMAND_NPC_SPAWNGROUP, rbac::RBAC_PERM_COMMAND_NPC_TAME, rbac::RBAC_PERM_COMMAND_NPC_TEXTEMOTE, rbac::RBAC_PERM_COMMAND_NPC_WHISPER, and rbac::RBAC_PERM_COMMAND_NPC_YELL.

◆ HandleNpcAddCommand()

◆ HandleNpcAddFormationCommand()

◆ HandleNpcAddMoveCommand()

◆ HandleNpcAddTempSpawnCommand()

static bool npc_commandscript::HandleNpcAddTempSpawnCommand ( ChatHandler *  handler,
Optional< std::string_view >  lootStr,
CreatureEntry  id 
)
inlinestatic

◆ HandleNpcAddVendorItemCommand()

◆ HandleNpcAddWeaponCommand()

static bool npc_commandscript::HandleNpcAddWeaponCommand ( ChatHandler *  handler,
uint32  SlotID,
ItemTemplate const *  tmpItem 
)
inlinestatic
Todo:
NpcCommands that need to be fixed :

Definition at line 1268 of file cs_npc.cpp.

◆ HandleNpcDeleteCommand()

◆ HandleNpcDeleteVendorItemCommand()

◆ HandleNpcEvadeCommand()

◆ HandleNpcFollowCommand()

◆ HandleNpcInfoCommand()

static bool npc_commandscript::HandleNpcInfoCommand ( ChatHandler *  handler)
inlinestatic

Definition at line 458 of file cs_npc.cpp.

References Creature::AI(), DescribeReactState(), SpawnGroupTemplateData::flags, CreatureTemplate::flags_extra, Creature::GetAIName(), Unit::GetArmor(), Unit::GetCreateHealth(), Creature::GetCreatureData(), Map::GetCreatureRespawnTime(), Creature::GetCreatureTemplate(), Creature::GetCurrentEquipmentId(), Unit::GetDisplayId(), Unit::GetDynamicFlags(), Object::GetEntry(), Unit::GetFaction(), GameTime::GetGameTime(), Object::GetGUID(), Unit::GetHealth(), WorldObject::GetInstanceId(), Unit::GetLevel(), WorldObject::GetMap(), Unit::GetMaxHealth(), Creature::GetMovementTemplate(), WorldObject::GetName(), Unit::GetNativeDisplayId(), Unit::GetNpcFlags(), Creature::GetOriginalEquipmentId(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Creature::GetReactState(), Creature::GetRespawnCompatibilityMode(), Creature::GetRespawnDelay(), Creature::GetRespawnTimeEx(), Creature::GetScriptName(), ChatHandler::getSelectedCreature(), Creature::GetSpawnId(), Creature::GetStringId(), Trinity::GetTypeName(), Unit::GetUnitFlags(), Unit::GetUnitFlags2(), SpawnGroupTemplateData::groupId, Unit::HasUnitFlag(), Map::IsSpawnGroupActive(), LANG_COMMAND_RAWPAWNTIMES, LANG_NPCINFO_ARMOR, LANG_NPCINFO_CHAR, LANG_NPCINFO_DUNGEON_ID, LANG_NPCINFO_EQUIPMENT, LANG_NPCINFO_FLAGS, LANG_NPCINFO_FLAGS_EXTRA, LANG_NPCINFO_HEALTH, LANG_NPCINFO_LEVEL, LANG_NPCINFO_LOOT, LANG_NPCINFO_MECHANIC_IMMUNE, LANG_NPCINFO_MOVEMENT_DATA, LANG_NPCINFO_PHASEMASK, LANG_NPCINFO_POSITION, LANG_NPCINFO_REACTSTATE, LANG_NPCINFO_UNIT_FIELD_FLAGS, LANG_OBJECTINFO_AIINFO, LANG_OBJECTINFO_AITYPE, LANG_OBJECTINFO_STRINGIDS, LANG_SELECT_CREATURE, LANG_SPAWNINFO_COMPATIBILITY_MODE, LANG_SPAWNINFO_GROUP_ID, CreatureTemplate::lootid, CreatureTemplate::MechanicImmuneMask, SpawnGroupTemplateData::name, CreatureTemplate::pickpocketLootId, ChatHandler::PSendSysMessage(), Script, secsToTimeString(), ChatHandler::SendSysMessage(), ChatHandler::SetSentErrorMessage(), ShortText, CreatureTemplate::SkinLootId, Spawn, SpawnMetadata::spawnGroupData, STRING_VIEW_FMT_ARG, Template, CreatureMovementData::ToString(), ObjectGuid::ToString(), and EnumUtils::ToTitle().

Referenced by GetCommands().

◆ HandleNpcMoveCommand()

◆ HandleNpcNearCommand()

◆ HandleNpcPlayEmoteCommand()

static bool npc_commandscript::HandleNpcPlayEmoteCommand ( ChatHandler *  handler,
Emote  emote 
)
inlinestatic

◆ HandleNpcSayCommand()

◆ HandleNpcSetAllowMovementCommand()

static bool npc_commandscript::HandleNpcSetAllowMovementCommand ( ChatHandler *  handler)
inlinestatic

◆ HandleNpcSetDataCommand()

◆ HandleNpcSetEntryCommand()

static bool npc_commandscript::HandleNpcSetEntryCommand ( ChatHandler *  handler,
CreatureEntry  newEntryNum 
)
inlinestatic

◆ HandleNpcSetFactionIdCommand()

◆ HandleNpcSetFlagCommand()

◆ HandleNpcSetLevelCommand()

◆ HandleNpcSetLinkCommand()

◆ HandleNpcSetModelCommand()

◆ HandleNpcSetMoveTypeCommand()

static bool npc_commandscript::HandleNpcSetMoveTypeCommand ( ChatHandler *  handler,
Optional< CreatureSpawnId >  lowGuid,
Variant< EXACT_SEQUENCE("stay"), EXACT_SEQUENCE("random"), EXACT_SEQUENCE("way")>  type,
Optional< EXACT_SEQUENCE("nodel")>  nodel 
)
inlinestatic

HandleNpcSetMoveTypeCommand Set the movement type for an NPC.

Valid movement types are:

  • stay - NPC wont move
  • random - NPC will move randomly according to the wander_distance
  • way - NPC will move with given waypoints set

additional parameter: NODEL - so no waypoints are deleted, if you change the movement type

Definition at line 683 of file cs_npc.cpp.

References ChatHandler::GetCreatureFromPlayerMapByDbGuid(), Unit::GetMotionMaster(), ChatHandler::getSelectedCreature(), Creature::GetSpawnId(), IDLE_MOTION_TYPE, MotionMaster::Initialize(), Unit::IsAlive(), Unit::IsPet(), JUST_DIED, LANG_COMMAND_CREATGUIDNOTFOUND, LANG_MOVE_TYPE_SET, LANG_MOVE_TYPE_SET_NODEL, Creature::LoadPath(), ChatHandler::PSendSysMessage(), RANDOM_MOTION_TYPE, Creature::Respawn(), Creature::SaveToDB(), Creature::setDeathState(), Creature::SetDefaultMovementType(), ChatHandler::SetSentErrorMessage(), sObjectMgr, EnumUtils::ToTitle(), and WAYPOINT_MOTION_TYPE.

Referenced by GetCommands().

◆ HandleNpcSetPhaseCommand()

static bool npc_commandscript::HandleNpcSetPhaseCommand ( ChatHandler *  handler,
uint32  phasemask 
)
inlinestatic

◆ HandleNpcSetSpawnTimeCommand()

static bool npc_commandscript::HandleNpcSetSpawnTimeCommand ( ChatHandler *  handler,
uint32  spawnTime 
)
inlinestatic

◆ HandleNpcSetWanderDistanceCommand()

◆ HandleNpcShowLootCommand()

◆ HandleNpcTameCommand()

◆ HandleNpcTextEmoteCommand()

static bool npc_commandscript::HandleNpcTextEmoteCommand ( ChatHandler *  handler,
Tail  text 
)
inlinestatic

◆ HandleNpcUnFollowCommand()

◆ HandleNpcWhisperCommand()

static bool npc_commandscript::HandleNpcWhisperCommand ( ChatHandler *  handler,
Variant< Hyperlink< player >, std::string_view >  recv,
Tail  text 
)
inlinestatic

◆ HandleNpcYellCommand()

static bool npc_commandscript::HandleNpcYellCommand ( ChatHandler *  handler,
Tail  text 
)
inlinestatic

The documentation for this class was generated from the following file: