Merge pull request #6867 from Vincent-Michael/listCommand
Core/Commands: Convert list commands in commandscript
This commit is contained in:
@@ -122,15 +122,6 @@ ChatCommand* ChatHandler::getCommandTable()
|
|||||||
{ NULL, 0, false, NULL, "", NULL }
|
{ NULL, 0, false, NULL, "", NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static ChatCommand listCommandTable[] =
|
|
||||||
{
|
|
||||||
{ "creature", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleListCreatureCommand>, "", NULL },
|
|
||||||
{ "item", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleListItemCommand>, "", NULL },
|
|
||||||
{ "object", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleListObjectCommand>, "", NULL },
|
|
||||||
{ "auras", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleListAurasCommand>, "", NULL },
|
|
||||||
{ NULL, 0, false, NULL, "", NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static ChatCommand lookupPlayerCommandTable[] =
|
static ChatCommand lookupPlayerCommandTable[] =
|
||||||
{
|
{
|
||||||
{ "ip", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupPlayerIpCommand>, "", NULL },
|
{ "ip", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleLookupPlayerIpCommand>, "", NULL },
|
||||||
@@ -234,7 +225,6 @@ ChatCommand* ChatHandler::getCommandTable()
|
|||||||
|
|
||||||
static ChatCommand commandTable[] =
|
static ChatCommand commandTable[] =
|
||||||
{
|
{
|
||||||
{ "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable },
|
|
||||||
{ "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable },
|
{ "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable },
|
||||||
{ "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable },
|
{ "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable },
|
||||||
{ "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable },
|
{ "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable },
|
||||||
|
|||||||
@@ -163,11 +163,6 @@ class ChatHandler
|
|||||||
bool HandleGuildRankCommand(const char* args);
|
bool HandleGuildRankCommand(const char* args);
|
||||||
bool HandleGuildDeleteCommand(const char* args);
|
bool HandleGuildDeleteCommand(const char* args);
|
||||||
|
|
||||||
bool HandleListAurasCommand(const char * args);
|
|
||||||
bool HandleListCreatureCommand(const char* args);
|
|
||||||
bool HandleListItemCommand(const char* args);
|
|
||||||
bool HandleListObjectCommand(const char* args);
|
|
||||||
|
|
||||||
bool HandleLookupAreaCommand(const char* args);
|
bool HandleLookupAreaCommand(const char* args);
|
||||||
bool HandleLookupCreatureCommand(const char* args);
|
bool HandleLookupCreatureCommand(const char* args);
|
||||||
bool HandleLookupEventCommand(const char* args);
|
bool HandleLookupEventCommand(const char* args);
|
||||||
|
|||||||
@@ -385,365 +385,6 @@ bool ChatHandler::HandleAddItemSetCommand(const char *args)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatHandler::HandleListItemCommand(const char *args)
|
|
||||||
{
|
|
||||||
if (!*args)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
char* cId = extractKeyFromLink((char*)args, "Hitem");
|
|
||||||
if (!cId)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint32 item_id = atol(cId);
|
|
||||||
if (!item_id)
|
|
||||||
{
|
|
||||||
PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id);
|
|
||||||
if (!itemProto)
|
|
||||||
{
|
|
||||||
PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, item_id);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* c_count = strtok(NULL, " ");
|
|
||||||
int _count = c_count ? atol(c_count) : 10;
|
|
||||||
|
|
||||||
if (_count < 0)
|
|
||||||
return false;
|
|
||||||
uint32 count = uint32(_count);
|
|
||||||
|
|
||||||
PreparedQueryResult result;
|
|
||||||
|
|
||||||
// inventory case
|
|
||||||
uint32 inv_count = 0;
|
|
||||||
|
|
||||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM);
|
|
||||||
stmt->setUInt32(0, item_id);
|
|
||||||
result = CharacterDatabase.Query(stmt);
|
|
||||||
|
|
||||||
if (result)
|
|
||||||
inv_count = (*result)[0].GetUInt64();
|
|
||||||
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY);
|
|
||||||
stmt->setUInt32(0, item_id);
|
|
||||||
stmt->setUInt32(1, count);
|
|
||||||
result = CharacterDatabase.Query(stmt);
|
|
||||||
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Field* fields = result->Fetch();
|
|
||||||
uint32 item_guid = fields[0].GetUInt32();
|
|
||||||
uint32 item_bag = fields[1].GetUInt32();
|
|
||||||
uint8 item_slot = fields[2].GetUInt8();
|
|
||||||
uint32 owner_guid = fields[3].GetUInt32();
|
|
||||||
uint32 owner_acc = fields[4].GetUInt32();
|
|
||||||
std::string owner_name = fields[5].GetString();
|
|
||||||
|
|
||||||
char const* item_pos = 0;
|
|
||||||
if (Player::IsEquipmentPos(item_bag, item_slot))
|
|
||||||
item_pos = "[equipped]";
|
|
||||||
else if (Player::IsInventoryPos(item_bag, item_slot))
|
|
||||||
item_pos = "[in inventory]";
|
|
||||||
else if (Player::IsBankPos(item_bag, item_slot))
|
|
||||||
item_pos = "[in bank]";
|
|
||||||
else
|
|
||||||
item_pos = "";
|
|
||||||
|
|
||||||
PSendSysMessage(LANG_ITEMLIST_SLOT, item_guid, owner_name.c_str(), owner_guid, owner_acc, item_pos);
|
|
||||||
}
|
|
||||||
while (result->NextRow());
|
|
||||||
|
|
||||||
uint32 res_count = uint32(result->GetRowCount());
|
|
||||||
|
|
||||||
if (count > res_count)
|
|
||||||
count -= res_count;
|
|
||||||
else if (count)
|
|
||||||
count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// mail case
|
|
||||||
uint32 mail_count = 0;
|
|
||||||
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT_ITEM);
|
|
||||||
stmt->setUInt32(0, item_id);
|
|
||||||
result = CharacterDatabase.Query(stmt);
|
|
||||||
|
|
||||||
if (result)
|
|
||||||
mail_count = (*result)[0].GetUInt64();
|
|
||||||
|
|
||||||
if (count > 0)
|
|
||||||
{
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_ITEMS_BY_ENTRY);
|
|
||||||
stmt->setUInt32(0, item_id);
|
|
||||||
stmt->setUInt32(1, count);
|
|
||||||
result = CharacterDatabase.Query(stmt);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
result = PreparedQueryResult(NULL);
|
|
||||||
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Field* fields = result->Fetch();
|
|
||||||
uint32 item_guid = fields[0].GetUInt32();
|
|
||||||
uint32 item_s = fields[1].GetUInt32();
|
|
||||||
uint32 item_r = fields[2].GetUInt32();
|
|
||||||
uint32 item_s_acc = fields[3].GetUInt32();
|
|
||||||
std::string item_s_name = fields[4].GetString();
|
|
||||||
uint32 item_r_acc = fields[5].GetUInt32();
|
|
||||||
std::string item_r_name = fields[6].GetString();
|
|
||||||
|
|
||||||
char const* item_pos = "[in mail]";
|
|
||||||
|
|
||||||
PSendSysMessage(LANG_ITEMLIST_MAIL, item_guid, item_s_name.c_str(), item_s, item_s_acc, item_r_name.c_str(), item_r, item_r_acc, item_pos);
|
|
||||||
}
|
|
||||||
while (result->NextRow());
|
|
||||||
|
|
||||||
uint32 res_count = uint32(result->GetRowCount());
|
|
||||||
|
|
||||||
if (count > res_count)
|
|
||||||
count -= res_count;
|
|
||||||
else if (count)
|
|
||||||
count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// auction case
|
|
||||||
uint32 auc_count = 0;
|
|
||||||
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM);
|
|
||||||
stmt->setUInt32(0, item_id);
|
|
||||||
result = CharacterDatabase.Query(stmt);
|
|
||||||
|
|
||||||
if (result)
|
|
||||||
auc_count = (*result)[0].GetUInt64();
|
|
||||||
|
|
||||||
if (count > 0)
|
|
||||||
{
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_ITEM_BY_ENTRY);
|
|
||||||
stmt->setUInt32(0, item_id);
|
|
||||||
stmt->setUInt32(1, count);
|
|
||||||
result = CharacterDatabase.Query(stmt);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
result = PreparedQueryResult(NULL);
|
|
||||||
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Field* fields = result->Fetch();
|
|
||||||
uint32 item_guid = fields[0].GetUInt32();
|
|
||||||
uint32 owner = fields[1].GetUInt32();
|
|
||||||
uint32 owner_acc = fields[2].GetUInt32();
|
|
||||||
std::string owner_name = fields[3].GetString();
|
|
||||||
|
|
||||||
char const* item_pos = "[in auction]";
|
|
||||||
|
|
||||||
PSendSysMessage(LANG_ITEMLIST_AUCTION, item_guid, owner_name.c_str(), owner, owner_acc, item_pos);
|
|
||||||
}
|
|
||||||
while (result->NextRow());
|
|
||||||
}
|
|
||||||
|
|
||||||
// guild bank case
|
|
||||||
uint32 guild_count = 0;
|
|
||||||
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_COUNT_ITEM);
|
|
||||||
stmt->setUInt32(0, item_id);
|
|
||||||
result = CharacterDatabase.Query(stmt);
|
|
||||||
|
|
||||||
if (result)
|
|
||||||
guild_count = (*result)[0].GetUInt64();
|
|
||||||
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_ITEM_BY_ENTRY);
|
|
||||||
stmt->setUInt32(0, item_id);
|
|
||||||
stmt->setUInt32(1, count);
|
|
||||||
result = CharacterDatabase.Query(stmt);
|
|
||||||
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Field* fields = result->Fetch();
|
|
||||||
uint32 item_guid = fields[0].GetUInt32();
|
|
||||||
uint32 guild_guid = fields[1].GetUInt32();
|
|
||||||
std::string guild_name = fields[2].GetString();
|
|
||||||
|
|
||||||
char const* item_pos = "[in guild bank]";
|
|
||||||
|
|
||||||
PSendSysMessage(LANG_ITEMLIST_GUILD, item_guid, guild_name.c_str(), guild_guid, item_pos);
|
|
||||||
}
|
|
||||||
while (result->NextRow());
|
|
||||||
|
|
||||||
uint32 res_count = uint32(result->GetRowCount());
|
|
||||||
|
|
||||||
if (count > res_count)
|
|
||||||
count -= res_count;
|
|
||||||
else if (count)
|
|
||||||
count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inv_count + mail_count + auc_count + guild_count == 0)
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_COMMAND_NOITEMFOUND);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
PSendSysMessage(LANG_COMMAND_LISTITEMMESSAGE, item_id, inv_count + mail_count + auc_count + guild_count, inv_count, mail_count, auc_count, guild_count);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ChatHandler::HandleListObjectCommand(const char *args)
|
|
||||||
{
|
|
||||||
if (!*args)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
|
|
||||||
char* cId = extractKeyFromLink((char*)args, "Hgameobject_entry");
|
|
||||||
if (!cId)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint32 go_id = atol(cId);
|
|
||||||
if (!go_id)
|
|
||||||
{
|
|
||||||
PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GameObjectTemplate const* gInfo = sObjectMgr->GetGameObjectTemplate(go_id);
|
|
||||||
if (!gInfo)
|
|
||||||
{
|
|
||||||
PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, go_id);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* c_count = strtok(NULL, " ");
|
|
||||||
int count = c_count ? atol(c_count) : 10;
|
|
||||||
|
|
||||||
if (count < 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QueryResult result;
|
|
||||||
|
|
||||||
uint32 obj_count = 0;
|
|
||||||
result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", go_id);
|
|
||||||
if (result)
|
|
||||||
obj_count = (*result)[0].GetUInt64();
|
|
||||||
|
|
||||||
if (m_session)
|
|
||||||
{
|
|
||||||
Player* player = m_session->GetPlayer();
|
|
||||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
|
||||||
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), go_id, uint32(count));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '%u' LIMIT %u",
|
|
||||||
go_id, uint32(count));
|
|
||||||
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Field* fields = result->Fetch();
|
|
||||||
uint32 guid = fields[0].GetUInt32();
|
|
||||||
float x = fields[1].GetFloat();
|
|
||||||
float y = fields[2].GetFloat();
|
|
||||||
float z = fields[3].GetFloat();
|
|
||||||
int mapid = fields[4].GetUInt16();
|
|
||||||
uint32 entry = fields[5].GetUInt32();
|
|
||||||
|
|
||||||
if (m_session)
|
|
||||||
PSendSysMessage(LANG_GO_LIST_CHAT, guid, entry, guid, gInfo->name.c_str(), x, y, z, mapid);
|
|
||||||
else
|
|
||||||
PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, gInfo->name.c_str(), x, y, z, mapid);
|
|
||||||
} while (result->NextRow());
|
|
||||||
}
|
|
||||||
|
|
||||||
PSendSysMessage(LANG_COMMAND_LISTOBJMESSAGE, go_id, obj_count);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ChatHandler::HandleListCreatureCommand(const char *args)
|
|
||||||
{
|
|
||||||
if (!*args)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
|
|
||||||
char* cId = extractKeyFromLink((char*)args, "Hcreature_entry");
|
|
||||||
if (!cId)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint32 cr_id = atol(cId);
|
|
||||||
if (!cr_id)
|
|
||||||
{
|
|
||||||
PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(cr_id);
|
|
||||||
if (!cInfo)
|
|
||||||
{
|
|
||||||
PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, cr_id);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* c_count = strtok(NULL, " ");
|
|
||||||
int count = c_count ? atol(c_count) : 10;
|
|
||||||
|
|
||||||
if (count < 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QueryResult result;
|
|
||||||
|
|
||||||
uint32 cr_count = 0;
|
|
||||||
result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", cr_id);
|
|
||||||
if (result)
|
|
||||||
cr_count = (*result)[0].GetUInt64();
|
|
||||||
|
|
||||||
if (m_session)
|
|
||||||
{
|
|
||||||
Player* player = m_session->GetPlayer();
|
|
||||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
|
||||||
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), cr_id, uint32(count));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u",
|
|
||||||
cr_id, uint32(count));
|
|
||||||
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
Field* fields = result->Fetch();
|
|
||||||
uint32 guid = fields[0].GetUInt32();
|
|
||||||
float x = fields[1].GetFloat();
|
|
||||||
float y = fields[2].GetFloat();
|
|
||||||
float z = fields[3].GetFloat();
|
|
||||||
int mapid = fields[4].GetUInt16();
|
|
||||||
|
|
||||||
if (m_session)
|
|
||||||
PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, cInfo->Name.c_str(), x, y, z, mapid);
|
|
||||||
else
|
|
||||||
PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, cInfo->Name.c_str(), x, y, z, mapid);
|
|
||||||
} while (result->NextRow());
|
|
||||||
}
|
|
||||||
|
|
||||||
PSendSysMessage(LANG_COMMAND_LISTCREATUREMESSAGE, cr_id, cr_count);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ChatHandler::HandleLookupItemCommand(const char *args)
|
bool ChatHandler::HandleLookupItemCommand(const char *args)
|
||||||
{
|
{
|
||||||
if (!*args)
|
if (!*args)
|
||||||
@@ -2349,54 +1990,6 @@ bool ChatHandler::HandleChangeWeather(const char *args)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
|
|
||||||
{
|
|
||||||
Unit* unit = getSelectedUnit();
|
|
||||||
if (!unit)
|
|
||||||
{
|
|
||||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
|
||||||
SetSentErrorMessage(true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
char const* talentStr = GetTrinityString(LANG_TALENT);
|
|
||||||
char const* passiveStr = GetTrinityString(LANG_PASSIVE);
|
|
||||||
|
|
||||||
Unit::AuraApplicationMap const& uAuras = unit->GetAppliedAuras();
|
|
||||||
PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, uAuras.size());
|
|
||||||
for (Unit::AuraApplicationMap::const_iterator itr = uAuras.begin(); itr != uAuras.end(); ++itr)
|
|
||||||
{
|
|
||||||
bool talent = GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0;
|
|
||||||
|
|
||||||
AuraApplication const* aurApp = itr->second;
|
|
||||||
Aura const* aura = aurApp->GetBase();
|
|
||||||
char const* name = aura->GetSpellInfo()->SpellName[GetSessionDbcLocale()];
|
|
||||||
|
|
||||||
std::ostringstream ss_name;
|
|
||||||
ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r";
|
|
||||||
|
|
||||||
PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (m_session ? ss_name.str().c_str() : name),
|
|
||||||
aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(),
|
|
||||||
aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""),
|
|
||||||
(talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",
|
|
||||||
GUID_LOPART(aura->GetCasterGUID()));
|
|
||||||
}
|
|
||||||
for (uint16 i = 0; i < TOTAL_AURAS; ++i)
|
|
||||||
{
|
|
||||||
Unit::AuraEffectList const& uAuraList = unit->GetAuraEffectsByType(AuraType(i));
|
|
||||||
if (uAuraList.empty())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i);
|
|
||||||
for (Unit::AuraEffectList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr)
|
|
||||||
{
|
|
||||||
PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(),
|
|
||||||
(*itr)->GetAmount());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ChatHandler::HandleResetAchievementsCommand (const char * args)
|
bool ChatHandler::HandleResetAchievementsCommand (const char * args)
|
||||||
{
|
{
|
||||||
Player* target;
|
Player* target;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ set(scripts_STAT_SRCS
|
|||||||
Commands/cs_account.cpp
|
Commands/cs_account.cpp
|
||||||
Commands/cs_achievement.cpp
|
Commands/cs_achievement.cpp
|
||||||
Commands/cs_cast.cpp
|
Commands/cs_cast.cpp
|
||||||
|
Commands/cs_character.cpp
|
||||||
Commands/cs_debug.cpp
|
Commands/cs_debug.cpp
|
||||||
Commands/cs_event.cpp
|
Commands/cs_event.cpp
|
||||||
Commands/cs_gm.cpp
|
Commands/cs_gm.cpp
|
||||||
@@ -21,6 +22,7 @@ set(scripts_STAT_SRCS
|
|||||||
Commands/cs_honor.cpp
|
Commands/cs_honor.cpp
|
||||||
Commands/cs_instance.cpp
|
Commands/cs_instance.cpp
|
||||||
Commands/cs_learn.cpp
|
Commands/cs_learn.cpp
|
||||||
|
Commands/cs_list.cpp
|
||||||
Commands/cs_misc.cpp
|
Commands/cs_misc.cpp
|
||||||
Commands/cs_modify.cpp
|
Commands/cs_modify.cpp
|
||||||
Commands/cs_npc.cpp
|
Commands/cs_npc.cpp
|
||||||
@@ -30,13 +32,10 @@ set(scripts_STAT_SRCS
|
|||||||
Commands/cs_server.cpp
|
Commands/cs_server.cpp
|
||||||
Commands/cs_titles.cpp
|
Commands/cs_titles.cpp
|
||||||
Commands/cs_wp.cpp
|
Commands/cs_wp.cpp
|
||||||
Commands/cs_character.cpp
|
|
||||||
# Commands/cs_list.cpp
|
|
||||||
# Commands/cs_lookup.cpp
|
# Commands/cs_lookup.cpp
|
||||||
# Commands/cs_pdump.cpp
|
# Commands/cs_pdump.cpp
|
||||||
# Commands/cs_guild.cpp
|
# Commands/cs_guild.cpp
|
||||||
# Commands/cs_reset.cpp
|
# Commands/cs_reset.cpp
|
||||||
# Commands/cs_server.cpp
|
|
||||||
# Commands/cs_channel.cpp
|
# Commands/cs_channel.cpp
|
||||||
# Commands/cs_pet.cpp
|
# Commands/cs_pet.cpp
|
||||||
# Commands/cs_ticket.cpp
|
# Commands/cs_ticket.cpp
|
||||||
|
|||||||
@@ -0,0 +1,467 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* ScriptData
|
||||||
|
Name: list_commandscript
|
||||||
|
%Complete: 100
|
||||||
|
Comment: All list related commands
|
||||||
|
Category: commandscripts
|
||||||
|
EndScriptData */
|
||||||
|
|
||||||
|
#include "ScriptMgr.h"
|
||||||
|
#include "Chat.h"
|
||||||
|
#include "SpellAuraEffects.h"
|
||||||
|
|
||||||
|
class list_commandscript : public CommandScript
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
list_commandscript() : CommandScript("list_commandscript") { }
|
||||||
|
|
||||||
|
ChatCommand* GetCommands() const
|
||||||
|
{
|
||||||
|
static ChatCommand listCommandTable[] =
|
||||||
|
{
|
||||||
|
{ "creature", SEC_ADMINISTRATOR, true, &HandleListCreatureCommand, "", NULL },
|
||||||
|
{ "item", SEC_ADMINISTRATOR, true, &HandleListItemCommand, "", NULL },
|
||||||
|
{ "object", SEC_ADMINISTRATOR, true, &HandleListObjectCommand, "", NULL },
|
||||||
|
{ "auras", SEC_ADMINISTRATOR, false, &HandleListAurasCommand, "", NULL },
|
||||||
|
{ NULL, 0, false, NULL, "", NULL }
|
||||||
|
};
|
||||||
|
static ChatCommand commandTable[] =
|
||||||
|
{
|
||||||
|
{ "list", SEC_ADMINISTRATOR, true, NULL, "", listCommandTable },
|
||||||
|
{ NULL, 0, false, NULL, "", NULL }
|
||||||
|
};
|
||||||
|
return commandTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HandleListCreatureCommand(ChatHandler* handler, char const* args)
|
||||||
|
{
|
||||||
|
if (!*args)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// number or [name] Shift-click form |color|Hcreature_entry:creature_id|h[name]|h|r
|
||||||
|
char* id = handler->extractKeyFromLink((char*)args, "Hcreature_entry");
|
||||||
|
if (!id)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint32 creatureId = atol(id);
|
||||||
|
if (!creatureId)
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, creatureId);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureId);
|
||||||
|
if (!cInfo)
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, creatureId);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* countStr = strtok(NULL, " ");
|
||||||
|
uint32 count = countStr ? atol(countStr) : 10;
|
||||||
|
|
||||||
|
if (count < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
QueryResult result;
|
||||||
|
|
||||||
|
uint32 creatureCount = 0;
|
||||||
|
result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", creatureId);
|
||||||
|
if (result)
|
||||||
|
creatureCount = (*result)[0].GetUInt64();
|
||||||
|
|
||||||
|
if (handler->GetSession())
|
||||||
|
{
|
||||||
|
Player* player = handler->GetSession()->GetPlayer();
|
||||||
|
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
||||||
|
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), creatureId, count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u",
|
||||||
|
creatureId, count);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Field* fields = result->Fetch();
|
||||||
|
uint32 guid = fields[0].GetUInt32();
|
||||||
|
float x = fields[1].GetFloat();
|
||||||
|
float y = fields[2].GetFloat();
|
||||||
|
float z = fields[3].GetFloat();
|
||||||
|
uint16 mapId = fields[4].GetUInt16();
|
||||||
|
|
||||||
|
if (handler->GetSession())
|
||||||
|
handler->PSendSysMessage(LANG_CREATURE_LIST_CHAT, guid, guid, cInfo->Name.c_str(), x, y, z, mapId);
|
||||||
|
else
|
||||||
|
handler->PSendSysMessage(LANG_CREATURE_LIST_CONSOLE, guid, cInfo->Name.c_str(), x, y, z, mapId);
|
||||||
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
}
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_LISTCREATUREMESSAGE, creatureId, creatureCount);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HandleListItemCommand(ChatHandler* handler, char const* args)
|
||||||
|
{
|
||||||
|
if (!*args)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
char* id = handler->extractKeyFromLink((char*)args, "Hitem");
|
||||||
|
if (!id)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint32 itemId = atol(id);
|
||||||
|
if (!itemId)
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
|
||||||
|
if (!itemTemplate)
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* countStr = strtok(NULL, " ");
|
||||||
|
uint32 count = countStr ? atol(countStr) : 10;
|
||||||
|
|
||||||
|
if (count < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
PreparedQueryResult result;
|
||||||
|
|
||||||
|
// inventory case
|
||||||
|
uint32 inventoryCount = 0;
|
||||||
|
|
||||||
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_COUNT_ITEM);
|
||||||
|
stmt->setUInt32(0, itemId);
|
||||||
|
result = CharacterDatabase.Query(stmt);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
inventoryCount = (*result)[0].GetUInt64();
|
||||||
|
|
||||||
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_ITEM_BY_ENTRY);
|
||||||
|
stmt->setUInt32(0, itemId);
|
||||||
|
stmt->setUInt32(1, count);
|
||||||
|
result = CharacterDatabase.Query(stmt);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Field* fields = result->Fetch();
|
||||||
|
uint32 itemGuid = fields[0].GetUInt32();
|
||||||
|
uint32 itemBag = fields[1].GetUInt32();
|
||||||
|
uint8 itemSlot = fields[2].GetUInt8();
|
||||||
|
uint32 ownerGuid = fields[3].GetUInt32();
|
||||||
|
uint32 ownerAccountId = fields[4].GetUInt32();
|
||||||
|
std::string ownerName = fields[5].GetString();
|
||||||
|
|
||||||
|
char const* itemPos = 0;
|
||||||
|
if (Player::IsEquipmentPos(itemBag, itemSlot))
|
||||||
|
itemPos = "[equipped]";
|
||||||
|
else if (Player::IsInventoryPos(itemBag, itemSlot))
|
||||||
|
itemPos = "[in inventory]";
|
||||||
|
else if (Player::IsBankPos(itemBag, itemSlot))
|
||||||
|
itemPos = "[in bank]";
|
||||||
|
else
|
||||||
|
itemPos = "";
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_ITEMLIST_SLOT, itemGuid, ownerName.c_str(), ownerGuid, ownerAccountId, itemPos);
|
||||||
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
|
||||||
|
uint32 resultCount = uint32(result->GetRowCount());
|
||||||
|
|
||||||
|
if (count > resultCount)
|
||||||
|
count -= resultCount;
|
||||||
|
else if (count)
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mail case
|
||||||
|
uint32 mailCount;
|
||||||
|
|
||||||
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_COUNT_ITEM);
|
||||||
|
stmt->setUInt32(0, itemId);
|
||||||
|
result = CharacterDatabase.Query(stmt);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
mailCount = (*result)[0].GetUInt64();
|
||||||
|
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_ITEMS_BY_ENTRY);
|
||||||
|
stmt->setUInt32(0, itemId);
|
||||||
|
stmt->setUInt32(1, count);
|
||||||
|
result = CharacterDatabase.Query(stmt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result = PreparedQueryResult(NULL);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Field* fields = result->Fetch();
|
||||||
|
uint32 itemGuid = fields[0].GetUInt32();
|
||||||
|
uint32 itemSender = fields[1].GetUInt32();
|
||||||
|
uint32 itemReceiver = fields[2].GetUInt32();
|
||||||
|
uint32 itemSenderAccountId = fields[3].GetUInt32();
|
||||||
|
std::string itemSenderName = fields[4].GetString();
|
||||||
|
uint32 itemReceiverAccount = fields[5].GetUInt32();
|
||||||
|
std::string itemReceiverName = fields[6].GetString();
|
||||||
|
|
||||||
|
char const* itemPos = "[in mail]";
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_ITEMLIST_MAIL, itemGuid, itemSenderName.c_str(), itemSender, itemSenderAccountId, itemReceiverName.c_str(), itemReceiver, itemReceiverAccount, itemPos);
|
||||||
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
|
||||||
|
uint32 resultCount = uint32(result->GetRowCount());
|
||||||
|
|
||||||
|
if (count > resultCount)
|
||||||
|
count -= resultCount;
|
||||||
|
else if (count)
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// auction case
|
||||||
|
uint32 auctionCount = 0;
|
||||||
|
|
||||||
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_COUNT_ITEM);
|
||||||
|
stmt->setUInt32(0, itemId);
|
||||||
|
result = CharacterDatabase.Query(stmt);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
auctionCount = (*result)[0].GetUInt64();
|
||||||
|
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_AUCTIONHOUSE_ITEM_BY_ENTRY);
|
||||||
|
stmt->setUInt32(0, itemId);
|
||||||
|
stmt->setUInt32(1, count);
|
||||||
|
result = CharacterDatabase.Query(stmt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result = PreparedQueryResult(NULL);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Field* fields = result->Fetch();
|
||||||
|
uint32 itemGuid = fields[0].GetUInt32();
|
||||||
|
uint32 owner = fields[1].GetUInt32();
|
||||||
|
uint32 ownerAccountId = fields[2].GetUInt32();
|
||||||
|
std::string ownerName = fields[3].GetString();
|
||||||
|
|
||||||
|
char const* itemPos = "[in auction]";
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_ITEMLIST_AUCTION, itemGuid, ownerName.c_str(), owner, ownerAccountId, itemPos);
|
||||||
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
}
|
||||||
|
|
||||||
|
// guild bank case
|
||||||
|
uint32 guildCount = 0;
|
||||||
|
|
||||||
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_COUNT_ITEM);
|
||||||
|
stmt->setUInt32(0, itemId);
|
||||||
|
result = CharacterDatabase.Query(stmt);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
guildCount = (*result)[0].GetUInt64();
|
||||||
|
|
||||||
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_BANK_ITEM_BY_ENTRY);
|
||||||
|
stmt->setUInt32(0, itemId);
|
||||||
|
stmt->setUInt32(1, count);
|
||||||
|
result = CharacterDatabase.Query(stmt);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Field* fields = result->Fetch();
|
||||||
|
uint32 itemGuid = fields[0].GetUInt32();
|
||||||
|
uint32 guildGuid = fields[1].GetUInt32();
|
||||||
|
std::string guildName = fields[2].GetString();
|
||||||
|
|
||||||
|
char const* itemPos = "[in guild bank]";
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_ITEMLIST_GUILD, itemGuid, guildName.c_str(), guildGuid, itemPos);
|
||||||
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
|
||||||
|
uint32 resultCount = uint32(result->GetRowCount());
|
||||||
|
|
||||||
|
if (count > resultCount)
|
||||||
|
count -= resultCount;
|
||||||
|
else if (count)
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inventoryCount + mailCount + auctionCount + guildCount == 0)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_COMMAND_NOITEMFOUND);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_LISTITEMMESSAGE, itemId, inventoryCount + mailCount + auctionCount + guildCount, inventoryCount, mailCount, auctionCount, guildCount);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HandleListObjectCommand(ChatHandler* handler, char const* args)
|
||||||
|
{
|
||||||
|
if (!*args)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// number or [name] Shift-click form |color|Hgameobject_entry:go_id|h[name]|h|r
|
||||||
|
char* id = handler->extractKeyFromLink((char*)args, "Hgameobject_entry");
|
||||||
|
if (!id)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint32 gameObjectId = atol(id);
|
||||||
|
if (!gameObjectId)
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, gameObjectId);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameObjectTemplate const* gInfo = sObjectMgr->GetGameObjectTemplate(gameObjectId);
|
||||||
|
if (!gInfo)
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, gameObjectId);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* countStr = strtok(NULL, " ");
|
||||||
|
uint32 count = countStr ? atol(countStr) : 10;
|
||||||
|
|
||||||
|
if (count < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
QueryResult result;
|
||||||
|
|
||||||
|
uint32 objectCount = 0;
|
||||||
|
result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", gameObjectId);
|
||||||
|
if (result)
|
||||||
|
objectCount = (*result)[0].GetUInt64();
|
||||||
|
|
||||||
|
if (handler->GetSession())
|
||||||
|
{
|
||||||
|
Player* player = handler->GetSession()->GetPlayer();
|
||||||
|
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
||||||
|
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), gameObjectId, count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '%u' LIMIT %u",
|
||||||
|
gameObjectId, count);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Field* fields = result->Fetch();
|
||||||
|
uint32 guid = fields[0].GetUInt32();
|
||||||
|
float x = fields[1].GetFloat();
|
||||||
|
float y = fields[2].GetFloat();
|
||||||
|
float z = fields[3].GetFloat();
|
||||||
|
uint16 mapId = fields[4].GetUInt16();
|
||||||
|
uint32 entry = fields[5].GetUInt32();
|
||||||
|
|
||||||
|
if (handler->GetSession())
|
||||||
|
handler->PSendSysMessage(LANG_GO_LIST_CHAT, guid, entry, guid, gInfo->name.c_str(), x, y, z, mapId);
|
||||||
|
else
|
||||||
|
handler->PSendSysMessage(LANG_GO_LIST_CONSOLE, guid, gInfo->name.c_str(), x, y, z, mapId);
|
||||||
|
}
|
||||||
|
while (result->NextRow());
|
||||||
|
}
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_LISTOBJMESSAGE, gameObjectId, objectCount);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HandleListAurasCommand(ChatHandler* handler, char const* /*args*/)
|
||||||
|
{
|
||||||
|
Unit* unit = handler->getSelectedUnit();
|
||||||
|
if (!unit)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char const* talentStr = handler->GetTrinityString(LANG_TALENT);
|
||||||
|
char const* passiveStr = handler->GetTrinityString(LANG_PASSIVE);
|
||||||
|
|
||||||
|
Unit::AuraApplicationMap const& auras = unit->GetAppliedAuras();
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, auras.size());
|
||||||
|
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
|
||||||
|
{
|
||||||
|
bool talent = GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0;
|
||||||
|
|
||||||
|
AuraApplication const* aurApp = itr->second;
|
||||||
|
Aura const* aura = aurApp->GetBase();
|
||||||
|
char const* name = aura->GetSpellInfo()->SpellName[handler->GetSessionDbcLocale()];
|
||||||
|
|
||||||
|
std::ostringstream ss_name;
|
||||||
|
ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r";
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (handler->GetSession() ? ss_name.str().c_str() : name),
|
||||||
|
aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(),
|
||||||
|
aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""),
|
||||||
|
(talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",
|
||||||
|
GUID_LOPART(aura->GetCasterGUID()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint16 i = 0; i < TOTAL_AURAS; ++i)
|
||||||
|
{
|
||||||
|
Unit::AuraEffectList const& auraList = unit->GetAuraEffectsByType(AuraType(i));
|
||||||
|
if (auraList.empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, auraList.size(), i);
|
||||||
|
|
||||||
|
for (Unit::AuraEffectList::const_iterator itr = auraList.begin(); itr != auraList.end(); ++itr)
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(), (*itr)->GetAmount());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void AddSC_list_commandscript()
|
||||||
|
{
|
||||||
|
new list_commandscript();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user