Core/Spells: Implemented SpellReagentsCurrency.db2
Port From (https://github.com/TrinityCore/TrinityCore/commit/8492c273dd50227ca01ead785eda6c4de9361e74)
This commit is contained in:
@@ -1048,6 +1048,9 @@ namespace Framework.Database
|
|||||||
PrepareStatement(HotfixStatements.SEL_SPELL_REAGENTS, "SELECT ID, SpellID, Reagent1, Reagent2, Reagent3, Reagent4, Reagent5, Reagent6, Reagent7, Reagent8, " +
|
PrepareStatement(HotfixStatements.SEL_SPELL_REAGENTS, "SELECT ID, SpellID, Reagent1, Reagent2, Reagent3, Reagent4, Reagent5, Reagent6, Reagent7, Reagent8, " +
|
||||||
"ReagentCount1, ReagentCount2, ReagentCount3, ReagentCount4, ReagentCount5, ReagentCount6, ReagentCount7, ReagentCount8 FROM spell_reagents");
|
"ReagentCount1, ReagentCount2, ReagentCount3, ReagentCount4, ReagentCount5, ReagentCount6, ReagentCount7, ReagentCount8 FROM spell_reagents");
|
||||||
|
|
||||||
|
// SpellReagentsCurrency.db2
|
||||||
|
PrepareStatement(HotfixStatements.SEL_SPELL_REAGENTS_CURRENCY, "SELECT ID, SpellID, CurrencyTypesID, CurrencyCount FROM spell_reagents_currency");
|
||||||
|
|
||||||
// SpellScaling.db2
|
// SpellScaling.db2
|
||||||
PrepareStatement(HotfixStatements.SEL_SPELL_SCALING, "SELECT ID, SpellID, MinScalingLevel, MaxScalingLevel, ScalesFromItemLevel FROM spell_scaling");
|
PrepareStatement(HotfixStatements.SEL_SPELL_SCALING, "SELECT ID, SpellID, MinScalingLevel, MaxScalingLevel, ScalesFromItemLevel FROM spell_scaling");
|
||||||
|
|
||||||
@@ -1749,6 +1752,8 @@ namespace Framework.Database
|
|||||||
|
|
||||||
SEL_SPELL_REAGENTS,
|
SEL_SPELL_REAGENTS,
|
||||||
|
|
||||||
|
SEL_SPELL_REAGENTS_CURRENCY,
|
||||||
|
|
||||||
SEL_SPELL_SCALING,
|
SEL_SPELL_SCALING,
|
||||||
|
|
||||||
SEL_SPELL_SHAPESHIFT,
|
SEL_SPELL_SHAPESHIFT,
|
||||||
|
|||||||
@@ -293,6 +293,7 @@ namespace Game.DataStorage
|
|||||||
SpellRadiusStorage = ReadDB2<SpellRadiusRecord>("SpellRadius.db2", HotfixStatements.SEL_SPELL_RADIUS);
|
SpellRadiusStorage = ReadDB2<SpellRadiusRecord>("SpellRadius.db2", HotfixStatements.SEL_SPELL_RADIUS);
|
||||||
SpellRangeStorage = ReadDB2<SpellRangeRecord>("SpellRange.db2", HotfixStatements.SEL_SPELL_RANGE, HotfixStatements.SEL_SPELL_RANGE_LOCALE);
|
SpellRangeStorage = ReadDB2<SpellRangeRecord>("SpellRange.db2", HotfixStatements.SEL_SPELL_RANGE, HotfixStatements.SEL_SPELL_RANGE_LOCALE);
|
||||||
SpellReagentsStorage = ReadDB2<SpellReagentsRecord>("SpellReagents.db2", HotfixStatements.SEL_SPELL_REAGENTS);
|
SpellReagentsStorage = ReadDB2<SpellReagentsRecord>("SpellReagents.db2", HotfixStatements.SEL_SPELL_REAGENTS);
|
||||||
|
SpellReagentsCurrencyStorage = ReadDB2<SpellReagentsCurrencyRecord>("SpellReagentsCurrency.db2", HotfixStatements.SEL_SPELL_REAGENTS_CURRENCY);
|
||||||
SpellScalingStorage = ReadDB2<SpellScalingRecord>("SpellScaling.db2", HotfixStatements.SEL_SPELL_SCALING);
|
SpellScalingStorage = ReadDB2<SpellScalingRecord>("SpellScaling.db2", HotfixStatements.SEL_SPELL_SCALING);
|
||||||
SpellShapeshiftStorage = ReadDB2<SpellShapeshiftRecord>("SpellShapeshift.db2", HotfixStatements.SEL_SPELL_SHAPESHIFT);
|
SpellShapeshiftStorage = ReadDB2<SpellShapeshiftRecord>("SpellShapeshift.db2", HotfixStatements.SEL_SPELL_SHAPESHIFT);
|
||||||
SpellShapeshiftFormStorage = ReadDB2<SpellShapeshiftFormRecord>("SpellShapeshiftForm.db2", HotfixStatements.SEL_SPELL_SHAPESHIFT_FORM, HotfixStatements.SEL_SPELL_SHAPESHIFT_FORM_LOCALE);
|
SpellShapeshiftFormStorage = ReadDB2<SpellShapeshiftFormRecord>("SpellShapeshiftForm.db2", HotfixStatements.SEL_SPELL_SHAPESHIFT_FORM, HotfixStatements.SEL_SPELL_SHAPESHIFT_FORM_LOCALE);
|
||||||
@@ -665,6 +666,7 @@ namespace Game.DataStorage
|
|||||||
public static DB6Storage<SpellRadiusRecord> SpellRadiusStorage;
|
public static DB6Storage<SpellRadiusRecord> SpellRadiusStorage;
|
||||||
public static DB6Storage<SpellRangeRecord> SpellRangeStorage;
|
public static DB6Storage<SpellRangeRecord> SpellRangeStorage;
|
||||||
public static DB6Storage<SpellReagentsRecord> SpellReagentsStorage;
|
public static DB6Storage<SpellReagentsRecord> SpellReagentsStorage;
|
||||||
|
public static DB6Storage<SpellReagentsCurrencyRecord> SpellReagentsCurrencyStorage;
|
||||||
public static DB6Storage<SpellScalingRecord> SpellScalingStorage;
|
public static DB6Storage<SpellScalingRecord> SpellScalingStorage;
|
||||||
public static DB6Storage<SpellShapeshiftRecord> SpellShapeshiftStorage;
|
public static DB6Storage<SpellShapeshiftRecord> SpellShapeshiftStorage;
|
||||||
public static DB6Storage<SpellShapeshiftFormRecord> SpellShapeshiftFormStorage;
|
public static DB6Storage<SpellShapeshiftFormRecord> SpellShapeshiftFormStorage;
|
||||||
|
|||||||
@@ -482,6 +482,14 @@ namespace Game.DataStorage
|
|||||||
public ushort[] ReagentCount = new ushort[SpellConst.MaxReagents];
|
public ushort[] ReagentCount = new ushort[SpellConst.MaxReagents];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sealed class SpellReagentsCurrencyRecord
|
||||||
|
{
|
||||||
|
public uint Id;
|
||||||
|
public int SpellID;
|
||||||
|
public ushort CurrencyTypesID;
|
||||||
|
public ushort CurrencyCount;
|
||||||
|
}
|
||||||
|
|
||||||
public sealed class SpellScalingRecord
|
public sealed class SpellScalingRecord
|
||||||
{
|
{
|
||||||
public uint Id;
|
public uint Id;
|
||||||
|
|||||||
@@ -3367,7 +3367,6 @@ namespace Game.Spells
|
|||||||
packet.FailedArg1 = (int)param1;
|
packet.FailedArg1 = (int)param1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint missingItem = 0;
|
|
||||||
for (uint i = 0; i < SpellConst.MaxReagents; i++)
|
for (uint i = 0; i < SpellConst.MaxReagents; i++)
|
||||||
{
|
{
|
||||||
if (spellInfo.Reagent[i] <= 0)
|
if (spellInfo.Reagent[i] <= 0)
|
||||||
@@ -3378,12 +3377,25 @@ namespace Game.Spells
|
|||||||
|
|
||||||
if (!caster.HasItemCount(itemid, itemcount))
|
if (!caster.HasItemCount(itemid, itemcount))
|
||||||
{
|
{
|
||||||
missingItem = itemid;
|
packet.FailedArg1 = (int)itemid; // first missing item
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
packet.FailedArg1 = (int)missingItem; // first missing item
|
if (param2.HasValue)
|
||||||
|
packet.FailedArg2 = (int)param2;
|
||||||
|
else if (!param1.HasValue)
|
||||||
|
{
|
||||||
|
foreach (var reagentsCurrency in spellInfo.ReagentsCurrency)
|
||||||
|
{
|
||||||
|
if (!caster.HasCurrency(reagentsCurrency.CurrencyTypesID, reagentsCurrency.CurrencyCount))
|
||||||
|
{
|
||||||
|
packet.FailedArg1 = -1;
|
||||||
|
packet.FailedArg2 = reagentsCurrency.CurrencyTypesID;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -4240,6 +4252,9 @@ namespace Game.Spells
|
|||||||
|
|
||||||
p_caster.DestroyItemCount(itemid, itemcount, true);
|
p_caster.DestroyItemCount(itemid, itemcount, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var reagentsCurrency in m_spellInfo.ReagentsCurrency)
|
||||||
|
p_caster.ModifyCurrency((CurrencyTypes)reagentsCurrency.CurrencyTypesID, -reagentsCurrency.CurrencyCount, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleThreatSpells()
|
void HandleThreatSpells()
|
||||||
@@ -6002,6 +6017,17 @@ namespace Game.Spells
|
|||||||
return SpellCastResult.Reagents;
|
return SpellCastResult.Reagents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var reagentsCurrency in m_spellInfo.ReagentsCurrency)
|
||||||
|
{
|
||||||
|
if (!player.HasCurrency(reagentsCurrency.CurrencyTypesID, reagentsCurrency.CurrencyCount))
|
||||||
|
{
|
||||||
|
param1 = -1;
|
||||||
|
param2 = reagentsCurrency.CurrencyTypesID;
|
||||||
|
|
||||||
|
return SpellCastResult.Reagents;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check totem-item requirements (items presence in inventory)
|
// check totem-item requirements (items presence in inventory)
|
||||||
|
|||||||
@@ -208,6 +208,8 @@ namespace Game.Spells
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReagentsCurrency = data.ReagentsCurrency;
|
||||||
|
|
||||||
// SpellShapeshiftEntry
|
// SpellShapeshiftEntry
|
||||||
SpellShapeshiftRecord _shapeshift = data.Shapeshift;
|
SpellShapeshiftRecord _shapeshift = data.Shapeshift;
|
||||||
if (_shapeshift != null)
|
if (_shapeshift != null)
|
||||||
@@ -3883,6 +3885,7 @@ namespace Game.Spells
|
|||||||
public uint[] TotemCategory = new uint[SpellConst.MaxTotems];
|
public uint[] TotemCategory = new uint[SpellConst.MaxTotems];
|
||||||
public int[] Reagent = new int[SpellConst.MaxReagents];
|
public int[] Reagent = new int[SpellConst.MaxReagents];
|
||||||
public uint[] ReagentCount = new uint[SpellConst.MaxReagents];
|
public uint[] ReagentCount = new uint[SpellConst.MaxReagents];
|
||||||
|
public List<SpellReagentsCurrencyRecord> ReagentsCurrency = new();
|
||||||
public ItemClass EquippedItemClass { get; set; }
|
public ItemClass EquippedItemClass { get; set; }
|
||||||
public int EquippedItemSubClassMask { get; set; }
|
public int EquippedItemSubClassMask { get; set; }
|
||||||
public int EquippedItemInventoryTypeMask { get; set; }
|
public int EquippedItemInventoryTypeMask { get; set; }
|
||||||
|
|||||||
@@ -2255,6 +2255,9 @@ namespace Game.Entities
|
|||||||
foreach (SpellReagentsRecord reagents in CliDB.SpellReagentsStorage.Values)
|
foreach (SpellReagentsRecord reagents in CliDB.SpellReagentsStorage.Values)
|
||||||
GetLoadHelper(reagents.SpellID, 0).Reagents = reagents;
|
GetLoadHelper(reagents.SpellID, 0).Reagents = reagents;
|
||||||
|
|
||||||
|
foreach (SpellReagentsCurrencyRecord reagentsCurrency in CliDB.SpellReagentsCurrencyStorage.Values)
|
||||||
|
GetLoadHelper((uint)reagentsCurrency.SpellID, 0).ReagentsCurrency.Add(reagentsCurrency);
|
||||||
|
|
||||||
foreach (SpellScalingRecord scaling in CliDB.SpellScalingStorage.Values)
|
foreach (SpellScalingRecord scaling in CliDB.SpellScalingStorage.Values)
|
||||||
GetLoadHelper(scaling.SpellID, 0).Scaling = scaling;
|
GetLoadHelper(scaling.SpellID, 0).Scaling = scaling;
|
||||||
|
|
||||||
@@ -2336,6 +2339,9 @@ namespace Game.Entities
|
|||||||
if (data.Value.Reagents == null)
|
if (data.Value.Reagents == null)
|
||||||
data.Value.Reagents = fallbackData.Reagents;
|
data.Value.Reagents = fallbackData.Reagents;
|
||||||
|
|
||||||
|
if (data.Value.ReagentsCurrency.Empty())
|
||||||
|
data.Value.ReagentsCurrency = fallbackData.ReagentsCurrency;
|
||||||
|
|
||||||
if (data.Value.Scaling == null)
|
if (data.Value.Scaling == null)
|
||||||
data.Value.Scaling = fallbackData.Scaling;
|
data.Value.Scaling = fallbackData.Scaling;
|
||||||
|
|
||||||
@@ -4672,6 +4678,7 @@ namespace Game.Entities
|
|||||||
public SpellMiscRecord Misc;
|
public SpellMiscRecord Misc;
|
||||||
public SpellPowerRecord[] Powers = new SpellPowerRecord[SpellConst.MaxPowersPerSpell];
|
public SpellPowerRecord[] Powers = new SpellPowerRecord[SpellConst.MaxPowersPerSpell];
|
||||||
public SpellReagentsRecord Reagents;
|
public SpellReagentsRecord Reagents;
|
||||||
|
public List<SpellReagentsCurrencyRecord> ReagentsCurrency = new();
|
||||||
public SpellScalingRecord Scaling;
|
public SpellScalingRecord Scaling;
|
||||||
public SpellShapeshiftRecord Shapeshift;
|
public SpellShapeshiftRecord Shapeshift;
|
||||||
public SpellTargetRestrictionsRecord TargetRestrictions;
|
public SpellTargetRestrictionsRecord TargetRestrictions;
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
--
|
||||||
|
-- Table structure for table `spell_reagents_currency`
|
||||||
|
--
|
||||||
|
DROP TABLE IF EXISTS `spell_reagents_currency`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!50503 SET character_set_client = utf8mb4 */;
|
||||||
|
CREATE TABLE `spell_reagents_currency` (
|
||||||
|
`ID` int(10) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`SpellID` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`CurrencyTypesID` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`CurrencyCount` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||||
|
`VerifiedBuild` int(11) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`ID`,`VerifiedBuild`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table data for table `spell_reagents_currency`
|
||||||
|
--
|
||||||
|
INSERT INTO `spell_reagents_currency`
|
||||||
|
SELECT hb.`RecordId`, CONV(HEX(SUBSTRING(hb.`Blob`, 1, 4)), 16, 10), CONV(HEX(SUBSTRING(hb.`Blob`, 5, 2)), 16, 10), CONV(HEX(SUBSTRING(hb.`Blob`, 7, 2)), 16, 10), hb.`VerifiedBuild` FROM `hotfix_blob` hb WHERE hb.`TableHash`=0x2049B60C AND hb.`locale`='enUS';
|
||||||
|
|
||||||
|
DELETE FROM `hotfix_blob` WHERE `TableHash`=0x2049B60C;
|
||||||
Reference in New Issue
Block a user