Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/Achievements/AchievementMgr.cpp src/server/game/Entities/Player/Player.cpp src/server/game/Entities/Player/Player.h src/server/game/Guilds/Guild.cpp src/server/game/Handlers/MailHandler.cpp src/server/game/Spells/SpellMgr.cpp
This commit is contained in:
commit
6161f69b7e
17 files changed
+260
-96
No files matched your search
@@ -0,0 +1 @@
|
||||
DELETE FROM `gameobject` WHERE `id`=180184;
|
||||
@@ -0,0 +1,12 @@
|
||||
-- loot for Prismatic Black Diamond
|
||||
DELETE FROM `spell_loot_template` WHERE `entry`=62941;
|
||||
INSERT INTO `spell_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES
|
||||
(62941, 23094, 0, 1, 1, 1, 1),
|
||||
(62941, 23095, 0, 1, 1, 1, 1),
|
||||
(62941, 28595, 0, 1, 1, 1, 1),
|
||||
(62941, 23116, 0, 1, 1, 1, 1),
|
||||
(62941, 23118, 0, 1, 1, 1, 1),
|
||||
(62941, 23119, 0, 1, 1, 1, 1),
|
||||
(62941, 23120, 0, 1, 1, 1, 1),
|
||||
(62941, 23114, 0, 1, 1, 1, 1),
|
||||
(62941, 23115, 0, 1, 1, 1, 1);
|
||||
@@ -0,0 +1,4 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_marrowgar_bone_slice';
|
||||
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
|
||||
(69055,'spell_marrowgar_bone_slice'),
|
||||
(70814,'spell_marrowgar_bone_slice');
|
||||
@@ -3151,14 +3151,14 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
|
||||
}
|
||||
|
||||
uint32 dataType = fields[1].GetUInt8();
|
||||
const char* scriptName = fields[4].GetCString();
|
||||
std::string scriptName = fields[4].GetString();
|
||||
uint32 scriptId = 0;
|
||||
if (strcmp(scriptName, "")) // not empty
|
||||
if (scriptName.length()) // not empty
|
||||
{
|
||||
if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT)
|
||||
sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: %u, type %u), useless data.", criteria_id, dataType);
|
||||
else
|
||||
scriptId = sObjectMgr->GetScriptId(scriptName);
|
||||
scriptId = sObjectMgr->GetScriptId(scriptName.c_str());
|
||||
}
|
||||
|
||||
AchievementCriteriaData data(dataType, fields[2].GetUInt32(), fields[3].GetUInt32(), scriptId);
|
||||
|
||||
@@ -22456,26 +22456,28 @@ void Player::InitPrimaryProfessions()
|
||||
SetFreePrimaryProfessions(sWorld->getIntConfig(CONFIG_MAX_PRIMARY_TRADE_SKILL));
|
||||
}
|
||||
|
||||
void Player::ModifyMoney(int64 d)
|
||||
bool Player::ModifyMoney(int64 amount, bool sendError /*= true*/)
|
||||
{
|
||||
sScriptMgr->OnPlayerMoneyChanged(this, d);
|
||||
if (!amount)
|
||||
return true;
|
||||
|
||||
if (d < 0)
|
||||
SetMoney (GetMoney() > uint64(-d) ? GetMoney() + d : 0);
|
||||
sScriptMgr->OnPlayerMoneyChanged(this, amount);
|
||||
|
||||
if (amount < 0)
|
||||
SetMoney (GetMoney() > uint64(-amount) ? GetMoney() + amount : 0);
|
||||
else
|
||||
{
|
||||
uint64 newAmount = 0;
|
||||
if (GetMoney() < uint64(MAX_MONEY_AMOUNT - d))
|
||||
newAmount = GetMoney() + d;
|
||||
if (GetMoney() < uint64(MAX_MONEY_AMOUNT - amount))
|
||||
SetMoney(GetMoney() + amount);
|
||||
else
|
||||
{
|
||||
// "At Gold Limit"
|
||||
newAmount = MAX_MONEY_AMOUNT;
|
||||
if (d)
|
||||
if (sendError)
|
||||
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
|
||||
return false;
|
||||
}
|
||||
SetMoney(newAmount);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Unit* Player::GetSelectedUnit() const
|
||||
|
||||
@@ -1731,7 +1731,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
void setWeaponChangeTimer(uint32 time) {m_weaponChangeTimer = time;}
|
||||
|
||||
uint64 GetMoney() const { return GetUInt64Value(PLAYER_FIELD_COINAGE); }
|
||||
void ModifyMoney(int64 d);
|
||||
bool ModifyMoney(int64 amount, bool sendError = true);
|
||||
bool HasEnoughMoney(uint64 amount) const { return GetMoney() >= amount; }
|
||||
bool HasEnoughMoney(int64 amount) const
|
||||
{
|
||||
|
||||
@@ -2035,16 +2035,20 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint64 amount, bool
|
||||
sScriptMgr->OnGuildMemberWitdrawMoney(this, player, amount, repair);
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
// Add money to player (if required)
|
||||
if (!repair)
|
||||
{
|
||||
if (!player->ModifyMoney(amount))
|
||||
return false;
|
||||
|
||||
player->SaveGoldToDB(trans);
|
||||
}
|
||||
|
||||
// Update remaining money amount
|
||||
member->UpdateBankWithdrawValue(trans, GUILD_BANK_MAX_TABS, amount);
|
||||
// Remove money from bank
|
||||
_ModifyBankMoney(trans, amount, false);
|
||||
// Add money to player (if required)
|
||||
if (!repair)
|
||||
{
|
||||
player->ModifyMoney((int64)amount);
|
||||
player->SaveGoldToDB(trans);
|
||||
}
|
||||
|
||||
// Log guild bank event
|
||||
_LogBankEvent(trans, repair ? GUILD_BANK_LOG_REPAIR_MONEY : GUILD_BANK_LOG_WITHDRAW_MONEY, uint8(0), player->GetGUIDLow(), amount);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
@@ -570,13 +570,18 @@ void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_OK);
|
||||
if (!player->ModifyMoney(m->money, false))
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_TOO_MUCH_GOLD);
|
||||
return;
|
||||
}
|
||||
|
||||
player->ModifyMoney(money);
|
||||
m->money = 0;
|
||||
m->state = MAIL_STATE_CHANGED;
|
||||
player->m_mailsUpdated = true;
|
||||
|
||||
player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_OK);
|
||||
|
||||
// save money and mail to prevent cheating
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
player->SaveGoldToDB(trans);
|
||||
|
||||
@@ -353,6 +353,20 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player->GetMoney() >= uint64(MAX_MONEY_AMOUNT) - his_trade->GetMoney())
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
|
||||
my_trade->SetAccepted(false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (trader->GetMoney() >= uint64(MAX_MONEY_AMOUNT) - my_trade->GetMoney())
|
||||
{
|
||||
trader->SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
|
||||
his_trade->SetAccepted(false, true);
|
||||
return;
|
||||
}
|
||||
|
||||
// not accept if some items now can't be trade (cheating)
|
||||
for (uint8 i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i)
|
||||
{
|
||||
@@ -363,6 +377,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
SendTradeStatus(TRADE_STATUS_TRADE_CANCELED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->IsBindedNotWith(trader))
|
||||
{
|
||||
SendTradeStatus(TRADE_STATUS_NOT_ELIGIBLE);
|
||||
|
||||
@@ -3429,22 +3429,19 @@ void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const* aurApp, uint
|
||||
|
||||
Unit* target = aurApp->GetTarget();
|
||||
|
||||
target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
|
||||
target->ApplySpellImmune(GetId(), IMMUNITY_EFFECT, GetMiscValue(), apply);
|
||||
|
||||
// when removing flag aura, handle flag drop
|
||||
if (!apply && target->GetTypeId() == TYPEID_PLAYER
|
||||
&& (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
|
||||
Player* player = target->ToPlayer();
|
||||
if (!apply && player && (GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION))
|
||||
{
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
if (player->InBattleground())
|
||||
{
|
||||
if (target->ToPlayer()->InBattleground())
|
||||
{
|
||||
if (Battleground* bg = target->ToPlayer()->GetBattleground())
|
||||
bg->EventPlayerDroppedFlag(target->ToPlayer());
|
||||
}
|
||||
else
|
||||
sOutdoorPvPMgr->HandleDropFlag((Player*)target, GetSpellInfo()->Id);
|
||||
if (Battleground* bg = player->GetBattleground())
|
||||
bg->EventPlayerDroppedFlag(player);
|
||||
}
|
||||
else
|
||||
sOutdoorPvPMgr->HandleDropFlag(player, GetSpellInfo()->Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2987,24 +2987,6 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
|
||||
|
||||
switch (m_spellInfo->SpellFamilyName)
|
||||
{
|
||||
case SPELLFAMILY_GENERIC:
|
||||
{
|
||||
switch (m_spellInfo->Id)
|
||||
{
|
||||
case 69055: // Saber Lash
|
||||
case 70814: // Saber Lash
|
||||
{
|
||||
uint32 count = 0;
|
||||
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
|
||||
if (ihit->effectMask & (1 << effIndex))
|
||||
++count;
|
||||
|
||||
totalDamagePercentMod /= count;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPELLFAMILY_WARRIOR:
|
||||
{
|
||||
// Devastate (player ones)
|
||||
|
||||
@@ -1007,7 +1007,7 @@ bool SpellInfo::IsLootCrafting() const
|
||||
return (Effects[0].Effect == SPELL_EFFECT_CREATE_RANDOM_ITEM ||
|
||||
// different random cards from Inscription (121==Virtuoso Inking Set category) r without explicit item
|
||||
(Effects[0].Effect == SPELL_EFFECT_CREATE_ITEM_2 &&
|
||||
(TotemCategory[0] != 0 || Effects[0].ItemType == 0)));
|
||||
((TotemCategory[0] != 0 || (Totem[0] != 0 && SpellIconID == 1)) || Effects[0].ItemType == 0)));
|
||||
}
|
||||
|
||||
bool SpellInfo::IsQuestTame() const
|
||||
|
||||
@@ -3382,7 +3382,7 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
break;
|
||||
case 69055: // Saber Lash (Lord Marrowgar)
|
||||
case 70814: // Saber Lash (Lord Marrowgar)
|
||||
spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_5_YARDS); // 5yd
|
||||
spellInfo->Effects[EFFECT_0].RadiusEntry = sSpellRadiusStore.LookupEntry(EFFECT_RADIUS_8_YARDS); // 8yd
|
||||
break;
|
||||
case 69075: // Bone Storm (Lord Marrowgar)
|
||||
case 70834: // Bone Storm (Lord Marrowgar)
|
||||
|
||||
@@ -2967,8 +2967,6 @@ void World::ResetMonthlyQuests()
|
||||
if (itr->second->GetPlayer())
|
||||
itr->second->GetPlayer()->ResetMonthlyQuestStatus();
|
||||
|
||||
time_t mostRecentQuestTime = 0;
|
||||
|
||||
// generate time
|
||||
time_t curTime = time(NULL);
|
||||
tm localTm = *localtime(&curTime);
|
||||
@@ -2998,11 +2996,8 @@ void World::ResetMonthlyQuests()
|
||||
// last reset time before current moment
|
||||
time_t resetTime = (curTime < nextMonthResetTime) ? nextMonthResetTime - MONTH : nextMonthResetTime;
|
||||
|
||||
// need reset (if we have quest time before last reset time (not processed by some reason)
|
||||
if (mostRecentQuestTime && mostRecentQuestTime <= resetTime)
|
||||
m_NextMonthlyQuestReset = mostRecentQuestTime;
|
||||
else // plan next reset time
|
||||
m_NextMonthlyQuestReset = (curTime >= nextMonthResetTime) ? nextMonthResetTime + MONTH : nextMonthResetTime;
|
||||
// plan next reset time
|
||||
m_NextMonthlyQuestReset = (curTime >= nextMonthResetTime) ? nextMonthResetTime + MONTH : nextMonthResetTime;
|
||||
|
||||
sWorld->setWorldState(WS_MONTHLY_QUEST_RESET_TIME, uint64(m_NextMonthlyQuestReset));
|
||||
}
|
||||
|
||||
@@ -1048,9 +1048,12 @@ public:
|
||||
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_MONEY_GIVEN, handler->GetNameLink().c_str(), uint32(moneyToAdd));
|
||||
|
||||
if (moneyToAdd >= MAX_MONEY_AMOUNT)
|
||||
target->SetMoney(MAX_MONEY_AMOUNT);
|
||||
else
|
||||
target->ModifyMoney(moneyToAdd);
|
||||
moneyToAdd = MAX_MONEY_AMOUNT;
|
||||
|
||||
if (targetMoney >= uint64(MAX_MONEY_AMOUNT) - moneyToAdd)
|
||||
moneyToAdd -= targetMoney;
|
||||
|
||||
target->ModifyMoney(moneyToAdd);
|
||||
}
|
||||
|
||||
sLog->outDebug(LOG_FILTER_GENERAL, handler->GetTrinityString(LANG_NEW_MONEY), uint32(targetMoney), int32(moneyToAdd), uint32(target->GetMoney()));
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "MapManager.h"
|
||||
#include "icecrown_citadel.h"
|
||||
#include "MoveSplineInit.h"
|
||||
#include "Player.h"
|
||||
#include "icecrown_citadel.h"
|
||||
|
||||
enum ScriptTexts
|
||||
{
|
||||
@@ -78,7 +79,46 @@ enum MovementPoints
|
||||
POINT_TARGET_COLDFLAME = 36672631,
|
||||
};
|
||||
|
||||
#define DATA_COLDFLAME_GUID 0
|
||||
enum MiscInfo
|
||||
{
|
||||
DATA_COLDFLAME_GUID = 0,
|
||||
|
||||
// Manual marking for targets hit by Bone Slice as no aura exists for this purpose
|
||||
// These units are the tanks in this encounter
|
||||
// and should be immune to Bone Spike Graveyard
|
||||
DATA_SPIKE_IMMUNE = 1,
|
||||
//DATA_SPIKE_IMMUNE_1, = 2, // Reserved & used
|
||||
//DATA_SPIKE_IMMUNE_2, = 3, // Reserved & used
|
||||
|
||||
ACTION_CLEAR_SPIKE_IMMUNITIES = 1,
|
||||
|
||||
MAX_BONE_SPIKE_IMMUNE = 3,
|
||||
};
|
||||
|
||||
class BoneSpikeTargetSelector : public std::unary_function<Unit*, bool>
|
||||
{
|
||||
public:
|
||||
BoneSpikeTargetSelector(UnitAI* ai) : _ai(ai) { }
|
||||
|
||||
bool operator()(Unit* unit) const
|
||||
{
|
||||
if (unit->GetTypeId() != TYPEID_PLAYER)
|
||||
return false;
|
||||
|
||||
if (unit->HasAura(SPELL_IMPALED))
|
||||
return false;
|
||||
|
||||
// Check if it is one of the tanks soaking Bone Slice
|
||||
for (uint32 i = 0; i < MAX_BONE_SPIKE_IMMUNE; ++i)
|
||||
if (unit->GetGUID() == _ai->GetGUID(DATA_SPIKE_IMMUNE + i))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
UnitAI* _ai;
|
||||
};
|
||||
|
||||
class boss_lord_marrowgar : public CreatureScript
|
||||
{
|
||||
@@ -108,6 +148,7 @@ class boss_lord_marrowgar : public CreatureScript
|
||||
events.ScheduleEvent(EVENT_WARN_BONE_STORM, urand(45000, 50000));
|
||||
events.ScheduleEvent(EVENT_ENRAGE, 600000);
|
||||
_boneSlice = false;
|
||||
_boneSpikeImmune.clear();
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/)
|
||||
@@ -205,7 +246,7 @@ class boss_lord_marrowgar : public CreatureScript
|
||||
case EVENT_BONE_STORM_END:
|
||||
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
|
||||
me->GetMotionMaster()->MovementExpired();
|
||||
DoStartMovement(me->getVictim());
|
||||
me->GetMotionMaster()->MoveChase(me->getVictim());
|
||||
me->SetSpeed(MOVE_RUN, _baseSpeed, true);
|
||||
events.CancelEvent(EVENT_BONE_STORM_MOVE);
|
||||
events.ScheduleEvent(EVENT_ENABLE_BONE_SLICE, 10000);
|
||||
@@ -239,7 +280,7 @@ class boss_lord_marrowgar : public CreatureScript
|
||||
return;
|
||||
|
||||
// lock movement
|
||||
DoStartNoMovement(me->getVictim());
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
|
||||
Position const* GetLastColdflamePosition() const
|
||||
@@ -247,23 +288,51 @@ class boss_lord_marrowgar : public CreatureScript
|
||||
return &_coldflameLastPos;
|
||||
}
|
||||
|
||||
uint64 GetGUID(int32 type/* = 0 */) const
|
||||
uint64 GetGUID(int32 type /*= 0 */) const
|
||||
{
|
||||
if (type == DATA_COLDFLAME_GUID)
|
||||
return _coldflameTarget;
|
||||
switch (type)
|
||||
{
|
||||
case DATA_COLDFLAME_GUID:
|
||||
return _coldflameTarget;
|
||||
case DATA_SPIKE_IMMUNE + 0:
|
||||
case DATA_SPIKE_IMMUNE + 1:
|
||||
case DATA_SPIKE_IMMUNE + 2:
|
||||
{
|
||||
int32 index = type - DATA_SPIKE_IMMUNE;
|
||||
if (index < _boneSpikeImmune.size())
|
||||
return _boneSpikeImmune[index];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0LL;
|
||||
}
|
||||
|
||||
void SetGUID(uint64 guid, int32 type/* = 0 */)
|
||||
void SetGUID(uint64 guid, int32 type /*= 0 */)
|
||||
{
|
||||
if (type != DATA_COLDFLAME_GUID)
|
||||
switch (type)
|
||||
{
|
||||
case DATA_COLDFLAME_GUID:
|
||||
_coldflameTarget = guid;
|
||||
break;
|
||||
case DATA_SPIKE_IMMUNE:
|
||||
_boneSpikeImmune.push_back(guid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DoAction(int32 const action)
|
||||
{
|
||||
if (action != ACTION_CLEAR_SPIKE_IMMUNITIES)
|
||||
return;
|
||||
|
||||
_coldflameTarget = guid;
|
||||
_boneSpikeImmune.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
Position _coldflameLastPos;
|
||||
std::vector<uint64> _boneSpikeImmune;
|
||||
uint64 _coldflameTarget;
|
||||
uint32 _boneStormDuration;
|
||||
float _baseSpeed;
|
||||
@@ -322,7 +391,7 @@ class npc_coldflame : public CreatureScript
|
||||
}
|
||||
|
||||
me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), me->GetPositionZ(), me->GetOrientation());
|
||||
_events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 450);
|
||||
_events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 500);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
@@ -332,10 +401,10 @@ class npc_coldflame : public CreatureScript
|
||||
if (_events.ExecuteEvent() == EVENT_COLDFLAME_TRIGGER)
|
||||
{
|
||||
Position newPos;
|
||||
me->GetNearPosition(newPos, 5.5f, 0.0f);
|
||||
me->GetNearPosition(newPos, 5.0f, 0.0f);
|
||||
me->NearTeleportTo(newPos.GetPositionX(), newPos.GetPositionY(), me->GetPositionZ(), me->GetOrientation());
|
||||
DoCast(SPELL_COLDFLAME_SUMMON);
|
||||
_events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 450);
|
||||
_events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,6 +453,24 @@ class npc_bone_spike : public CreatureScript
|
||||
_hasTrappedUnit = true;
|
||||
}
|
||||
|
||||
void PassengerBoarded(Unit* passenger, int8 /*seat*/, bool apply)
|
||||
{
|
||||
if (!apply)
|
||||
return;
|
||||
|
||||
/// @HACK - Change passenger offset to the one taken directly from sniffs
|
||||
/// Remove this when proper calculations are implemented.
|
||||
/// This fixes healing spiked people
|
||||
Movement::MoveSplineInit init(passenger);
|
||||
init.DisableTransportPathTransformations();
|
||||
init.MoveTo(-0.02206125f, -0.02132235f, 5.514783f, false);
|
||||
init.Launch();
|
||||
|
||||
/// @WORKAROUND - Clear ON VEHICLE state to allow healing (Invalid target errors)
|
||||
/// Current rule for applying this state is questionable (seatFlags & VEHICLE_SEAT_FLAG_ALLOW_TURNING ???)
|
||||
passenger->ClearUnitState(UNIT_STATE_ONVEHICLE);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 const diff)
|
||||
{
|
||||
if (!_hasTrappedUnit)
|
||||
@@ -486,16 +573,24 @@ class spell_marrowgar_coldflame_damage : public SpellScriptLoader
|
||||
{
|
||||
PrepareAuraScript(spell_marrowgar_coldflame_damage_AuraScript);
|
||||
|
||||
void OnPeriodic(AuraEffect const* /*aurEff*/)
|
||||
bool CanBeAppliedOn(Unit* target)
|
||||
{
|
||||
if (DynamicObject* owner = GetDynobjOwner())
|
||||
if (GetTarget()->GetExactDist2d(owner) >= owner->GetRadius() || GetTarget()->HasAura(SPELL_IMPALED))
|
||||
PreventDefaultAction();
|
||||
if (target->HasAura(SPELL_IMPALED))
|
||||
return false;
|
||||
|
||||
if (target->GetExactDist2d(GetOwner()) > GetSpellInfo()->Effects[EFFECT_0].CalcRadius())
|
||||
return false;
|
||||
|
||||
if (Aura* aur = target->GetAura(GetId()))
|
||||
if (aur->GetOwner() != GetOwner())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_marrowgar_coldflame_damage_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE);
|
||||
DoCheckAreaTarget += AuraCheckAreaTargetFn(spell_marrowgar_coldflame_damage_AuraScript::CanBeAppliedOn);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -530,7 +625,7 @@ class spell_marrowgar_bone_spike_graveyard : public SpellScriptLoader
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
return GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_TOPAGGRO, 1, 0.0f, true, -SPELL_IMPALED) ? SPELL_CAST_OK : SPELL_FAILED_NO_VALID_TARGETS;
|
||||
return GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, BoneSpikeTargetSelector(GetCaster()->GetAI())) ? SPELL_CAST_OK : SPELL_FAILED_NO_VALID_TARGETS;
|
||||
}
|
||||
|
||||
void HandleSpikes(SpellEffIndex effIndex)
|
||||
@@ -538,22 +633,22 @@ class spell_marrowgar_bone_spike_graveyard : public SpellScriptLoader
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
if (Creature* marrowgar = GetCaster()->ToCreature())
|
||||
{
|
||||
bool didHit = false;
|
||||
CreatureAI* marrowgarAI = marrowgar->AI();
|
||||
uint8 boneSpikeCount = uint8(GetCaster()->GetMap()->GetSpawnMode() & 1 ? 3 : 1);
|
||||
for (uint8 i = 0; i < boneSpikeCount; ++i)
|
||||
{
|
||||
// select any unit but not the tank
|
||||
Unit* target = marrowgarAI->SelectTarget(SELECT_TARGET_RANDOM, 1, 150.0f, true, -SPELL_IMPALED);
|
||||
if (!target)
|
||||
break;
|
||||
|
||||
didHit = true;
|
||||
std::list<Unit*> targets;
|
||||
marrowgarAI->SelectTargetList(targets, BoneSpikeTargetSelector(marrowgarAI), boneSpikeCount, SELECT_TARGET_RANDOM);
|
||||
if (targets.empty())
|
||||
return;
|
||||
|
||||
uint32 i = 0;
|
||||
for (std::list<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr, ++i)
|
||||
{
|
||||
Unit* target = *itr;
|
||||
target->CastCustomSpell(BoneSpikeSummonId[i], SPELLVALUE_BASE_POINT0, 0, target, true);
|
||||
}
|
||||
|
||||
if (didHit)
|
||||
marrowgarAI->Talk(SAY_BONESPIKE);
|
||||
marrowgarAI->Talk(SAY_BONESPIKE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,6 +691,56 @@ class spell_marrowgar_bone_storm : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
class spell_marrowgar_bone_slice : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_marrowgar_bone_slice() : SpellScriptLoader("spell_marrowgar_bone_slice") { }
|
||||
|
||||
class spell_marrowgar_bone_slice_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_marrowgar_bone_slice_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
_targetCount = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ClearSpikeImmunities()
|
||||
{
|
||||
GetCaster()->GetAI()->DoAction(ACTION_CLEAR_SPIKE_IMMUNITIES);
|
||||
}
|
||||
|
||||
void CountTarget(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
++_targetCount;
|
||||
GetCaster()->GetAI()->SetGUID(GetHitUnit()->GetGUID(), DATA_SPIKE_IMMUNE);
|
||||
}
|
||||
|
||||
void SplitDamage()
|
||||
{
|
||||
if (!_targetCount)
|
||||
return; // why would there be an unit not hit by effect hook and hit by this?
|
||||
|
||||
SetHitDamage(GetHitDamage() / _targetCount);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
BeforeCast += SpellCastFn(spell_marrowgar_bone_slice_SpellScript::ClearSpikeImmunities);
|
||||
OnEffectLaunchTarget += SpellEffectFn(spell_marrowgar_bone_slice_SpellScript::CountTarget, EFFECT_0, SPELL_EFFECT_WEAPON_PERCENT_DAMAGE);
|
||||
OnHit += SpellHitFn(spell_marrowgar_bone_slice_SpellScript::SplitDamage);
|
||||
}
|
||||
|
||||
uint32 _targetCount;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_marrowgar_bone_slice_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_lord_marrowgar()
|
||||
{
|
||||
new boss_lord_marrowgar();
|
||||
@@ -606,4 +751,5 @@ void AddSC_boss_lord_marrowgar()
|
||||
new spell_marrowgar_coldflame_damage();
|
||||
new spell_marrowgar_bone_spike_graveyard();
|
||||
new spell_marrowgar_bone_storm();
|
||||
new spell_marrowgar_bone_slice();
|
||||
}
|
||||
@@ -851,7 +851,7 @@ class boss_the_lich_king : public CreatureScript
|
||||
events.Update(diff);
|
||||
|
||||
// during Remorseless Winter phases The Lich King is channeling a spell, but we must continue casting other spells
|
||||
if ((me->HasUnitState(UNIT_STATE_CASTING) && !events.IsInPhase(PHASE_TRANSITION)) || events.IsInPhase(PHASE_OUTRO) || events.IsInPhase(PHASE_FROSTMOURNE))
|
||||
if (me->HasUnitState(UNIT_STATE_CASTING) && !(events.IsInPhase(PHASE_TRANSITION) || events.IsInPhase(PHASE_OUTRO) || events.IsInPhase(PHASE_FROSTMOURNE)))
|
||||
return;
|
||||
|
||||
while (uint32 eventId = events.ExecuteEvent())
|
||||
@@ -2818,8 +2818,6 @@ class spell_the_lich_king_vile_spirit_damage_target_search : public SpellScriptL
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
|
||||
}
|
||||
|
||||
Unit* _target;
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
|
||||
Reference in new issue
Block a user