mirror of
https://github.com/azerothcore/mod-transmog
synced 2025-11-29 22:48:30 +08:00
feat: Implement multiple AllowMixedWeaponType options (#106)
Co-authored-by: Stefano Borzì <stefanoborzi32@gmail.com>
This commit is contained in:
@@ -149,7 +149,10 @@ Transmogrification.TokenAmount = 1
|
|||||||
#
|
#
|
||||||
# Transmogrification.AllowMixedWeaponTypes
|
# Transmogrification.AllowMixedWeaponTypes
|
||||||
# Description: Allow axe to be transmogrified with dagger for example
|
# Description: Allow axe to be transmogrified with dagger for example
|
||||||
# Default: 0
|
# Possible options:
|
||||||
|
# Default: 0 - STRICT - Fully restricted like original Blizzard 4.3 transmog - Weapons must be the same weapon type (exceptions: Guns, Crossbows, or Bows)
|
||||||
|
# 1 - MODERN - Like later retail WoW, allow swords to be transmogged to axes, etc.
|
||||||
|
# 2 - FULL - No restrictions, allow any weapon to be transmogrified to any other weapon
|
||||||
#
|
#
|
||||||
# Transmogrification.AllowFishingPoles
|
# Transmogrification.AllowFishingPoles
|
||||||
# Description: Allow fishing poles to be transmogrified
|
# Description: Allow fishing poles to be transmogrified
|
||||||
|
|||||||
@@ -470,13 +470,62 @@ bool Transmogrification::CanTransmogrifyItemWithItem(Player* player, ItemTemplat
|
|||||||
{
|
{
|
||||||
if (source->Class == ITEM_CLASS_ARMOR && !AllowMixedArmorTypes)
|
if (source->Class == ITEM_CLASS_ARMOR && !AllowMixedArmorTypes)
|
||||||
return false;
|
return false;
|
||||||
if (source->Class == ITEM_CLASS_WEAPON && !AllowMixedWeaponTypes)
|
if (source->Class == ITEM_CLASS_WEAPON)
|
||||||
|
{
|
||||||
|
if (AllowMixedWeaponTypes == MIXED_WEAPONS_STRICT)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (AllowMixedWeaponTypes == MIXED_WEAPONS_MODERN)
|
||||||
|
{
|
||||||
|
switch (source->SubClass)
|
||||||
|
{
|
||||||
|
case ITEM_SUBCLASS_WEAPON_WAND:
|
||||||
|
case ITEM_SUBCLASS_WEAPON_DAGGER:
|
||||||
|
case ITEM_SUBCLASS_WEAPON_FIST:
|
||||||
|
return false;
|
||||||
|
case ITEM_SUBCLASS_WEAPON_AXE:
|
||||||
|
case ITEM_SUBCLASS_WEAPON_SWORD:
|
||||||
|
case ITEM_SUBCLASS_WEAPON_MACE:
|
||||||
|
if (target->SubClass != ITEM_SUBCLASS_WEAPON_MACE &&
|
||||||
|
target->SubClass != ITEM_SUBCLASS_WEAPON_AXE &&
|
||||||
|
target->SubClass != ITEM_SUBCLASS_WEAPON_SWORD)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ITEM_SUBCLASS_WEAPON_AXE2:
|
||||||
|
case ITEM_SUBCLASS_WEAPON_SWORD2:
|
||||||
|
case ITEM_SUBCLASS_WEAPON_MACE2:
|
||||||
|
case ITEM_SUBCLASS_WEAPON_STAFF:
|
||||||
|
case ITEM_SUBCLASS_WEAPON_POLEARM:
|
||||||
|
if (target->SubClass != ITEM_SUBCLASS_WEAPON_MACE2 &&
|
||||||
|
target->SubClass != ITEM_SUBCLASS_WEAPON_AXE2 &&
|
||||||
|
target->SubClass != ITEM_SUBCLASS_WEAPON_SWORD2 &&
|
||||||
|
target->SubClass != ITEM_SUBCLASS_WEAPON_STAFF &&
|
||||||
|
target->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source->InventoryType != target->InventoryType)
|
if (source->InventoryType != target->InventoryType)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Main-hand to offhand restrictions - see https://wowpedia.fandom.com/wiki/Transmogrification
|
||||||
|
if (AllowMixedWeaponTypes != MIXED_WEAPONS_LOOSE && ((source->InventoryType == INVTYPE_WEAPONMAINHAND && target->InventoryType != INVTYPE_WEAPONMAINHAND)
|
||||||
|
|| (source->InventoryType == INVTYPE_WEAPONOFFHAND && target->InventoryType != INVTYPE_WEAPONOFFHAND)))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (source->Class == ITEM_CLASS_WEAPON && !(IsRangedWeapon(target->Class, target->SubClass) ||
|
if (source->Class == ITEM_CLASS_WEAPON && !(IsRangedWeapon(target->Class, target->SubClass) ||
|
||||||
(
|
(
|
||||||
// [AZTH] Yehonal: fixed weapon check
|
// [AZTH] Yehonal: fixed weapon check
|
||||||
@@ -519,7 +568,7 @@ bool Transmogrification::SuitableForTransmogrification(Player* player, ItemTempl
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proto->Class == ITEM_CLASS_WEAPON && !AllowMixedWeaponTypes)
|
if (proto->Class == ITEM_CLASS_WEAPON && AllowMixedWeaponTypes != MIXED_WEAPONS_LOOSE)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -801,9 +850,10 @@ void Transmogrification::LoadConfig(bool reload)
|
|||||||
AllowTradeable = sConfigMgr->GetOption<bool>("Transmogrification.AllowTradeable", false);
|
AllowTradeable = sConfigMgr->GetOption<bool>("Transmogrification.AllowTradeable", false);
|
||||||
|
|
||||||
AllowMixedArmorTypes = sConfigMgr->GetOption<bool>("Transmogrification.AllowMixedArmorTypes", false);
|
AllowMixedArmorTypes = sConfigMgr->GetOption<bool>("Transmogrification.AllowMixedArmorTypes", false);
|
||||||
AllowMixedWeaponTypes = sConfigMgr->GetOption<bool>("Transmogrification.AllowMixedWeaponTypes", false);
|
|
||||||
AllowFishingPoles = sConfigMgr->GetOption<bool>("Transmogrification.AllowFishingPoles", false);
|
AllowFishingPoles = sConfigMgr->GetOption<bool>("Transmogrification.AllowFishingPoles", false);
|
||||||
|
|
||||||
|
AllowMixedWeaponTypes = sConfigMgr->GetOption<uint8>("Transmogrification.AllowMixedWeaponTypes", MIXED_WEAPONS_STRICT);
|
||||||
|
|
||||||
IgnoreReqRace = sConfigMgr->GetOption<bool>("Transmogrification.IgnoreReqRace", false);
|
IgnoreReqRace = sConfigMgr->GetOption<bool>("Transmogrification.IgnoreReqRace", false);
|
||||||
IgnoreReqClass = sConfigMgr->GetOption<bool>("Transmogrification.IgnoreReqClass", false);
|
IgnoreReqClass = sConfigMgr->GetOption<bool>("Transmogrification.IgnoreReqClass", false);
|
||||||
IgnoreReqSkill = sConfigMgr->GetOption<bool>("Transmogrification.IgnoreReqSkill", false);
|
IgnoreReqSkill = sConfigMgr->GetOption<bool>("Transmogrification.IgnoreReqSkill", false);
|
||||||
@@ -881,7 +931,7 @@ bool Transmogrification::GetAllowMixedArmorTypes() const
|
|||||||
{
|
{
|
||||||
return AllowMixedArmorTypes;
|
return AllowMixedArmorTypes;
|
||||||
};
|
};
|
||||||
bool Transmogrification::GetAllowMixedWeaponTypes() const
|
uint8 Transmogrification::GetAllowMixedWeaponTypes() const
|
||||||
{
|
{
|
||||||
return AllowMixedWeaponTypes;
|
return AllowMixedWeaponTypes;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -31,6 +31,13 @@ enum TransmogSettings
|
|||||||
SETTING_RETROACTIVE_CHECK = 1
|
SETTING_RETROACTIVE_CHECK = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum MixedWeaponSettings
|
||||||
|
{
|
||||||
|
MIXED_WEAPONS_STRICT = 0,
|
||||||
|
MIXED_WEAPONS_MODERN = 1,
|
||||||
|
MIXED_WEAPONS_LOOSE = 2
|
||||||
|
};
|
||||||
|
|
||||||
enum TransmogAcoreStrings // Language.h might have same entries, appears when executing SQL, change if needed
|
enum TransmogAcoreStrings // Language.h might have same entries, appears when executing SQL, change if needed
|
||||||
{
|
{
|
||||||
LANG_ERR_TRANSMOG_OK = 11100, // change this
|
LANG_ERR_TRANSMOG_OK = 11100, // change this
|
||||||
@@ -125,9 +132,10 @@ public:
|
|||||||
bool AllowTradeable;
|
bool AllowTradeable;
|
||||||
|
|
||||||
bool AllowMixedArmorTypes;
|
bool AllowMixedArmorTypes;
|
||||||
bool AllowMixedWeaponTypes;
|
|
||||||
bool AllowFishingPoles;
|
bool AllowFishingPoles;
|
||||||
|
|
||||||
|
uint8 AllowMixedWeaponTypes;
|
||||||
|
|
||||||
bool IgnoreReqRace;
|
bool IgnoreReqRace;
|
||||||
bool IgnoreReqClass;
|
bool IgnoreReqClass;
|
||||||
bool IgnoreReqSkill;
|
bool IgnoreReqSkill;
|
||||||
@@ -181,7 +189,7 @@ public:
|
|||||||
uint32 GetTokenAmount() const;
|
uint32 GetTokenAmount() const;
|
||||||
|
|
||||||
bool GetAllowMixedArmorTypes() const;
|
bool GetAllowMixedArmorTypes() const;
|
||||||
bool GetAllowMixedWeaponTypes() const;
|
uint8 GetAllowMixedWeaponTypes() const;
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
bool GetEnableTransmogInfo() const;
|
bool GetEnableTransmogInfo() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user