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

Public Member Functions

 item_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
 

Static Public Member Functions

static bool HandleItemRestoreCommand (ChatHandler *handler, uint32 restoreId, PlayerIdentifier player)
 
static bool HandleItemRestoreListCommand (ChatHandler *handler, PlayerIdentifier player)
 
static bool HandleItemMoveCommand (ChatHandler *handler, uint8 srcSlot, uint8 dstSlot)
 
static bool HasItemDeletionConfig ()
 
static bool HandleItemRefundCommand (ChatHandler *handler, PlayerIdentifier player, uint32 itemId, uint32 extendedCost)
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ item_commandscript()

item_commandscript::item_commandscript ( )
inline
38: CommandScript("item_commandscript") { }
Definition: ScriptMgr.h:849

Member Function Documentation

◆ GetCommands()

ChatCommandTable item_commandscript::GetCommands ( ) const
inlineoverridevirtual

Implements CommandScript.

41 {
42 static ChatCommandTable HandleItemRestoreCommandTable =
43 {
44 { "list", HandleItemRestoreListCommand, SEC_GAMEMASTER, Console::Yes },
45 { "", HandleItemRestoreCommand, SEC_GAMEMASTER, Console::Yes },
46 };
47 static ChatCommandTable itemCommandTable =
48 {
49 { "restore", HandleItemRestoreCommandTable },
50 { "move", HandleItemMoveCommand, SEC_GAMEMASTER, Console::Yes },
51 { "refund", HandleItemRefundCommand, SEC_ADMINISTRATOR, Console::Yes },
52 };
53 static ChatCommandTable commandTable =
54 {
55 { "item", itemCommandTable }
56 };
57 return commandTable;
58 }
@ SEC_ADMINISTRATOR
Definition: Common.h:69
@ SEC_GAMEMASTER
Definition: Common.h:68
std::vector< ChatCommandBuilder > ChatCommandTable
Definition: ChatCommand.h:50
static bool HandleItemRestoreListCommand(ChatHandler *handler, PlayerIdentifier player)
Definition: cs_item.cpp:123
static bool HandleItemMoveCommand(ChatHandler *handler, uint8 srcSlot, uint8 dstSlot)
Definition: cs_item.cpp:163
static bool HandleItemRestoreCommand(ChatHandler *handler, uint32 restoreId, PlayerIdentifier player)
Definition: cs_item.cpp:60
static bool HandleItemRefundCommand(ChatHandler *handler, PlayerIdentifier player, uint32 itemId, uint32 extendedCost)
Definition: cs_item.cpp:187

References HandleItemMoveCommand(), HandleItemRefundCommand(), HandleItemRestoreCommand(), HandleItemRestoreListCommand(), SEC_ADMINISTRATOR, and SEC_GAMEMASTER.

◆ HandleItemMoveCommand()

static bool item_commandscript::HandleItemMoveCommand ( ChatHandler handler,
uint8  srcSlot,
uint8  dstSlot 
)
inlinestatic
164 {
165 if (srcSlot == dstSlot)
166 return true;
167
168 if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, srcSlot, true))
169 return false;
170
171 if (!handler->GetSession()->GetPlayer()->IsValidPos(INVENTORY_SLOT_BAG_0, dstSlot, false))
172 return false;
173
174 uint16 src = ((INVENTORY_SLOT_BAG_0 << 8) | srcSlot);
175 uint16 dst = ((INVENTORY_SLOT_BAG_0 << 8) | dstSlot);
176
177 handler->GetSession()->GetPlayer()->SwapItem(src, dst);
178
179 return true;
180 }
std::uint16_t uint16
Definition: Define.h:109
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:671
WorldSession * GetSession()
Definition: Chat.h:122
void SwapItem(uint16 src, uint16 dst)
Definition: PlayerStorage.cpp:3564
bool IsValidPos(uint16 pos, bool explicit_pos)
Definition: Player.h:1237
Player * GetPlayer() const
Definition: WorldSession.h:360

References WorldSession::GetPlayer(), ChatHandler::GetSession(), INVENTORY_SLOT_BAG_0, Player::IsValidPos(), and Player::SwapItem().

Referenced by GetCommands().

◆ HandleItemRefundCommand()

static bool item_commandscript::HandleItemRefundCommand ( ChatHandler handler,
PlayerIdentifier  player,
uint32  itemId,
uint32  extendedCost 
)
inlinestatic
188 {
189 ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(extendedCost);
190 if (!iece)
191 {
193 handler->SetSentErrorMessage(true);
194 return false;
195 }
196
197 ItemTemplate const* item = sObjectMgr->GetItemTemplate(itemId);
198
199 if (!item)
200 {
202 handler->SetSentErrorMessage(true);
203 return false;
204 }
205
206 if (Player* target = player.GetConnectedPlayer())
207 {
208 if (!target->HasItemCount(itemId, 1, true))
209 {
211 handler->SetSentErrorMessage(true);
212 return false;
213 }
214
215 if (iece->reqhonorpoints)
216 {
217 uint32 honor = target->GetHonorPoints() + iece->reqhonorpoints;
218 if (honor > sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS))
219 {
220 handler->PSendSysMessage(LANG_CMD_ITEM_REFUND_MAX_HONOR, item->Name1, item->ItemId, sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS), target->GetHonorPoints(), iece->reqhonorpoints);
222 handler->SetSentErrorMessage(true);
223 return false;
224 }
225
226 target->SetHonorPoints(honor);
227 ChatHandler(target->GetSession()).PSendSysMessage(LANG_CMD_ITEM_REFUNDED_HONOR, item->Name1, item->ItemId, iece->reqhonorpoints);
229 }
230
231 if (iece->reqarenapoints)
232 {
233 uint32 arenapoints = target->GetArenaPoints() + iece->reqarenapoints;
234 if (arenapoints > sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS))
235 {
236 handler->PSendSysMessage(LANG_CMD_ITEM_REFUND_MAX_AP, item->Name1, item->ItemId, sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS), target->GetArenaPoints(), iece->reqarenapoints);
238 handler->SetSentErrorMessage(true);
239 return false;
240 }
241
242 target->SetArenaPoints(arenapoints);
243 ChatHandler(target->GetSession()).PSendSysMessage(LANG_CMD_ITEM_REFUNDED_AP, item->Name1, item->ItemId, iece->reqarenapoints);
245 }
246
247 uint8 count = 0;
248 for (uint32 const& reqItem : iece->reqitem)
249 {
250 if (reqItem)
251 {
252 target->AddItem(reqItem, iece->reqitemcount[count]);
253 }
254
255 ++count;
256 }
257
258 target->DestroyItemCount(itemId, 1, true);
259 }
260 else
261 {
262 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
264
265 ObjectGuid::LowType guid = player.GetGUID().GetCounter();
266
268 stmt->SetData(0, itemId);
269 stmt->SetData(1, guid);
270
271 PreparedQueryResult result = CharacterDatabase.Query(stmt);
272
273 if (result)
274 {
275 if (iece->reqhonorpoints)
276 {
277 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_HONORPOINTS);
278 stmt->SetData(0, guid);
279
280 PreparedQueryResult queryResult = CharacterDatabase.Query(stmt);
281
282 if (queryResult)
283 {
284 Field* fields = queryResult->Fetch();
285 if ((fields[0].Get<uint32>() + iece->reqhonorpoints) > sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS))
286 {
287 handler->PSendSysMessage(LANG_CMD_ITEM_REFUND_MAX_HONOR, item->Name1, item->ItemId, sWorld->getIntConfig(CONFIG_MAX_HONOR_POINTS), fields[0].Get<uint32>(), iece->reqhonorpoints);
288 handler->SetSentErrorMessage(true);
289 return false;
290 }
291 }
292
294 stmt->SetData(0, iece->reqhonorpoints);
295 stmt->SetData(1, guid);
296 trans->Append(stmt);
298 }
299
300 if (iece->reqarenapoints)
301 {
302 stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ARENAPOINTS);
303 stmt->SetData(0, guid);
304
305 PreparedQueryResult queryResult = CharacterDatabase.Query(stmt);
306
307 if (queryResult)
308 {
309 Field* fields = queryResult->Fetch();
310 if ((fields[0].Get<uint32>() + iece->reqhonorpoints) > sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS))
311 {
312 handler->PSendSysMessage(LANG_CMD_ITEM_REFUND_MAX_AP, item->Name1, item->ItemId, sWorld->getIntConfig(CONFIG_MAX_ARENA_POINTS), fields[0].Get<uint32>(), iece->reqarenapoints);
313 handler->SetSentErrorMessage(true);
314 return false;
315 }
316 }
317
319 stmt->SetData(0, iece->reqarenapoints);
320 stmt->SetData(1, guid);
321 trans->Append(stmt);
323 }
324
326 // fill mail
327 std::string msg = "Your item " + item->Name1 + " has been removed and the used currency restored. This mail contains any items used as currency.";
328 MailDraft draft("Item Refund", msg);
329
330 uint8 count = 0;
331 bool foundItems = false;
332 for (uint32 const& reqItem : iece->reqitem)
333 {
334 if (reqItem)
335 {
336 // Skip invalid items.
337 if (!sObjectMgr->GetItemTemplate(reqItem))
338 {
339 continue;
340 }
341
342 if (Item* item = Item::CreateItem(reqItem, iece->reqitemcount[count]))
343 {
344 item->SaveToDB(trans);
345 draft.AddItem(item);
346 foundItems = true;
347 }
348 }
349
350 ++count;
351 }
352
353 if (foundItems)
354 {
355 draft.SendMailTo(trans, MailReceiver(nullptr, guid), sender);
356 }
357
358 Field* fields = result->Fetch();
359
360 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_ITEM);
361 stmt->SetData(0, fields[0].Get<uint32>());
362 trans->Append(stmt);
363
364 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
365 stmt->SetData(0, fields[0].Get<uint32>());
366 trans->Append(stmt);
367
368 CharacterDatabase.CommitTransaction(trans);
369 }
370 else
371 {
373 handler->SetSentErrorMessage(true);
374 return false;
375 }
376 }
377
378 return true;
379 }
std::uint8_t uint8
Definition: Define.h:110
std::uint32_t uint32
Definition: Define.h:108
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:70
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: DatabaseEnvFwd.h:46
@ CHAR_DEL_ITEM_INSTANCE
Definition: CharacterDatabase.h:127
@ CHAR_DEL_CHAR_INVENTORY_BY_ITEM
Definition: CharacterDatabase.h:430
@ CHAR_SEL_HONORPOINTS
Definition: CharacterDatabase.h:509
@ CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY_AND_OWNER
Definition: CharacterDatabase.h:359
@ CHAR_UDP_CHAR_HONOR_POINTS_ACCUMULATIVE
Definition: CharacterDatabase.h:421
@ CHAR_SEL_ARENAPOINTS
Definition: CharacterDatabase.h:510
@ CHAR_UDP_CHAR_ARENA_POINTS_ACCUMULATIVE
Definition: CharacterDatabase.h:423
DBCStorage< ItemExtendedCostEntry > sItemExtendedCostStore(ItemExtendedCostEntryfmt)
#define sObjectMgr
Definition: ObjectMgr.h:1606
@ MAIL_STATIONERY_GM
Definition: Mail.h:60
@ MAIL_NORMAL
Definition: Mail.h:38
@ LANG_CMD_ITEM_REFUND_MAX_HONOR
Definition: Language.h:1135
@ LANG_CMD_ITEM_REFUNDED_HONOR
Definition: Language.h:1137
@ LANG_CMD_ITEM_REFUND_MAX_AP
Definition: Language.h:1138
@ LANG_CMD_ITEM_REFUND_HONOR_FAILED
Definition: Language.h:1136
@ LANG_CMD_ITEM_REFUND_AP_FAILED
Definition: Language.h:1139
@ LANG_CMD_ITEM_REFUND_NOT_FOUND
Definition: Language.h:1141
@ LANG_CMD_ITEM_REFUNDED_AP
Definition: Language.h:1140
@ LANG_CMD_ITEM_REFUND_BAD_EXTENDED_COST
Definition: Language.h:1134
@ LANG_COMMAND_ITEMIDINVALID
Definition: Language.h:450
@ CONFIG_MAX_HONOR_POINTS
Definition: IWorld.h:236
@ CONFIG_MAX_ARENA_POINTS
Definition: IWorld.h:239
#define sWorld
Definition: World.h:458
Definition: PreparedStatement.h:158
Class used to access individual fields of database query result.
Definition: Field.h:99
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:78
Definition: Chat.h:38
void SetSentErrorMessage(bool val)
Definition: Chat.h:118
void PSendSysMessage(char const *fmt, Args &&... args)
Definition: Chat.h:60
ObjectGuid GetGUID() const
Definition: ChatCommandTags.h:181
Player * GetConnectedPlayer() const
Definition: ChatCommandTags.h:183
Definition: Item.h:214
static Item * CreateItem(uint32 item, uint32 count, Player const *player=nullptr, bool clone=false, uint32 randomPropertyId=0)
Definition: Item.cpp:1089
Definition: ItemTemplate.h:628
std::string Name1
Definition: ItemTemplate.h:633
uint32 ItemId
Definition: ItemTemplate.h:629
LowType GetCounter() const
Definition: ObjectGuid.h:147
uint32 LowType
Definition: ObjectGuid.h:124
Definition: Player.h:1046
Definition: Mail.h:84
Definition: Mail.h:106
Definition: Mail.h:120
Definition: DBCStructure.h:1164
uint32 reqarenapoints
Definition: DBCStructure.h:1167
uint32 reqitemcount[MAX_ITEM_EXTENDED_COST_REQUIREMENTS]
Definition: DBCStructure.h:1170
uint32 reqitem[MAX_ITEM_EXTENDED_COST_REQUIREMENTS]
Definition: DBCStructure.h:1169
uint32 reqhonorpoints
Definition: DBCStructure.h:1166

References MailDraft::AddItem(), CHAR_DEL_CHAR_INVENTORY_BY_ITEM, CHAR_DEL_ITEM_INSTANCE, CHAR_SEL_ARENAPOINTS, CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY_AND_OWNER, CHAR_SEL_HONORPOINTS, CHAR_UDP_CHAR_ARENA_POINTS_ACCUMULATIVE, CHAR_UDP_CHAR_HONOR_POINTS_ACCUMULATIVE, CharacterDatabase, CONFIG_MAX_ARENA_POINTS, CONFIG_MAX_HONOR_POINTS, Item::CreateItem(), Field::Get(), Acore::ChatCommands::PlayerIdentifier::GetConnectedPlayer(), ObjectGuid::GetCounter(), Acore::ChatCommands::PlayerIdentifier::GetGUID(), ItemTemplate::ItemId, LANG_CMD_ITEM_REFUND_AP_FAILED, LANG_CMD_ITEM_REFUND_BAD_EXTENDED_COST, LANG_CMD_ITEM_REFUND_HONOR_FAILED, LANG_CMD_ITEM_REFUND_MAX_AP, LANG_CMD_ITEM_REFUND_MAX_HONOR, LANG_CMD_ITEM_REFUND_NOT_FOUND, LANG_CMD_ITEM_REFUNDED_AP, LANG_CMD_ITEM_REFUNDED_HONOR, LANG_COMMAND_ITEMIDINVALID, MAIL_NORMAL, MAIL_STATIONERY_GM, ItemTemplate::Name1, ChatHandler::PSendSysMessage(), ItemExtendedCostEntry::reqarenapoints, ItemExtendedCostEntry::reqhonorpoints, ItemExtendedCostEntry::reqitem, ItemExtendedCostEntry::reqitemcount, MailDraft::SendMailTo(), PreparedStatementBase::SetData(), ChatHandler::SetSentErrorMessage(), sItemExtendedCostStore, sObjectMgr, and sWorld.

Referenced by GetCommands().

◆ HandleItemRestoreCommand()

static bool item_commandscript::HandleItemRestoreCommand ( ChatHandler handler,
uint32  restoreId,
PlayerIdentifier  player 
)
inlinestatic
61 {
62 if (!restoreId)
63 {
64 return false;
65 }
66
68 {
70 handler->SetSentErrorMessage(true);
71 return false;
72 }
73
74 // Check existence of item in recovery table
76 stmt->SetData(0, restoreId);
77 PreparedQueryResult fields = CharacterDatabase.Query(stmt);
78
79 if (!fields || !(*fields)[1].Get<uint32>() || (*fields)[3].Get<uint32>() != player.GetGUID().GetCounter())
80 {
82 handler->SetSentErrorMessage(true);
83 return false;
84 }
85
86 // Mail item to player
87 uint32 itemEntry = (*fields)[1].Get<uint32>();
88 uint32 itemCount = (*fields)[2].Get<uint32>();
89
90 if (Player* onlinePlayer = player.GetConnectedPlayer())
91 {
92 onlinePlayer->SendItemRetrievalMail({ { itemEntry, itemCount } });
93 }
94
95 else
96 {
97 MailSender sender(MAIL_CREATURE, 34337 /* The Postmaster */);
98 MailDraft draft("Recovered Item", "We recovered a lost item in the twisting nether and noted that it was yours.$B$BPlease find said object enclosed.");
99
100 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
101
102 // Save to prevent loss at next mail load. Item deletes on fail
103 if (Item* item = Item::CreateItem(itemEntry, itemCount, 0))
104 {
105 item->SaveToDB(trans);
106 draft.AddItem(item);
107 }
108
109 draft.SendMailTo(trans, MailReceiver(player.GetGUID().GetCounter()), sender);
110 CharacterDatabase.CommitTransaction(trans);
111 }
112
113 // Remove from recovery table
115 delStmt->SetData(0, (*fields)[0].Get<uint32>());
116 CharacterDatabase.Execute(delStmt);
117
118 std::string nameLink = handler->playerLink(player.GetName());
119 handler->PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
120 return true;
121 }
@ CHAR_DEL_RECOVERY_ITEM_BY_RECOVERY_ID
Definition: CharacterDatabase.h:507
@ CHAR_SEL_RECOVERY_ITEM
Definition: CharacterDatabase.h:504
@ MAIL_CREATURE
Definition: Mail.h:40
@ LANG_COMMAND_DISABLED
Definition: Language.h:1132
@ LANG_ITEM_RESTORE_MISSING
Definition: Language.h:234
@ LANG_MAIL_SENT
Definition: Language.h:209
std::string playerLink(std::string const &name) const
Definition: Chat.h:111
virtual void SendSysMessage(std::string_view str, bool escapeCharacters=false)
Definition: Chat.cpp:103
std::string const & GetName() const
Definition: ChatCommandTags.h:180
static bool HasItemDeletionConfig()
Definition: cs_item.cpp:182

References MailDraft::AddItem(), CHAR_DEL_RECOVERY_ITEM_BY_RECOVERY_ID, CHAR_SEL_RECOVERY_ITEM, CharacterDatabase, Item::CreateItem(), Acore::ChatCommands::PlayerIdentifier::GetConnectedPlayer(), ObjectGuid::GetCounter(), Acore::ChatCommands::PlayerIdentifier::GetGUID(), Acore::ChatCommands::PlayerIdentifier::GetName(), HasItemDeletionConfig(), LANG_COMMAND_DISABLED, LANG_ITEM_RESTORE_MISSING, LANG_MAIL_SENT, MAIL_CREATURE, ChatHandler::playerLink(), ChatHandler::PSendSysMessage(), MailDraft::SendMailTo(), ChatHandler::SendSysMessage(), PreparedStatementBase::SetData(), and ChatHandler::SetSentErrorMessage().

Referenced by GetCommands().

◆ HandleItemRestoreListCommand()

static bool item_commandscript::HandleItemRestoreListCommand ( ChatHandler handler,
PlayerIdentifier  player 
)
inlinestatic
124 {
126 {
128 handler->SetSentErrorMessage(true);
129 return false;
130 }
131
133 stmt->SetData(0, player.GetGUID().GetCounter());
134 PreparedQueryResult disposedItems = CharacterDatabase.Query(stmt);
135
136 if (!disposedItems)
137 {
139 handler->SetSentErrorMessage(true);
140 return false;
141 }
142
143 do
144 {
145 Field* fields = disposedItems->Fetch();
146 uint32 id = fields[0].Get<uint32>();
147 uint32 itemId = fields[1].Get<uint32>();
148 uint32 count = fields[2].Get<uint32>();
149
150 std::string itemName = "";
151 if (ItemTemplate const* item = sObjectMgr->GetItemTemplate(itemId))
152 {
153 itemName = item->Name1;
154 }
155
156 handler->PSendSysMessage(LANG_ITEM_RESTORE_LIST, id, itemName, itemId, count);
157 } while (disposedItems->NextRow());
158
159 return true;
160 }
@ CHAR_SEL_RECOVERY_ITEM_LIST
Definition: CharacterDatabase.h:505
@ LANG_ITEM_RESTORE_LIST
Definition: Language.h:232
@ LANG_ITEM_RESTORE_LIST_EMPTY
Definition: Language.h:233
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition: Field.h:113

References CHAR_SEL_RECOVERY_ITEM_LIST, CharacterDatabase, Field::Get(), ObjectGuid::GetCounter(), Acore::ChatCommands::PlayerIdentifier::GetGUID(), HasItemDeletionConfig(), LANG_COMMAND_DISABLED, LANG_ITEM_RESTORE_LIST, LANG_ITEM_RESTORE_LIST_EMPTY, ChatHandler::PSendSysMessage(), ChatHandler::SendSysMessage(), PreparedStatementBase::SetData(), ChatHandler::SetSentErrorMessage(), and sObjectMgr.

Referenced by GetCommands().

◆ HasItemDeletionConfig()

static bool item_commandscript::HasItemDeletionConfig ( )
inlinestatic
183 {
184 return sWorld->getBoolConfig(CONFIG_ITEMDELETE_METHOD) || sWorld->getBoolConfig(CONFIG_ITEMDELETE_VENDOR);
185 }
@ CONFIG_ITEMDELETE_METHOD
Definition: IWorld.h:162
@ CONFIG_ITEMDELETE_VENDOR
Definition: IWorld.h:163

References CONFIG_ITEMDELETE_METHOD, CONFIG_ITEMDELETE_VENDOR, and sWorld.

Referenced by HandleItemRestoreCommand(), and HandleItemRestoreListCommand().