From b2bc29ea00d5aa48d675088b6478ecc319e0e40f Mon Sep 17 00:00:00 2001 From: Pagani Walter Date: Wed, 19 Jul 2023 23:23:41 -0300 Subject: [PATCH] feat. Update module --- .editorconfig | 8 + .gitattributes | 105 +++++++ .github/ISSUE_TEMPLATE/bug_report.yml | 72 +++++ .github/ISSUE_TEMPLATE/feature_request.yml | 33 ++ README.md => .github/README.md | 0 .github/workflows/core-build.yml | 43 +-- .gitignore | 72 +++-- include.sh | 0 pull_request_template.md | 25 ++ src/BetterItemReloading.cpp | 343 ++++++++++----------- 10 files changed, 460 insertions(+), 241 deletions(-) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml rename README.md => .github/README.md (100%) create mode 100644 include.sh create mode 100644 pull_request_template.md diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..eb64e2f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +tab_width = 4 +insert_final_newline = true +trim_trailing_whitespace = true +max_line_length = 80 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7ef9001 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,105 @@ +## AUTO-DETECT +## Handle line endings automatically for files detected as +## text and leave all files detected as binary untouched. +## This will handle all files NOT defined below. +* text=auto eol=lf + +# Text +*.conf text +*.conf.dist text +*.cmake text + +## Scripts +*.sh text +*.fish text +*.lua text + +## SQL +*.sql text + +## C++ +*.c text +*.cc text +*.cxx text +*.cpp text +*.c++ text +*.hpp text +*.h text +*.h++ text +*.hh text + + +## For documentation + +# Documents +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain + +## DOCUMENTATION +*.markdown text +*.md text +*.mdwn text +*.mdown text +*.mkd text +*.mkdn text +*.mdtxt text +*.mdtext text +*.txt text +AUTHORS text +CHANGELOG text +CHANGES text +CONTRIBUTING text +COPYING text +copyright text +*COPYRIGHT* text +INSTALL text +license text +LICENSE text +NEWS text +readme text +*README* text +TODO text + +## GRAPHICS +*.ai binary +*.bmp binary +*.eps binary +*.gif binary +*.ico binary +*.jng binary +*.jp2 binary +*.jpg binary +*.jpeg binary +*.jpx binary +*.jxr binary +*.pdf binary +*.png binary +*.psb binary +*.psd binary +*.svg text +*.svgz binary +*.tif binary +*.tiff binary +*.wbmp binary +*.webp binary + + +## ARCHIVES +*.7z binary +*.gz binary +*.jar binary +*.rar binary +*.tar binary +*.zip binary + +## EXECUTABLES +*.exe binary +*.pyc binary diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..5610d2b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,72 @@ +name: Bug report +description: Create a bug report to help us improve. +title: "Bug: " +body: + - type: textarea + id: current + attributes: + label: Current Behaviour + description: | + Description of the problem or issue here. + Include entries of affected creatures / items / quests / spells etc. + If this is a crash, post the crashlog (upload to https://gist.github.com/) and include the link here. + Never upload files! Use GIST for text and YouTube for videos! + validations: + required: true + - type: textarea + id: expected + attributes: + label: Expected Behaviour + description: | + Tell us what should happen instead. + validations: + required: true + - type: textarea + id: reproduce + attributes: + label: Steps to reproduce the problem + description: | + What does someone else need to do to encounter the same bug? + placeholder: | + 1. Step 1 + 2. Step 2 + 3. Step 3 + validations: + required: true + - type: textarea + id: extra + attributes: + label: Extra Notes + description: | + Do you have any extra notes that can help solve the issue that does not fit any other field? + placeholder: | + None + validations: + required: false + - type: textarea + id: commit + attributes: + label: AC rev. hash/commit + description: | + Copy the result of the `.server debug` command (if you need to run it from the client get a prat addon) + validations: + required: true + - type: input + id: os + attributes: + label: Operating system + description: | + The Operating System the Server is running on. + i.e. Windows 11 x64, Debian 10 x64, macOS 12, Ubuntu 20.04 + validations: + required: true + - type: textarea + id: custom + attributes: + label: Custom changes or Modules + description: | + List which custom changes or modules you have applied, i.e. Eluna module, etc. + placeholder: | + None + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..58f79dd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,33 @@ +name: Feature request +description: Suggest an idea for this project +title: "Feature: " +body: + - type: markdown + attributes: + value: | + Thank you for taking your time to fill out a feature request. Remember to fill out all fields including the title above. + An issue that is not properly filled out will be closed. + - type: textarea + id: description + attributes: + label: Describe your feature request or suggestion in detail + description: | + A clear and concise description of what you want to happen. + validations: + required: true + - type: textarea + id: solution + attributes: + label: Describe a possible solution to your feature or suggestion in detail + description: | + A clear and concise description of any alternative solutions or features you've considered. + validations: + required: false + - type: textarea + id: additional + attributes: + label: Additional context + description: | + Add any other context or screenshots about the feature request here. + validations: + required: false diff --git a/README.md b/.github/README.md similarity index 100% rename from README.md rename to .github/README.md diff --git a/.github/workflows/core-build.yml b/.github/workflows/core-build.yml index 7dfa4b4..921c9eb 100644 --- a/.github/workflows/core-build.yml +++ b/.github/workflows/core-build.yml @@ -1,45 +1,12 @@ name: core-build on: push: + branches: + - 'master' pull_request: jobs: build: - strategy: - fail-fast: false - matrix: - compiler: [clang] - runs-on: ubuntu-latest - name: ${{ matrix.compiler }} - env: - COMPILER: ${{ matrix.compiler }} - steps: - - uses: actions/checkout@v2 - with: - repository: 'azerothcore/azerothcore-wotlk' - ref: 'master' - submodules: 'recursive' - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - path: 'modules/mod-better-item-reloading' - - name: Cache - uses: actions/cache@v1.1.2 - with: - path: /home/runner/.ccache - key: ccache:${{ matrix.compiler }}:${{ github.ref }}:${{ github.sha }} - restore-keys: | - ccache:${{ matrix.compiler }}:${{ github.ref }} - ccache:${{ matrix.compiler }} - - name: Configure OS - run: source ./apps/ci/ci-install.sh - env: - CONTINUOUS_INTEGRATION: true - - name: Import db - run: source ./apps/ci/ci-import-db.sh - - name: Build - run: source ./apps/ci/ci-compile.sh - - name: Dry run - run: source ./apps/ci/ci-worldserver-dry-run.sh - - name: Check startup errors - run: source ./apps/ci/ci-error-check.sh \ No newline at end of file + uses: azerothcore/reusable-workflows/.github/workflows/core_build_modules.yml@main + with: + module_repo: ${{ github.event.repository.name }} diff --git a/.gitignore b/.gitignore index 259148f..c6e1299 100644 --- a/.gitignore +++ b/.gitignore @@ -1,32 +1,48 @@ -# Prerequisites -*.d +!.gitignore -# Compiled Object files -*.slo -*.lo -*.o -*.obj +# +#Generic +# -# Precompiled Headers -*.gch -*.pch +.directory +.mailmap +*.orig +*.rej +*.*~ +.hg/ +*.kdev* +.DS_Store +CMakeLists.txt.user +*.bak +*.patch +*.diff +*.REMOTE.* +*.BACKUP.* +*.BASE.* +*.LOCAL.* -# Compiled Dynamic libraries -*.so -*.dylib -*.dll +# +# IDE & other softwares +# +/.settings/ +/.externalToolBuilders/* +# exclude in all levels +nbproject/ +.sync.ffs_db +*.kate-swp -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app +# +# Eclipse +# +*.pydevproject +.metadata +.gradle +tmp/ +*.tmp +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.project +.cproject diff --git a/include.sh b/include.sh new file mode 100644 index 0000000..e69de29 diff --git a/pull_request_template.md b/pull_request_template.md new file mode 100644 index 0000000..21c9245 --- /dev/null +++ b/pull_request_template.md @@ -0,0 +1,25 @@ + + +## Changes Proposed: +- +- + +## Issues Addressed: + +- Closes + +## SOURCE: + + +## Tests Performed: + +- +- + + +## How to Test the Changes: + + +1. +2. +3. diff --git a/src/BetterItemReloading.cpp b/src/BetterItemReloading.cpp index 823a32e..87187ee 100644 --- a/src/BetterItemReloading.cpp +++ b/src/BetterItemReloading.cpp @@ -5,30 +5,31 @@ #include "ScriptMgr.h" #include "Language.h" #include "DisableMgr.h" +#include "Tokenize.h" class BetterItemReloading : public CommandScript { public: BetterItemReloading() : CommandScript("BetterItemReloading") { } - std::vector GetCommands() const override + Acore::ChatCommands::ChatCommandTable GetCommands() const override { - static std::vector breloadCommandTable = + static Acore::ChatCommands::ChatCommandTable breloadCommandTable = { - { "item", SEC_ADMINISTRATOR, true, &HandleBetterReloadItemsCommand, ""} + { "item", HandleBetterReloadItemsCommand, SEC_ADMINISTRATOR, Acore::ChatCommands::Console::Yes } }; - static std::vector commandTable = + static Acore::ChatCommands::ChatCommandTable commandTable = { - { "breload", SEC_ADMINISTRATOR, true, nullptr, "", breloadCommandTable} + { "breload", breloadCommandTable} }; return commandTable; } - static bool HandleBetterReloadItemsCommand(ChatHandler* handler, const char* args) + static bool HandleBetterReloadItemsCommand(ChatHandler* handler, std::string args) { - if (!*args) + if (!args.empty()) return false; Player* player = handler->GetSession()->GetPlayer(); @@ -39,17 +40,15 @@ class BetterItemReloading : public CommandScript std::vector slots; std::vector bagSlots; - Tokenizer entries(std::string(args), ' '); - - for (Tokenizer::const_iterator itr = entries.begin(); itr != entries.end(); ++itr) + for (auto const& itr : Acore::Tokenize(args, ' ', false)) { - uint32 entry = uint32(atoi(*itr)); + Optional entry = Acore::StringTo(itr); // Deequip the item and cache it for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) { Item* pItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); - if (pItem && pItem->GetEntry() == entry) + if (pItem && pItem->GetEntry() == *entry) { uint8 slot = pItem->GetSlot(); pItems.push_back(pItem); @@ -58,38 +57,23 @@ class BetterItemReloading : public CommandScript } } - QueryResult result = WorldDatabase.PQuery("SELECT entry, class, subclass, SoundOverrideSubclass, name, displayid, Quality, Flags, FlagsExtra, BuyCount, BuyPrice, SellPrice, InventoryType, " - "AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, requiredspell, requiredhonorrank, " - "RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, maxcount, stackable, ContainerSlots, StatsCount, stat_type1, " - "stat_value1, stat_type2, stat_value2, stat_type3, stat_value3, stat_type4, stat_value4, stat_type5, stat_value5, stat_type6, " - "stat_value6, stat_type7, stat_value7, stat_type8, stat_value8, stat_type9, stat_value9, stat_type10, stat_value10, " - "ScalingStatDistribution, ScalingStatValue, dmg_min1, dmg_max1, dmg_type1, dmg_min2, dmg_max2, dmg_type2, armor, holy_res, fire_res, " - "nature_res, frost_res, shadow_res, arcane_res, delay, ammo_type, RangedModRange, spellid_1, spelltrigger_1, spellcharges_1, " - "spellppmRate_1, spellcooldown_1, spellcategory_1, spellcategorycooldown_1, spellid_2, spelltrigger_2, spellcharges_2, " - "spellppmRate_2, spellcooldown_2, spellcategory_2, spellcategorycooldown_2, spellid_3, spelltrigger_3, spellcharges_3, " - "spellppmRate_3, spellcooldown_3, spellcategory_3, spellcategorycooldown_3, spellid_4, spelltrigger_4, spellcharges_4, " - "spellppmRate_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4, spellid_5, spelltrigger_5, spellcharges_5, " - "spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5, bonding, description, PageText, LanguageID, PageMaterial, " - "startquest, lockid, Material, sheath, RandomProperty, RandomSuffix, block, itemset, MaxDurability, area, Map, BagFamily, " - "TotemCategory, socketColor_1, socketContent_1, socketColor_2, socketContent_2, socketColor_3, socketContent_3, socketBonus, " - "GemProperties, RequiredDisenchantSkill, ArmorDamageModifier, duration, ItemLimitCategory, HolidayId, ScriptName, DisenchantID, " - "FoodType, minMoneyLoot, maxMoneyLoot, flagsCustom FROM item_template WHERE entry = %u", entry); + QueryResult result = WorldDatabase.Query("SELECT `entry`, `class`, `subclass`, `SoundOverrideSubclass`, `name`, `displayid`, `Quality`, `Flags`, `FlagsExtra`, `BuyCount`, `BuyPrice`, `SellPrice`, `InventoryType`, `AllowableClass`, `AllowableRace`, `ItemLevel`, `RequiredLevel`, `RequiredSkill`, `RequiredSkillRank`, `requiredspell`, `requiredhonorrank`, `RequiredCityRank`, `RequiredReputationFaction`, `RequiredReputationRank`, `maxcount`, `stackable`, `ContainerSlots`, `StatsCount`, `stat_type1`, `stat_value1`, `stat_type2`, `stat_value2`, `stat_type3`, `stat_value3`, `stat_type4`, `stat_value4`, `stat_type5`, `stat_value5`, `stat_type6`, `stat_value6`, `stat_type7`, `stat_value7`, `stat_type8`, `stat_value8`, `stat_type9`, `stat_value9`, `stat_type10`, `stat_value10`, `ScalingStatDistribution`, `ScalingStatValue`, `dmg_min1`, `dmg_max1`, `dmg_type1`, `dmg_min2`, `dmg_max2`, `dmg_type2`, `armor`, `holy_res`, `fire_res`, `nature_res`, `frost_res`, `shadow_res`, `arcane_res`, `delay`, `ammo_type`, `RangedModRange`, `spellid_1`, `spelltrigger_1`, `spellcharges_1`, `spellppmRate_1`, `spellcooldown_1`, `spellcategory_1`, `spellcategorycooldown_1`, `spellid_2`, `spelltrigger_2`, `spellcharges_2`, `spellppmRate_2`, `spellcooldown_2`, `spellcategory_2`, `spellcategorycooldown_2`, `spellid_3`, `spelltrigger_3`, `spellcharges_3`, `spellppmRate_3`, `spellcooldown_3`, `spellcategory_3`, `spellcategorycooldown_3`, `spellid_4`, `spelltrigger_4`, `spellcharges_4`, `spellppmRate_4`, `spellcooldown_4`, `spellcategory_4`, `spellcategorycooldown_4`, `spellid_5`, `spelltrigger_5`, `spellcharges_5`, `spellppmRate_5`, `spellcooldown_5`, `spellcategory_5`, `spellcategorycooldown_5`, `bonding`, `description`, `PageText`, `LanguageID`, `PageMaterial`, `startquest`, `lockid`, `Material`, `sheath`, `RandomProperty`, `RandomSuffix`, `block`, `itemset`, `MaxDurability`, `area`, `Map`, `BagFamily`, `TotemCategory`, `socketColor_1`, `socketContent_1`, `socketColor_2`, `socketContent_2`, `socketColor_3`, `socketContent_3`, `socketBonus`, `GemProperties`, `RequiredDisenchantSkill`, `ArmorDamageModifier`, `duration`, `ItemLimitCategory`, `HolidayId`, `ScriptName`, `DisenchantID`, `FoodType`, `minMoneyLoot`, `maxMoneyLoot`, `flagsCustom`, `VerifiedBuild` FROM `item_template` WHERE `entry`={}", *entry); if (!result) { - handler->PSendSysMessage("Couldn't reload item_template entry %u", entry); + handler->PSendSysMessage("Couldn't reload item_template entry {}", *entry); continue; } Field* fields = result->Fetch(); ItemTemplate* itemTemplate; - std::unordered_map::const_iterator hasItem = sObjectMgr->GetItemTemplateStore()->find(entry); + std::unordered_map::const_iterator hasItem = sObjectMgr->GetItemTemplateStore()->find(*entry); if (hasItem == sObjectMgr->GetItemTemplateStore()->end()) { auto itStore = const_cast(sObjectMgr->GetItemTemplateStore()); - itStore->insert(std::make_pair(entry, ItemTemplate())); + itStore->insert(std::make_pair(*entry, ItemTemplate())); auto itStoreFast = const_cast*>(sObjectMgr->GetItemTemplateStoreFast()); // Sadly, we have to reinsert all items here @@ -106,129 +90,129 @@ class BetterItemReloading : public CommandScript } } - itemTemplate = const_cast(&sObjectMgr->GetItemTemplateStore()->at(entry)); - - itemTemplate->ItemId = entry; - itemTemplate->Class = uint32(fields[1].GetUInt8()); - itemTemplate->SubClass = uint32(fields[2].GetUInt8()); - itemTemplate->SoundOverrideSubclass = int32(fields[3].GetInt8()); - itemTemplate->Name1 = fields[4].GetString(); - itemTemplate->DisplayInfoID = fields[5].GetUInt32(); - itemTemplate->Quality = uint32(fields[6].GetUInt8()); - itemTemplate->Flags = fields[7].GetUInt32(); - itemTemplate->Flags2 = fields[8].GetUInt32(); - itemTemplate->BuyCount = uint32(fields[9].GetUInt8()); - itemTemplate->BuyPrice = int32(fields[10].GetInt64()); - itemTemplate->SellPrice = fields[11].GetUInt32(); - itemTemplate->InventoryType = uint32(fields[12].GetUInt8()); - itemTemplate->AllowableClass = fields[13].GetInt32(); - itemTemplate->AllowableRace = fields[14].GetInt32(); - itemTemplate->ItemLevel = uint32(fields[15].GetUInt16()); - itemTemplate->RequiredLevel = uint32(fields[16].GetUInt8()); - itemTemplate->RequiredSkill = uint32(fields[17].GetUInt16()); - itemTemplate->RequiredSkillRank = uint32(fields[18].GetUInt16()); - itemTemplate->RequiredSpell = fields[19].GetUInt32(); - itemTemplate->RequiredHonorRank = fields[20].GetUInt32(); - itemTemplate->RequiredCityRank = fields[21].GetUInt32(); - itemTemplate->RequiredReputationFaction = uint32(fields[22].GetUInt16()); - itemTemplate->RequiredReputationRank = uint32(fields[23].GetUInt16()); - itemTemplate->MaxCount = fields[24].GetInt32(); - itemTemplate->Stackable = fields[25].GetInt32(); - itemTemplate->ContainerSlots = uint32(fields[26].GetUInt8()); - itemTemplate->StatsCount = uint32(fields[27].GetUInt8()); + itemTemplate = const_cast(&sObjectMgr->GetItemTemplateStore()->at(*entry)); + + itemTemplate->ItemId = *entry; + itemTemplate->Class = uint32(fields[1].Get()); + itemTemplate->SubClass = uint32(fields[2].Get()); + itemTemplate->SoundOverrideSubclass = int32(fields[3].Get()); + itemTemplate->Name1 = fields[4].Get(); + itemTemplate->DisplayInfoID = fields[5].Get(); + itemTemplate->Quality = uint32(fields[6].Get()); + itemTemplate->Flags = fields[7].Get(); + itemTemplate->Flags2 = fields[8].Get(); + itemTemplate->BuyCount = uint32(fields[9].Get()); + itemTemplate->BuyPrice = int32(fields[10].Get()); + itemTemplate->SellPrice = fields[11].Get(); + itemTemplate->InventoryType = uint32(fields[12].Get()); + itemTemplate->AllowableClass = fields[13].Get(); + itemTemplate->AllowableRace = fields[14].Get(); + itemTemplate->ItemLevel = uint32(fields[15].Get()); + itemTemplate->RequiredLevel = uint32(fields[16].Get()); + itemTemplate->RequiredSkill = uint32(fields[17].Get()); + itemTemplate->RequiredSkillRank = uint32(fields[18].Get()); + itemTemplate->RequiredSpell = fields[19].Get(); + itemTemplate->RequiredHonorRank = fields[20].Get(); + itemTemplate->RequiredCityRank = fields[21].Get(); + itemTemplate->RequiredReputationFaction = uint32(fields[22].Get()); + itemTemplate->RequiredReputationRank = uint32(fields[23].Get()); + itemTemplate->MaxCount = fields[24].Get(); + itemTemplate->Stackable = fields[25].Get(); + itemTemplate->ContainerSlots = uint32(fields[26].Get()); + itemTemplate->StatsCount = uint32(fields[27].Get()); for (uint8 i = 0; i < itemTemplate->StatsCount; ++i) { - itemTemplate->ItemStat[i].ItemStatType = uint32(fields[28 + i * 2].GetUInt8()); - itemTemplate->ItemStat[i].ItemStatValue = int32(fields[29 + i * 2].GetInt16()); + itemTemplate->ItemStat[i].ItemStatType = uint32(fields[28 + i * 2].Get()); + itemTemplate->ItemStat[i].ItemStatValue = int32(fields[29 + i * 2].Get()); } - itemTemplate->ScalingStatDistribution = uint32(fields[48].GetUInt16()); - itemTemplate->ScalingStatValue = fields[49].GetInt32(); + itemTemplate->ScalingStatDistribution = uint32(fields[48].Get()); + itemTemplate->ScalingStatValue = fields[49].Get(); for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i) { - itemTemplate->Damage[i].DamageMin = fields[50 + i * 3].GetFloat(); - itemTemplate->Damage[i].DamageMax = fields[51 + i * 3].GetFloat(); - itemTemplate->Damage[i].DamageType = uint32(fields[52 + i * 3].GetUInt8()); + itemTemplate->Damage[i].DamageMin = fields[50 + i * 3].Get(); + itemTemplate->Damage[i].DamageMax = fields[51 + i * 3].Get(); + itemTemplate->Damage[i].DamageType = uint32(fields[52 + i * 3].Get()); } - itemTemplate->Armor = uint32(fields[56].GetUInt16()); - itemTemplate->HolyRes = uint32(fields[57].GetUInt8()); - itemTemplate->FireRes = uint32(fields[58].GetUInt8()); - itemTemplate->NatureRes = uint32(fields[59].GetUInt8()); - itemTemplate->FrostRes = uint32(fields[60].GetUInt8()); - itemTemplate->ShadowRes = uint32(fields[61].GetUInt8()); - itemTemplate->ArcaneRes = uint32(fields[62].GetUInt8()); - itemTemplate->Delay = uint32(fields[63].GetUInt16()); - itemTemplate->AmmoType = uint32(fields[64].GetUInt8()); - itemTemplate->RangedModRange = fields[65].GetFloat(); + itemTemplate->Armor = uint32(fields[56].Get()); + itemTemplate->HolyRes = uint32(fields[57].Get()); + itemTemplate->FireRes = uint32(fields[58].Get()); + itemTemplate->NatureRes = uint32(fields[59].Get()); + itemTemplate->FrostRes = uint32(fields[60].Get()); + itemTemplate->ShadowRes = uint32(fields[61].Get()); + itemTemplate->ArcaneRes = uint32(fields[62].Get()); + itemTemplate->Delay = uint32(fields[63].Get()); + itemTemplate->AmmoType = uint32(fields[64].Get()); + itemTemplate->RangedModRange = fields[65].Get(); for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) { - itemTemplate->Spells[i].SpellId = fields[66 + i * 7].GetInt32(); - itemTemplate->Spells[i].SpellTrigger = uint32(fields[67 + i * 7].GetUInt8()); - itemTemplate->Spells[i].SpellCharges = int32(fields[68 + i * 7].GetInt16()); - itemTemplate->Spells[i].SpellPPMRate = fields[69 + i * 7].GetFloat(); - itemTemplate->Spells[i].SpellCooldown = fields[70 + i * 7].GetInt32(); - itemTemplate->Spells[i].SpellCategory = uint32(fields[71 + i * 7].GetUInt16()); - itemTemplate->Spells[i].SpellCategoryCooldown = fields[72 + i * 7].GetInt32(); - } - - itemTemplate->Bonding = uint32(fields[101].GetUInt8()); - itemTemplate->Description = fields[102].GetString(); - itemTemplate->PageText = fields[103].GetUInt32(); - itemTemplate->LanguageID = uint32(fields[104].GetUInt8()); - itemTemplate->PageMaterial = uint32(fields[105].GetUInt8()); - itemTemplate->StartQuest = fields[106].GetUInt32(); - itemTemplate->LockID = fields[107].GetUInt32(); - itemTemplate->Material = int32(fields[108].GetInt8()); - itemTemplate->Sheath = uint32(fields[109].GetUInt8()); - itemTemplate->RandomProperty = fields[110].GetUInt32(); - itemTemplate->RandomSuffix = fields[111].GetInt32(); - itemTemplate->Block = fields[112].GetUInt32(); - itemTemplate->ItemSet = fields[113].GetUInt32(); - itemTemplate->MaxDurability = uint32(fields[114].GetUInt16()); - itemTemplate->Area = fields[115].GetUInt32(); - itemTemplate->Map = uint32(fields[116].GetUInt16()); - itemTemplate->BagFamily = fields[117].GetUInt32(); - itemTemplate->TotemCategory = fields[118].GetUInt32(); + itemTemplate->Spells[i].SpellId = fields[66 + i * 7].Get(); + itemTemplate->Spells[i].SpellTrigger = uint32(fields[67 + i * 7].Get()); + itemTemplate->Spells[i].SpellCharges = int32(fields[68 + i * 7].Get()); + itemTemplate->Spells[i].SpellPPMRate = fields[69 + i * 7].Get(); + itemTemplate->Spells[i].SpellCooldown = fields[70 + i * 7].Get(); + itemTemplate->Spells[i].SpellCategory = uint32(fields[71 + i * 7].Get()); + itemTemplate->Spells[i].SpellCategoryCooldown = fields[72 + i * 7].Get(); + } + + itemTemplate->Bonding = uint32(fields[101].Get()); + itemTemplate->Description = fields[102].Get(); + itemTemplate->PageText = fields[103].Get(); + itemTemplate->LanguageID = uint32(fields[104].Get()); + itemTemplate->PageMaterial = uint32(fields[105].Get()); + itemTemplate->StartQuest = fields[106].Get(); + itemTemplate->LockID = fields[107].Get(); + itemTemplate->Material = int32(fields[108].Get()); + itemTemplate->Sheath = uint32(fields[109].Get()); + itemTemplate->RandomProperty = fields[110].Get(); + itemTemplate->RandomSuffix = fields[111].Get(); + itemTemplate->Block = fields[112].Get(); + itemTemplate->ItemSet = fields[113].Get(); + itemTemplate->MaxDurability = uint32(fields[114].Get()); + itemTemplate->Area = fields[115].Get(); + itemTemplate->Map = uint32(fields[116].Get()); + itemTemplate->BagFamily = fields[117].Get(); + itemTemplate->TotemCategory = fields[118].Get(); for (uint8 i = 0; i < MAX_ITEM_PROTO_SOCKETS; ++i) { - itemTemplate->Socket[i].Color = uint32(fields[119 + i * 2].GetUInt8()); - itemTemplate->Socket[i].Content = fields[120 + i * 2].GetUInt32(); + itemTemplate->Socket[i].Color = uint32(fields[119 + i * 2].Get()); + itemTemplate->Socket[i].Content = fields[120 + i * 2].Get(); } - itemTemplate->socketBonus = fields[125].GetUInt32(); - itemTemplate->GemProperties = fields[126].GetUInt32(); - itemTemplate->RequiredDisenchantSkill = uint32(fields[127].GetInt16()); - itemTemplate->ArmorDamageModifier = fields[128].GetFloat(); - itemTemplate->Duration = fields[129].GetUInt32(); - itemTemplate->ItemLimitCategory = uint32(fields[130].GetInt16()); - itemTemplate->HolidayId = fields[131].GetUInt32(); - itemTemplate->ScriptId = sObjectMgr->GetScriptId(fields[132].GetCString()); - itemTemplate->DisenchantID = fields[133].GetUInt32(); - itemTemplate->FoodType = uint32(fields[134].GetUInt8()); - itemTemplate->MinMoneyLoot = fields[135].GetUInt32(); - itemTemplate->MaxMoneyLoot = fields[136].GetUInt32(); - itemTemplate->FlagsCu = fields[137].GetUInt32(); + itemTemplate->socketBonus = fields[125].Get(); + itemTemplate->GemProperties = fields[126].Get(); + itemTemplate->RequiredDisenchantSkill = uint32(fields[127].Get()); + itemTemplate->ArmorDamageModifier = fields[128].Get(); + itemTemplate->Duration = fields[129].Get(); + itemTemplate->ItemLimitCategory = uint32(fields[130].Get()); + itemTemplate->HolidayId = fields[131].Get(); + itemTemplate->ScriptId = sObjectMgr->GetScriptId(fields[132].Get()); + itemTemplate->DisenchantID = fields[133].Get(); + itemTemplate->FoodType = uint32(fields[134].Get()); + itemTemplate->MinMoneyLoot = fields[135].Get(); + itemTemplate->MaxMoneyLoot = fields[136].Get(); + itemTemplate->FlagsCu = fields[137].Get(); if (itemTemplate->Class >= MAX_ITEM_CLASS) { - sLog->outErrorDb("Item (Entry: %u) has wrong Class value (%u)", entry, itemTemplate->Class); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Class value ({})", *entry, itemTemplate->Class); itemTemplate->Class = ITEM_CLASS_MISC; } if (itemTemplate->SubClass >= MaxItemSubclassValues[itemTemplate->Class]) { - sLog->outErrorDb("Item (Entry: %u) has wrong Subclass value (%u) for class %u", entry, itemTemplate->SubClass, itemTemplate->Class); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Subclass value ({}) for class {}", *entry, itemTemplate->SubClass, itemTemplate->Class); itemTemplate->SubClass = 0;// exist for all item classes } if (itemTemplate->Quality >= MAX_ITEM_QUALITY) { - sLog->outErrorDb("Item (Entry: %u) has wrong Quality value (%u)", entry, itemTemplate->Quality); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Quality value ({})", *entry, itemTemplate->Quality); itemTemplate->Quality = ITEM_QUALITY_NORMAL; } @@ -236,36 +220,33 @@ class BetterItemReloading : public CommandScript { if (FactionEntry const* faction = sFactionStore.LookupEntry(HORDE)) if ((itemTemplate->AllowableRace & faction->BaseRepRaceMask[0]) == 0) - sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", - entry, itemTemplate->AllowableRace, ITEM_FLAGS_EXTRA_HORDE_ONLY); + LOG_ERROR("sql.sql", "Item (Entry: {}) has value ({}) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY ({}) in Flags field, item cannot be equipped or used by these races.", *entry, itemTemplate->AllowableRace, ITEM_FLAGS_EXTRA_HORDE_ONLY); if (itemTemplate->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) - sLog->outErrorDb("Item (Entry: %u) has value (%u) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, this is a wrong combination.", - entry, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY, ITEM_FLAGS_EXTRA_HORDE_ONLY); + LOG_ERROR("sql.sql", "Item (Entry: {}) has value ({}) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY ({}) in Flags field, this is a wrong combination.", *entry, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY, ITEM_FLAGS_EXTRA_HORDE_ONLY); } else if (itemTemplate->Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) { if (FactionEntry const* faction = sFactionStore.LookupEntry(ALLIANCE)) if ((itemTemplate->AllowableRace & faction->BaseRepRaceMask[0]) == 0) - sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", - entry, itemTemplate->AllowableRace, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY); + LOG_ERROR("sql.sql", "Item (Entry: {}) has value ({}) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY ({}) in Flags field, item cannot be equipped or used by these races.", *entry, itemTemplate->AllowableRace, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY); } if (itemTemplate->BuyCount <= 0) { - sLog->outErrorDb("Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", entry, itemTemplate->BuyCount); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong BuyCount value ({}), set to default(1).", *entry, itemTemplate->BuyCount); itemTemplate->BuyCount = 1; } if (itemTemplate->InventoryType >= MAX_INVTYPE) { - sLog->outErrorDb("Item (Entry: %u) has wrong InventoryType value (%u)", entry, itemTemplate->InventoryType); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong InventoryType value ({})", *entry, itemTemplate->InventoryType); itemTemplate->InventoryType = INVTYPE_NON_EQUIP; } if (itemTemplate->RequiredSkill >= MAX_SKILL_TYPE) { - sLog->outErrorDb("Item (Entry: %u) has wrong RequiredSkill value (%u)", entry, itemTemplate->RequiredSkill); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong RequiredSkill value ({})", *entry, itemTemplate->RequiredSkill); itemTemplate->RequiredSkill = 0; } @@ -285,60 +266,60 @@ class BetterItemReloading : public CommandScript if (req) { if (!(itemTemplate->AllowableClass & CLASSMASK_ALL_PLAYABLE)) - sLog->outErrorDb("Item (Entry: %u) does not have any playable classes (%u) in `AllowableClass` and can't be equipped or used.", entry, itemTemplate->AllowableClass); + LOG_ERROR("sql.sql", "Item (Entry: {}) does not have any playable classes ({}) in `AllowableClass` and can't be equipped or used.", *entry, itemTemplate->AllowableClass); if (!(itemTemplate->AllowableRace & RACEMASK_ALL_PLAYABLE)) - sLog->outErrorDb("Item (Entry: %u) does not have any playable races (%u) in `AllowableRace` and can't be equipped or used.", entry, itemTemplate->AllowableRace); + LOG_ERROR("sql.sql", "Item (Entry: {}) does not have any playable races ({}) in `AllowableRace` and can't be equipped or used.", *entry, itemTemplate->AllowableRace); } } if (itemTemplate->RequiredSpell && !sSpellMgr->GetSpellInfo(itemTemplate->RequiredSpell)) { - sLog->outErrorDb("Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate->RequiredSpell); + LOG_ERROR("sql.sql", "Item (Entry: {}) has a wrong (non-existing) spell in RequiredSpell ({})", *entry, itemTemplate->RequiredSpell); itemTemplate->RequiredSpell = 0; } if (itemTemplate->RequiredReputationRank >= MAX_REPUTATION_RANK) - sLog->outErrorDb("Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", entry, itemTemplate->RequiredReputationRank); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong reputation rank in RequiredReputationRank ({}), item can't be used.", *entry, itemTemplate->RequiredReputationRank); if (itemTemplate->RequiredReputationFaction) { if (!sFactionStore.LookupEntry(itemTemplate->RequiredReputationFaction)) { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", entry, itemTemplate->RequiredReputationFaction); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong (not existing) faction in RequiredReputationFaction ({})", *entry, itemTemplate->RequiredReputationFaction); itemTemplate->RequiredReputationFaction = 0; } if (itemTemplate->RequiredReputationRank == MIN_REPUTATION_RANK) - sLog->outErrorDb("Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", entry); + LOG_ERROR("sql.sql", "Item (Entry: {}) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", *entry); } if (itemTemplate->MaxCount < -1) { - sLog->outErrorDb("Item (Entry: %u) has too large negative in maxcount (%i), replace by value (-1) no storing limits.", entry, itemTemplate->MaxCount); + LOG_ERROR("sql.sql", "Item (Entry: {}) has too large negative in maxcount (%i), replace by value (-1) no storing limits.", *entry, itemTemplate->MaxCount); itemTemplate->MaxCount = -1; } if (itemTemplate->Stackable == 0) { - sLog->outErrorDb("Item (Entry: %u) has wrong value in stackable (%i), replace by default 1.", entry, itemTemplate->Stackable); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong value in stackable (%i), replace by default 1.", *entry, itemTemplate->Stackable); itemTemplate->Stackable = 1; } else if (itemTemplate->Stackable < -1) { - sLog->outErrorDb("Item (Entry: %u) has too large negative in stackable (%i), replace by value (-1) no stacking limits.", entry, itemTemplate->Stackable); + LOG_ERROR("sql.sql", "Item (Entry: {}) has too large negative in stackable (%i), replace by value (-1) no stacking limits.", *entry, itemTemplate->Stackable); itemTemplate->Stackable = -1; } if (itemTemplate->ContainerSlots > MAX_BAG_SIZE) { - sLog->outErrorDb("Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", entry, itemTemplate->ContainerSlots, MAX_BAG_SIZE); + LOG_ERROR("sql.sql", "Item (Entry: {}) has too large value in ContainerSlots ({}), replace by hardcoded limit ({}).", *entry, itemTemplate->ContainerSlots, MAX_BAG_SIZE); itemTemplate->ContainerSlots = MAX_BAG_SIZE; } if (itemTemplate->StatsCount > MAX_ITEM_PROTO_STATS) { - sLog->outErrorDb("Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).", entry, itemTemplate->StatsCount, MAX_ITEM_PROTO_STATS); + LOG_ERROR("sql.sql", "Item (Entry: {}) has too large value in statscount ({}), replace by hardcoded limit ({}).", *entry, itemTemplate->StatsCount, MAX_ITEM_PROTO_STATS); itemTemplate->StatsCount = MAX_ITEM_PROTO_STATS; } @@ -347,7 +328,7 @@ class BetterItemReloading : public CommandScript // for ItemStatValue != 0 if (itemTemplate->ItemStat[j].ItemStatValue && itemTemplate->ItemStat[j].ItemStatType >= MAX_ITEM_MOD) { - sLog->outErrorDb("Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j + 1, itemTemplate->ItemStat[j].ItemStatType); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong (non-existing?) stat_type%d ({})", *entry, j + 1, itemTemplate->ItemStat[j].ItemStatType); itemTemplate->ItemStat[j].ItemStatType = 0; } @@ -355,7 +336,7 @@ class BetterItemReloading : public CommandScript { case ITEM_MOD_SPELL_HEALING_DONE: case ITEM_MOD_SPELL_DAMAGE_DONE: - sLog->outErrorDb("Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j + 1, itemTemplate->ItemStat[j].ItemStatType); + LOG_ERROR("sql.sql", "Item (Entry: {}) has deprecated stat_type%d ({})", *entry, j + 1, itemTemplate->ItemStat[j].ItemStatType); break; default: break; @@ -366,7 +347,7 @@ class BetterItemReloading : public CommandScript { if (itemTemplate->Damage[j].DamageType >= MAX_SPELL_SCHOOL) { - sLog->outErrorDb("Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j + 1, itemTemplate->Damage[j].DamageType); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong dmg_type%d ({})", *entry, j + 1, itemTemplate->Damage[j].DamageType); itemTemplate->Damage[j].DamageType = 0; } } @@ -377,7 +358,7 @@ class BetterItemReloading : public CommandScript // spell_1 if (itemTemplate->Spells[0].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0 + 1, itemTemplate->Spells[0].SpellTrigger); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong item spell trigger value in spelltrigger_%d ({}) for special learning format", *entry, 0 + 1, itemTemplate->Spells[0].SpellTrigger); itemTemplate->Spells[0].SpellId = 0; itemTemplate->Spells[0].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; itemTemplate->Spells[1].SpellId = 0; @@ -387,14 +368,14 @@ class BetterItemReloading : public CommandScript // spell_2 have learning spell if (itemTemplate->Spells[1].SpellTrigger != ITEM_SPELLTRIGGER_LEARN_SPELL_ID) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1 + 1, itemTemplate->Spells[1].SpellTrigger); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong item spell trigger value in spelltrigger_%d ({}) for special learning format.", *entry, 1 + 1, itemTemplate->Spells[1].SpellTrigger); itemTemplate->Spells[0].SpellId = 0; itemTemplate->Spells[1].SpellId = 0; itemTemplate->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } else if (!itemTemplate->Spells[1].SpellId) { - sLog->outErrorDb("Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1 + 1); + LOG_ERROR("sql.sql", "Item (Entry: {}) does not have an expected spell in spellid_%d in special learning format.", *entry, 1 + 1); itemTemplate->Spells[0].SpellId = 0; itemTemplate->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } @@ -403,7 +384,7 @@ class BetterItemReloading : public CommandScript SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate->Spells[1].SpellId); if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate->Spells[1].SpellId, NULL)) { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1 + 1, itemTemplate->Spells[1].SpellId); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong (not existing) spell in spellid_%d (%d)", *entry, 1 + 1, itemTemplate->Spells[1].SpellId); itemTemplate->Spells[0].SpellId = 0; itemTemplate->Spells[1].SpellId = 0; itemTemplate->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; @@ -411,7 +392,7 @@ class BetterItemReloading : public CommandScript // allowed only in special format else if ((itemTemplate->Spells[1].SpellId == 483) || (itemTemplate->Spells[1].SpellId == 55884)) { - sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1 + 1, itemTemplate->Spells[1].SpellId); + LOG_ERROR("sql.sql", "Item (Entry: {}) has broken spell in spellid_%d (%d)", *entry, 1 + 1, itemTemplate->Spells[1].SpellId); itemTemplate->Spells[0].SpellId = 0; itemTemplate->Spells[1].SpellId = 0; itemTemplate->Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; @@ -423,13 +404,13 @@ class BetterItemReloading : public CommandScript { if (itemTemplate->Spells[j].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j + 1, itemTemplate->Spells[j].SpellTrigger); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong item spell trigger value in spelltrigger_%d ({})", *entry, j + 1, itemTemplate->Spells[j].SpellTrigger); itemTemplate->Spells[j].SpellId = 0; itemTemplate->Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } else if (itemTemplate->Spells[j].SpellId != 0) { - sLog->outErrorDb("Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j + 1, itemTemplate->Spells[j].SpellId); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong spell in spellid_%d (%d) for learning special format", *entry, j + 1, itemTemplate->Spells[j].SpellId); itemTemplate->Spells[j].SpellId = 0; } } @@ -441,7 +422,7 @@ class BetterItemReloading : public CommandScript { if (itemTemplate->Spells[j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER || itemTemplate->Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j + 1, itemTemplate->Spells[j].SpellTrigger); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong item spell trigger value in spelltrigger_%d ({})", *entry, j + 1, itemTemplate->Spells[j].SpellTrigger); itemTemplate->Spells[j].SpellId = 0; itemTemplate->Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } @@ -451,13 +432,13 @@ class BetterItemReloading : public CommandScript SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate->Spells[j].SpellId); if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate->Spells[j].SpellId, NULL)) { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j + 1, itemTemplate->Spells[j].SpellId); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong (not existing) spell in spellid_%d (%d)", *entry, j + 1, itemTemplate->Spells[j].SpellId); itemTemplate->Spells[j].SpellId = 0; } // allowed only in special format else if ((itemTemplate->Spells[j].SpellId == 483) || (itemTemplate->Spells[j].SpellId == 55884)) { - sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j + 1, itemTemplate->Spells[j].SpellId); + LOG_ERROR("sql.sql", "Item (Entry: {}) has broken spell in spellid_%d (%d)", *entry, j + 1, itemTemplate->Spells[j].SpellId); itemTemplate->Spells[j].SpellId = 0; } } @@ -465,17 +446,17 @@ class BetterItemReloading : public CommandScript } if (itemTemplate->Bonding >= MAX_BIND_TYPE) - sLog->outErrorDb("Item (Entry: %u) has wrong Bonding value (%u)", entry, itemTemplate->Bonding); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Bonding value ({})", *entry, itemTemplate->Bonding); if (itemTemplate->PageText && !sObjectMgr->GetPageText(itemTemplate->PageText)) - sLog->outErrorDb("Item (Entry: %u) has non existing first page (Id:%u)", entry, itemTemplate->PageText); + LOG_ERROR("sql.sql", "Item (Entry: {}) has non existing first page (Id:{})", *entry, itemTemplate->PageText); if (itemTemplate->LockID && !sLockStore.LookupEntry(itemTemplate->LockID)) - sLog->outErrorDb("Item (Entry: %u) has wrong LockID (%u)", entry, itemTemplate->LockID); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong LockID ({})", *entry, itemTemplate->LockID); if (itemTemplate->Sheath >= MAX_SHEATHETYPE) { - sLog->outErrorDb("Item (Entry: %u) has wrong Sheath (%u)", entry, itemTemplate->Sheath); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Sheath ({})", *entry, itemTemplate->Sheath); itemTemplate->Sheath = SHEATHETYPE_NONE; } @@ -486,28 +467,28 @@ class BetterItemReloading : public CommandScript else if (!sItemRandomPropertiesStore.LookupEntry(GetItemEnchantMod(itemTemplate->RandomProperty))) { - sLog->outErrorDb("Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", entry, itemTemplate->RandomProperty); + LOG_ERROR("sql.sql", "Item (Entry: {}) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty ({})", *entry, itemTemplate->RandomProperty); itemTemplate->RandomProperty = 0; } } if (itemTemplate->RandomSuffix && !sItemRandomSuffixStore.LookupEntry(GetItemEnchantMod(itemTemplate->RandomSuffix))) { - sLog->outErrorDb("Item (Entry: %u) has wrong RandomSuffix (%u)", entry, itemTemplate->RandomSuffix); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong RandomSuffix ({})", *entry, itemTemplate->RandomSuffix); itemTemplate->RandomSuffix = 0; } if (itemTemplate->ItemSet && !sItemSetStore.LookupEntry(itemTemplate->ItemSet)) { - sLog->outErrorDb("Item (Entry: %u) have wrong ItemSet (%u)", entry, itemTemplate->ItemSet); + LOG_ERROR("sql.sql", "Item (Entry: {}) have wrong ItemSet ({})", *entry, itemTemplate->ItemSet); itemTemplate->ItemSet = 0; } if (itemTemplate->Area && !sAreaTableStore.LookupEntry(itemTemplate->Area)) - sLog->outErrorDb("Item (Entry: %u) has wrong Area (%u)", entry, itemTemplate->Area); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Area ({})", *entry, itemTemplate->Area); if (itemTemplate->Map && !sMapStore.LookupEntry(itemTemplate->Map)) - sLog->outErrorDb("Item (Entry: %u) has wrong Map (%u)", entry, itemTemplate->Map); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong Map ({})", *entry, itemTemplate->Map); if (itemTemplate->BagFamily) { @@ -521,7 +502,7 @@ class BetterItemReloading : public CommandScript ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j + 1); if (!bf) { - sLog->outErrorDb("Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", entry); + LOG_ERROR("sql.sql", "Item (Entry: {}) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", *entry); itemTemplate->BagFamily &= ~mask; continue; } @@ -531,7 +512,7 @@ class BetterItemReloading : public CommandScript CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemTemplate->ItemId); if (!ctEntry) { - sLog->outErrorDb("Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit", entry); + LOG_ERROR("sql.sql", "Item (Entry: {}) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit", *entry); itemTemplate->BagFamily &= ~mask; } } @@ -539,41 +520,41 @@ class BetterItemReloading : public CommandScript } if (itemTemplate->TotemCategory && !sTotemCategoryStore.LookupEntry(itemTemplate->TotemCategory)) - sLog->outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)", entry, itemTemplate->TotemCategory); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong TotemCategory ({})", *entry, itemTemplate->TotemCategory); for (uint8 j = 0; j < MAX_ITEM_PROTO_SOCKETS; ++j) { if (itemTemplate->Socket[j].Color && (itemTemplate->Socket[j].Color & SOCKET_COLOR_ALL) != itemTemplate->Socket[j].Color) { - sLog->outErrorDb("Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j + 1, itemTemplate->Socket[j].Color); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong socketColor_%d ({})", *entry, j + 1, itemTemplate->Socket[j].Color); itemTemplate->Socket[j].Color = 0; } } if (itemTemplate->GemProperties && !sGemPropertiesStore.LookupEntry(itemTemplate->GemProperties)) - sLog->outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)", entry, itemTemplate->GemProperties); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong GemProperties ({})", *entry, itemTemplate->GemProperties); if (itemTemplate->FoodType >= MAX_PET_DIET) { - sLog->outErrorDb("Item (Entry: %u) has wrong FoodType value (%u)", entry, itemTemplate->FoodType); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong FoodType value ({})", *entry, itemTemplate->FoodType); itemTemplate->FoodType = 0; } if (itemTemplate->ItemLimitCategory && !sItemLimitCategoryStore.LookupEntry(itemTemplate->ItemLimitCategory)) { - sLog->outErrorDb("Item (Entry: %u) has wrong LimitCategory value (%u)", entry, itemTemplate->ItemLimitCategory); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong LimitCategory value ({})", *entry, itemTemplate->ItemLimitCategory); itemTemplate->ItemLimitCategory = 0; } if (itemTemplate->HolidayId && !sHolidaysStore.LookupEntry(itemTemplate->HolidayId)) { - sLog->outErrorDb("Item (Entry: %u) has wrong HolidayId value (%u)", entry, itemTemplate->HolidayId); + LOG_ERROR("sql.sql", "Item (Entry: {}) has wrong HolidayId value ({})", *entry, itemTemplate->HolidayId); itemTemplate->HolidayId = 0; } if (itemTemplate->FlagsCu & ITEM_FLAGS_CU_DURATION_REAL_TIME && !itemTemplate->Duration) { - sLog->outErrorDb("Item (Entry %u) has flag ITEM_FLAGS_CU_DURATION_REAL_TIME but it does not have duration limit", entry); + LOG_ERROR("sql.sql", "Item (Entry {}) has flag ITEM_FLAGS_CU_DURATION_REAL_TIME but it does not have duration limit", *entry); itemTemplate->FlagsCu &= ~ITEM_FLAGS_CU_DURATION_REAL_TIME; } @@ -606,7 +587,7 @@ class BetterItemReloading : public CommandScript player->EquipItem(slots.at(i), pItems.at(i), true); } - handler->PSendSysMessage("Reloaded item template entry %u", entry); + handler->PSendSysMessage("Reloaded item template entry {}", *entry); } return true; @@ -620,7 +601,9 @@ class BetterItemReloading : public CommandScript std::string name = item->Name1; std::string description = item->Description; + int loc_idx = player->GetSession()->GetSessionDbLocaleIndex(); + if (loc_idx >= 0) { if (ItemLocale const* il = sObjectMgr->GetItemLocale(item->ItemId)) @@ -629,6 +612,7 @@ class BetterItemReloading : public CommandScript ObjectMgr::GetLocaleString(il->Description, loc_idx, description); } } + WorldPacket data(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 600); data << item->ItemId; data << item->Class; @@ -660,19 +644,23 @@ class BetterItemReloading : public CommandScript data << int32(item->Stackable); data << item->ContainerSlots; data << item->StatsCount; + for (uint32 i = 0; i < item->StatsCount; ++i) { data << item->ItemStat[i].ItemStatType; data << item->ItemStat[i].ItemStatValue; } + data << item->ScalingStatDistribution; data << item->ScalingStatValue; + for (int i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i) { data << item->Damage[i].DamageMin; data << item->Damage[i].DamageMax; data << item->Damage[i].DamageType; } + data << item->Armor; data << item->HolyRes; data << item->FireRes; @@ -683,6 +671,7 @@ class BetterItemReloading : public CommandScript data << item->Delay; data << item->AmmoType; data << item->RangedModRange; + for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) { SpellInfo const* spell = sSpellMgr->GetSpellInfo(item->Spells[s].SpellId); @@ -717,6 +706,7 @@ class BetterItemReloading : public CommandScript data << uint32(-1); } } + data << item->Bonding; data << description; data << item->PageText; @@ -735,11 +725,13 @@ class BetterItemReloading : public CommandScript data << item->Map; data << item->BagFamily; data << item->TotemCategory; + for (int s = 0; s < MAX_ITEM_PROTO_SOCKETS; ++s) { data << item->Socket[s].Color; data << item->Socket[s].Content; } + data << item->socketBonus; data << item->GemProperties; data << item->RequiredDisenchantSkill; @@ -747,6 +739,7 @@ class BetterItemReloading : public CommandScript data << item->Duration; data << item->ItemLimitCategory; data << item->HolidayId; + player->GetSession()->SendPacket(&data); } };