mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Items: Updated item gem colors
This commit is contained in:
@@ -342,7 +342,7 @@ class TC_GAME_API Item : public Object
|
||||
int32 GetRequiredLevel() const;
|
||||
int32 GetItemStatType(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_STATS); return _bonusData.ItemStatType[index]; }
|
||||
float GetItemStatValue(uint32 index, Player const* owner) const;
|
||||
SocketColor GetSocketColor(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_SOCKETS); return SocketColor(_bonusData.SocketColor[index]); }
|
||||
uint32 GetSocketColor(uint32 index) const { ASSERT(index < MAX_ITEM_PROTO_SOCKETS); return _bonusData.SocketColor[index]; }
|
||||
uint32 GetAppearanceModId() const { return m_itemData->ItemAppearanceModID; }
|
||||
void SetAppearanceModId(uint32 appearanceModId) { SetUpdateFieldValue(m_values.ModifyValue(&Item::m_itemData).ModifyValue(&UF::ItemData::ItemAppearanceModID), appearanceModId); }
|
||||
uint32 GetDisplayId(Player const* owner) const;
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "DB2Stores.h"
|
||||
#include "World.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
|
||||
int32 const SocketColorToGemTypeMask[26] =
|
||||
int32 const SocketColorToGemTypeMask[30] =
|
||||
{
|
||||
0,
|
||||
SOCKET_COLOR_META,
|
||||
@@ -29,7 +29,7 @@ int32 const SocketColorToGemTypeMask[26] =
|
||||
SOCKET_COLOR_BLUE,
|
||||
SOCKET_COLOR_HYDRAULIC,
|
||||
SOCKET_COLOR_COGWHEEL,
|
||||
SOCKET_COLOR_PRISMATIC,
|
||||
SOCKET_COLOR_RED | SOCKET_COLOR_YELLOW | SOCKET_COLOR_BLUE,
|
||||
SOCKET_COLOR_RELIC_IRON,
|
||||
SOCKET_COLOR_RELIC_BLOOD,
|
||||
SOCKET_COLOR_RELIC_SHADOW,
|
||||
@@ -44,15 +44,19 @@ int32 const SocketColorToGemTypeMask[26] =
|
||||
SOCKET_COLOR_PUNCHCARD_RED,
|
||||
SOCKET_COLOR_PUNCHCARD_YELLOW,
|
||||
SOCKET_COLOR_PUNCHCARD_BLUE,
|
||||
SOCKET_COLOR_DOMINATION,
|
||||
SOCKET_COLOR_DOMINATION_BLOOD | SOCKET_COLOR_DOMINATION_FROST | SOCKET_COLOR_DOMINATION_UNHOLY,
|
||||
SOCKET_COLOR_CYPHER,
|
||||
SOCKET_COLOR_TINKER,
|
||||
SOCKET_COLOR_PRIMORDIAL
|
||||
SOCKET_COLOR_PRIMORDIAL,
|
||||
SOCKET_COLOR_FRAGRANCE,
|
||||
SOCKET_COLOR_SINGING_THUNDER,
|
||||
SOCKET_COLOR_SINGING_SEA,
|
||||
SOCKET_COLOR_SINGING_WIND
|
||||
};
|
||||
|
||||
char const* ItemTemplate::GetName(LocaleConstant locale) const
|
||||
{
|
||||
if (!strlen(ExtendedData->Display[locale]))
|
||||
if (ExtendedData->Display[locale][0] == '\0')
|
||||
return GetDefaultLocaleName();
|
||||
|
||||
return ExtendedData->Display[locale];
|
||||
@@ -91,7 +95,7 @@ bool ItemTemplate::CanChangeEquipStateInCombat() const
|
||||
|
||||
uint32 ItemTemplate::GetSkill() const
|
||||
{
|
||||
static uint32 const itemWeaponSkills[MAX_ITEM_SUBCLASS_WEAPON] =
|
||||
static constexpr uint32 ItemWeaponSkills[MAX_ITEM_SUBCLASS_WEAPON] =
|
||||
{
|
||||
SKILL_AXES, SKILL_TWO_HANDED_AXES, SKILL_BOWS, SKILL_GUNS, SKILL_MACES,
|
||||
SKILL_TWO_HANDED_MACES, SKILL_POLEARMS, SKILL_SWORDS, SKILL_TWO_HANDED_SWORDS, SKILL_WARGLAIVES,
|
||||
@@ -100,12 +104,12 @@ uint32 ItemTemplate::GetSkill() const
|
||||
SKILL_FISHING
|
||||
};
|
||||
|
||||
static uint32 const itemArmorSkills[MAX_ITEM_SUBCLASS_ARMOR] =
|
||||
static constexpr uint32 ItemArmorSkills[MAX_ITEM_SUBCLASS_ARMOR] =
|
||||
{
|
||||
0, SKILL_CLOTH, SKILL_LEATHER, SKILL_MAIL, SKILL_PLATE_MAIL, 0, SKILL_SHIELD, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static uint32 const itemProfessionSkills[MAX_ITEM_SUBCLASS_PROFESSION] =
|
||||
static constexpr uint32 ItemProfessionSkills[MAX_ITEM_SUBCLASS_PROFESSION] =
|
||||
{
|
||||
SKILL_BLACKSMITHING, SKILL_LEATHERWORKING, SKILL_ALCHEMY, SKILL_HERBALISM, SKILL_COOKING,
|
||||
SKILL_MINING, SKILL_TAILORING, SKILL_ENGINEERING, SKILL_ENCHANTING, SKILL_FISHING,
|
||||
@@ -118,17 +122,17 @@ uint32 ItemTemplate::GetSkill() const
|
||||
if (GetSubClass() >= MAX_ITEM_SUBCLASS_WEAPON)
|
||||
return 0;
|
||||
else
|
||||
return itemWeaponSkills[GetSubClass()];
|
||||
return ItemWeaponSkills[GetSubClass()];
|
||||
case ITEM_CLASS_ARMOR:
|
||||
if (GetSubClass() >= MAX_ITEM_SUBCLASS_ARMOR)
|
||||
return 0;
|
||||
else
|
||||
return itemArmorSkills[GetSubClass()];
|
||||
return ItemArmorSkills[GetSubClass()];
|
||||
case ITEM_CLASS_PROFESSION:
|
||||
if (GetSubClass() >= MAX_ITEM_SUBCLASS_PROFESSION)
|
||||
return 0;
|
||||
else
|
||||
return itemProfessionSkills[GetSubClass()];
|
||||
return ItemProfessionSkills[GetSubClass()];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -349,34 +349,39 @@ enum BAG_FAMILY_MASK
|
||||
|
||||
enum SocketColor
|
||||
{
|
||||
SOCKET_COLOR_META = 0x000001,
|
||||
SOCKET_COLOR_RED = 0x000002,
|
||||
SOCKET_COLOR_YELLOW = 0x000004,
|
||||
SOCKET_COLOR_BLUE = 0x000008,
|
||||
SOCKET_COLOR_HYDRAULIC = 0x000010, // not used
|
||||
SOCKET_COLOR_COGWHEEL = 0x000020,
|
||||
SOCKET_COLOR_PRISMATIC = 0x00000E,
|
||||
SOCKET_COLOR_RELIC_IRON = 0x000040,
|
||||
SOCKET_COLOR_RELIC_BLOOD = 0x000080,
|
||||
SOCKET_COLOR_RELIC_SHADOW = 0x000100,
|
||||
SOCKET_COLOR_RELIC_FEL = 0x000200,
|
||||
SOCKET_COLOR_RELIC_ARCANE = 0x000400,
|
||||
SOCKET_COLOR_RELIC_FROST = 0x000800,
|
||||
SOCKET_COLOR_RELIC_FIRE = 0x001000,
|
||||
SOCKET_COLOR_RELIC_WATER = 0x002000,
|
||||
SOCKET_COLOR_RELIC_LIFE = 0x004000,
|
||||
SOCKET_COLOR_RELIC_WIND = 0x008000,
|
||||
SOCKET_COLOR_RELIC_HOLY = 0x010000,
|
||||
SOCKET_COLOR_PUNCHCARD_RED = 0x020000,
|
||||
SOCKET_COLOR_PUNCHCARD_YELLOW = 0x040000,
|
||||
SOCKET_COLOR_PUNCHCARD_BLUE = 0x080000,
|
||||
SOCKET_COLOR_DOMINATION = 0x100000,
|
||||
SOCKET_COLOR_CYPHER = 0x200000,
|
||||
SOCKET_COLOR_TINKER = 0x400000,
|
||||
SOCKET_COLOR_PRIMORDIAL = 0x800000,
|
||||
SOCKET_COLOR_META = 0x00000001,
|
||||
SOCKET_COLOR_RED = 0x00000002,
|
||||
SOCKET_COLOR_YELLOW = 0x00000004,
|
||||
SOCKET_COLOR_BLUE = 0x00000008,
|
||||
SOCKET_COLOR_HYDRAULIC = 0x00000010,
|
||||
SOCKET_COLOR_COGWHEEL = 0x00000020,
|
||||
SOCKET_COLOR_RELIC_IRON = 0x00000040,
|
||||
SOCKET_COLOR_RELIC_BLOOD = 0x00000080,
|
||||
SOCKET_COLOR_RELIC_SHADOW = 0x00000100,
|
||||
SOCKET_COLOR_RELIC_FEL = 0x00000200,
|
||||
SOCKET_COLOR_RELIC_ARCANE = 0x00000400,
|
||||
SOCKET_COLOR_RELIC_FROST = 0x00000800,
|
||||
SOCKET_COLOR_RELIC_FIRE = 0x00001000,
|
||||
SOCKET_COLOR_RELIC_WATER = 0x00002000,
|
||||
SOCKET_COLOR_RELIC_LIFE = 0x00004000,
|
||||
SOCKET_COLOR_RELIC_WIND = 0x00008000,
|
||||
SOCKET_COLOR_RELIC_HOLY = 0x00010000,
|
||||
SOCKET_COLOR_PUNCHCARD_RED = 0x00020000,
|
||||
SOCKET_COLOR_PUNCHCARD_YELLOW = 0x00040000,
|
||||
SOCKET_COLOR_PUNCHCARD_BLUE = 0x00080000,
|
||||
SOCKET_COLOR_DOMINATION_BLOOD = 0x00100000,
|
||||
SOCKET_COLOR_DOMINATION_FROST = 0x00200000,
|
||||
SOCKET_COLOR_DOMINATION_UNHOLY = 0x00400000,
|
||||
SOCKET_COLOR_CYPHER = 0x00800000,
|
||||
SOCKET_COLOR_TINKER = 0x01000000,
|
||||
SOCKET_COLOR_PRIMORDIAL = 0x02000000,
|
||||
SOCKET_COLOR_FRAGRANCE = 0x04000000,
|
||||
SOCKET_COLOR_SINGING_THUNDER = 0x08000000,
|
||||
SOCKET_COLOR_SINGING_SEA = 0x10000000,
|
||||
SOCKET_COLOR_SINGING_WIND = 0x20000000,
|
||||
};
|
||||
|
||||
extern int32 const SocketColorToGemTypeMask[26];
|
||||
extern int32 const SocketColorToGemTypeMask[30];
|
||||
|
||||
#define SOCKET_COLOR_STANDARD (SOCKET_COLOR_RED | SOCKET_COLOR_YELLOW | SOCKET_COLOR_BLUE)
|
||||
|
||||
|
||||
@@ -977,24 +977,35 @@ void WorldSession::HandleSocketGems(WorldPackets::Item::SocketGems& socketGems)
|
||||
if (!gemProperties[i])
|
||||
continue;
|
||||
|
||||
uint32 acceptableGemTypeMask = SocketColorToGemTypeMask[itemTarget->GetSocketColor(i)];
|
||||
// tried to put gem in socket where no socket exists (take care about prismatic sockets)
|
||||
if (!itemTarget->GetSocketColor(i))
|
||||
switch (itemTarget->GetSocketColor(i))
|
||||
{
|
||||
// no prismatic socket
|
||||
if (!itemTarget->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT))
|
||||
return;
|
||||
case 0:
|
||||
{
|
||||
// no prismatic socket
|
||||
if (!itemTarget->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT))
|
||||
return;
|
||||
|
||||
if (i != firstPrismatic)
|
||||
return;
|
||||
if (i != firstPrismatic)
|
||||
return;
|
||||
|
||||
acceptableGemTypeMask = SOCKET_COLOR_RED | SOCKET_COLOR_YELLOW | SOCKET_COLOR_BLUE;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
// red, blue and yellow sockets accept any red/blue/yellow gem
|
||||
acceptableGemTypeMask = SOCKET_COLOR_RED | SOCKET_COLOR_YELLOW | SOCKET_COLOR_BLUE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Gem must match socket color
|
||||
if (SocketColorToGemTypeMask[itemTarget->GetSocketColor(i)] != gemProperties[i]->Type)
|
||||
{
|
||||
// unless its red, blue, yellow or prismatic
|
||||
if (!(SocketColorToGemTypeMask[itemTarget->GetSocketColor(i)] & SOCKET_COLOR_PRISMATIC) || !(gemProperties[i]->Type & SOCKET_COLOR_PRISMATIC))
|
||||
return;
|
||||
}
|
||||
if (!(acceptableGemTypeMask & gemProperties[i]->Type))
|
||||
return;
|
||||
}
|
||||
|
||||
// check unique-equipped conditions
|
||||
|
||||
Reference in New Issue
Block a user