mirror of
https://github.com/azerothcore/mod-transmog
synced 2025-11-29 22:48:30 +08:00
feat: Implement transmog interface command (#188)
* feat: Implement transmog interface command * Update transmog_scripts.cpp
This commit is contained in:
@@ -29,6 +29,7 @@ enum TransmogSettings
|
||||
{
|
||||
SETTING_HIDE_TRANSMOG = 0,
|
||||
SETTING_RETROACTIVE_CHECK = 1,
|
||||
SETTING_VENDOR_INTERFACE = 2,
|
||||
|
||||
// Subscriptions
|
||||
SETTING_TRANSMOG_MEMBERSHIP_LEVEL = 0
|
||||
@@ -64,6 +65,8 @@ enum TransmogAcoreStrings // Language.h might have same entries, appears when ex
|
||||
LANG_CMD_TRANSMOG_ADD_FORBIDDEN = 11114,
|
||||
LANG_CMD_TRANSMOG_BEGIN_SYNC = 11115,
|
||||
LANG_CMD_TRANSMOG_COMPLETE_SYNC = 11116,
|
||||
LANG_CMD_TRANSMOG_VENDOR_INTERFACE_ENABLE = 11117,
|
||||
LANG_CMD_TRANSMOG_VENDOR_INTERFACE_DISABLE = 11118
|
||||
};
|
||||
|
||||
enum ArmorClassSpellIDs
|
||||
|
||||
@@ -40,10 +40,11 @@ public:
|
||||
|
||||
static ChatCommandTable transmogTable =
|
||||
{
|
||||
{ "add", addCollectionTable },
|
||||
{ "", HandleDisableTransMogVisual, SEC_PLAYER, Console::No },
|
||||
{ "sync", HandleSyncTransMogCommand, SEC_PLAYER, Console::No },
|
||||
{ "portable", HandleTransmogPortableCommand, SEC_PLAYER, Console::No },
|
||||
{ "add", addCollectionTable },
|
||||
{ "", HandleDisableTransMogVisual, SEC_PLAYER, Console::No },
|
||||
{ "sync", HandleSyncTransMogCommand, SEC_PLAYER, Console::No },
|
||||
{ "portable", HandleTransmogPortableCommand, SEC_PLAYER, Console::No },
|
||||
{ "interface", HandleInterfaceOption, SEC_PLAYER, Console::No }
|
||||
};
|
||||
|
||||
static ChatCommandTable commandTable =
|
||||
@@ -99,27 +100,19 @@ public:
|
||||
}
|
||||
|
||||
if (!player)
|
||||
{
|
||||
player = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||
}
|
||||
|
||||
if (!player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player* target = player->GetConnectedPlayer();
|
||||
bool isNotConsole = handler->GetSession();
|
||||
bool suitableForTransmog;
|
||||
|
||||
if (target)
|
||||
{
|
||||
suitableForTransmog = sTransmogrification->SuitableForTransmogrification(target, itemTemplate);
|
||||
}
|
||||
else
|
||||
{
|
||||
suitableForTransmog = sTransmogrification->SuitableForTransmogrification(player->GetGUID(), itemTemplate);
|
||||
}
|
||||
|
||||
if (!sTransmogrification->GetTrackUnusableItems() && !suitableForTransmog)
|
||||
{
|
||||
@@ -192,14 +185,10 @@ public:
|
||||
}
|
||||
|
||||
if (!player)
|
||||
{
|
||||
player = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||
}
|
||||
|
||||
if (!player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player* target = player->GetConnectedPlayer();
|
||||
ItemSetEntry const* set = sItemSetStore.LookupEntry(uint32(itemSetId));
|
||||
@@ -277,16 +266,12 @@ public:
|
||||
|
||||
// Successful command execution
|
||||
if (target != handler->GetPlayer())
|
||||
{
|
||||
handler->PSendSysMessage("ItemSet |cffffffff|Hitemset:{}|h[{} {}]|h|r has been added to the appearance collection of Player {}.", uint32(itemSetId), setName.c_str(), localeNames[locale], nameLink);
|
||||
}
|
||||
}
|
||||
|
||||
// Notify target of new item in appearance collection
|
||||
if (target && !(target->GetPlayerSetting("mod-transmog", SETTING_HIDE_TRANSMOG).value))
|
||||
{
|
||||
ChatHandler(target->GetSession()).PSendSysMessage("ItemSet |cffffffff|Hitemset:%d|h[{} {}]|h|r has been added to your appearance collection.", uint32(itemSetId), setName.c_str(), localeNames[locale]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -318,6 +303,13 @@ public:
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
static bool HandleInterfaceOption(ChatHandler* handler, bool enable)
|
||||
{
|
||||
handler->GetPlayer()->UpdatePlayerSetting("mod-transmog", SETTING_VENDOR_INTERFACE, enable);
|
||||
handler->SendSysMessage(enable ? LANG_CMD_TRANSMOG_VENDOR_INTERFACE_ENABLE : LANG_CMD_TRANSMOG_VENDOR_INTERFACE_DISABLE);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_transmog_commandscript()
|
||||
|
||||
@@ -485,7 +485,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
return sTransmogrification->IsEnabled() && (target && !target->GetPlayerSetting("mod-transmog", SETTING_HIDE_TRANSMOG).value);
|
||||
return sTransmogrification->IsEnabled() && (target && !target->GetPlayerSetting("mod-transmog", SETTING_HIDE_TRANSMOG).IsEnabled());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -538,13 +538,20 @@ public:
|
||||
switch (sender)
|
||||
{
|
||||
case EQUIPMENT_SLOT_END: // Show items you can use
|
||||
{
|
||||
sT->selectionCache[player->GetGUID()] = action;
|
||||
|
||||
bool useVendorInterface = player->GetPlayerSetting("mod-transmog", SETTING_VENDOR_INTERFACE).IsEnabled();
|
||||
|
||||
if (sT->GetUseVendorInterface())
|
||||
ShowTransmogItemsInFakeVendor(player, creature, action);
|
||||
else
|
||||
useVendorInterface ? ShowTransmogItemsInFakeVendor(player, creature, action) :
|
||||
ShowTransmogItemsInGossipMenu(player, creature, action, sender);
|
||||
else
|
||||
useVendorInterface ? ShowTransmogItemsInGossipMenu(player, creature, action, sender) :
|
||||
ShowTransmogItemsInFakeVendor(player, creature, action);
|
||||
|
||||
break;
|
||||
}
|
||||
case EQUIPMENT_SLOT_END + 1: // Main menu
|
||||
OnGossipHello(player, creature);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user