Merge branch 'master' into questXPHook

This commit is contained in:
郑佩茹
2022-03-10 12:08:00 -07:00
31 changed files with 2548 additions and 351 deletions

View File

@@ -425,8 +425,14 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
SetNativeDisplayId(displayID);
// Load creature equipment
if (!data || data->equipmentId == 0) // use default from the template
LoadEquipment(0); // 0 means no equipment for creature table
if (!data)
{
LoadEquipment(); // use default from the template
}
else if (data->equipmentId == 0)
{
LoadEquipment(0); // 0 means no equipment for creature table
}
else
{
m_originalEquipmentId = data->equipmentId;

View File

@@ -74,8 +74,9 @@ void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& me
* @param menuItemId Gossip menu item id.
* @param sender Identifier of the current menu.
* @param action Custom action given to OnGossipHello.
* @param boxMoney Custom price for pop-up box. If > 0, it will replace DB value.
*/
void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action)
void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action, uint32 boxMoney)
{
/// Find items for given menu id.
GossipMenuItemsMapBounds bounds = sObjectMgr->GetGossipMenuItemsMapBounds(menuId);
@@ -126,7 +127,7 @@ void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, ui
}
/// Add menu item with existing method. Menu item id -1 is also used in ADD_GOSSIP_ITEM macro.
AddMenuItem(-1, itr->second.OptionIcon, strOptionText, sender, action, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded);
AddMenuItem(-1, itr->second.OptionIcon, strOptionText, sender, action, strBoxText, boxMoney ? boxMoney : itr->second.BoxMoney, itr->second.BoxCoded);
}
}

View File

@@ -165,7 +165,7 @@ public:
~GossipMenu();
void AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded = false);
void AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action);
void AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action, uint32 boxMoney);
void SetMenuId(uint32 menu_id) { _menuId = menu_id; }
[[nodiscard]] uint32 GetMenuId() const { return _menuId; }

View File

@@ -3009,11 +3009,18 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo
thisLevel = std::max<int32>(thisLevel, spellInfo->SpellLevel);
int32 levelDiff = int32(victim->getLevelForTarget(this)) - thisLevel;
int32 MISS_CHANCE_MULTIPLIER = sWorld->getRate(
int32 MISS_CHANCE_MULTIPLIER;
if (sWorld->getBoolConfig(CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS) && GetTypeId() != TYPEID_PLAYER) // keep it as it was originally (7 and 11)
{
MISS_CHANCE_MULTIPLIER = victim->GetTypeId() == TYPEID_PLAYER ? 7 : 11;
}
else
{
MISS_CHANCE_MULTIPLIER = sWorld->getRate(
victim->GetTypeId() == TYPEID_PLAYER
? RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER
: RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE
);
: RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE);
}
// Base hit chance from attacker and victim levels
int32 modHitChance = levelDiff < 3