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
+41 -32
View File
@@ -47,7 +47,7 @@ namespace Framework.Constants
SocketColor.Blue, SocketColor.Blue,
SocketColor.Hydraulic, SocketColor.Hydraulic,
SocketColor.Cogwheel, SocketColor.Cogwheel,
SocketColor.Prismatic, SocketColor.Red | SocketColor.Yellow | SocketColor.Blue,
SocketColor.RelicIron, SocketColor.RelicIron,
SocketColor.RelicBlood, SocketColor.RelicBlood,
SocketColor.RelicShadow, SocketColor.RelicShadow,
@@ -62,10 +62,14 @@ namespace Framework.Constants
SocketColor.PunchcardRed, SocketColor.PunchcardRed,
SocketColor.PunchcardYellow, SocketColor.PunchcardYellow,
SocketColor.PunchcardBlue, SocketColor.PunchcardBlue,
SocketColor.Domination, SocketColor.DominationBlood | SocketColor.DominationFrost | SocketColor.DominationUnholy,
SocketColor.Cypher, SocketColor.Cypher,
SocketColor.Tinker, SocketColor.Tinker,
SocketColor.Primordial SocketColor.Primordial,
SocketColor.Fragrance,
SocketColor.SingingThunder,
SocketColor.SingingSea,
SocketColor.SingingWind
}; };
public static ItemModifier[] AppearanceModifierSlotBySpec = public static ItemModifier[] AppearanceModifierSlotBySpec =
@@ -206,31 +210,36 @@ namespace Framework.Constants
public enum SocketColor public enum SocketColor
{ {
Meta = 0x00001, Meta = 0X01,
Red = 0x00002, Red = 0X02,
Yellow = 0x00004, Yellow = 0X04,
Blue = 0x00008, Blue = 0X08,
Hydraulic = 0x00010, // Not Used Hydraulic = 0X10,
Cogwheel = 0x00020, Cogwheel = 0X20,
Prismatic = 0x0000e, RelicIron = 0X40,
RelicIron = 0x00040, RelicBlood = 0X80,
RelicBlood = 0x00080, RelicShadow = 0X100,
RelicShadow = 0x00100, RelicFel = 0X200,
RelicFel = 0x00200, RelicArcane = 0X400,
RelicArcane = 0x00400, RelicFrost = 0X800,
RelicFrost = 0x00800, RelicFire = 0X1000,
RelicFire = 0x01000, RelicWater = 0X2000,
RelicWater = 0x02000, RelicLife = 0X4000,
RelicLife = 0x04000, RelicWind = 0X8000,
RelicWind = 0x08000, RelicHoly = 0X10000,
RelicHoly = 0x10000, PunchcardRed = 0X20000,
PunchcardRed = 0x20000, PunchcardYellow = 0X40000,
PunchcardYellow = 0x40000, PunchcardBlue = 0X80000,
PunchcardBlue = 0x80000, DominationBlood = 0X100000,
Domination = 0x100000, DominationFrost = 0X200000,
Cypher = 0x200000, DominationUnholy = 0X400000,
Tinker = 0x400000, Cypher = 0X800000,
Primordial = 0x800000, Tinker = 0x01000000,
Primordial = 0x02000000,
Fragrance = 0x04000000,
SingingThunder = 0x08000000,
SingingSea = 0x10000000,
SingingWind = 0x20000000,
Standard = (Red | Yellow | Blue) Standard = (Red | Yellow | Blue)
} }
@@ -1082,10 +1091,10 @@ namespace Framework.Constants
Unk8 = 0x2000, // ? Unk8 = 0x2000, // ?
Unk9 = 0x4000, // ? Unk9 = 0x4000, // ?
Unk10 = 0x8000, // ? Unk10 = 0x8000, // ?
Unk11 = 0x00010000, // ? Unk11 = 0X0010000, // ?
Unk12 = 0x00020000, // ? Unk12 = 0X0020000, // ?
Unk13 = 0x00040000, // ? Unk13 = 0X0040000, // ?
Child = 0x00080000, Child = 0X0080000,
Unk15 = 0x00100000, // ? Unk15 = 0x00100000, // ?
NewItem = 0x00200000, // Item glows in inventory NewItem = 0x00200000, // Item glows in inventory
AzeriteEmpoweredItemViewed = 0x00400000, // Won't play azerite powers animation when viewing it AzeriteEmpoweredItemViewed = 0x00400000, // Won't play azerite powers animation when viewing it
+4 -4
View File
@@ -2675,7 +2675,7 @@ namespace Game.Entities
Cypher.Assert(index < ItemConst.MaxStats); Cypher.Assert(index < ItemConst.MaxStats);
return _bonusData.ItemStatType[index]; return _bonusData.ItemStatType[index];
} }
public SocketColor GetSocketColor(uint index) public uint GetSocketColor(uint index)
{ {
Cypher.Assert(index < ItemConst.MaxGemSockets); Cypher.Assert(index < ItemConst.MaxGemSockets);
return _bonusData.socketColor[index]; return _bonusData.socketColor[index];
@@ -2881,7 +2881,7 @@ namespace Game.Entities
for (uint i = 0; i < ItemConst.MaxGemSockets; ++i) for (uint i = 0; i < ItemConst.MaxGemSockets; ++i)
{ {
socketColor[i] = proto.GetSocketColor(i); socketColor[i] = (uint)proto.GetSocketColor(i);
GemItemLevelBonus[i] = 0; GemItemLevelBonus[i] = 0;
GemRelicType[i] = -1; GemRelicType[i] = -1;
GemRelicRankBonus[i] = 0; GemRelicRankBonus[i] = 0;
@@ -2980,7 +2980,7 @@ namespace Game.Entities
{ {
if (socketColor[i] == 0) if (socketColor[i] == 0)
{ {
socketColor[i] = (SocketColor)values[1]; socketColor[i] = (uint)values[1];
--socketCount; --socketCount;
} }
} }
@@ -3061,7 +3061,7 @@ namespace Game.Entities
public int[] ItemStatType = new int[ItemConst.MaxStats]; public int[] ItemStatType = new int[ItemConst.MaxStats];
public int[] StatPercentEditor = new int[ItemConst.MaxStats]; public int[] StatPercentEditor = new int[ItemConst.MaxStats];
public float[] ItemStatSocketCostMultiplier = new float[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 ItemBondingType Bonding;
public uint AppearanceModID; public uint AppearanceModID;
public float RepairCostMultiplier; public float RepairCostMultiplier;
+21 -11
View File
@@ -818,24 +818,34 @@ namespace Game
if (gemProperties[i] == null) if (gemProperties[i] == null)
continue; continue;
SocketColor acceptableGemTypeMask = ItemConst.SocketColorToGemTypeMask[(int)itemTarget.GetSocketColor(i)];
// tried to put gem in socket where no socket exists (take care about prismatic sockets) // 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 case 0:
if (itemTarget.GetEnchantmentId(EnchantmentSlot.Prismatic) == 0) {
return; // no prismatic socket
if (itemTarget.GetEnchantmentId(EnchantmentSlot.Prismatic) == 0)
return;
if (i != firstPrismatic) if (i != firstPrismatic)
return; 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 // Gem must match socket color
if (ItemConst.SocketColorToGemTypeMask[(int)itemTarget.GetSocketColor(i)] != gemProperties[i].Type) if ((acceptableGemTypeMask & gemProperties[i].Type) == 0)
{ return;
// unless its red, blue, yellow or prismatic
if (!ItemConst.SocketColorToGemTypeMask[(int)itemTarget.GetSocketColor(i)].HasAnyFlag(SocketColor.Prismatic) || !gemProperties[i].Type.HasAnyFlag(SocketColor.Prismatic))
return;
}
} }
// check unique-equipped conditions // check unique-equipped conditions