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

Public Member Functions

 npc_commandscript ()
 
std::span< ChatCommandBuilder const > GetCommands () const override
 
- Public Member Functions inherited from CommandScript
 ~CommandScript ()
 
- Public Member Functions inherited from ScriptObject
 ScriptObject (ScriptObject const &right)=delete
 
 ScriptObject (ScriptObject &&right)=delete
 
ScriptObject & operator= (ScriptObject const &right)=delete
 
ScriptObject & operator= (ScriptObject &&right)=delete
 
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, Optional< std::string_view > bonusListIDs)
 
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, NPCFlags2 npcFlags2)
 
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, uint32 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 HandleNpcSetPhaseGroup (ChatHandler *handler, char const *args)
 
static bool HandleNpcSetPhaseCommand (ChatHandler *handler, uint32 phaseID)
 
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< EvadeReason > why, Optional< EXACT_SEQUENCE("force")> force)
 
static void _ShowLootEntry (ChatHandler *handler, uint32 itemId, uint32 itemCount, bool alternateString=false)
 
static void _ShowLootCurrencyEntry (ChatHandler *handler, uint32 currencyId, uint32 count, bool alternateString=false)
 
static void _ShowLootTrackingQuestCurrencyEntry (ChatHandler *handler, uint32 questId, bool alternateString=false)
 
static void _IterateNotNormalLootMap (ChatHandler *handler, NotNormalLootItemMap const &map, std::vector< LootItem > const &items)
 
static void _ShowLootContents (ChatHandler *handler, bool all, Loot const *loot)
 
static bool HandleNpcShowLootCommand (ChatHandler *handler, Optional< EXACT_SEQUENCE("all")> all)
 
static bool HandleNpcAddFormationCommand (ChatHandler *handler, ObjectGuid::LowType leaderGUID, Optional< bool > linkedAggro, Optional< bool > formationMovement)
 
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) noexcept
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (char const *name) noexcept
 
virtual ~ScriptObject ()
 

Detailed Description

Definition at line 62 of file cs_npc.cpp.

Constructor & Destructor Documentation

◆ npc_commandscript()

npc_commandscript::npc_commandscript ( )
inline

Definition at line 65 of file cs_npc.cpp.

Member Function Documentation

◆ _IterateNotNormalLootMap()

◆ _ShowLootContents()

◆ _ShowLootCurrencyEntry()

static void npc_commandscript::_ShowLootCurrencyEntry ( ChatHandler *  handler,
uint32  currencyId,
uint32  count,
bool  alternateString = false 
)
inlinestatic

◆ _ShowLootEntry()

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

◆ _ShowLootTrackingQuestCurrencyEntry()

static void npc_commandscript::_ShowLootTrackingQuestCurrencyEntry ( ChatHandler *  handler,
uint32  questId,
bool  alternateString = false 
)
inlinestatic

◆ GetCommands()

std::span< ChatCommandBuilder const > npc_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

Definition at line 67 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 1413 of file cs_npc.cpp.

◆ HandleNpcDeleteCommand()

◆ HandleNpcDeleteVendorItemCommand()

◆ HandleNpcEvadeCommand()

◆ HandleNpcFollowCommand()

◆ HandleNpcInfoCommand()

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

Definition at line 471 of file cs_npc.cpp.

References Creature::AI(), CreatureTemplate::CreatureImmunitiesId, DescribeReactState(), SpawnGroupTemplateData::flags, CreatureTemplate::flags_extra, Creature::GetAIName(), Unit::GetArmor(), Unit::GetCreateHealth(), Creature::GetCreatureData(), Creature::GetCreatureDifficulty(), SpellMgr::GetCreatureImmunities(), Map::GetCreatureRespawnTime(), Creature::GetCreatureTemplate(), Creature::GetCurrentEquipmentId(), Unit::GetDisplayId(), Object::GetDynamicFlags(), Object::GetEntry(), Unit::GetFaction(), GameTime::GetGameTime(), BaseEntity::GetGUID(), Unit::GetHealth(), WorldObject::GetInstanceId(), Unit::GetLevel(), WorldObject::GetMap(), Unit::GetMaxHealth(), Creature::GetMovementTemplate(), WorldObject::GetName(), Unit::GetNativeDisplayId(), Unit::GetNpcFlags(), Unit::GetNpcFlags2(), Creature::GetOriginalEquipmentId(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Creature::GetReactState(), Creature::GetRespawnCompatibilityMode(), Creature::GetRespawnDelay(), Creature::GetRespawnTimeEx(), Creature::GetScriptName(), ChatHandler::getSelectedCreature(), Creature::GetSpawnId(), Creature::GetStringId(), Trinity::GetTypeName(), SpawnGroupTemplateData::groupId, Unit::HasNpcFlag(), Unit::HasNpcFlag2(), Unit::HasUnitFlag(), Unit::HasUnitFlag2(), Unit::HasUnitFlag3(), Map::IsSpawnGroupActive(), LANG_COMMAND_RAWPAWNTIMES, LANG_NPCINFO_ARMOR, LANG_NPCINFO_CHAR, LANG_NPCINFO_DUNGEON_ID, LANG_NPCINFO_DYNAMIC_FLAGS, LANG_NPCINFO_EQUIPMENT, LANG_NPCINFO_FLAGS_EXTRA, LANG_NPCINFO_HEALTH, LANG_NPCINFO_LEVEL, LANG_NPCINFO_LOOT, LANG_NPCINFO_MECHANIC_IMMUNE, LANG_NPCINFO_MOVEMENT_DATA, LANG_NPCINFO_NPC_FLAGS, LANG_NPCINFO_PHASES, LANG_NPCINFO_POSITION, LANG_NPCINFO_REACTSTATE, LANG_NPCINFO_UNIT_FIELD_FLAGS, LANG_NPCINFO_UNIT_FIELD_FLAGS_2, LANG_NPCINFO_UNIT_FIELD_FLAGS_3, LANG_OBJECTINFO_AIINFO, LANG_OBJECTINFO_AITYPE, LANG_OBJECTINFO_STRINGIDS, LANG_SELECT_CREATURE, LANG_SPAWNINFO_COMPATIBILITY_MODE, LANG_SPAWNINFO_GROUP_ID, CreatureDifficulty::LootID, Unit::m_unitData, SpawnGroupTemplateData::name, CreatureDifficulty::PickPocketLootID, PhasingHandler::PrintToChat(), ChatHandler::PSendSysMessage(), Script, secsToTimeString(), ChatHandler::SendSysMessage(), ChatHandler::SetSentErrorMessage(), ShortText, CreatureDifficulty::SkinLootID, sObjectMgr, Spawn, SpawnMetadata::spawnGroupData, STRING_VIEW_FMT_ARG, Trinity::StringFormat(), Template, CreatureMovementData::ToString(), ObjectGuid::ToString(), EnumUtils::ToTitle(), and UI64LIT.

Referenced by GetCommands().

◆ HandleNpcMoveCommand()

◆ HandleNpcNearCommand()

◆ HandleNpcPlayEmoteCommand()

static bool npc_commandscript::HandleNpcPlayEmoteCommand ( ChatHandler *  handler,
uint32  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 721 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(), UI64LIT, and WAYPOINT_MOTION_TYPE.

Referenced by GetCommands().

◆ HandleNpcSetPhaseCommand()

◆ HandleNpcSetPhaseGroup()

◆ HandleNpcSetSpawnTimeCommand()

◆ 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: