Core/Items: downgrade items part 1: removed item bonus generation, artifact weapon handling and azerite item mechanics

This commit is contained in:
Ovahlord
2023-11-23 02:31:31 +01:00
parent 40ddd29d03
commit bba8e6fe41
50 changed files with 159 additions and 2601 deletions

View File

@@ -30,7 +30,6 @@
#include "IpAddress.h"
#include "IPLocation.h"
#include "Item.h"
#include "ItemBonusMgr.h"
#include "Language.h"
#include "MiscPackets.h"
#include "MMapFactory.h"
@@ -1233,14 +1232,7 @@ public:
ItemContext itemContext = ItemContext::NONE;
if (context)
{
itemContext = ItemContext(Trinity::StringTo<uint8>(context).value_or(0));
if (itemContext < ItemContext::Max)
{
std::vector<int32> contextBonuses = ItemBonusMgr::GetBonusListsForItem(itemId, itemContext);
bonusListIDs.insert(bonusListIDs.begin(), contextBonuses.begin(), contextBonuses.end());
}
}
Player* player = handler->GetSession()->GetPlayer();
Player* playerTarget = handler->getSelectedPlayer();
@@ -1298,8 +1290,7 @@ public:
return false;
}
Item* item = playerTarget->StoreNewItem(dest, itemId, true, GenerateItemRandomBonusListId(itemId), GuidSet(), itemContext,
bonusListIDs.empty() ? nullptr : &bonusListIDs);
Item* item = playerTarget->StoreNewItem(dest, itemId, true, GuidSet(), itemContext);
// remove binding (let GM give it to another player later)
if (player == playerTarget)
@@ -1399,14 +1390,7 @@ public:
ItemContext itemContext = ItemContext::NONE;
if (context)
{
itemContext = ItemContext(Trinity::StringTo<uint8>(context).value_or(0));
if (itemContext < ItemContext::Max)
{
std::vector<int32> contextBonuses = ItemBonusMgr::GetBonusListsForItem(itemId, itemContext);
bonusListIDs.insert(bonusListIDs.begin(), contextBonuses.begin(), contextBonuses.end());
}
}
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
if (!itemTemplate)
@@ -1459,8 +1443,7 @@ public:
return false;
}
Item* item = playerTarget->StoreNewItem(dest, itemId, true, GenerateItemRandomBonusListId(itemId), GuidSet(), itemContext,
bonusListIDs.empty() ? nullptr : &bonusListIDs);
Item* item = playerTarget->StoreNewItem(dest, itemId, true, GuidSet(), itemContext);
// remove binding (let GM give it to another player later)
if (player == playerTarget)
@@ -1481,7 +1464,7 @@ public:
return true;
}
static bool HandleAddItemSetCommand(ChatHandler* handler, Variant<Hyperlink<itemset>, uint32> itemSetId, Optional<std::string_view> bonuses, Optional<uint8> context)
static bool HandleAddItemSetCommand(ChatHandler* handler, Variant<Hyperlink<itemset>, uint32> itemSetId, Optional<std::string_view> /*bonuses*/, Optional<uint8> context)
{
// prevent generation all items with itemset field value '0'
if (*itemSetId == 0)
@@ -1493,12 +1476,6 @@ public:
std::vector<int32> bonusListIDs;
// semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!)
if (bonuses)
for (std::string_view token : Trinity::Tokenize(*bonuses, ';', false))
if (Optional<int32> bonusListId = Trinity::StringTo<int32>(token); bonusListId && *bonusListId)
bonusListIDs.push_back(*bonusListId);
ItemContext itemContext = ItemContext::NONE;
if (context)
itemContext = ItemContext(*context);
@@ -1520,15 +1497,7 @@ public:
InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemTemplatePair.first, 1);
if (msg == EQUIP_ERR_OK)
{
std::vector<int32> bonusListIDsForItem = bonusListIDs; // copy, bonuses for each depending on context might be different for each item
if (itemContext < ItemContext::Max)
{
std::vector<int32> contextBonuses = ItemBonusMgr::GetBonusListsForItem(itemTemplatePair.first, itemContext);
bonusListIDsForItem.insert(bonusListIDsForItem.begin(), contextBonuses.begin(), contextBonuses.end());
}
Item* item = playerTarget->StoreNewItem(dest, itemTemplatePair.first, true, {}, GuidSet(), itemContext,
bonusListIDsForItem.empty() ? nullptr : &bonusListIDsForItem);
Item* item = playerTarget->StoreNewItem(dest, itemTemplatePair.first, true, GuidSet(), itemContext);
// remove binding (let GM give it to another player later)
if (player == playerTarget)

View File

@@ -882,7 +882,6 @@ public:
static bool HandleReloadItemRandomBonusListTemplatesCommand(ChatHandler* handler, char const* /*args*/)
{
TC_LOG_INFO("misc", "Re-Loading Random item bonus list definitions...");
LoadItemRandomBonusListTemplates();
handler->SendGlobalGMSysMessage("DB table `item_random_bonus_list_template` reloaded.");
return true;
}

View File

@@ -3935,54 +3935,6 @@ class spell_item_zandalarian_charm : public SpellScriptLoader
uint32 _spellId;
};
class spell_item_artifical_stamina : public AuraScript
{
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
}
bool Load() override
{
return GetOwner()->GetTypeId() == TYPEID_PLAYER;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
if (Item* artifact = GetOwner()->ToPlayer()->GetItemByGuid(GetAura()->GetCastItemGUID()))
amount = GetEffectInfo(EFFECT_1).BasePoints * artifact->GetTotalPurchasedArtifactPowers() / 100;
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_artifical_stamina::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE);
}
};
class spell_item_artifical_damage : public AuraScript
{
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } });
}
bool Load() override
{
return GetOwner()->GetTypeId() == TYPEID_PLAYER;
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
if (Item* artifact = GetOwner()->ToPlayer()->GetItemByGuid(GetAura()->GetCastItemGUID()))
amount = GetSpellInfo()->GetEffect(EFFECT_1).BasePoints * artifact->GetTotalPurchasedArtifactPowers() / 100;
}
void Register() override
{
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_item_artifical_damage::CalculateAmount, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
}
};
enum AuraProcRemoveSpells
{
SPELL_TALISMAN_OF_ASCENDANCE = 28200,
@@ -4740,8 +4692,6 @@ void AddSC_item_spell_scripts()
RegisterSpellScript(spell_item_frozen_shadoweave);
RegisterSpellScript(spell_item_gnomish_death_ray);
RegisterSpellScript(spell_item_harm_prevention_belt);
RegisterSpellScriptWithArgs((spell_item_heartpierce<SPELL_INVIGORATION_ENERGY, SPELL_INVIGORATION_MANA, SPELL_INVIGORATION_RAGE, SPELL_INVIGORATION_RP>), "spell_item_heartpierce");
RegisterSpellScriptWithArgs((spell_item_heartpierce<SPELL_INVIGORATION_ENERGY_HERO, SPELL_INVIGORATION_MANA_HERO, SPELL_INVIGORATION_RAGE_HERO, SPELL_INVIGORATION_RP_HERO>), "spell_item_heartpierce_hero");
RegisterSpellScript(spell_item_hourglass_sand);
RegisterSpellScript(spell_item_crystal_spire_of_karabor);
RegisterSpellScript(spell_item_make_a_wish);
@@ -4818,8 +4768,6 @@ void AddSC_item_spell_scripts()
RegisterSpellScript(spell_item_universal_remote);
new spell_item_zandalarian_charm("spell_item_unstable_power", SPELL_UNSTABLE_POWER_AURA_STACK);
new spell_item_zandalarian_charm("spell_item_restless_strength", SPELL_RESTLESS_STRENGTH_AURA_STACK);
RegisterSpellScript(spell_item_artifical_stamina);
RegisterSpellScript(spell_item_artifical_damage);
RegisterSpellScript(spell_item_talisman_of_ascendance);
RegisterSpellScript(spell_item_battle_trance);
RegisterSpellScript(spell_item_world_queller_focus);

View File

@@ -118,7 +118,7 @@ public:
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 39883, 1); // Cracked Egg
if (msg == EQUIP_ERR_OK)
player->StoreNewItem(dest, 39883, true, GenerateItemRandomBonusListId(39883));
player->StoreNewItem(dest, 39883, true);
return true;
}
@@ -138,7 +138,7 @@ public:
ItemPosCountVec dest;
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 44718, 1); // Ripe Disgusting Jar
if (msg == EQUIP_ERR_OK)
player->StoreNewItem(dest, 44718, true, GenerateItemRandomBonusListId(44718));
player->StoreNewItem(dest, 44718, true);
return true;
}