AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
reset_commandscript Class Reference
Inheritance diagram for reset_commandscript:
CommandScript ScriptObject

Public Member Functions

 reset_commandscript ()
 
ChatCommandTable GetCommands () const override
 
virtual std::vector< Acore::ChatCommands::ChatCommandBuilderGetCommands () const =0
 
- Public Member Functions inherited from ScriptObject
virtual bool IsDatabaseBound () const
 
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
const std::string & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Static Public Member Functions

static bool HandleResetAchievementsCommand (ChatHandler *, Optional< PlayerIdentifier > target)
 
static bool HandleResetHonorCommand (ChatHandler *, Optional< PlayerIdentifier > target)
 
static bool HandleResetStatsOrLevelHelper (Player *player)
 
static bool HandleResetLevelCommand (ChatHandler *, Optional< PlayerIdentifier > target)
 
static bool HandleResetSpellsCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleResetStatsCommand (ChatHandler *, Optional< PlayerIdentifier > target)
 
static bool HandleResetTalentsCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleResetAllCommand (ChatHandler *handler, std::string_view caseName)
 
static bool HandleResetItemsEquippedCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleResetItemsInBagsCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleResetItemsKeyringCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleResetItemsInCurrenciesListCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleResetItemsInBankCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleResetItemsInVendorBuyBackTabCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleResetItemsAllCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static bool HandleResetItemsAllAndDeleteBagsCommand (ChatHandler *handler, Optional< PlayerIdentifier > target)
 

Static Private Member Functions

static PlayerGetPlayerFromIdentifierOrSelectedTarget (ChatHandler *handler, Optional< PlayerIdentifier > target)
 
static int16 ResetItemsEquipped (Player *playerTarget)
 
static int16 ResetItemsInBags (Player *playerTarget)
 
static int16 ResetItemsInBank (Player *playerTarget)
 
static int16 ResetItemsInKeyring (Player *playerTarget)
 
static int16 ResetItemsInCurrenciesList (Player *playerTarget)
 
static int16 ResetItemsInVendorBuyBackTab (Player *playerTarget)
 
static int16 ResetItemsDeleteStandardBags (Player *playerTarget)
 
static int16 ResetItemsDeleteBankBags (Player *playerTarget)
 

Additional Inherited Members

- Protected Member Functions inherited from CommandScript
 CommandScript (const char *name)
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (const char *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ reset_commandscript()

reset_commandscript::reset_commandscript ( )
inline
39: CommandScript("reset_commandscript") { }
Definition: CommandScript.h:25

Member Function Documentation

◆ GetCommands()

ChatCommandTable reset_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

42 {
43 static ChatCommandTable resetItemsCommandTable =
44 {
45 { "equipped", HandleResetItemsEquippedCommand, SEC_ADMINISTRATOR, Console::Yes },
46 { "bags", HandleResetItemsInBagsCommand, SEC_ADMINISTRATOR, Console::Yes },
47 { "bank", HandleResetItemsInBankCommand, SEC_ADMINISTRATOR, Console::Yes },
48 { "keyring", HandleResetItemsKeyringCommand, SEC_ADMINISTRATOR, Console::Yes },
50 { "vendor_buyback", HandleResetItemsInVendorBuyBackTabCommand, SEC_ADMINISTRATOR, Console::Yes },
51 { "all", HandleResetItemsAllCommand, SEC_ADMINISTRATOR, Console::Yes },
53 };
54 static ChatCommandTable resetCommandTable =
55 {
56 { "achievements", HandleResetAchievementsCommand, SEC_CONSOLE, Console::Yes },
57 { "honor", HandleResetHonorCommand, SEC_ADMINISTRATOR, Console::Yes },
58 { "level", HandleResetLevelCommand, SEC_ADMINISTRATOR, Console::Yes },
59 { "spells", HandleResetSpellsCommand, SEC_ADMINISTRATOR, Console::Yes },
60 { "stats", HandleResetStatsCommand, SEC_ADMINISTRATOR, Console::Yes },
61 { "talents", HandleResetTalentsCommand, SEC_ADMINISTRATOR, Console::Yes },
62 { "items", resetItemsCommandTable },
63 { "all", HandleResetAllCommand, SEC_CONSOLE, Console::Yes }
64 };
65 static ChatCommandTable commandTable =
66 {
67 { "reset", resetCommandTable }
68 };
69 return commandTable;
70 }
@ SEC_ADMINISTRATOR
Definition: Common.h:60
@ SEC_CONSOLE
Definition: Common.h:61
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:49
static bool HandleResetItemsInBagsCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:329
static bool HandleResetTalentsCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:235
static bool HandleResetItemsAllAndDeleteBagsCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:445
static bool HandleResetSpellsCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:179
static bool HandleResetItemsInBankCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:380
static bool HandleResetItemsInVendorBuyBackTabCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:397
static bool HandleResetStatsCommand(ChatHandler *, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:214
static bool HandleResetHonorCommand(ChatHandler *, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:89
static bool HandleResetItemsEquippedCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:312
static bool HandleResetLevelCommand(ChatHandler *, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:140
static bool HandleResetAllCommand(ChatHandler *handler, std::string_view caseName)
Definition: cs_reset.cpp:276
static bool HandleResetItemsAllCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:414
static bool HandleResetItemsInCurrenciesListCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:363
static bool HandleResetItemsKeyringCommand(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:346
static bool HandleResetAchievementsCommand(ChatHandler *, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:72

References HandleResetAchievementsCommand(), HandleResetAllCommand(), HandleResetHonorCommand(), HandleResetItemsAllAndDeleteBagsCommand(), HandleResetItemsAllCommand(), HandleResetItemsEquippedCommand(), HandleResetItemsInBagsCommand(), HandleResetItemsInBankCommand(), HandleResetItemsInCurrenciesListCommand(), HandleResetItemsInVendorBuyBackTabCommand(), HandleResetItemsKeyringCommand(), HandleResetLevelCommand(), HandleResetSpellsCommand(), HandleResetStatsCommand(), HandleResetTalentsCommand(), SEC_ADMINISTRATOR, and SEC_CONSOLE.

◆ GetPlayerFromIdentifierOrSelectedTarget()

static Player * reset_commandscript::GetPlayerFromIdentifierOrSelectedTarget ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestaticprivate
482 {
483 Player* targetPlayer = nullptr;
484
485 // Check if there is an optional target player name
486 // Do not use TargetOrSelf, we must be sure to select ourself
487 if (!target)
488 {
489 // No optional target, so try to get selected target
490 target = PlayerIdentifier::FromTarget(handler);
491
492 if (!target)
493 {
494 // No character selected
496 return targetPlayer;
497 }
498
499 targetPlayer = target->GetConnectedPlayer();
500 }
501 else
502 {
503 targetPlayer = target->GetConnectedPlayer();
504
505 if (!targetPlayer || !target->IsConnected())
506 {
507 // No character selected
509 }
510 }
511
512 return targetPlayer;
513 }
@ LANG_PLAYER_NOT_EXIST_OR_OFFLINE
Definition: Language.h:745
@ LANG_NO_CHAR_SELECTED
Definition: Language.h:148
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:162
static Optional< PlayerIdentifier > FromTarget(ChatHandler *handler)
Definition: ChatCommandTags.cpp:138
Definition: Player.h:1064

References Acore::ChatCommands::PlayerIdentifier::FromTarget(), LANG_NO_CHAR_SELECTED, LANG_PLAYER_NOT_EXIST_OR_OFFLINE, and ChatHandler::SendSysMessage().

Referenced by HandleResetItemsAllAndDeleteBagsCommand(), HandleResetItemsAllCommand(), HandleResetItemsEquippedCommand(), HandleResetItemsInBagsCommand(), HandleResetItemsInBankCommand(), HandleResetItemsInCurrenciesListCommand(), HandleResetItemsInVendorBuyBackTabCommand(), and HandleResetItemsKeyringCommand().

◆ HandleResetAchievementsCommand()

static bool reset_commandscript::HandleResetAchievementsCommand ( ChatHandler ,
Optional< PlayerIdentifier target 
)
inlinestatic
73 {
74 if (!target)
75 {
76 return false;
77 }
78
79 Player* playerTarget = target->GetConnectedPlayer();
80
81 if (playerTarget)
82 playerTarget->ResetAchievements();
83 else
84 AchievementMgr::DeleteFromDB(target->GetGUID().GetCounter());
85
86 return true;
87 }
static void DeleteFromDB(ObjectGuid::LowType lowguid)
Definition: AchievementMgr.cpp:542
void ResetAchievements()
Definition: Player.cpp:13905

References AchievementMgr::DeleteFromDB(), and Player::ResetAchievements().

Referenced by GetCommands().

◆ HandleResetAllCommand()

static bool reset_commandscript::HandleResetAllCommand ( ChatHandler handler,
std::string_view  caseName 
)
inlinestatic
277 {
278 AtLoginFlags atLogin;
279
280 // Command specially created as single command to prevent using short case names
281 if (caseName == "spells")
282 {
283 atLogin = AT_LOGIN_RESET_SPELLS;
285 if (!handler->GetSession())
287 }
288 else if (caseName == "talents")
289 {
292 if (!handler->GetSession())
294 }
295 else
296 {
298 return false;
299 }
300
302 stmt->SetData(0, uint16(atLogin));
303 CharacterDatabase.Execute(stmt);
304
305 sWorld->DoForAllOnlinePlayers([&] (Player* player){
306 player->SetAtLoginFlag(atLogin);
307 });
308
309 return true;
310 }
std::uint16_t uint16
Definition: Define.h:108
@ LANG_RESETALL_TALENTS
Definition: Language.h:259
@ LANG_RESETALL_UNKNOWN_CASE
Definition: Language.h:257
@ LANG_RESETALL_SPELLS
Definition: Language.h:258
AtLoginFlags
Definition: Player.h:598
@ AT_LOGIN_RESET_TALENTS
Definition: Player.h:602
@ AT_LOGIN_RESET_SPELLS
Definition: Player.h:601
@ AT_LOGIN_RESET_PET_TALENTS
Definition: Player.h:604
@ CHAR_UPD_ALL_AT_LOGIN_FLAGS
Definition: CharacterDatabase.h:276
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
#define sWorld
Definition: World.h:444
Definition: PreparedStatement.h:158
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78
WorldSession * GetSession()
Definition: Chat.h:244
void SendErrorMessage(uint32 entry)
Definition: Chat.cpp:218
void SendWorldText(std::string_view str)
Definition: Chat.cpp:133
void SetAtLoginFlag(AtLoginFlags f)
Definition: Player.h:2383

References AT_LOGIN_RESET_PET_TALENTS, AT_LOGIN_RESET_SPELLS, AT_LOGIN_RESET_TALENTS, CHAR_UPD_ALL_AT_LOGIN_FLAGS, CharacterDatabase, ChatHandler::GetSession(), LANG_RESETALL_SPELLS, LANG_RESETALL_TALENTS, LANG_RESETALL_UNKNOWN_CASE, ChatHandler::SendErrorMessage(), ChatHandler::SendSysMessage(), ChatHandler::SendWorldText(), Player::SetAtLoginFlag(), PreparedStatementBase::SetData(), and sWorld.

Referenced by GetCommands().

◆ HandleResetHonorCommand()

static bool reset_commandscript::HandleResetHonorCommand ( ChatHandler ,
Optional< PlayerIdentifier target 
)
inlinestatic
90 {
91 if (!target)
92 {
93 return false;
94 }
95
96 Player* playerTarget = target->GetConnectedPlayer();
97
98 playerTarget->SetHonorPoints(0);
99 playerTarget->SetUInt32Value(PLAYER_FIELD_KILLS, 0);
104
105 return true;
106 }
@ PLAYER_FIELD_TODAY_CONTRIBUTION
Definition: UpdateFields.h:375
@ PLAYER_FIELD_KILLS
Definition: UpdateFields.h:374
@ PLAYER_FIELD_YESTERDAY_CONTRIBUTION
Definition: UpdateFields.h:376
@ PLAYER_FIELD_LIFETIME_HONORABLE_KILLS
Definition: UpdateFields.h:377
@ ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL
Definition: DBCEnums.h:219
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition: PlayerUpdates.cpp:2127
void SetHonorPoints(uint32 value)
Definition: Player.cpp:6241
void SetUInt32Value(uint16 index, uint32 value)
Definition: Unit.cpp:21256

References ACHIEVEMENT_CRITERIA_TYPE_EARN_HONORABLE_KILL, PLAYER_FIELD_KILLS, PLAYER_FIELD_LIFETIME_HONORABLE_KILLS, PLAYER_FIELD_TODAY_CONTRIBUTION, PLAYER_FIELD_YESTERDAY_CONTRIBUTION, Player::SetHonorPoints(), Unit::SetUInt32Value(), and Player::UpdateAchievementCriteria().

Referenced by GetCommands().

◆ HandleResetItemsAllAndDeleteBagsCommand()

static bool reset_commandscript::HandleResetItemsAllAndDeleteBagsCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
446 {
447 Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target);
448
449 if (!targetPlayer)
450 {
451 return false;
452 }
453 else
454 {
455
456 // Delete all items destinations
457 int16 deletedItemsEquippedCount = ResetItemsEquipped(targetPlayer);
458 int16 deletedItemsInBagsCount = ResetItemsInBags(targetPlayer);
459 int16 deletedItemsInBankCount = ResetItemsInBank(targetPlayer);
460 int16 deletedItemsInKeyringCount = ResetItemsInKeyring(targetPlayer);
461 int16 deletedItemsInCurrenciesListCount = ResetItemsInCurrenciesList(targetPlayer);
462 int16 deletedItemsInVendorBuyBackTabCount = ResetItemsInVendorBuyBackTab(targetPlayer);
463 int16 deletedItemsStandardBagsCount = ResetItemsDeleteStandardBags(targetPlayer);
464 int16 deletedItemsBankBagsCount = ResetItemsDeleteBankBags(targetPlayer);
465
466 handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_ALL_BAGS, handler->GetNameLink(targetPlayer),
467 deletedItemsEquippedCount,
468 deletedItemsInBagsCount,
469 deletedItemsInBankCount,
470 deletedItemsInKeyringCount,
471 deletedItemsInCurrenciesListCount,
472 deletedItemsInVendorBuyBackTabCount,
473 deletedItemsStandardBagsCount,
474 deletedItemsBankBagsCount);
475 }
476
477 return true;
478 }
std::int16_t int16
Definition: Define.h:104
@ LANG_COMMAND_RESET_ITEMS_ALL_BAGS
Definition: Language.h:415
virtual std::string GetNameLink() const
Definition: Chat.h:200
void PSendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:213
static int16 ResetItemsDeleteStandardBags(Player *playerTarget)
Definition: cs_reset.cpp:679
static Player * GetPlayerFromIdentifierOrSelectedTarget(ChatHandler *handler, Optional< PlayerIdentifier > target)
Definition: cs_reset.cpp:481
static int16 ResetItemsDeleteBankBags(Player *playerTarget)
Definition: cs_reset.cpp:701
static int16 ResetItemsInBank(Player *playerTarget)
Definition: cs_reset.cpp:576
static int16 ResetItemsInKeyring(Player *playerTarget)
Definition: cs_reset.cpp:616
static int16 ResetItemsInVendorBuyBackTab(Player *playerTarget)
Definition: cs_reset.cpp:658
static int16 ResetItemsInBags(Player *playerTarget)
Definition: cs_reset.cpp:536
static int16 ResetItemsInCurrenciesList(Player *playerTarget)
Definition: cs_reset.cpp:637
static int16 ResetItemsEquipped(Player *playerTarget)
Definition: cs_reset.cpp:515

References ChatHandler::GetNameLink(), GetPlayerFromIdentifierOrSelectedTarget(), LANG_COMMAND_RESET_ITEMS_ALL_BAGS, ChatHandler::PSendSysMessage(), ResetItemsDeleteBankBags(), ResetItemsDeleteStandardBags(), ResetItemsEquipped(), ResetItemsInBags(), ResetItemsInBank(), ResetItemsInCurrenciesList(), ResetItemsInKeyring(), and ResetItemsInVendorBuyBackTab().

Referenced by GetCommands().

◆ HandleResetItemsAllCommand()

static bool reset_commandscript::HandleResetItemsAllCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
415 {
416 Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target);
417
418 if (!targetPlayer)
419 {
420 return false;
421 }
422 else
423 {
424
425 // Delete all items destinations
426 int16 deletedItemsEquippedCount = ResetItemsEquipped(targetPlayer);
427 int16 deletedItemsInBagsCount = ResetItemsInBags(targetPlayer);
428 int16 deletedItemsInBankCount = ResetItemsInBank(targetPlayer);
429 int16 deletedItemsInKeyringCount = ResetItemsInKeyring(targetPlayer);
430 int16 deletedItemsInCurrenciesListCount = ResetItemsInCurrenciesList(targetPlayer);
431 int16 deletedItemsInVendorBuyBackTabCount = ResetItemsInVendorBuyBackTab(targetPlayer);
432
433 handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_ALL, handler->GetNameLink(targetPlayer),
434 deletedItemsEquippedCount,
435 deletedItemsInBagsCount,
436 deletedItemsInBankCount,
437 deletedItemsInKeyringCount,
438 deletedItemsInCurrenciesListCount,
439 deletedItemsInVendorBuyBackTabCount);
440 }
441
442 return true;
443 }
@ LANG_COMMAND_RESET_ITEMS_ALL
Definition: Language.h:414

References ChatHandler::GetNameLink(), GetPlayerFromIdentifierOrSelectedTarget(), LANG_COMMAND_RESET_ITEMS_ALL, ChatHandler::PSendSysMessage(), ResetItemsEquipped(), ResetItemsInBags(), ResetItemsInBank(), ResetItemsInCurrenciesList(), ResetItemsInKeyring(), and ResetItemsInVendorBuyBackTab().

Referenced by GetCommands().

◆ HandleResetItemsEquippedCommand()

static bool reset_commandscript::HandleResetItemsEquippedCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
313 {
314 Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target);
315
316 if (!targetPlayer)
317 {
318 return false;
319 }
320 else
321 {
322 int16 deletedItemsCount = ResetItemsEquipped(targetPlayer);
323 handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_EQUIPPED, deletedItemsCount, handler->GetNameLink(targetPlayer));
324 }
325
326 return true;
327 }
@ LANG_COMMAND_RESET_ITEMS_EQUIPPED
Definition: Language.h:408

References ChatHandler::GetNameLink(), GetPlayerFromIdentifierOrSelectedTarget(), LANG_COMMAND_RESET_ITEMS_EQUIPPED, ChatHandler::PSendSysMessage(), and ResetItemsEquipped().

Referenced by GetCommands().

◆ HandleResetItemsInBagsCommand()

static bool reset_commandscript::HandleResetItemsInBagsCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
330 {
331 Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target);
332
333 if (!targetPlayer)
334 {
335 return false;
336 }
337 else
338 {
339 int16 deletedItemsCount = ResetItemsInBags(targetPlayer);
340 handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_BAGS, deletedItemsCount, handler->GetNameLink(targetPlayer));
341 }
342
343 return true;
344 }
@ LANG_COMMAND_RESET_ITEMS_BAGS
Definition: Language.h:409

References ChatHandler::GetNameLink(), GetPlayerFromIdentifierOrSelectedTarget(), LANG_COMMAND_RESET_ITEMS_BAGS, ChatHandler::PSendSysMessage(), and ResetItemsInBags().

Referenced by GetCommands().

◆ HandleResetItemsInBankCommand()

static bool reset_commandscript::HandleResetItemsInBankCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
381 {
382 Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target);
383
384 if (!targetPlayer)
385 {
386 return false;
387 }
388 else
389 {
390 int16 deletedItemsCount = ResetItemsInBank(targetPlayer);
391 handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_BANK, deletedItemsCount, handler->GetNameLink(targetPlayer));
392 }
393
394 return true;
395 }
@ LANG_COMMAND_RESET_ITEMS_BANK
Definition: Language.h:410

References ChatHandler::GetNameLink(), GetPlayerFromIdentifierOrSelectedTarget(), LANG_COMMAND_RESET_ITEMS_BANK, ChatHandler::PSendSysMessage(), and ResetItemsInBank().

Referenced by GetCommands().

◆ HandleResetItemsInCurrenciesListCommand()

static bool reset_commandscript::HandleResetItemsInCurrenciesListCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
364 {
365 Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target);
366
367 if (!targetPlayer)
368 {
369 return false;
370 }
371 else
372 {
373 int16 deletedItemsCount = ResetItemsInCurrenciesList(targetPlayer);
374 handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_CURRENCY, deletedItemsCount, handler->GetNameLink(targetPlayer));
375 }
376
377 return true;
378 }
@ LANG_COMMAND_RESET_ITEMS_CURRENCY
Definition: Language.h:412

References ChatHandler::GetNameLink(), GetPlayerFromIdentifierOrSelectedTarget(), LANG_COMMAND_RESET_ITEMS_CURRENCY, ChatHandler::PSendSysMessage(), and ResetItemsInCurrenciesList().

Referenced by GetCommands().

◆ HandleResetItemsInVendorBuyBackTabCommand()

static bool reset_commandscript::HandleResetItemsInVendorBuyBackTabCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
398 {
399 Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target);
400
401 if (!targetPlayer)
402 {
403 return false;
404 }
405 else
406 {
407 int16 deletedItemsCount = ResetItemsInVendorBuyBackTab(targetPlayer);
408 handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_BUYBACK, deletedItemsCount, handler->GetNameLink(targetPlayer));
409 }
410
411 return true;
412 }
@ LANG_COMMAND_RESET_ITEMS_BUYBACK
Definition: Language.h:413

References ChatHandler::GetNameLink(), GetPlayerFromIdentifierOrSelectedTarget(), LANG_COMMAND_RESET_ITEMS_BUYBACK, ChatHandler::PSendSysMessage(), and ResetItemsInVendorBuyBackTab().

Referenced by GetCommands().

◆ HandleResetItemsKeyringCommand()

static bool reset_commandscript::HandleResetItemsKeyringCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
347 {
348 Player* targetPlayer = GetPlayerFromIdentifierOrSelectedTarget(handler, target);
349
350 if (!targetPlayer)
351 {
352 return false;
353 }
354 else
355 {
356 int16 deletedItemsCount = ResetItemsInKeyring(targetPlayer);
357 handler->PSendSysMessage(LANG_COMMAND_RESET_ITEMS_KEYRING, deletedItemsCount, handler->GetNameLink(targetPlayer));
358 }
359
360 return true;
361 }
@ LANG_COMMAND_RESET_ITEMS_KEYRING
Definition: Language.h:411

References ChatHandler::GetNameLink(), GetPlayerFromIdentifierOrSelectedTarget(), LANG_COMMAND_RESET_ITEMS_KEYRING, ChatHandler::PSendSysMessage(), and ResetItemsInKeyring().

Referenced by GetCommands().

◆ HandleResetLevelCommand()

static bool reset_commandscript::HandleResetLevelCommand ( ChatHandler ,
Optional< PlayerIdentifier target 
)
inlinestatic
141 {
142 if (!target)
143 {
144 return false;
145 }
146
147 Player* playerTarget = target->GetConnectedPlayer();
148
149 if (!HandleResetStatsOrLevelHelper(playerTarget))
150 return false;
151
152 uint8 oldLevel = playerTarget->GetLevel();
153
154 // set starting level
155 uint32 startLevel = !playerTarget->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_INIT)
156 ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL)
158
159 playerTarget->_ApplyAllLevelScaleItemMods(false);
160 playerTarget->SetLevel(startLevel);
161 playerTarget->InitRunes();
162 playerTarget->InitStatsForLevel(true);
163 playerTarget->InitTaxiNodesForLevel();
164 playerTarget->InitGlyphsForLevel();
165 playerTarget->InitTalentForLevel();
166 playerTarget->SetUInt32Value(PLAYER_XP, 0);
167
168 playerTarget->_ApplyAllLevelScaleItemMods(true);
169
170 // reset level for pet
171 if (Pet* pet = playerTarget->GetPet())
172 pet->SynchronizeLevelWithOwner();
173
174 sScriptMgr->OnPlayerLevelChanged(playerTarget, oldLevel);
175
176 return true;
177 }
std::uint8_t uint8
Definition: Define.h:109
std::uint32_t uint32
Definition: Define.h:107
#define sScriptMgr
Definition: ScriptMgr.h:708
@ CONFIG_START_HEROIC_PLAYER_LEVEL
Definition: IWorld.h:243
@ CONFIG_START_PLAYER_LEVEL
Definition: IWorld.h:242
@ CLASS_CONTEXT_INIT
Definition: UnitDefines.h:206
@ PLAYER_XP
Definition: UpdateFields.h:339
@ CLASS_DEATH_KNIGHT
Definition: SharedDefines.h:146
Definition: Pet.h:41
void _ApplyAllLevelScaleItemMods(bool apply)
Definition: Player.cpp:7611
void InitTalentForLevel()
Definition: Player.cpp:2553
void InitGlyphsForLevel()
Definition: Player.cpp:13285
Pet * GetPet() const
Definition: Player.cpp:8906
void InitTaxiNodesForLevel()
Definition: Player.h:1144
void InitStatsForLevel(bool reapplyMods=false)
Definition: Player.cpp:2568
bool IsClass(Classes playerClass, ClassContext context=CLASS_CONTEXT_NONE) const override
Definition: Player.cpp:1280
void InitRunes()
Definition: Player.cpp:13455
void SetLevel(uint8 lvl, bool showLevelChange=true)
Definition: Unit.cpp:15415
uint8 GetLevel() const
Definition: Unit.h:855
static bool HandleResetStatsOrLevelHelper(Player *player)
Definition: cs_reset.cpp:108

References Player::_ApplyAllLevelScaleItemMods(), CLASS_CONTEXT_INIT, CLASS_DEATH_KNIGHT, CONFIG_START_HEROIC_PLAYER_LEVEL, CONFIG_START_PLAYER_LEVEL, Unit::GetLevel(), Player::GetPet(), HandleResetStatsOrLevelHelper(), Player::InitGlyphsForLevel(), Player::InitRunes(), Player::InitStatsForLevel(), Player::InitTalentForLevel(), Player::InitTaxiNodesForLevel(), Player::IsClass(), PLAYER_XP, Unit::SetLevel(), Unit::SetUInt32Value(), sScriptMgr, and sWorld.

Referenced by GetCommands().

◆ HandleResetSpellsCommand()

static bool reset_commandscript::HandleResetSpellsCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
180 {
181 if (!target)
182 {
183 target = PlayerIdentifier::FromTargetOrSelf(handler);
184 }
185
186 if (!target)
187 {
188 return false;
189 }
190
191 Player* playerTarget = target->GetConnectedPlayer();
192
193 if (target)
194 {
195 playerTarget->resetSpells(/* bool myClassOnly */);
196
198 if (!handler->GetSession() || handler->GetSession()->GetPlayer() != playerTarget)
199 handler->PSendSysMessage(LANG_RESET_SPELLS_ONLINE, handler->GetNameLink(playerTarget));
200 }
201 else
202 {
205 stmt->SetData(1, playerTarget->GetGUID().GetCounter());
206 CharacterDatabase.Execute(stmt);
207
208 handler->PSendSysMessage(LANG_RESET_SPELLS_OFFLINE, target->GetName());
209 }
210
211 return true;
212 }
@ LANG_RESET_SPELLS_ONLINE
Definition: Language.h:250
@ LANG_RESET_SPELLS_OFFLINE
Definition: Language.h:251
@ LANG_RESET_SPELLS
Definition: Language.h:254
@ CHAR_UPD_ADD_AT_LOGIN_FLAG
Definition: CharacterDatabase.h:274
Definition: Chat.h:39
static Optional< PlayerIdentifier > FromTargetOrSelf(ChatHandler *handler)
Definition: ChatCommandTags.h:188
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
LowType GetCounter() const
Definition: ObjectGuid.h:145
WorldSession * GetSession() const
Definition: Player.h:1978
void resetSpells()
Definition: Player.cpp:11815
Player * GetPlayer() const
Definition: WorldSession.h:362

References AT_LOGIN_RESET_SPELLS, CHAR_UPD_ADD_AT_LOGIN_FLAG, CharacterDatabase, Acore::ChatCommands::PlayerIdentifier::FromTargetOrSelf(), ObjectGuid::GetCounter(), Object::GetGUID(), ChatHandler::GetNameLink(), WorldSession::GetPlayer(), ChatHandler::GetSession(), Player::GetSession(), LANG_RESET_SPELLS, LANG_RESET_SPELLS_OFFLINE, LANG_RESET_SPELLS_ONLINE, ChatHandler::PSendSysMessage(), Player::resetSpells(), ChatHandler::SendSysMessage(), and PreparedStatementBase::SetData().

Referenced by GetCommands().

◆ HandleResetStatsCommand()

static bool reset_commandscript::HandleResetStatsCommand ( ChatHandler ,
Optional< PlayerIdentifier target 
)
inlinestatic
215 {
216 if (!target)
217 {
218 return false;
219 }
220
221 Player* playerTarget = target->GetConnectedPlayer();
222
223 if (!HandleResetStatsOrLevelHelper(playerTarget))
224 return false;
225
226 playerTarget->InitRunes();
227 playerTarget->InitStatsForLevel(true);
228 playerTarget->InitTaxiNodesForLevel();
229 playerTarget->InitGlyphsForLevel();
230 playerTarget->InitTalentForLevel();
231
232 return true;
233 }

References HandleResetStatsOrLevelHelper(), Player::InitGlyphsForLevel(), Player::InitRunes(), Player::InitStatsForLevel(), Player::InitTalentForLevel(), and Player::InitTaxiNodesForLevel().

Referenced by GetCommands().

◆ HandleResetStatsOrLevelHelper()

static bool reset_commandscript::HandleResetStatsOrLevelHelper ( Player player)
inlinestatic
109 {
110 ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(player->getClass());
111 if (!classEntry)
112 {
113 LOG_ERROR("dbc", "Class {} not found in DBC (Wrong DBC files?)", player->getClass());
114 return false;
115 }
116
117 uint8 powerType = classEntry->powerType;
118
119 // reset m_form if no aura
122
123 player->SetFactionForRace(player->getRace());
124
125 player->SetUInt32Value(UNIT_FIELD_BYTES_0, ((player->getRace()) | (player->getClass() << 8) | (player->getGender() << 16) | (powerType << 24)));
126
127 // reset only if player not in some form;
128 if (player->GetShapeshiftForm() == FORM_NONE)
129 player->InitDisplayIds();
130
132
134
135 //-1 is default value
137 return true;
138 }
#define LOG_ERROR(filterType__,...)
Definition: Log.h:156
DBCStorage< ChrClassesEntry > sChrClassesStore(ChrClassesEntryfmt)
@ FORM_NONE
Definition: UnitDefines.h:69
@ UNIT_BYTE2_FLAG_PVP
Definition: UnitDefines.h:115
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition: UnitDefines.h:232
@ UNIT_FIELD_BYTES_0
Definition: UpdateFields.h:95
@ PLAYER_FIELD_WATCHED_FACTION_INDEX
Definition: UpdateFields.h:379
@ UNIT_FIELD_BYTES_2
Definition: UpdateFields.h:161
@ SPELL_AURA_MOD_SHAPESHIFT
Definition: SpellAuraDefines.h:99
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:750
void InitDisplayIds()
Definition: Player.cpp:10616
void SetFactionForRace(uint8 race)
Definition: Player.cpp:5849
uint8 getGender() const
Definition: Unit.h:752
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:1463
void ReplaceAllUnitFlags(UnitFlags flags)
Remove the Unit flag specify only.
Definition: Unit.h:685
uint8 getClass() const
Definition: Unit.h:747
uint8 getRace(bool original=false) const
Definition: Unit.cpp:20962
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:5676
void SetShapeshiftForm(ShapeshiftForm form)
Definition: Unit.h:1464
Definition: DBCStructure.h:653
uint32 powerType
Definition: DBCStructure.h:656

References FORM_NONE, Unit::getClass(), Unit::getGender(), Unit::getRace(), Unit::GetShapeshiftForm(), Unit::HasAuraType(), Player::InitDisplayIds(), LOG_ERROR, PLAYER_FIELD_WATCHED_FACTION_INDEX, ChrClassesEntry::powerType, Unit::ReplaceAllUnitFlags(), sChrClassesStore, Object::SetByteValue(), Player::SetFactionForRace(), Unit::SetShapeshiftForm(), Unit::SetUInt32Value(), SPELL_AURA_MOD_SHAPESHIFT, UNIT_BYTE2_FLAG_PVP, UNIT_FIELD_BYTES_0, UNIT_FIELD_BYTES_2, and UNIT_FLAG_PLAYER_CONTROLLED.

Referenced by HandleResetLevelCommand(), and HandleResetStatsCommand().

◆ HandleResetTalentsCommand()

static bool reset_commandscript::HandleResetTalentsCommand ( ChatHandler handler,
Optional< PlayerIdentifier target 
)
inlinestatic
236 {
237 Player* targetPlayer = nullptr;
238
239 if (target)
240 {
241 targetPlayer = target->GetConnectedPlayer();
242 }
243 else
244 {
246 return false;
247 }
248
249 if (targetPlayer)
250 {
251 targetPlayer->resetTalents(true);
252 targetPlayer->SendTalentsInfoData(false);
254 if (!handler->GetSession() || handler->GetSession()->GetPlayer() != targetPlayer)
255 handler->PSendSysMessage(LANG_RESET_TALENTS_ONLINE, handler->GetNameLink(targetPlayer));
256
257 Pet* pet = targetPlayer->GetPet();
258 Pet::resetTalentsForAllPetsOf(targetPlayer, pet);
259 if (pet)
260 targetPlayer->SendTalentsInfoData(true);
261 return true;
262 }
263 else
264 {
267 stmt->SetData(1, target->GetGUID().GetCounter());
268 CharacterDatabase.Execute(stmt);
269
270 std::string nameLink = handler->playerLink(target->GetName());
272 return true;
273 }
274 }
@ LANG_RESET_TALENTS_OFFLINE
Definition: Language.h:253
@ LANG_RESET_TALENTS_ONLINE
Definition: Language.h:252
@ LANG_RESET_TALENTS
Definition: Language.h:255
std::string playerLink(std::string const &name) const
Definition: Chat.h:233
static void resetTalentsForAllPetsOf(Player *owner, Pet *online_pet=nullptr)
Definition: Pet.cpp:2138
void SendTalentsInfoData(bool pet)
Definition: Player.cpp:14421
bool resetTalents(bool noResetCost=false)
Definition: Player.cpp:3684

References AT_LOGIN_RESET_PET_TALENTS, AT_LOGIN_RESET_TALENTS, CHAR_UPD_ADD_AT_LOGIN_FLAG, CharacterDatabase, ChatHandler::GetNameLink(), Player::GetPet(), WorldSession::GetPlayer(), ChatHandler::GetSession(), Player::GetSession(), LANG_NO_CHAR_SELECTED, LANG_RESET_TALENTS, LANG_RESET_TALENTS_OFFLINE, LANG_RESET_TALENTS_ONLINE, ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), Player::resetTalents(), Pet::resetTalentsForAllPetsOf(), ChatHandler::SendErrorMessage(), ChatHandler::SendSysMessage(), Player::SendTalentsInfoData(), and PreparedStatementBase::SetData().

Referenced by GetCommands().

◆ ResetItemsDeleteBankBags()

static int16 reset_commandscript::ResetItemsDeleteBankBags ( Player playerTarget)
inlinestaticprivate
702 {
703 if (!playerTarget)
704 {
705 return -1;
706 }
707
708 int16 count = 0;
709 // Bank bags
711 {
712 Bag* pBag = (Bag*)playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
713 if (pBag)
714 {
715 // prevent no empty ?
716 playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true);
717 ++count;
718 }
719 }
720
721 return count;
722 }
@ BANK_SLOT_BAG_END
Definition: Player.h:718
@ BANK_SLOT_BAG_START
Definition: Player.h:717
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:670
Definition: Bag.h:28
Item * GetItemByPos(uint16 pos) const
Definition: PlayerStorage.cpp:447
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition: PlayerStorage.cpp:3029

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, Player::DestroyItem(), Player::GetItemByPos(), and INVENTORY_SLOT_BAG_0.

Referenced by HandleResetItemsAllAndDeleteBagsCommand().

◆ ResetItemsDeleteStandardBags()

static int16 reset_commandscript::ResetItemsDeleteStandardBags ( Player playerTarget)
inlinestaticprivate
680 {
681 if (!playerTarget)
682 {
683 return -1;
684 }
685
686 int16 count = 0;
687 // Standard bag slots
689 {
690 Bag* pBag = (Bag*)playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
691 if (pBag)
692 {
693 playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true);
694 ++count;
695 }
696 }
697
698 return count;
699 }
@ INVENTORY_SLOT_BAG_START
Definition: Player.h:699
@ INVENTORY_SLOT_BAG_END
Definition: Player.h:700

References Player::DestroyItem(), Player::GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, and INVENTORY_SLOT_BAG_START.

Referenced by HandleResetItemsAllAndDeleteBagsCommand().

◆ ResetItemsEquipped()

static int16 reset_commandscript::ResetItemsEquipped ( Player playerTarget)
inlinestaticprivate
516 {
517 if (!playerTarget)
518 {
519 return -1;
520 }
521
522 int16 count = 0;
524 {
525 Item* pItem = playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
526 if (pItem)
527 {
528 playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true);
529 ++count;
530 }
531 }
532
533 return count;
534 }
@ EQUIPMENT_SLOT_END
Definition: Player.h:694
@ EQUIPMENT_SLOT_START
Definition: Player.h:674
Definition: Item.h:220

References Player::DestroyItem(), EQUIPMENT_SLOT_END, EQUIPMENT_SLOT_START, Player::GetItemByPos(), and INVENTORY_SLOT_BAG_0.

Referenced by HandleResetItemsAllAndDeleteBagsCommand(), HandleResetItemsAllCommand(), and HandleResetItemsEquippedCommand().

◆ ResetItemsInBags()

static int16 reset_commandscript::ResetItemsInBags ( Player playerTarget)
inlinestaticprivate
537 {
538 if (!playerTarget)
539 {
540 return -1;
541 }
542
543 int16 count = 0;
544 // Default bagpack :
546 {
547 Item* pItem = playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
548 if (pItem)
549 {
550 playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true);
551 ++count;
552 }
553 }
554
555 // Bag slots
557 {
558 Bag* pBag = (Bag*)playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
559 if (pBag)
560 {
561 for (uint8 j = 0; j < pBag->GetBagSize(); ++j)
562 {
563 Item* pItem = pBag->GetItemByPos(j);
564 if (pItem)
565 {
566 playerTarget->DestroyItem(i, j, true);
567 ++count;
568 }
569 }
570 }
571 }
572
573 return count;
574 }
@ INVENTORY_SLOT_ITEM_START
Definition: Player.h:705
@ INVENTORY_SLOT_ITEM_END
Definition: Player.h:706
uint32 GetBagSize() const
Definition: Bag.h:48
Item * GetItemByPos(uint8 slot) const
Definition: Bag.cpp:235

References Player::DestroyItem(), Bag::GetBagSize(), Player::GetItemByPos(), Bag::GetItemByPos(), INVENTORY_SLOT_BAG_0, INVENTORY_SLOT_BAG_END, INVENTORY_SLOT_BAG_START, INVENTORY_SLOT_ITEM_END, and INVENTORY_SLOT_ITEM_START.

Referenced by HandleResetItemsAllAndDeleteBagsCommand(), HandleResetItemsAllCommand(), and HandleResetItemsInBagsCommand().

◆ ResetItemsInBank()

static int16 reset_commandscript::ResetItemsInBank ( Player playerTarget)
inlinestaticprivate
577 {
578 if (!playerTarget)
579 {
580 return -1;
581 }
582
583 int16 count = 0;
584 // Normal bank slot
586 {
587 Item* pItem = playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
588 if (pItem)
589 {
590 playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true);
591 ++count;
592 }
593 }
594
595 // Bank bagslots
597 {
598 Bag* pBag = (Bag*)playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
599 if (pBag)
600 {
601 for (uint8 j = 0; j < pBag->GetBagSize(); ++j)
602 {
603 Item* pItem = pBag->GetItemByPos(j);
604 if (pItem)
605 {
606 playerTarget->DestroyItem(i, j, true);
607 ++count;
608 }
609 }
610 }
611 }
612
613 return count;
614 }
@ BANK_SLOT_ITEM_START
Definition: Player.h:711
@ BANK_SLOT_ITEM_END
Definition: Player.h:712

References BANK_SLOT_BAG_END, BANK_SLOT_BAG_START, BANK_SLOT_ITEM_END, BANK_SLOT_ITEM_START, Player::DestroyItem(), Bag::GetBagSize(), Player::GetItemByPos(), Bag::GetItemByPos(), and INVENTORY_SLOT_BAG_0.

Referenced by HandleResetItemsAllAndDeleteBagsCommand(), HandleResetItemsAllCommand(), and HandleResetItemsInBankCommand().

◆ ResetItemsInCurrenciesList()

static int16 reset_commandscript::ResetItemsInCurrenciesList ( Player playerTarget)
inlinestaticprivate
638 {
639 if (!playerTarget)
640 {
641 return -1;
642 }
643
644 int16 count = 0;
646 {
647 Item* pItem = playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
648 if (pItem)
649 {
650 playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true);
651 ++count;
652 }
653 }
654
655 return count;
656 }
@ CURRENCYTOKEN_SLOT_END
Definition: Player.h:737
@ CURRENCYTOKEN_SLOT_START
Definition: Player.h:736

References CURRENCYTOKEN_SLOT_END, CURRENCYTOKEN_SLOT_START, Player::DestroyItem(), Player::GetItemByPos(), and INVENTORY_SLOT_BAG_0.

Referenced by HandleResetItemsAllAndDeleteBagsCommand(), HandleResetItemsAllCommand(), and HandleResetItemsInCurrenciesListCommand().

◆ ResetItemsInKeyring()

static int16 reset_commandscript::ResetItemsInKeyring ( Player playerTarget)
inlinestaticprivate
617 {
618 if (!playerTarget)
619 {
620 return -1;
621 }
622
623 int16 count = 0;
624 for (uint8 i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; ++i)
625 {
626 Item* pItem = playerTarget->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
627 if (pItem)
628 {
629 playerTarget->DestroyItem(INVENTORY_SLOT_BAG_0, i, true);
630 ++count;
631 }
632 }
633
634 return count;
635 }
@ KEYRING_SLOT_END
Definition: Player.h:731
@ KEYRING_SLOT_START
Definition: Player.h:730

References Player::DestroyItem(), Player::GetItemByPos(), INVENTORY_SLOT_BAG_0, KEYRING_SLOT_END, and KEYRING_SLOT_START.

Referenced by HandleResetItemsAllAndDeleteBagsCommand(), HandleResetItemsAllCommand(), and HandleResetItemsKeyringCommand().

◆ ResetItemsInVendorBuyBackTab()

static int16 reset_commandscript::ResetItemsInVendorBuyBackTab ( Player playerTarget)
inlinestaticprivate
659 {
660 if (!playerTarget)
661 {
662 return -1;
663 }
664
665 int16 count = 0;
666 for (uint8 i = BUYBACK_SLOT_START; i < BUYBACK_SLOT_END; ++i)
667 {
668 Item* pItem = playerTarget->GetItemFromBuyBackSlot(i);
669 if (pItem)
670 {
671 playerTarget->RemoveItemFromBuyBackSlot(i, true);
672 ++count;
673 }
674 }
675
676 return count;
677 }
@ BUYBACK_SLOT_END
Definition: Player.h:725
@ BUYBACK_SLOT_START
Definition: Player.h:724
void RemoveItemFromBuyBackSlot(uint32 slot, bool del)
Definition: PlayerStorage.cpp:4001
Item * GetItemFromBuyBackSlot(uint32 slot)
Definition: PlayerStorage.cpp:3993

References BUYBACK_SLOT_END, BUYBACK_SLOT_START, Player::GetItemFromBuyBackSlot(), and Player::RemoveItemFromBuyBackSlot().

Referenced by HandleResetItemsAllAndDeleteBagsCommand(), HandleResetItemsAllCommand(), and HandleResetItemsInVendorBuyBackTabCommand().