Core/Items: Updated item gem colors

Port From (https://github.com/TrinityCore/TrinityCore/commit/d938fea455ece3a4236eead2e4d9d0b33d58c404)
This commit is contained in:
Hondacrx
2025-08-11 21:43:06 -04:00
parent 0fe016c3dd
commit 896f1077c2
3 changed files with 66 additions and 47 deletions
+4 -4
View File
@@ -2675,7 +2675,7 @@ namespace Game.Entities
Cypher.Assert(index < ItemConst.MaxStats);
return _bonusData.ItemStatType[index];
}
public SocketColor GetSocketColor(uint index)
public uint GetSocketColor(uint index)
{
Cypher.Assert(index < ItemConst.MaxGemSockets);
return _bonusData.socketColor[index];
@@ -2881,7 +2881,7 @@ namespace Game.Entities
for (uint i = 0; i < ItemConst.MaxGemSockets; ++i)
{
socketColor[i] = proto.GetSocketColor(i);
socketColor[i] = (uint)proto.GetSocketColor(i);
GemItemLevelBonus[i] = 0;
GemRelicType[i] = -1;
GemRelicRankBonus[i] = 0;
@@ -2980,7 +2980,7 @@ namespace Game.Entities
{
if (socketColor[i] == 0)
{
socketColor[i] = (SocketColor)values[1];
socketColor[i] = (uint)values[1];
--socketCount;
}
}
@@ -3061,7 +3061,7 @@ namespace Game.Entities
public int[] ItemStatType = new int[ItemConst.MaxStats];
public int[] StatPercentEditor = new int[ItemConst.MaxStats];
public float[] ItemStatSocketCostMultiplier = new float[ItemConst.MaxStats];
public SocketColor[] socketColor = new SocketColor[ItemConst.MaxGemSockets];
public uint[] socketColor = new uint[ItemConst.MaxGemSockets];
public ItemBondingType Bonding;
public uint AppearanceModID;
public float RepairCostMultiplier;
+21 -11
View File
@@ -818,24 +818,34 @@ namespace Game
if (gemProperties[i] == null)
continue;
SocketColor acceptableGemTypeMask = ItemConst.SocketColorToGemTypeMask[(int)itemTarget.GetSocketColor(i)];
// tried to put gem in socket where no socket exists (take care about prismatic sockets)
if (itemTarget.GetSocketColor(i) == 0)
switch (itemTarget.GetSocketColor(i))
{
// no prismatic socket
if (itemTarget.GetEnchantmentId(EnchantmentSlot.Prismatic) == 0)
return;
case 0:
{
// no prismatic socket
if (itemTarget.GetEnchantmentId(EnchantmentSlot.Prismatic) == 0)
return;
if (i != firstPrismatic)
if (i != firstPrismatic)
return;
acceptableGemTypeMask = SocketColor.Red | SocketColor.Yellow | SocketColor.Blue;
break;
}
case 2:
case 3:
case 4:
// red, blue and yellow sockets accept any red/blue/yellow gem
acceptableGemTypeMask = SocketColor.Red | SocketColor.Yellow | SocketColor.Blue;
break;
default:
break;
}
// Gem must match socket color
if (ItemConst.SocketColorToGemTypeMask[(int)itemTarget.GetSocketColor(i)] != gemProperties[i].Type)
{
// unless its red, blue, yellow or prismatic
if (!ItemConst.SocketColorToGemTypeMask[(int)itemTarget.GetSocketColor(i)].HasAnyFlag(SocketColor.Prismatic) || !gemProperties[i].Type.HasAnyFlag(SocketColor.Prismatic))
return;
}
if ((acceptableGemTypeMask & gemProperties[i].Type) == 0)
return;
}
// check unique-equipped conditions