Merge remote-tracking branch 'tc/3.3.5' into 4.3.4

Conflicts:
	sql/base/characters_database.sql
	sql/updates/world/2016_01_26_00_world.sql
	sql/updates/world/2016_01_31_00_world.sql
	sql/updates/world/2016_02_07_00_world.sql
	src/server/authserver/Server/AuthSession.cpp
	src/server/database/Database/Implementation/LoginDatabase.cpp
	src/server/database/Database/Implementation/LoginDatabase.h
	src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
	src/server/game/AI/ScriptedAI/ScriptedCreature.h
	src/server/game/Achievements/AchievementMgr.cpp
	src/server/game/Chat/Chat.cpp
	src/server/game/DataStores/DBCStores.cpp
	src/server/game/DataStores/DBCStructure.h
	src/server/game/DataStores/DBCfmt.h
	src/server/game/Entities/Player/Player.cpp
	src/server/game/Entities/Unit/Unit.cpp
	src/server/game/Globals/ObjectMgr.cpp
	src/server/game/Handlers/AuctionHouseHandler.cpp
	src/server/game/Handlers/MailHandler.cpp
	src/server/game/Handlers/MovementHandler.cpp
	src/server/game/Server/WorldSocket.cpp
	src/server/game/Server/WorldSocket.h
	src/server/game/Spells/Auras/SpellAuraEffects.cpp
	src/server/game/Spells/SpellEffects.cpp
	src/server/game/Spells/SpellMgr.cpp
	src/server/scripts/Spells/spell_druid.cpp
	src/server/scripts/Spells/spell_generic.cpp
	src/server/scripts/Spells/spell_hunter.cpp
	src/server/scripts/Spells/spell_rogue.cpp
	src/server/scripts/Spells/spell_shaman.cpp
	src/server/shared/Networking/AsyncAcceptor.h
	src/tools/map_extractor/CMakeLists.txt
	src/tools/map_extractor/System.cpp
	src/tools/map_extractor/adt.h
	src/tools/mmaps_generator/MapBuilder.cpp
This commit is contained in:
ariel- committed 2016-02-21 07:02:53 -03:00
commit 8bc477a2de
161 files changed
+3548 -2022

No files matched your search

+6 -6
View File
@@ -133,7 +133,7 @@ public:
info.name = fields[1].GetString();
info.accountId = fields[2].GetUInt32();
// account name will be empty for not existed account
// account name will be empty for nonexisting account
AccountMgr::GetName(info.accountId, info.accountName);
info.deleteDate = time_t(fields[3].GetUInt32());
foundList.push_back(info);
@@ -169,11 +169,11 @@ public:
if (!handler->GetSession())
handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CONSOLE,
itr->guid.GetCounter(), itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
itr->guid.GetCounter(), itr->name.c_str(), itr->accountName.empty() ? "<Not existing>" : itr->accountName.c_str(),
itr->accountId, dateStr.c_str());
else
handler->PSendSysMessage(LANG_CHARACTER_DELETED_LIST_LINE_CHAT,
itr->guid.GetCounter(), itr->name.c_str(), itr->accountName.empty() ? "<Not existed>" : itr->accountName.c_str(),
itr->guid.GetCounter(), itr->name.c_str(), itr->accountName.empty() ? "<Not existing>" : itr->accountName.c_str(),
itr->accountId, dateStr.c_str());
}
@@ -193,7 +193,7 @@ public:
*/
static void HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo, ChatHandler* handler)
{
if (delInfo.accountName.empty()) // account not exist
if (delInfo.accountName.empty()) // account does not exist
{
handler->PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_ACCOUNT, delInfo.name.c_str(), delInfo.guid.GetCounter(), delInfo.accountId);
return;
@@ -660,7 +660,7 @@ public:
if (newCharName.empty())
{
// Drop not existed account cases
// Drop nonexisting account cases
for (DeletedInfoList::iterator itr = foundList.begin(); itr != foundList.end(); ++itr)
HandleCharacterDeletedRestoreHelper(*itr, handler);
}
@@ -810,7 +810,7 @@ public:
if (levelStr && isalpha(levelStr[0]))
{
nameStr = levelStr;
levelStr = NULL; // current level will used
levelStr = NULL; // current level will be used
}
Player* target;
+28 -1
View File
@@ -94,7 +94,8 @@ public:
{ "transport", rbac::RBAC_PERM_COMMAND_DEBUG_TRANSPORT, false, &HandleDebugTransportCommand, "" },
{ "phase", rbac::RBAC_PERM_COMMAND_DEBUG_PHASE, false, &HandleDebugPhaseCommand, "" },
{ "loadcells", rbac::RBAC_PERM_COMMAND_DEBUG_LOADCELLS, false, &HandleDebugLoadCellsCommand, "" },
{ "boundary", rbac::RBAC_PERM_COMMAND_DEBUG_BOUNDARY, false, &HandleDebugBoundaryCommand, "" }
{ "boundary", rbac::RBAC_PERM_COMMAND_DEBUG_BOUNDARY, false, &HandleDebugBoundaryCommand, "" },
{ "raidreset", rbac::RBAC_PERM_COMMAND_INSTANCE_UNBIND, false, &HandleDebugRaidResetCommand, "" }
};
static std::vector<ChatCommand> commandTable =
{
@@ -1470,6 +1471,32 @@ public:
return true;
}
static bool HandleDebugRaidResetCommand(ChatHandler* /*handler*/, char const* args)
{
char* map_str = args ? strtok((char*)args, " ") : nullptr;
char* difficulty_str = args ? strtok(nullptr, " ") : nullptr;
int32 map = map_str ? atoi(map_str) : -1;
if (map <= 0)
return false;
MapEntry const* mEntry = sMapStore.LookupEntry(map);
if (!mEntry || !mEntry->IsRaid())
return false;
int32 difficulty = difficulty_str ? atoi(difficulty_str) : -1;
if (difficulty >= MAX_RAID_DIFFICULTY || difficulty < -1)
return false;
if (difficulty == -1)
for (uint8 diff = 0; diff < MAX_RAID_DIFFICULTY; ++diff)
{
if (GetMapDifficultyData(mEntry->MapID, Difficulty(diff)))
sInstanceSaveMgr->ForceGlobalReset(mEntry->MapID, Difficulty(diff));
}
else
sInstanceSaveMgr->ForceGlobalReset(mEntry->MapID, Difficulty(difficulty));
return true;
}
};
void AddSC_debug_commandscript()
+2 -2
View File
@@ -424,7 +424,7 @@ public:
uint32 areaId = id ? (uint32)atoi(id) : player->GetZoneId();
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId);
if (x < 0 || x > 100 || y < 0 || y > 100 || !areaEntry)
{
@@ -434,7 +434,7 @@ public:
}
// update to parent zone if exist (client map show only zones without parents)
AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry;
AreaTableEntry const* zoneEntry = areaEntry->zone ? sAreaTableStore.LookupEntry(areaEntry->zone) : areaEntry;
ASSERT(zoneEntry);
Map const* map = sMapMgr->CreateBaseMap(zoneEntry->mapid);
+2 -2
View File
@@ -348,10 +348,10 @@ public:
phase = (!p->IsGameMaster() ? p->GetPhaseMask() : -1);
uint32 locale = handler->GetSessionDbcLocale();
AreaTableEntry const* area = GetAreaEntryByAreaID(p->GetAreaId());
AreaTableEntry const* area = sAreaTableStore.LookupEntry(p->GetAreaId());
if (area)
{
AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone);
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->zone);
if (zone)
zoneName = zone->area_name[locale];
}
+2 -2
View File
@@ -82,7 +82,7 @@ public:
{
InstanceSave* save = itr->second.save;
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", itr->second.extendState == EXTEND_STATE_EXPIRED ? "expired" : itr->second.extendState == EXTEND_STATE_EXTENDED ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
counter++;
}
}
@@ -98,7 +98,7 @@ public:
{
InstanceSave* save = itr->second.save;
std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", "-", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
counter++;
}
}
+2 -2
View File
@@ -97,9 +97,9 @@ public:
wstrToLower(wNamePart);
// Search in AreaTable.dbc
for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag)
for (uint32 i = 0; i < sAreaTableStore.GetNumRows(); ++i)
{
AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag);
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(i);
if (areaEntry)
{
std::string name = areaEntry->area_name;
+27 -15
View File
@@ -197,8 +197,8 @@ public:
uint32 mapId = object->GetMapId();
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
AreaTableEntry const* zoneEntry = GetAreaEntryByAreaID(zoneId);
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(areaId);
AreaTableEntry const* zoneEntry = sAreaTableStore.LookupEntry(zoneId);
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(areaId);
float zoneX = object->GetPositionX();
float zoneY = object->GetPositionY();
@@ -976,7 +976,7 @@ public:
uint32 zoneId = player->GetZoneId();
AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId);
AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(zoneId);
if (!areaEntry || areaEntry->zone !=0)
{
handler->PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, graveyardId, zoneId);
@@ -1067,17 +1067,23 @@ public:
return false;
}
int32 area = GetAreaFlagByAreaID(atoi((char*)args));
int32 offset = area / 32;
if (area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
AreaTableEntry const* area = sAreaTableStore.LookupEntry(atoi(args));
if (!area)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
return false;
}
uint32 val = uint32((1 << (area % 32)));
int32 offset = area->exploreFlag / 32;
if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
return false;
}
uint32 val = uint32((1 << (area->exploreFlag % 32)));
uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields | val)));
@@ -1098,17 +1104,23 @@ public:
return false;
}
int32 area = GetAreaFlagByAreaID(atoi((char*)args));
int32 offset = area / 32;
if (area < 0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
AreaTableEntry const* area = sAreaTableStore.LookupEntry(atoi(args));
if (!area)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
return false;
}
uint32 val = uint32((1 << (area % 32)));
int32 offset = area->exploreFlag / 32;
if (offset >= PLAYER_EXPLORED_ZONES_SIZE)
{
handler->SendSysMessage(LANG_BAD_VALUE);
handler->SetSentErrorMessage(true);
return false;
}
uint32 val = uint32((1 << (area->exploreFlag % 32)));
uint32 currFields = playerTarget->GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset);
playerTarget->SetUInt32Value(PLAYER_EXPLORED_ZONES_1 + offset, uint32((currFields ^ val)));
@@ -1752,12 +1764,12 @@ public:
// Position data
MapEntry const* map = sMapStore.LookupEntry(mapId);
AreaTableEntry const* area = GetAreaEntryByAreaID(areaId);
AreaTableEntry const* area = sAreaTableStore.LookupEntry(areaId);
if (area)
{
areaName = area->area_name;
AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone);
AreaTableEntry const* zone = sAreaTableStore.LookupEntry(area->zone);
if (zone)
zoneName = zone->area_name;
}
+5 -2
View File
@@ -43,7 +43,7 @@ struct EnumName
#define CREATE_NAMED_ENUM(VALUE) { VALUE, STRINGIZE(VALUE) }
#define NPCFLAG_COUNT 24
#define FLAGS_EXTRA_COUNT 16
#define FLAGS_EXTRA_COUNT 19
EnumName<NPCFlags, int32> const npcFlagTexts[NPCFLAG_COUNT] =
{
@@ -163,7 +163,10 @@ EnumName<CreatureFlagsExtra> const flagsExtra[FLAGS_EXTRA_COUNT] =
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_SKILLGAIN),
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_TAUNT_DIMINISH),
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_ALL_DIMINISH),
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_DUNGEON_BOSS)
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ),
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_DUNGEON_BOSS),
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING),
CREATE_NAMED_ENUM(CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK)
};
class npc_commandscript : public CommandScript
+5 -5
View File
@@ -74,7 +74,7 @@ public:
std::string subject = msgSubject;
std::string text = msgText;
// from console show not existed sender
// from console, use non-existing sender
MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : 0, MAIL_STATIONERY_GM);
/// @todo Fix poor design
@@ -173,7 +173,7 @@ public:
}
}
// from console show not existed sender
// from console show nonexisting sender
MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : 0, MAIL_STATIONERY_GM);
// fill mail
@@ -185,7 +185,7 @@ public:
{
if (Item* item = Item::CreateItem(itr->first, itr->second, handler->GetSession() ? handler->GetSession()->GetPlayer() : 0))
{
item->SaveToDB(trans); // save for prevent lost at next mail load, if send fail then item will deleted
item->SaveToDB(trans); // Save to prevent being lost at next mail load. If send fails, the item will be deleted.
draft.AddItem(item);
}
}
@@ -233,7 +233,7 @@ public:
std::string subject = msgSubject;
std::string text = msgText;
// from console show not existed sender
// from console show nonexisting sender
MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : 0, MAIL_STATIONERY_GM);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -260,7 +260,7 @@ public:
if (!msgStr)
return false;
///- Check that he is not logging out.
/// - Check if player is logging out.
if (player->GetSession()->isLogingOut())
{
handler->SendSysMessage(LANG_PLAYER_NOT_FOUND);
+1 -1
View File
@@ -224,7 +224,7 @@ public:
if (CharTitlesEntry const* tEntry = sCharTitlesStore.LookupEntry(i))
titles2 &= ~(uint64(1) << tEntry->bit_index);
titles &= ~titles2; // remove not existed titles
titles &= ~titles2; // remove non-existing titles
target->SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES, titles);
handler->SendSysMessage(LANG_DONE);
@@ -25,17 +25,25 @@ EndScriptData */
#include "ScriptedCreature.h"
#include "deadmines.h"
enum Spels
enum Spells
{
SPELL_TRASH = 3391,
SPELL_SMITE_STOMP = 6432,
SPELL_SMITE_SLAM = 6435,
SPELL_NIMBLE_REFLEXES = 6264,
SPELL_NIMBLE_REFLEXES = 6264
};
enum Equips
{
EQUIP_SWORD = 5191,
EQUIP_MACE = 7230,
EQUIP_AXE = 5196,
EQUIP_MACE = 7230
};
SAY_AGGRO = 0,
enum Texts
{
SAY_PHASE_1 = 2,
SAY_PHASE_2 = 3
};
class boss_mr_smite : public CreatureScript
@@ -66,6 +74,8 @@ public:
uiPhase = 0;
uiTimer = 0;
uiIsMoving = false;
}
InstanceScript* instance;
@@ -79,16 +89,19 @@ public:
uint32 uiPhase;
uint32 uiTimer;
bool uiIsMoving;
void Reset() override
{
Initialize();
SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_UNEQUIP, EQUIP_NO_CHANGE);
me->SetStandState(UNIT_STAND_STATE_STAND);
me->SetReactState(REACT_AGGRESSIVE);
}
void EnterCombat(Unit* /*who*/) override
{
Talk(SAY_AGGRO);
}
bool bCheckChances()
@@ -105,38 +118,52 @@ public:
if (!UpdateVictim())
return;
/*START ACID-AI*/
if (uiTrashTimer <= uiDiff)
if (!uiIsMoving) // halt abilities in between phases
{
if (bCheckChances())
DoCast(me, SPELL_TRASH);
uiTrashTimer = urand(6000, 15500);
} else uiTrashTimer -= uiDiff;
if (uiTrashTimer <= uiDiff)
{
if (bCheckChances())
DoCast(me, SPELL_TRASH);
uiTrashTimer = urand(6000, 15500);
}
else uiTrashTimer -= uiDiff;
if (uiSlamTimer <= uiDiff)
{
if (bCheckChances())
DoCastVictim(SPELL_SMITE_SLAM);
uiSlamTimer = 11000;
} else uiSlamTimer -= uiDiff;
if (uiSlamTimer <= uiDiff)
{
if (bCheckChances())
DoCastVictim(SPELL_SMITE_SLAM);
uiSlamTimer = 11000;
}
else uiSlamTimer -= uiDiff;
if (uiNimbleReflexesTimer <= uiDiff)
{
if (bCheckChances())
DoCast(me, SPELL_NIMBLE_REFLEXES);
uiNimbleReflexesTimer = urand(27300, 60100);
} else uiNimbleReflexesTimer -= uiDiff;
/*END ACID-AI*/
if (uiNimbleReflexesTimer <= uiDiff)
{
if (bCheckChances())
DoCast(me, SPELL_NIMBLE_REFLEXES);
uiNimbleReflexesTimer = urand(27300, 60100);
}
else uiNimbleReflexesTimer -= uiDiff;
}
if ((uiHealth == 0 && !HealthAbovePct(66)) || (uiHealth == 1 && !HealthAbovePct(33)))
{
++uiHealth;
DoCastAOE(SPELL_SMITE_STOMP, false);
SetCombatMovement(false);
if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_SMITE_CHEST)))
me->AttackStop();
me->InterruptNonMeleeSpells(false);
me->SetReactState(REACT_PASSIVE);
uiTimer = 2500;
uiPhase = 1;
switch (uiHealth)
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(1, go->GetPositionX() - 3.0f, go->GetPositionY(), go->GetPositionZ());
case 1:
Talk(SAY_PHASE_1);
break;
case 2:
Talk(SAY_PHASE_2);
break;
}
}
@@ -147,21 +174,36 @@ public:
switch (uiPhase)
{
case 1:
me->HandleEmoteCommand(EMOTE_STATE_KNEEL); //dosen't work?
uiTimer = 1000;
uiPhase = 2;
{
if (uiIsMoving)
break;
if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(DATA_SMITE_CHEST)))
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MovePoint(1, go->GetPositionX() - 1.5f, go->GetPositionY() + 1.4f, go->GetPositionZ());
uiIsMoving = true;
}
break;
}
case 2:
if (uiHealth == 1)
SetEquipmentSlots(false, EQUIP_SWORD, EQUIP_SWORD, EQUIP_NO_CHANGE);
SetEquipmentSlots(false, EQUIP_AXE, EQUIP_AXE, EQUIP_NO_CHANGE);
else
SetEquipmentSlots(false, EQUIP_MACE, EQUIP_UNEQUIP, EQUIP_NO_CHANGE);
uiTimer = 500;
uiPhase = 3;
break;
case 3:
me->SetStandState(UNIT_STAND_STATE_STAND);
uiTimer = 750;
uiPhase = 4;
break;
case 4:
me->SetReactState(REACT_AGGRESSIVE);
SetCombatMovement(true);
me->GetMotionMaster()->MoveChase(me->GetVictim(), me->m_CombatDistance);
uiIsMoving = false;
uiPhase = 0;
break;
}
@@ -176,8 +218,11 @@ public:
if (uiType != POINT_MOTION_TYPE)
return;
uiTimer = 1500;
uiPhase = 1;
me->SetFacingTo(5.47f);
me->SetStandState(UNIT_STAND_STATE_KNEEL);
uiTimer = 2000;
uiPhase = 2;
}
};
};
@@ -26,6 +26,7 @@ enum CannonState
CANNON_GUNPOWDER_USED,
CANNON_BLAST_INITIATED,
PIRATES_ATTACK,
SMITE_ALARMED,
EVENT_DONE
};
@@ -48,4 +49,16 @@ enum GameObjects
GO_DOOR_LEVER = 101833,
GO_MR_SMITE_CHEST = 144111
};
enum CreaturesIds
{
NPC_MR_SMITE = 646
};
enum InstanceTexts
{
SAY_ALARM1 = 0,
SAY_ALARM2 = 1
};
#endif
@@ -32,18 +32,14 @@ EndScriptData */
enum Sounds
{
SOUND_CANNONFIRE = 1400,
SOUND_DESTROYDOOR = 3079,
SOUND_MR_SMITE_ALARM1 = 5775,
SOUND_MR_SMITE_ALARM2 = 5777
SOUND_DESTROYDOOR = 3079
};
#define SAY_MR_SMITE_ALARM1 "You there, check out that noise!"
#define SAY_MR_SMITE_ALARM2 "We're under attack! A vast, ye swabs! Repel the invaders!"
enum Misc
{
DATA_CANNON_BLAST_TIMER = 3000,
DATA_PIRATES_DELAY_TIMER = 1000
DATA_PIRATES_DELAY_TIMER = 1000,
DATA_SMITE_ALARM_DELAY_TIMER = 5000
};
class instance_deadmines : public InstanceMapScript
@@ -61,6 +57,8 @@ class instance_deadmines : public InstanceMapScript
SetHeaders(DataHeader);
State = CANNON_NOT_USED;
CannonBlast_Timer = 0;
PiratesDelay_Timer = 0;
}
ObjectGuid FactoryDoorGUID;
@@ -70,10 +68,12 @@ class instance_deadmines : public InstanceMapScript
ObjectGuid DefiasPirate1GUID;
ObjectGuid DefiasPirate2GUID;
ObjectGuid DefiasCompanionGUID;
ObjectGuid MrSmiteGUID;
uint32 State;
uint32 CannonBlast_Timer;
uint32 PiratesDelay_Timer;
uint32 SmiteAlarmDelay_Timer;
ObjectGuid uiSmiteChestGUID;
virtual void Update(uint32 diff) override
@@ -89,22 +89,20 @@ class instance_deadmines : public InstanceMapScript
{
case CANNON_GUNPOWDER_USED:
CannonBlast_Timer = DATA_CANNON_BLAST_TIMER;
// it's a hack - Mr. Smite should do that but his too far away
//pIronCladDoor->SetName("Mr. Smite");
//pIronCladDoor->MonsterYell(SAY_MR_SMITE_ALARM1, LANG_UNIVERSAL, NULL);
pIronCladDoor->PlayDirectSound(SOUND_MR_SMITE_ALARM1);
State = CANNON_BLAST_INITIATED;
break;
case CANNON_BLAST_INITIATED:
PiratesDelay_Timer = DATA_PIRATES_DELAY_TIMER;
SmiteAlarmDelay_Timer = DATA_SMITE_ALARM_DELAY_TIMER;
if (CannonBlast_Timer <= diff)
{
SummonCreatures();
ShootCannon();
BlastOutDoor();
LeverStucked();
//pIronCladDoor->MonsterYell(SAY_MR_SMITE_ALARM2, LANG_UNIVERSAL, NULL);
pIronCladDoor->PlayDirectSound(SOUND_MR_SMITE_ALARM2);
instance->LoadGrid(-22.8f, -797.24f); // Loads Mr. Smite's grid.
if (Creature* smite = instance->GetCreature(MrSmiteGUID)) // goes off when door blows up
smite->AI()->Talk(SAY_ALARM1);
State = PIRATES_ATTACK;
} else CannonBlast_Timer -= diff;
break;
@@ -112,9 +110,17 @@ class instance_deadmines : public InstanceMapScript
if (PiratesDelay_Timer <= diff)
{
MoveCreaturesInside();
State = EVENT_DONE;
State = SMITE_ALARMED;
} else PiratesDelay_Timer -= diff;
break;
case SMITE_ALARMED:
if (SmiteAlarmDelay_Timer <= diff)
{
if (Creature* smite = instance->GetCreature(MrSmiteGUID))
smite->AI()->Talk(SAY_ALARM2);
State = EVENT_DONE;
} else SmiteAlarmDelay_Timer -= diff;
break;
}
}
@@ -178,6 +184,18 @@ class instance_deadmines : public InstanceMapScript
pDoorLever->SetUInt32Value(GAMEOBJECT_FLAGS, 4);
}
void OnCreatureCreate(Creature* creature) override
{
switch (creature->GetEntry())
{
case NPC_MR_SMITE:
MrSmiteGUID = creature->GetGUID();
break;
default:
break;
}
}
void OnGameObjectCreate(GameObject* go) override
{
switch (go->GetEntry())
@@ -44,6 +44,13 @@ EndScriptData */
11 - Nightbane
*/
const Position OptionalSpawn[] =
{
{ -10960.981445f, -1940.138428f, 46.178097f, 4.12f }, // Hyakiss the Lurker
{ -10899.903320f, -2085.573730f, 49.474449f, 1.38f }, // Rokad the Ravager
{ -10945.769531f, -2040.153320f, 49.474438f, 0.077f } // Shadikith the Glider
};
class instance_karazhan : public InstanceMapScript
{
public:
@@ -64,6 +71,7 @@ public:
// 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered.
m_uiOperaEvent = urand(1, 3);
m_uiOzDeathCount = 0;
OptionalBossCount = 0;
}
uint32 m_auiEncounter[MAX_ENCOUNTER];
@@ -71,6 +79,7 @@ public:
uint32 m_uiOperaEvent;
uint32 m_uiOzDeathCount;
uint32 OptionalBossCount;
ObjectGuid m_uiCurtainGUID;
ObjectGuid m_uiStageDoorLeftGUID;
@@ -107,6 +116,29 @@ public:
}
}
void OnUnitDeath(Unit* unit) override
{
Creature* creature = unit->ToCreature();
if (!creature)
return;
switch (creature->GetEntry())
{
case NPC_COLDMIST_WIDOW:
case NPC_COLDMIST_STALKER:
case NPC_SHADOWBAT:
case NPC_VAMPIRIC_SHADOWBAT:
case NPC_GREATER_SHADOWBAT:
case NPC_PHASE_HOUND:
case NPC_DREADBEAST:
case NPC_SHADOWBEAST:
SetData(TYPE_OPTIONAL_BOSS, NOT_STARTED);
break;
default:
break;
}
}
void SetData(uint32 type, uint32 uiData) override
{
switch (type)
@@ -118,7 +150,28 @@ public:
m_auiEncounter[1] = uiData;
break;
case TYPE_MAIDEN: m_auiEncounter[2] = uiData; break;
case TYPE_OPTIONAL_BOSS: m_auiEncounter[3] = uiData; break;
case TYPE_OPTIONAL_BOSS:
m_auiEncounter[3] = uiData;
if (uiData == NOT_STARTED)
{
++OptionalBossCount;
if (OptionalBossCount == 50)
{
switch (urand(0, 2))
{
case 0:
instance->SummonCreature(NPC_HYAKISS_THE_LURKER, OptionalSpawn[0]);
break;
case 1:
instance->SummonCreature(NPC_ROKAD_THE_RAVAGER, OptionalSpawn[1]);
break;
case 2:
instance->SummonCreature(NPC_SHADIKITH_THE_GLIDER, OptionalSpawn[2]);
break;
}
}
}
break;
case TYPE_OPERA:
m_auiEncounter[4] = uiData;
if (uiData == DONE)
@@ -64,4 +64,20 @@ enum OperaEvents
EVENT_RAJ = 3
};
enum MiscCreatures
{
NPC_HYAKISS_THE_LURKER = 16179,
NPC_ROKAD_THE_RAVAGER = 16181,
NPC_SHADIKITH_THE_GLIDER = 16180,
// Trash
NPC_COLDMIST_WIDOW = 16171,
NPC_COLDMIST_STALKER = 16170,
NPC_SHADOWBAT = 16173,
NPC_VAMPIRIC_SHADOWBAT = 16175,
NPC_GREATER_SHADOWBAT = 16174,
NPC_PHASE_HOUND = 16178,
NPC_DREADBEAST = 16177,
NPC_SHADOWBEAST = 16176
};
#endif
@@ -16,8 +16,10 @@
*/
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "InstanceScript.h"
#include "magisters_terrace.h"
#include "EventMap.h"
/*
0 - Selin Fireheart
@@ -36,6 +38,8 @@ DoorData const doorData[] =
{ 0, 0, DOOR_TYPE_ROOM } // END
};
Position const KalecgosSpawnPos = { 164.3747f, -397.1197f, 2.151798f, 1.66219f };
class instance_magisters_terrace : public InstanceMapScript
{
public:
@@ -93,6 +97,10 @@ class instance_magisters_terrace : public InstanceMapScript
case NPC_DELRISSA:
DelrissaGUID = creature->GetGUID();
break;
case NPC_KALECGOS:
case NPC_HUMAN_KALECGOS:
KalecgosGUID = creature->GetGUID();
break;
default:
break;
}
@@ -139,6 +147,25 @@ class instance_magisters_terrace : public InstanceMapScript
}
}
void ProcessEvent(WorldObject* obj, uint32 eventId) override
{
if (eventId == EVENT_SPAWN_KALECGOS)
if (!ObjectAccessor::GetCreature(*obj, KalecgosGUID) && Events.Empty())
Events.ScheduleEvent(EVENT_SPAWN_KALECGOS, Minutes(1));
}
void Update(uint32 diff) override
{
Events.Update(diff);
if (Events.ExecuteEvent() == EVENT_SPAWN_KALECGOS)
if (Creature* kalecgos = instance->SummonCreature(NPC_KALECGOS, KalecgosSpawnPos))
{
kalecgos->GetMotionMaster()->MovePath(PATH_KALECGOS_FLIGHT, false);
kalecgos->AI()->Talk(SAY_KALECGOS_SPAWN);
}
}
bool SetBossState(uint32 type, EncounterState state) override
{
if (!InstanceScript::SetBossState(type, state))
@@ -177,10 +204,12 @@ class instance_magisters_terrace : public InstanceMapScript
}
protected:
EventMap Events;
ObjectGuid SelinGUID;
ObjectGuid DelrissaGUID;
ObjectGuid KaelStatue[2];
ObjectGuid EscapeOrbGUID;
ObjectGuid KalecgosGUID;
uint32 DelrissaDeathCount;
};
@@ -31,7 +31,8 @@ EndContentData */
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "Player.h"
#include "SpellInfo.h"
#include "magisters_terrace.h"
#include "EventMap.h"
/*######
## npc_kalecgos
@@ -39,30 +40,29 @@ EndContentData */
enum Spells
{
SPELL_TRANSFORM_TO_KAEL = 44670,
SPELL_KALECGOS_TRANSFORM = 44670,
SPELL_TRANSFORM_VISUAL = 24085,
SPELL_CAMERA_SHAKE = 44762,
SPELL_ORB_KILL_CREDIT = 46307
};
enum Creatures
enum MovementPoints
{
NPC_KAEL = 24848 //human form entry
POINT_ID_PREPARE_LANDING = 6
};
enum Misc
enum EventIds
{
POINT_ID_LAND = 1
EVENT_KALECGOS_TRANSFORM = 1,
EVENT_KALECGOS_LANDING = 2
};
const float afKaelLandPoint[] = {225.045f, -276.236f, -5.434f};
#define GOSSIP_ITEM_KAEL_1 "Who are you?"
#define GOSSIP_ITEM_KAEL_2 "What can we do to assist you?"
#define GOSSIP_ITEM_KAEL_3 "What brings you to the Sunwell?"
#define GOSSIP_ITEM_KAEL_4 "You're not alone here?"
#define GOSSIP_ITEM_KAEL_5 "What would Kil'jaeden want with a mortal woman?"
// This is friendly keal that appear after used Orb.
// If we assume DB handle summon, summon appear somewhere outside the platform where Orb is
class npc_kalecgos : public CreatureScript
{
public:
@@ -115,52 +115,46 @@ public:
struct npc_kalecgosAI : public ScriptedAI
{
npc_kalecgosAI(Creature* creature) : ScriptedAI(creature)
npc_kalecgosAI(Creature* creature) : ScriptedAI(creature) { }
void MovementInform(uint32 type, uint32 pointId) override
{
Initialize();
}
void Initialize()
{
m_uiTransformTimer = 0;
}
uint32 m_uiTransformTimer;
void Reset() override
{
Initialize();
// we must assume he appear as dragon somewhere outside the platform of orb, and then move directly to here
if (me->GetEntry() != NPC_KAEL)
me->GetMotionMaster()->MovePoint(POINT_ID_LAND, afKaelLandPoint[0], afKaelLandPoint[1], afKaelLandPoint[2]);
}
void MovementInform(uint32 uiType, uint32 uiPointId) override
{
if (uiType != POINT_MOTION_TYPE)
if (type != WAYPOINT_MOTION_TYPE)
return;
if (uiPointId == POINT_ID_LAND)
m_uiTransformTimer = MINUTE*IN_MILLISECONDS;
}
void UpdateAI(uint32 uiDiff) override
{
if (m_uiTransformTimer)
if (pointId == POINT_ID_PREPARE_LANDING)
{
if (m_uiTransformTimer <= uiDiff)
{
DoCast(me, SPELL_ORB_KILL_CREDIT, true);
// Transform and update entry, now ready for quest/read gossip
DoCast(me, SPELL_TRANSFORM_TO_KAEL, false);
me->UpdateEntry(NPC_KAEL);
m_uiTransformTimer = 0;
} else m_uiTransformTimer -= uiDiff;
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
me->SetDisableGravity(false);
me->SetHover(false);
events.ScheduleEvent(EVENT_KALECGOS_LANDING, Seconds(2));
}
}
void UpdateAI(uint32 diff) override
{
events.Update(diff);
switch (events.ExecuteEvent())
{
case EVENT_KALECGOS_LANDING:
DoCastAOE(SPELL_CAMERA_SHAKE);
me->SetObjectScale(0.6f);
events.ScheduleEvent(EVENT_KALECGOS_TRANSFORM, Seconds(1));
break;
case EVENT_KALECGOS_TRANSFORM:
DoCast(me, SPELL_ORB_KILL_CREDIT, true);
DoCast(me, SPELL_TRANSFORM_VISUAL, false);
DoCast(me, SPELL_KALECGOS_TRANSFORM, false);
me->UpdateEntry(NPC_HUMAN_KALECGOS);
break;
default:
break;
}
}
private:
EventMap events;
};
};
@@ -42,7 +42,9 @@ enum CreatureIds
{
NPC_SELIN = 24723,
NPC_DELRISSA = 24560,
NPC_FEL_CRYSTAL = 24722
NPC_FEL_CRYSTAL = 24722,
NPC_KALECGOS = 24844,
NPC_HUMAN_KALECGOS = 24848
};
enum GameObjectIds
@@ -57,4 +59,19 @@ enum GameObjectIds
GO_ESCAPE_ORB = 188173
};
enum InstanceEventIds
{
EVENT_SPAWN_KALECGOS = 16547
};
enum InstanceText
{
SAY_KALECGOS_SPAWN = 0
};
enum MovementData
{
PATH_KALECGOS_FLIGHT = 248440
};
#endif
@@ -132,7 +132,10 @@ public:
## at_map_chamber
######*/
#define QUEST_HIDDEN_CHAMBER 2240
enum MapChamber
{
QUEST_HIDDEN_CHAMBER = 2240
};
class AreaTrigger_at_map_chamber : public AreaTriggerScript
{
@@ -157,7 +157,7 @@ public:
{
if (Creature* target = ObjectAccessor::GetCreature(*summoned, targetGUID))
{
target->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ() + 15.0f, 0);
target->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ() + 15.0f, me->GetOrientation(), 0);
target->SetPosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f);
summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false);
}
@@ -316,59 +316,6 @@ public:
};
};
/*######
## npc_parqual_fintallas
######*/
enum ParqualFintallas
{
SPELL_MARK_OF_SHAME = 6767
};
#define GOSSIP_HPF1 "Gul'dan"
#define GOSSIP_HPF2 "Kel'Thuzad"
#define GOSSIP_HPF3 "Ner'zhul"
class npc_parqual_fintallas : public CreatureScript
{
public:
npc_parqual_fintallas() : CreatureScript("npc_parqual_fintallas") { }
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
{
player->PlayerTalkClass->ClearMenus();
if (action == GOSSIP_ACTION_INFO_DEF+1)
{
player->CLOSE_GOSSIP_MENU();
creature->CastSpell(player, SPELL_MARK_OF_SHAME, false);
}
if (action == GOSSIP_ACTION_INFO_DEF+2)
{
player->CLOSE_GOSSIP_MENU();
player->AreaExploredOrEventHappens(6628);
}
return true;
}
bool OnGossipHello(Player* player, Creature* creature) override
{
if (creature->IsQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
if (player->GetQuestStatus(6628) == QUEST_STATUS_INCOMPLETE && !player->HasAura(SPELL_MARK_OF_SHAME))
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HPF3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
player->SEND_GOSSIP_MENU(5822, creature->GetGUID());
}
else
player->SEND_GOSSIP_MENU(5821, creature->GetGUID());
return true;
}
};
/*######
## AddSC
######*/
@@ -377,5 +324,4 @@ void AddSC_undercity()
{
new npc_lady_sylvanas_windrunner();
new npc_highborne_lamenter();
new npc_parqual_fintallas();
}
@@ -25,7 +25,6 @@ EndScriptData */
/* ContentData
npcs_dithers_and_arbington
npc_myranda_the_hag
npc_the_scourge_cauldron
npc_andorhal_tower
EndContentData */
@@ -33,7 +32,6 @@ EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "ScriptedEscortAI.h"
#include "Player.h"
#include "WorldSession.h"
@@ -41,12 +39,23 @@ EndContentData */
## npcs_dithers_and_arbington
######*/
#define GOSSIP_HDA1 "What does the Felstone Field Cauldron need?"
#define GOSSIP_HDA2 "What does the Dalson's Tears Cauldron need?"
#define GOSSIP_HDA3 "What does the Writhing Haunt Cauldron need?"
#define GOSSIP_HDA4 "What does the Gahrron's Withering Cauldron need?"
#define GOSSIP_SDA1 "Thanks, i need a Vitreous Focuser"
enum DithersAndArbington
{
GOSSIP_ITEM_ID_FELSTONE_FIELD = 0,
GOSSIP_ITEM_ID_DALSON_S_TEARS = 1,
GOSSIP_ITEM_ID_WRITHING_HAUNT = 2,
GOSSIP_ITEM_ID_GAHRRON_S_WITH = 3,
GOSSIP_MENU_ID_LETS_GET_TO_WORK = 3223,
GOSSIP_MENU_ID_VITREOUS_FOCUSER = 3229,
NPC_TEXT_OSSEOUS_AGITATORS = 3980,
NPC_TEXT_SOMATIC_INTENSIFIERS_1 = 3981,
NPC_TEXT_SOMATIC_INTENSIFIERS_2 = 3982,
NPC_TEXT_ECTOPLASMIC_RESONATORS = 3983,
NPC_TEXT_LET_S_GET_TO_WORK = 3985,
QUEST_MISSION_ACCOMPLISHED_H = 5237,
QUEST_MISSION_ACCOMPLISHED_A = 5238,
CREATE_ITEM_VITREOUS_FOCUSER = 17529
};
class npcs_dithers_and_arbington : public CreatureScript
{
@@ -62,24 +71,24 @@ public:
player->GetSession()->SendListInventory(creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+1:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
player->SEND_GOSSIP_MENU(3980, creature->GetGUID());
player->ADD_GOSSIP_ITEM_DB(GOSSIP_MENU_ID_VITREOUS_FOCUSER, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
player->SEND_GOSSIP_MENU(NPC_TEXT_OSSEOUS_AGITATORS, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+2:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
player->SEND_GOSSIP_MENU(3981, creature->GetGUID());
player->ADD_GOSSIP_ITEM_DB(GOSSIP_MENU_ID_VITREOUS_FOCUSER, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
player->SEND_GOSSIP_MENU(NPC_TEXT_SOMATIC_INTENSIFIERS_1, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+3:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
player->SEND_GOSSIP_MENU(3982, creature->GetGUID());
player->ADD_GOSSIP_ITEM_DB(GOSSIP_MENU_ID_VITREOUS_FOCUSER, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
player->SEND_GOSSIP_MENU(NPC_TEXT_SOMATIC_INTENSIFIERS_2, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+4:
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
player->SEND_GOSSIP_MENU(3983, creature->GetGUID());
player->ADD_GOSSIP_ITEM_DB(GOSSIP_MENU_ID_VITREOUS_FOCUSER, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
player->SEND_GOSSIP_MENU(NPC_TEXT_ECTOPLASMIC_RESONATORS, creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF+5:
player->CLOSE_GOSSIP_MENU();
creature->CastSpell(player, 17529, false);
creature->CastSpell(player, CREATE_ITEM_VITREOUS_FOCUSER, false);
break;
}
return true;
@@ -93,61 +102,13 @@ public:
if (creature->IsVendor())
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
if (player->GetQuestRewardStatus(5237) || player->GetQuestRewardStatus(5238))
if (player->GetQuestRewardStatus(QUEST_MISSION_ACCOMPLISHED_H) || player->GetQuestRewardStatus(QUEST_MISSION_ACCOMPLISHED_A))
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HDA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
player->SEND_GOSSIP_MENU(3985, creature->GetGUID());
}
else
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
};
/*######
## npc_myranda_the_hag
######*/
enum Myranda
{
ILLUSION_GOSSIP = 4773,
QUEST_SUBTERFUGE = 5862,
QUEST_IN_DREAMS = 5944,
SPELL_SCARLET_ILLUSION = 17961
};
class npc_myranda_the_hag : public CreatureScript
{
public:
npc_myranda_the_hag() : CreatureScript("npc_myranda_the_hag") { }
bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) override
{
player->PlayerTalkClass->ClearMenus();
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_SCARLET_ILLUSION, false);
}
return true;
}
bool OnGossipHello(Player* player, Creature* creature) override
{
if (creature->IsQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
if (player->GetQuestStatus(QUEST_SUBTERFUGE) == QUEST_STATUS_COMPLETE &&
player->GetQuestStatus(QUEST_IN_DREAMS) != QUEST_STATUS_COMPLETE &&
!player->HasAura(SPELL_SCARLET_ILLUSION))
{
player->ADD_GOSSIP_ITEM_DB(Player::GetDefaultGossipMenuForSource(creature), 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(ILLUSION_GOSSIP, creature->GetGUID());
return true;
player->ADD_GOSSIP_ITEM_DB(GOSSIP_MENU_ID_LETS_GET_TO_WORK, GOSSIP_ITEM_ID_FELSTONE_FIELD, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->ADD_GOSSIP_ITEM_DB(GOSSIP_MENU_ID_LETS_GET_TO_WORK, GOSSIP_ITEM_ID_DALSON_S_TEARS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
player->ADD_GOSSIP_ITEM_DB(GOSSIP_MENU_ID_LETS_GET_TO_WORK, GOSSIP_ITEM_ID_WRITHING_HAUNT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
player->ADD_GOSSIP_ITEM_DB(GOSSIP_MENU_ID_LETS_GET_TO_WORK, GOSSIP_ITEM_ID_GAHRRON_S_WITH, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
player->SEND_GOSSIP_MENU(NPC_TEXT_LET_S_GET_TO_WORK, creature->GetGUID());
}
else
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
@@ -184,7 +145,7 @@ public:
me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
//override any database `spawntimesecs` to prevent duplicated summons
uint32 rTime = me->GetRespawnDelay();
if (rTime<600)
if (rTime < 600)
me->SetRespawnDelay(600);
}
@@ -263,7 +224,6 @@ public:
}
void MoveInLineOfSight(Unit* who) override
{
if (!who || who->GetTypeId() != TYPEID_PLAYER)
return;
@@ -275,14 +235,9 @@ public:
};
};
/*######
##
######*/
void AddSC_western_plaguelands()
{
new npcs_dithers_and_arbington();
new npc_myranda_the_hag();
new npc_the_scourge_cauldron();
new npc_andorhal_tower();
}
@@ -58,6 +58,10 @@ enum Enums
SAY_FAREWELL = 5,
SAY_ATTACKED = 11,
GOSSIP_OPTION_LET_EVENT_BEGIN = 201,
NPC_TEXT_NARALEX_SLEEPS_AGAIN = 698,
NPC_TEXT_FANGLORDS_ARE_DEAD = 699,
SPELL_MARK_OF_THE_WILD_RANK_2 = 5232,
SPELL_SERPENTINE_CLEANSING = 6270,
SPELL_NARALEXS_AWAKENING = 6271,
@@ -70,10 +74,6 @@ enum Enums
NPC_MUTANUS_THE_DEVOURER = 3654,
};
#define GOSSIP_ID_START_1 698 //Naralex sleeps again!
#define GOSSIP_ID_START_2 699 //The fanglords are dead!
#define GOSSIP_ITEM_NARALEX "Let the event begin!"
class npc_disciple_of_naralex : public CreatureScript
{
public:
@@ -116,8 +116,8 @@ public:
if ((instance->GetData(TYPE_LORD_COBRAHN) == DONE) && (instance->GetData(TYPE_LORD_PYTHAS) == DONE) &&
(instance->GetData(TYPE_LADY_ANACONDRA) == DONE) && (instance->GetData(TYPE_LORD_SERPENTIS) == DONE))
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NARALEX, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(GOSSIP_ID_START_2, creature->GetGUID());
player->ADD_GOSSIP_ITEM_DB(GOSSIP_OPTION_LET_EVENT_BEGIN, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
player->SEND_GOSSIP_MENU(NPC_TEXT_FANGLORDS_ARE_DEAD, creature->GetGUID());
if (!instance->GetData(TYPE_NARALEX_YELLED))
{
@@ -127,7 +127,7 @@ public:
}
else
{
player->SEND_GOSSIP_MENU(GOSSIP_ID_START_1, creature->GetGUID());
player->SEND_GOSSIP_MENU(NPC_TEXT_NARALEX_SLEEPS_AGAIN, creature->GetGUID());
}
}
return true;
@@ -31,6 +31,7 @@ EndContentData */
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "Player.h"
#include "SpellScript.h"
/*####
# npc_ruul_snowhoof
@@ -344,9 +345,42 @@ class go_naga_brazier : public GameObjectScript
}
};
enum KingoftheFoulwealdMisc
{
GO_BANNER = 178205
};
class spell_destroy_karangs_banner : public SpellScriptLoader
{
public:
spell_destroy_karangs_banner() : SpellScriptLoader("spell_destroy_karangs_banner") { }
class spell_destroy_karangs_banner_SpellScript : public SpellScript
{
PrepareSpellScript(spell_destroy_karangs_banner_SpellScript);
void HandleAfterCast()
{
if (GameObject* banner = GetCaster()->FindNearestGameObject(GO_BANNER, GetSpellInfo()->GetMaxRange(true)))
banner->Delete();
}
void Register() override
{
AfterCast += SpellCastFn(spell_destroy_karangs_banner_SpellScript::HandleAfterCast);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_destroy_karangs_banner_SpellScript();
}
};
void AddSC_ashenvale()
{
new npc_ruul_snowhoof();
new npc_muglash();
new go_naga_brazier();
new spell_destroy_karangs_banner();
}
@@ -135,9 +135,9 @@ class boss_general_zarithrian : public CreatureScript
Talk(SAY_KILL);
}
bool CanAIAttack(Unit const* /*target*/) const override
bool CanAIAttack(Unit const* target) const override
{
return (instance->GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && instance->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE);
return (instance->GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && instance->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE && BossAI::CanAIAttack(target));
}
void UpdateAI(uint32 diff) override
@@ -461,13 +461,13 @@ class boss_toc_champion_controller : public CreatureScript
if (playerTeam == ALLIANCE)
{
temp->SetHomePosition(vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 0);
temp->GetMotionMaster()->MoveJump(vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 20.0f, 20.0f);
temp->GetMotionMaster()->MoveJump(vChampionJumpTarget[pos], 20.0f, 20.0f);
temp->SetOrientation(0);
}
else
{
temp->SetHomePosition((ToCCommonLoc[1].GetPositionX()*2)-vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 3);
temp->GetMotionMaster()->MoveJump((ToCCommonLoc[1].GetPositionX()*2)-vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), 20.0f, 20.0f);
temp->GetMotionMaster()->MoveJump((ToCCommonLoc[1].GetPositionX() * 2) - vChampionJumpTarget[pos].GetPositionX(), vChampionJumpTarget[pos].GetPositionY(), vChampionJumpTarget[pos].GetPositionZ(), vChampionJumpTarget[pos].GetOrientation(), 20.0f, 20.0f);
temp->SetOrientation(3);
}
}
@@ -390,7 +390,7 @@ class npc_snobold_vassal : public CreatureScript
else if (Unit* target2 = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true))
{
_targetGUID = target2->GetGUID();
me->GetMotionMaster()->MoveJump(target2->GetPositionX(), target2->GetPositionY(), target2->GetPositionZ(), 15.0f, 15.0f);
me->GetMotionMaster()->MoveJump(*target2, 15.0f, 15.0f);
}
}
}
@@ -981,7 +981,7 @@ class boss_icehowl : public CreatureScript
events.ScheduleEvent(EVENT_WHIRL, urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS));
return;
case EVENT_MASSIVE_CRASH:
me->GetMotionMaster()->MoveJump(ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 20.0f, 20.0f, 0); // 1: Middle of the room
me->GetMotionMaster()->MoveJump(ToCCommonLoc[1], 20.0f, 20.0f, 0); // 1: Middle of the room
SetCombatMovement(false);
me->AttackStop();
_stage = 7; //Invalid (Do nothing more than move)
@@ -1034,7 +1034,7 @@ class boss_icehowl : public CreatureScript
_trampleTargetY = target->GetPositionY();
_trampleTargetZ = target->GetPositionZ();
// 2: Hop Backwards
me->GetMotionMaster()->MoveJump(2*me->GetPositionX() - _trampleTargetX, 2*me->GetPositionY() - _trampleTargetY, me->GetPositionZ(), 30.0f, 20.0f, 0);
me->GetMotionMaster()->MoveJump(2*me->GetPositionX() - _trampleTargetX, 2*me->GetPositionY() - _trampleTargetY, me->GetPositionZ(), me->GetOrientation(), 30.0f, 20.0f, 0);
_stage = 7; //Invalid (Do nothing more than move)
}
else
@@ -598,7 +598,7 @@ class boss_deathbringer_saurfang : public CreatureScript
if (target->GetTransport())
return false;
return true;
return BossAI::CanAIAttack(target);
}
static uint32 const FightWonValue;
@@ -317,14 +317,12 @@ class boss_professor_putricide : public CreatureScript
// no possible aura seen in sniff adding the aurastate
summon->ModifyAuraState(AURA_STATE_UNKNOWN22, true);
summon->CastSpell(summon, SPELL_GASEOUS_BLOAT_PROC, true);
summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
summon->SetReactState(REACT_PASSIVE);
break;
case NPC_VOLATILE_OOZE:
// no possible aura seen in sniff adding the aurastate
summon->ModifyAuraState(AURA_STATE_UNKNOWN19, true);
summon->CastSpell(summon, SPELL_OOZE_ERUPTION_SEARCH_PERIODIC, true);
summon->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
summon->SetReactState(REACT_PASSIVE);
break;
case NPC_CHOKING_GAS_BOMB:
@@ -285,6 +285,7 @@ enum Phases
#define PHASE_TWO_THREE (events.IsInPhase(PHASE_TWO) ? PHASE_TWO : PHASE_THREE)
Position const CenterPosition = {503.6282f, -2124.655f, 840.8569f, 0.0f};
Position const TirionSpawn = {505.2118f, -2124.353f, 840.9403f, 3.141593f};
Position const TirionIntro = {489.2970f, -2124.840f, 840.8569f, 0.0f};
Position const TirionCharge = {482.9019f, -2124.479f, 840.8570f, 0.0f};
Position const LichKingIntro[3] =
@@ -493,13 +494,33 @@ class boss_the_lich_king : public CreatureScript
_vileSpiritExplosions = 0;
}
void Reset() override
void InitializeAI() override
{
SetupEncounter();
}
void JustRespawned() override
{
SetupEncounter();
}
void SetupEncounter()
{
_Reset();
me->SetReactState(REACT_PASSIVE);
events.SetPhase(PHASE_INTRO);
Initialize();
SetEquipmentSlots(true);
// Reset The Frozen Throne gameobjects
FrozenThroneResetWorker reset;
Trinity::GameObjectWorker<FrozenThroneResetWorker> worker(me, reset);
me->VisitNearbyGridObject(333.0f, worker);
// Reset any light override
me->GetMap()->SetZoneOverrideLight(AREA_THE_FROZEN_THRONE, 0, 5000);
me->SummonCreature(NPC_HIGHLORD_TIRION_FORDRING_LK, TirionSpawn, TEMPSUMMON_MANUAL_DESPAWN);
}
void JustDied(Unit* /*killer*/) override
@@ -535,40 +556,21 @@ class boss_the_lich_king : public CreatureScript
events.ScheduleEvent(EVENT_SHADOW_TRAP, 15500, 0, PHASE_ONE);
}
void JustReachedHome() override
{
_JustReachedHome();
instance->SetBossState(DATA_THE_LICH_KING, NOT_STARTED);
// Reset The Frozen Throne gameobjects
FrozenThroneResetWorker reset;
Trinity::GameObjectWorker<FrozenThroneResetWorker> worker(me, reset);
me->VisitNearbyGridObject(333.0f, worker);
// Restore Tirion's gossip only after The Lich King fully resets to prevent
// restarting the encounter while LK still runs back to spawn point
if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING)))
tirion->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
// Reset any light override
me->GetMap()->SetZoneOverrideLight(AREA_THE_FROZEN_THRONE, 0, 5000);
}
bool CanAIAttack(Unit const* target) const override
{
// The Lich King must not select targets in frostmourne room if he killed everyone outside
return !target->HasAura(SPELL_IN_FROSTMOURNE_ROOM);
return !target->HasAura(SPELL_IN_FROSTMOURNE_ROOM) && BossAI::CanAIAttack(target);
}
void EnterEvadeMode(EvadeReason why) override
void EnterEvadeMode(EvadeReason /*why*/) override
{
instance->SetBossState(DATA_THE_LICH_KING, FAIL);
BossAI::EnterEvadeMode(why);
if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_HIGHLORD_TIRION_FORDRING)))
tirion->AI()->EnterEvadeMode();
tirion->DespawnOrUnsummon();
DoCastAOE(SPELL_KILL_FROSTMOURNE_PLAYERS);
EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE);
summons.DoAction(ACTION_TELEPORT_BACK, pred);
summons.DespawnAll();
_DespawnAtEvade();
}
void KilledUnit(Unit* victim) override
@@ -749,6 +751,8 @@ class boss_the_lich_king : public CreatureScript
case NPC_STRANGULATE_VEHICLE:
summons.Summon(summon);
return;
case NPC_HIGHLORD_TIRION_FORDRING_LK:
return;
default:
break;
}
@@ -1132,6 +1136,7 @@ class npc_tirion_fordring_tft : public CreatureScript
_events.Reset();
if (_instance->GetBossState(DATA_THE_LICH_KING) == DONE)
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
me->LoadEquipment(1);
}
void MovementInform(uint32 type, uint32 id) override
@@ -375,8 +375,12 @@ class boss_gothik : public CreatureScript
_gateIsOpen = true;
for (ObjectGuid summonGuid : summons)
{
if (Creature* summon = ObjectAccessor::GetCreature(*me, summonGuid))
summon->AI()->DoAction(ACTION_GATE_OPENED);
if (summons.empty()) // ACTION_GATE_OPENED may cause an evade, despawning summons and invalidating our iterator
break;
}
}
void DamageTaken(Unit* /*who*/, uint32& damage) override
@@ -979,6 +979,9 @@ class go_celestial_planetarium_access : public GameObjectScript
bool GossipHello(Player* player) override
{
if (go->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE))
return true;
bool hasKey = true;
if (LockEntry const* lock = sLockStore.LookupEntry(go->GetGOInfo()->goober.lockId))
{
@@ -1186,6 +1186,7 @@ class npc_brann_bronzebeard_ulduar_intro : public CreatureScript
{
if (menuId == GOSSIP_MENU_BRANN_BRONZEBEARD && gossipListId == GOSSIP_OPTION_BRANN_BRONZEBEARD)
{
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
player->PlayerTalkClass->SendCloseGossip();
if (Creature* loreKeeper = _instance->GetCreature(DATA_LORE_KEEPER_OF_NORGANNON))
loreKeeper->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
@@ -1238,6 +1239,7 @@ class npc_lorekeeper : public CreatureScript
{
if (menuId == GOSSIP_MENU_LORE_KEEPER && gossipListId == GOSSIP_OPTION_LORE_KEEPER)
{
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
player->PlayerTalkClass->SendCloseGossip();
_instance->instance->LoadGrid(364, -16); // make sure leviathan is loaded
@@ -1250,6 +1252,7 @@ class npc_lorekeeper : public CreatureScript
{
if (Creature* brann = _instance->GetCreature(DATA_BRANN_BRONZEBEARD_INTRO))
{
brann->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
delorah->GetMotionMaster()->MovePoint(0, brann->GetPositionX() - 4, brann->GetPositionY(), brann->GetPositionZ());
/// @todo delorah->AI()->Talk(xxxx, brann->GetGUID()); when reached at branz
}
@@ -1765,9 +1768,7 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader
else
{
passenger->ExitVehicle();
float x, y, z;
targets.GetDstPos()->GetPosition(x, y, z);
passenger->GetMotionMaster()->MoveJump(x, y, z, targets.GetSpeedXY(), targets.GetSpeedZ());
passenger->GetMotionMaster()->MoveJump(*targets.GetDstPos(), targets.GetSpeedXY(), targets.GetSpeedZ());
}
}
}
@@ -222,7 +222,6 @@ class npc_iron_roots : public CreatureScript
{
SetCombatMovement(false);
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); // Death Grip
me->setFaction(14);
me->SetReactState(REACT_PASSIVE);
@@ -380,7 +380,6 @@ class npc_saronite_vapors : public CreatureScript
{
Talk(EMOTE_VAPORS);
instance = me->GetInstanceScript();
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
me->ApplySpellImmune(0, IMMUNITY_ID, 49560, true); // Death Grip jump effect
me->SetReactState(REACT_PASSIVE);
}
@@ -444,7 +444,7 @@ class boss_mimiron : public CreatureScript
DoCastAOE(SPELL_DESPAWN_ASSAULT_BOTS);
me->ExitVehicle();
// ExitVehicle() offset position is not implemented, so we make up for that with MoveJump()...
me->GetMotionMaster()->MoveJump(me->GetPositionX() + (10.f * std::cos(me->GetOrientation())), me->GetPositionY() + (10.f * std::sin(me->GetOrientation())), me->GetPositionZ(), 10.f, 5.f);
me->GetMotionMaster()->MoveJump(me->GetPositionX() + (10.f * std::cos(me->GetOrientation())), me->GetPositionY() + (10.f * std::sin(me->GetOrientation())), me->GetPositionZ(), me->GetOrientation(), 10.f, 5.f);
events.ScheduleEvent(EVENT_OUTTRO_1, 7000);
}
@@ -1634,8 +1634,11 @@ class go_mimiron_hardmode_button : public GameObjectScript
public:
go_mimiron_hardmode_button() : GameObjectScript("go_mimiron_hardmode_button") { }
bool OnGossipHello(Player* /*player*/, GameObject* go)
bool OnGossipHello(Player* /*player*/, GameObject* go) override
{
if (go->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE))
return true;
InstanceScript* instance = go->GetInstanceScript();
if (!instance)
return false;
@@ -110,30 +110,24 @@ class boss_ingvar_the_plunderer : public CreatureScript
{
if (me->GetEntry() != NPC_INGVAR)
me->UpdateEntry(NPC_INGVAR);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
_Reset();
events.SetPhase(PHASE_HUMAN);
events.ScheduleEvent(EVENT_CLEAVE, urand(6, 12)*IN_MILLISECONDS, 0, PHASE_HUMAN);
events.ScheduleEvent(EVENT_STAGGERING_ROAR, urand(18, 21)*IN_MILLISECONDS, 0, PHASE_HUMAN);
events.ScheduleEvent(EVENT_ENRAGE, urand(7, 14)*IN_MILLISECONDS, 0, PHASE_HUMAN);
events.ScheduleEvent(EVENT_SMASH, urand(12, 17)*IN_MILLISECONDS, 0, PHASE_HUMAN);
}
void DamageTaken(Unit* /*doneBy*/, uint32& damage) override
{
if (damage >= me->GetHealth() && events.IsInPhase(PHASE_HUMAN))
{
events.SetPhase(PHASE_EVENT);
events.ScheduleEvent(EVENT_SUMMON_BANSHEE, 3 * IN_MILLISECONDS, 0, PHASE_EVENT);
me->RemoveAllAuras();
me->StopMoving();
DoCast(me, SPELL_INGVAR_FEIGN_DEATH, true);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
events.SetPhase(PHASE_EVENT);
events.ScheduleEvent(EVENT_SUMMON_BANSHEE, 3 * IN_MILLISECONDS, 0, PHASE_EVENT);
Talk(SAY_DEATH);
}
@@ -152,13 +146,28 @@ class boss_ingvar_the_plunderer : public CreatureScript
me->RemoveAura(SPELL_INGVAR_FEIGN_DEATH);
DoCast(me, SPELL_INGVAR_TRANSFORM, true);
me->UpdateEntry(NPC_INGVAR_UNDEAD);
events.ScheduleEvent(EVENT_JUST_TRANSFORMED, 2 * IN_MILLISECONDS, 0, PHASE_EVENT);
events.ScheduleEvent(EVENT_JUST_TRANSFORMED, IN_MILLISECONDS / 2, 0, PHASE_EVENT);
}
void EnterCombat(Unit* /*who*/) override
{
if (events.IsInPhase(PHASE_EVENT) || events.IsInPhase(PHASE_UNDEAD)) // ingvar gets multiple EnterCombat calls
return;
_EnterCombat();
Talk(SAY_AGGRO);
events.SetPhase(PHASE_HUMAN);
events.ScheduleEvent(EVENT_CLEAVE, urand(6, 12)*IN_MILLISECONDS, 0, PHASE_HUMAN);
events.ScheduleEvent(EVENT_STAGGERING_ROAR, urand(18, 21)*IN_MILLISECONDS, 0, PHASE_HUMAN);
events.ScheduleEvent(EVENT_ENRAGE, urand(7, 14)*IN_MILLISECONDS, 0, PHASE_HUMAN);
events.ScheduleEvent(EVENT_SMASH, urand(12, 17)*IN_MILLISECONDS, 0, PHASE_HUMAN);
}
void AttackStart(Unit* who) override
{
if (events.IsInPhase(PHASE_EVENT)) // prevent ingvar from beginning to attack/chase during transition
return;
BossAI::AttackStart(who);
}
void JustDied(Unit* /*killer*/) override
@@ -171,7 +180,7 @@ class boss_ingvar_the_plunderer : public CreatureScript
{
events.SetPhase(PHASE_UNDEAD);
events.ScheduleEvent(EVENT_DARK_SMASH, urand(14, 18)*IN_MILLISECONDS, 0, PHASE_UNDEAD);
events.ScheduleEvent(EVENT_DREADFUL_ROAR, urand(18, 22)*IN_MILLISECONDS, 0, PHASE_UNDEAD);
events.ScheduleEvent(EVENT_DREADFUL_ROAR, 0, 0, PHASE_UNDEAD);
events.ScheduleEvent(EVENT_WOE_STRIKE, urand(10, 14)*IN_MILLISECONDS, 0, PHASE_UNDEAD);
events.ScheduleEvent(EVENT_SHADOW_AXE, 30*IN_MILLISECONDS, 0, PHASE_UNDEAD);
}
@@ -214,9 +223,17 @@ class boss_ingvar_the_plunderer : public CreatureScript
events.ScheduleEvent(EVENT_SMASH, urand(12, 16)*IN_MILLISECONDS, 0, PHASE_HUMAN);
break;
case EVENT_JUST_TRANSFORMED:
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
DoZoneInCombat();
ScheduleSecondPhase();
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
if (Unit* target = me->getThreatManager().getHostilTarget())
AttackStart(target);
else
{
EnterEvadeMode(EVADE_REASON_NO_HOSTILES);
return;
}
Talk(SAY_AGGRO);
DoZoneInCombat();
return;
case EVENT_SUMMON_BANSHEE:
DoCast(me, SPELL_SUMMON_BANSHEE);
@@ -238,7 +238,7 @@ public:
me->SetInCombatWithZone();
instance->SetBossState(DATA_SKADI_THE_RUTHLESS, IN_PROGRESS);
instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT);
me->GetMotionMaster()->MoveJump(Location[0].GetPositionX(), Location[0].GetPositionY(), Location[0].GetPositionZ(), 5.0f, 10.0f);
me->GetMotionMaster()->MoveJump(Location[0], 5.0f, 10.0f);
me->SetWalk(false);
m_uiMountTimer = 1000;
Summons.DespawnEntry(NPC_GRAUF);
@@ -289,7 +289,7 @@ public:
pGrauf->GetMotionMaster()->MoveFall();
pGrauf->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH);
}
me->GetMotionMaster()->MoveJump(Location[4].GetPositionX(), Location[4].GetPositionY(), Location[4].GetPositionZ(), 5.0f, 10.0f);
me->GetMotionMaster()->MoveJump(Location[4], 5.0f, 10.0f);
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE);
Talk(SAY_DRAKE_DEATH);
m_uiCrushTimer = 8000;
@@ -206,7 +206,7 @@ class spell_ioc_parachute_ic : public SpellScriptLoader
class StartLaunchEvent : public BasicEvent
{
public:
StartLaunchEvent(float x, float y, float z, ObjectGuid::LowType lowGuid) : _x(x), _y(y), _z(z), _lowGuid(lowGuid)
StartLaunchEvent(Position const& pos, ObjectGuid::LowType lowGuid) : _pos(pos), _lowGuid(lowGuid)
{
}
@@ -218,15 +218,15 @@ class StartLaunchEvent : public BasicEvent
player->AddAura(SPELL_LAUNCH_NO_FALLING_DAMAGE, player); // prevents falling damage
float speedZ = 10.0f;
float dist = player->GetExactDist2d(_x, _y);
float dist = player->GetExactDist2d(&_pos);
player->ExitVehicle();
player->GetMotionMaster()->MoveJump(_x, _y, _z, dist, speedZ);
player->GetMotionMaster()->MoveJump(_pos, dist, speedZ, EVENT_JUMP, true);
return true;
}
private:
float _x, _y, _z;
Position _pos;
ObjectGuid::LowType _lowGuid;
};
@@ -244,11 +244,7 @@ class spell_ioc_launch : public SpellScriptLoader
if (!GetCaster()->ToCreature() || !GetExplTargetDest())
return;
float x, y, z;
x = GetExplTargetDest()->GetPositionX();
y = GetExplTargetDest()->GetPositionY();
z = GetExplTargetDest()->GetPositionZ();
GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(x, y, z, GetHitPlayer()->GetGUID().GetCounter()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500));
GetCaster()->ToCreature()->m_Events.AddEvent(new StartLaunchEvent(*GetExplTargetDest(), GetHitPlayer()->GetGUID().GetCounter()), GetCaster()->ToCreature()->m_Events.CalculateTime(2500));
}
void Register() override
@@ -213,7 +213,6 @@ class npc_tournament_training_dummy : public CreatureScript
void Reset() override
{
me->SetControlled(true, UNIT_STATE_STUNNED);
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);
Initialize();
// Cast Defend spells to max stack size
@@ -144,6 +144,7 @@ enum Spells
// Thaladred the Darkener spells
SPELL_PSYCHIC_BLOW = 10689,
SPELL_SILENCE = 30225,
SPELL_REND = 36965,
// Lord Sanguinar spells
SPELL_BELLOWING_ROAR = 40636,
// Grand Astromancer Capernian spells
@@ -881,11 +882,13 @@ class boss_thaladred_the_darkener : public CreatureScript
{
Gaze_Timer = 100;
Silence_Timer = 20000;
Rend_Timer = 4000;
PsychicBlow_Timer = 10000;
}
uint32 Gaze_Timer;
uint32 Silence_Timer;
uint32 Rend_Timer;
uint32 PsychicBlow_Timer;
void Reset() override
@@ -939,6 +942,15 @@ class boss_thaladred_the_darkener : public CreatureScript
else
Silence_Timer -= diff;
//Rend_Timer
if (Rend_Timer <= diff)
{
DoCastVictim(SPELL_REND);
Rend_Timer = 4000;
}
else
Rend_Timer -= diff;
//PsychicBlow_Timer
if (PsychicBlow_Timer <= diff)
{
+173
View File
@@ -20,10 +20,181 @@
* Scriptnames of files in this file should be prefixed with "npc_pet_gen_".
*/
/* ContentData
npc_pet_gen_egbert 100% Egbert run's around
npc_pet_gen_pandaren_monk 100% Pandaren Monk drinks and bows with you
npc_pet_gen_mojo 100% Mojo follows you when you kiss it
EndContentData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "PassiveAI.h"
#include "Player.h"
enum EgbertMisc
{
SPELL_EGBERT = 40669,
EVENT_RETURN = 3
};
class npc_pet_gen_egbert : public CreatureScript
{
public:
npc_pet_gen_egbert() : CreatureScript("npc_pet_gen_egbert") {}
struct npc_pet_gen_egbertAI : public NullCreatureAI
{
npc_pet_gen_egbertAI(Creature* creature) : NullCreatureAI(creature)
{
if (Unit* owner = me->GetCharmerOrOwner())
if (owner->GetMap()->GetEntry()->addon > 1)
me->SetCanFly(true);
}
void Reset() override
{
_events.Reset();
if (Unit* owner = me->GetCharmerOrOwner())
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle());
}
void EnterEvadeMode(EvadeReason why) override
{
if (!_EnterEvadeMode(why))
return;
Reset();
}
void UpdateAI(uint32 diff) override
{
_events.Update(diff);
if (Unit* owner = me->GetCharmerOrOwner())
{
if (!me->IsWithinDist(owner, 40.f))
{
me->RemoveAura(SPELL_EGBERT);
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle());
}
}
if (me->HasAura(SPELL_EGBERT))
_events.ScheduleEvent(EVENT_RETURN, urandms(5, 20));
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_RETURN:
me->RemoveAura(SPELL_EGBERT);
break;
default:
break;
}
}
}
private:
EventMap _events;
};
CreatureAI* GetAI(Creature* creature) const
{
return new npc_pet_gen_egbertAI(creature);
}
};
enum PandarenMonkMisc
{
SPELL_PANDAREN_MONK = 69800,
EVENT_FOCUS = 1,
EVENT_EMOTE = 2,
EVENT_FOLLOW = 3,
EVENT_DRINK = 4
};
class npc_pet_gen_pandaren_monk : public CreatureScript
{
public:
npc_pet_gen_pandaren_monk() : CreatureScript("npc_pet_gen_pandaren_monk") {}
struct npc_pet_gen_pandaren_monkAI : public NullCreatureAI
{
npc_pet_gen_pandaren_monkAI(Creature* creature) : NullCreatureAI(creature) { }
void Reset() override
{
_events.Reset();
_events.ScheduleEvent(EVENT_FOCUS, 1000);
}
void EnterEvadeMode(EvadeReason why) override
{
if (!_EnterEvadeMode(why))
return;
Reset();
}
void ReceiveEmote(Player* /*player*/, uint32 emote) override
{
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
me->StopMoving();
switch (emote)
{
case TEXT_EMOTE_BOW:
_events.ScheduleEvent(EVENT_FOCUS, 1000);
break;
case TEXT_EMOTE_DRINK:
_events.ScheduleEvent(EVENT_DRINK, 1000);
break;
}
}
void UpdateAI(uint32 diff) override
{
_events.Update(diff);
if (Unit* owner = me->GetCharmerOrOwner())
if (!me->IsWithinDist(owner, 30.f))
me->InterruptSpell(CURRENT_CHANNELED_SPELL);
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_FOCUS:
if (Unit* owner = me->GetCharmerOrOwner())
me->SetFacingToObject(owner);
_events.ScheduleEvent(EVENT_EMOTE, 1000);
break;
case EVENT_EMOTE:
me->HandleEmoteCommand(EMOTE_ONESHOT_BOW);
_events.ScheduleEvent(EVENT_FOLLOW, 1000);
break;
case EVENT_FOLLOW:
if (Unit* owner = me->GetCharmerOrOwner())
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
break;
case EVENT_DRINK:
me->CastSpell(me, SPELL_PANDAREN_MONK, false);
break;
default:
break;
}
}
}
private:
EventMap _events;
};
CreatureAI* GetAI(Creature* creature) const
{
return new npc_pet_gen_pandaren_monkAI(creature);
}
};
enum Mojo
{
SAY_MOJO = 0,
@@ -89,5 +260,7 @@ class npc_pet_gen_mojo : public CreatureScript
void AddSC_generic_pet_scripts()
{
new npc_pet_gen_egbert();
new npc_pet_gen_pandaren_monk();
new npc_pet_gen_mojo();
}
+32
View File
@@ -1083,6 +1083,37 @@ class spell_dru_swift_flight_passive : public SpellScriptLoader
}
};
// -33943 - Flight Form
class spell_dru_flight_form : public SpellScriptLoader
{
public:
spell_dru_flight_form() : SpellScriptLoader("spell_dru_flight_form") { }
class spell_dru_flight_form_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dru_flight_form_SpellScript);
SpellCastResult CheckCast()
{
Unit* caster = GetCaster();
if (caster->IsInDisallowedMountForm())
return SPELL_FAILED_NOT_SHAPESHIFT;
return SPELL_CAST_OK;
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_dru_flight_form_SpellScript::CheckCast);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_dru_flight_form_SpellScript();
}
};
// 5217 - Tiger's Fury
class spell_dru_tiger_s_fury : public SpellScriptLoader
{
@@ -1289,6 +1320,7 @@ void AddSC_druid_spell_scripts()
new spell_dru_stampede();
new spell_dru_survival_instincts();
new spell_dru_swift_flight_passive();
new spell_dru_flight_form();
new spell_dru_tiger_s_fury();
new spell_dru_typhoon();
new spell_dru_t10_restoration_4p_bonus();
+160 -3
View File
@@ -29,6 +29,7 @@
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
#include "Vehicle.h"
// 45102 Romantic Picnic
enum SpellsPicnic
@@ -410,6 +411,84 @@ class spell_pilgrims_bounty_buff_food : public SpellScriptLoader
}
};
enum FeastOnSpells
{
FEAST_ON_TURKEY = 61784,
FEAST_ON_CRANBERRIES = 61785,
FEAST_ON_SWEET_POTATOES = 61786,
FEAST_ON_PIE = 61787,
FEAST_ON_STUFFING = 61788,
SPELL_CRANBERRY_HELPINS = 61841,
SPELL_TURKEY_HELPINS = 61842,
SPELL_STUFFING_HELPINS = 61843,
SPELL_SWEET_POTATO_HELPINS = 61844,
SPELL_PIE_HELPINS = 61845,
SPELL_ON_PLATE_EAT_VISUAL = 61826
};
class spell_pilgrims_bounty_feast_on : public SpellScriptLoader
{
public:
spell_pilgrims_bounty_feast_on() : SpellScriptLoader("spell_pilgrims_bounty_feast_on") { }
class spell_pilgrims_bounty_feast_on_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pilgrims_bounty_feast_on_SpellScript);
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
uint32 _spellId = 0;
switch (GetSpellInfo()->Id)
{
case FEAST_ON_TURKEY:
_spellId = SPELL_TURKEY_HELPINS;
break;
case FEAST_ON_CRANBERRIES:
_spellId = SPELL_CRANBERRY_HELPINS;
break;
case FEAST_ON_SWEET_POTATOES:
_spellId = SPELL_SWEET_POTATO_HELPINS;
break;
case FEAST_ON_PIE:
_spellId = SPELL_PIE_HELPINS;
break;
case FEAST_ON_STUFFING:
_spellId = SPELL_STUFFING_HELPINS;
break;
default:
return;
}
if (Vehicle* vehicle = caster->GetVehicleKit())
if (Unit* target = vehicle->GetPassenger(0))
if (Player* player = target->ToPlayer())
{
player->CastSpell(player, SPELL_ON_PLATE_EAT_VISUAL, true);
caster->CastSpell(player, _spellId, true, NULL, NULL, player->GetGUID());
}
if (Aura* aura = caster->GetAura(GetEffectValue()))
{
if (aura->GetStackAmount() == 1)
caster->RemoveAurasDueToSpell(aura->GetSpellInfo()->Effects[EFFECT_0].CalcValue());
aura->ModStackAmount(-1);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_feast_on_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_pilgrims_bounty_feast_on_SpellScript();
}
};
enum TheTurkinator
{
SPELL_KILL_COUNTER_VISUAL = 62015,
@@ -429,7 +508,7 @@ class spell_pilgrims_bounty_turkey_tracker : public SpellScriptLoader
{
PrepareSpellScript(spell_pilgrims_bounty_turkey_tracker_SpellScript);
bool Validate(SpellInfo const* /*spell*/)
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_KILL_COUNTER_VISUAL) || !sSpellMgr->GetSpellInfo(SPELL_KILL_COUNTER_VISUAL_MAX))
return false;
@@ -472,18 +551,90 @@ class spell_pilgrims_bounty_turkey_tracker : public SpellScriptLoader
}
}
void Register()
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_turkey_tracker_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
SpellScript* GetSpellScript() const override
{
return new spell_pilgrims_bounty_turkey_tracker_SpellScript();
}
};
enum SpiritOfSharing
{
SPELL_THE_SPIRIT_OF_SHARING = 61849
};
class spell_pilgrims_bounty_well_fed : public SpellScriptLoader
{
private:
uint32 _triggeredSpellId;
public:
spell_pilgrims_bounty_well_fed(const char* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { }
class spell_pilgrims_bounty_well_fed_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pilgrims_bounty_well_fed_SpellScript);
private:
uint32 _triggeredSpellId;
public:
spell_pilgrims_bounty_well_fed_SpellScript(uint32 triggeredSpellId) : SpellScript(), _triggeredSpellId(triggeredSpellId) { }
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(_triggeredSpellId))
return false;
return true;
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Player* target = GetHitPlayer();
if (!target)
return;
if (Aura const* aura = target->GetAura(GetSpellInfo()->Id))
{
if (aura->GetStackAmount() == 5)
target->CastSpell(target, _triggeredSpellId, true);
}
Aura const* turkey = target->GetAura(SPELL_TURKEY_HELPINS);
Aura const* cranberies = target->GetAura(SPELL_CRANBERRY_HELPINS);
Aura const* stuffing = target->GetAura(SPELL_STUFFING_HELPINS);
Aura const* sweetPotatoes = target->GetAura(SPELL_SWEET_POTATO_HELPINS);
Aura const* pie = target->GetAura(SPELL_PIE_HELPINS);
if ((turkey && turkey->GetStackAmount() == 5) && (cranberies && cranberies->GetStackAmount() == 5) && (stuffing && stuffing->GetStackAmount() == 5)
&& (sweetPotatoes && sweetPotatoes->GetStackAmount() == 5) && (pie && pie->GetStackAmount() == 5))
{
target->CastSpell(target, SPELL_THE_SPIRIT_OF_SHARING, true);
target->RemoveAurasDueToSpell(SPELL_TURKEY_HELPINS);
target->RemoveAurasDueToSpell(SPELL_CRANBERRY_HELPINS);
target->RemoveAurasDueToSpell(SPELL_STUFFING_HELPINS);
target->RemoveAurasDueToSpell(SPELL_SWEET_POTATO_HELPINS);
target->RemoveAurasDueToSpell(SPELL_PIE_HELPINS);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_well_fed_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_pilgrims_bounty_well_fed_SpellScript(_triggeredSpellId);
}
};
enum Mistletoe
{
SPELL_CREATE_MISTLETOE = 26206,
@@ -1047,6 +1198,12 @@ void AddSC_holiday_spell_scripts()
new spell_pilgrims_bounty_buff_food("spell_gen_spice_bread_stuffing", SPELL_WELL_FED_HIT_TRIGGER);
new spell_pilgrims_bounty_buff_food("spell_gen_pumpkin_pie", SPELL_WELL_FED_SPIRIT_TRIGGER);
new spell_pilgrims_bounty_buff_food("spell_gen_candied_sweet_potato", SPELL_WELL_FED_HASTE_TRIGGER);
new spell_pilgrims_bounty_feast_on();
new spell_pilgrims_bounty_well_fed("spell_pilgrims_bounty_well_fed_turkey", SPELL_WELL_FED_AP_TRIGGER);
new spell_pilgrims_bounty_well_fed("spell_pilgrims_bounty_well_fed_cranberry", SPELL_WELL_FED_ZM_TRIGGER);
new spell_pilgrims_bounty_well_fed("spell_pilgrims_bounty_well_fed_stuffing", SPELL_WELL_FED_HIT_TRIGGER);
new spell_pilgrims_bounty_well_fed("spell_pilgrims_bounty_well_fed_sweet_potatoes", SPELL_WELL_FED_HASTE_TRIGGER);
new spell_pilgrims_bounty_well_fed("spell_pilgrims_bounty_well_fed_pie", SPELL_WELL_FED_SPIRIT_TRIGGER);
new spell_pilgrims_bounty_turkey_tracker();
// Winter Veil
new spell_winter_veil_mistletoe();
+39
View File
@@ -29,6 +29,7 @@
#include "SpellAuraEffects.h"
#include "SkillDiscovery.h"
#include "Battleground.h"
#include "DBCStores.h"
// Generic script for handling item dummy effects which trigger another spell.
class spell_item_trigger_spell : public SpellScriptLoader
@@ -2585,6 +2586,43 @@ public:
}
};
class spell_item_toy_train_set_pulse : public SpellScriptLoader
{
public:
spell_item_toy_train_set_pulse() : SpellScriptLoader("spell_item_toy_train_set_pulse") { }
class spell_item_toy_train_set_pulse_SpellScript : public SpellScript
{
PrepareSpellScript(spell_item_toy_train_set_pulse_SpellScript);
void HandleDummy(SpellEffIndex /*index*/)
{
if (Player* target = GetHitUnit()->ToPlayer())
{
target->HandleEmoteCommand(EMOTE_ONESHOT_TRAIN);
if (EmotesTextSoundEntry const* soundEntry = FindTextSoundEmoteFor(TEXT_EMOTE_TRAIN, target->getRace(), target->getGender()))
target->PlayDistanceSound(soundEntry->SoundId);
}
}
void HandleTargets(std::list<WorldObject*>& targetList)
{
targetList.remove_if([](WorldObject const* obj) { return obj->GetTypeId() != TYPEID_PLAYER; });
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_item_toy_train_set_pulse_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_item_toy_train_set_pulse_SpellScript::HandleTargets, EFFECT_ALL, TARGET_UNIT_SRC_AREA_ALLY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_item_toy_train_set_pulse_SpellScript();
}
};
void AddSC_item_spell_scripts()
{
// 23074 Arcanite Dragonling
@@ -2652,4 +2690,5 @@ void AddSC_item_spell_scripts()
new spell_item_chicken_cover();
new spell_item_muisek_vessel();
new spell_item_greatmothers_soulcatcher();
new spell_item_toy_train_set_pulse();
}
+31 -12
View File
@@ -34,9 +34,8 @@ class DuelResetScript : public PlayerScript
player1->GetSpellHistory()->SaveCooldownStateBeforeDuel();
player2->GetSpellHistory()->SaveCooldownStateBeforeDuel();
ResetSpellCooldowns(player1);
ResetSpellCooldowns(player2);
ResetSpellCooldowns(player1, true);
ResetSpellCooldowns(player2, true);
}
// Health and mana reset
@@ -73,9 +72,8 @@ class DuelResetScript : public PlayerScript
// Cooldown restore
if (sWorld->getBoolConfig(CONFIG_RESET_DUEL_COOLDOWNS))
{
ResetSpellCooldowns(winner);
ResetSpellCooldowns(loser);
ResetSpellCooldowns(winner, false);
ResetSpellCooldowns(loser, false);
winner->GetSpellHistory()->RestoreCooldownStateAfterDuel();
loser->GetSpellHistory()->RestoreCooldownStateAfterDuel();
@@ -98,14 +96,35 @@ class DuelResetScript : public PlayerScript
}
}
static void ResetSpellCooldowns(Player* player)
static void ResetSpellCooldowns(Player* player, bool onStartDuel)
{
// remove cooldowns on spells that have < 10 min CD and has no onHold
player->GetSpellHistory()->ResetCooldowns([](SpellHistory::CooldownStorageType::iterator itr) -> bool
if (onStartDuel)
{
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first);
return spellInfo->RecoveryTime < 10 * MINUTE * IN_MILLISECONDS && spellInfo->CategoryRecoveryTime < 10 * MINUTE * IN_MILLISECONDS && !itr->second.OnHold;
}, true);
// remove cooldowns on spells that have < 10 min CD > 30 sec and has no onHold
player->GetSpellHistory()->ResetCooldowns([](SpellHistory::CooldownStorageType::iterator itr) -> bool
{
SpellHistory::Clock::time_point now = SpellHistory::Clock::now();
uint32 cooldownDuration = itr->second.CooldownEnd > now ? std::chrono::duration_cast<std::chrono::milliseconds>(itr->second.CooldownEnd - now).count() : 0;
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first);
return spellInfo->RecoveryTime < 10 * MINUTE * IN_MILLISECONDS
&& spellInfo->CategoryRecoveryTime < 10 * MINUTE * IN_MILLISECONDS
&& !itr->second.OnHold
&& cooldownDuration > 0
&& ( spellInfo->RecoveryTime - cooldownDuration ) > (MINUTE / 2) * IN_MILLISECONDS
&& ( spellInfo->CategoryRecoveryTime - cooldownDuration ) > (MINUTE / 2) * IN_MILLISECONDS;
}, true);
}
else
{
// remove cooldowns on spells that have < 10 min CD and has no onHold
player->GetSpellHistory()->ResetCooldowns([](SpellHistory::CooldownStorageType::iterator itr) -> bool
{
SpellInfo const* spellInfo = sSpellMgr->EnsureSpellInfo(itr->first);
return spellInfo->RecoveryTime < 10 * MINUTE * IN_MILLISECONDS
&& spellInfo->CategoryRecoveryTime < 10 * MINUTE * IN_MILLISECONDS
&& !itr->second.OnHold;
}, true);
}
// pet cooldowns
if (Pet* pet = player->GetPet())
+44
View File
@@ -41,6 +41,7 @@ go_tadpole_cage
go_amberpine_outhouse
go_hive_pod
go_veil_skith_cage
go_toy_train_set
EndContentData */
#include "ScriptMgr.h"
@@ -1125,6 +1126,48 @@ public:
}
};
enum ToyTrainSpells
{
SPELL_TOY_TRAIN_PULSE = 61551,
};
class go_toy_train_set : public GameObjectScript
{
public:
go_toy_train_set() : GameObjectScript("go_toy_train_set") { }
struct go_toy_train_setAI : public GameObjectAI
{
go_toy_train_setAI(GameObject* go) : GameObjectAI(go), _pulseTimer(3 * IN_MILLISECONDS) { }
void UpdateAI(uint32 diff) override
{
if (diff < _pulseTimer)
_pulseTimer -= diff;
else
{
go->CastSpell(nullptr, SPELL_TOY_TRAIN_PULSE, true);
_pulseTimer = 6 * IN_MILLISECONDS;
}
}
// triggered on wrecker'd
void DoAction(int32 /*action*/) override
{
go->Delete();
}
private:
uint32 _pulseTimer;
};
GameObjectAI* GetAI(GameObject* go) const override
{
return new go_toy_train_setAI(go);
}
};
void AddSC_go_scripts()
{
new go_cat_figurine();
@@ -1160,4 +1203,5 @@ void AddSC_go_scripts()
new go_veil_skith_cage();
new go_frostblade_shrine();
new go_midsummer_bonfire();
new go_toy_train_set();
}
+100 -6
View File
@@ -18,27 +18,26 @@
/* ScriptData
SDName: Npc_Professions
SD%Complete: 80
SDComment: Provides learn/unlearn/relearn-options for professions. Not supported: Unlearn engineering, re-learn engineering, re-learn leatherworking.
SDCategory: NPCs
SD%Complete: 100
SDComment: Provides learn/unlearn/relearn-options for professions.
SDCategory: NPCs/GOBs
EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedGossip.h"
#include "GameObjectAI.h"
#include "Player.h"
#include "SpellInfo.h"
#include "WorldSession.h"
/*
A few notes for future developement:
- A full implementation of gossip for GO's is required. They must have the same scripting capabilities as creatures. Basically,
there is no difference here (except that default text is chosen with `gameobject_template`.`data3` (for GO type2, different dataN for a few others)
- It's possible blacksmithing still require some tweaks and adjustments due to the way we _have_ to use reputation.
*/
/*###
# to be removed from here (->ncp_text). This is data for database projects.
# to be removed from here (->npc_text). This is data for database projects.
###*/
#define TALK_MUST_UNLEARN_WEAPON "You must forget your weapon type specialty before I can help you. Go to Everlook in Winterspring and seek help there."
@@ -153,6 +152,9 @@ enum ProfessionSpells
S_LEARN_GOBLIN = 20221,
S_LEARN_GNOMISH = 20220,
S_UNLEARN_GOBLIN = 68334,
S_UNLEARN_GNOMISH = 68333,
S_SPELLFIRE = 26797,
S_MOONCLOTH = 26798,
S_SHADOWEAVE = 26801,
@@ -376,6 +378,27 @@ void ProfessionUnlearnSpells(Player* player, uint32 type)
player->RemoveSpell(36075); // Wildfeather Leggings
player->RemoveSpell(36078); // Living Crystal Breastplate
break;
case S_UNLEARN_GOBLIN: // S_UNLEARN_GOBLIN
player->RemoveSpell(30565); // Foreman's Enchanted Helmet
player->RemoveSpell(30566); // Foreman's Reinforced Helmet
player->RemoveSpell(30563); // Goblin Rocket Launcher
player->RemoveSpell(56514); // Global Thermal Sapper Charge
player->RemoveSpell(36954); // Dimensional Ripper - Area 52
player->RemoveSpell(23486); // Dimensional Ripper - Everlook
player->RemoveSpell(23078); // Goblin Jumper Cables XL
player->RemoveSpell(72952); // Shatter Rounds
break;
case S_UNLEARN_GNOMISH: // S_UNLEARN_GNOMISH
player->RemoveSpell(30575); // Gnomish Battle Goggles
player->RemoveSpell(30574); // Gnomish Power Goggles
player->RemoveSpell(56473); // Gnomish X-Ray Specs
player->RemoveSpell(30569); // Gnomish Poultryizer
player->RemoveSpell(30563); // Ultrasafe Transporter - Toshley's Station
player->RemoveSpell(23489); // Ultrasafe Transporter - Gadgetzan
player->RemoveSpell(23129); // World Enlarger
player->RemoveSpell(23096); // Gnomish Alarm-o-Bot
player->RemoveSpell(72953); // Iceblade Arrow
break;
case S_UNLEARN_SPELLFIRE: // S_UNLEARN_SPELLFIRE
player->RemoveSpell(26752); // Spellfire Belt
player->RemoveSpell(26753); // Spellfire Gloves
@@ -923,6 +946,76 @@ public:
}
};
// Object ID - 177226
// Book "Soothsaying for dummies"
enum SoothsayingForDummies
{
GOSSIP_ID = 7058,
// Engineering
OPTION_UNLEARN_GNOMISH = 0,
OPTION_UNLEARN_GOBLIN = 1,
OPTION_LEARN_GNOMISH = 2,
OPTION_LEARN_GOBLIN = 3,
// Leatherworking
OPTION_LEARN_DRAGONSCALE = 4,
OPTION_LEARN_ELEMENTAL = 5,
OPTION_LEARN_TRIBAL = 6
};
class go_soothsaying_for_dummies : public GameObjectScript
{
public:
go_soothsaying_for_dummies() : GameObjectScript("go_soothsaying_for_dummies") { }
struct go_soothsaying_for_dummiesAI : public GameObjectAI
{
go_soothsaying_for_dummiesAI(GameObject* go) : GameObjectAI(go) { }
bool GossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
{
if (menuId != GOSSIP_ID)
return false;
switch (gossipListId)
{
case OPTION_UNLEARN_GNOMISH:
ProcessUnlearnAction(player, nullptr, S_UNLEARN_GNOMISH, 0, 0); // cost is handled by gossip code
break;
case OPTION_UNLEARN_GOBLIN:
ProcessUnlearnAction(player, nullptr, S_UNLEARN_GOBLIN, 0, 0);
break;
case OPTION_LEARN_GNOMISH:
player->CastSpell(player, S_LEARN_GNOMISH, true);
break;
case OPTION_LEARN_GOBLIN:
player->CastSpell(player, S_LEARN_GOBLIN, true);
break;
case OPTION_LEARN_DRAGONSCALE:
player->CastSpell(player, S_LEARN_DRAGON, true);
break;
case OPTION_LEARN_ELEMENTAL:
player->CastSpell(player, S_LEARN_ELEMENTAL, true);
break;
case OPTION_LEARN_TRIBAL:
player->CastSpell(player, S_LEARN_TRIBAL, true);
break;
default:
return false;
}
player->CLOSE_GOSSIP_MENU();
return true; // prevent further processing
}
};
GameObjectAI* GetAI(GameObject* go) const override
{
return new go_soothsaying_for_dummiesAI(go);
}
};
/*###
# start menues leatherworking
###*/
@@ -1212,6 +1305,7 @@ void AddSC_npc_professions()
new npc_prof_alchemy();
new npc_prof_blacksmith();
new npc_engineering_tele_trinket();
new go_soothsaying_for_dummies();
new npc_prof_leather();
new npc_prof_tailor();
}
+188 -2
View File
@@ -38,6 +38,7 @@ npc_snake_trap_serpents 80% AI for snakes that summoned by Snake Trap
npc_shadowfiend 100% restore 5% of owner's mana when shadowfiend die from damage
npc_locksmith 75% list of keys needs to be confirmed
npc_firework 100% NPC's summoned by rockets and rocket clusters, for making them cast visual
npc_train_wrecker 100% Wind-Up Train Wrecker that kills train set
EndContentData */
#include "ScriptMgr.h"
@@ -512,6 +513,67 @@ public:
}
};
/*######
## npc_torch_tossing_target_bunny_controller
######*/
enum TorchTossingTarget
{
NPC_TORCH_TOSSING_TARGET_BUNNY = 25535,
SPELL_TARGET_INDICATOR = 45723
};
class npc_torch_tossing_target_bunny_controller : public CreatureScript
{
public:
npc_torch_tossing_target_bunny_controller() : CreatureScript("npc_torch_tossing_target_bunny_controller") { }
struct npc_torch_tossing_target_bunny_controllerAI : public ScriptedAI
{
npc_torch_tossing_target_bunny_controllerAI(Creature* creature) : ScriptedAI(creature)
{
_targetTimer = 3000;
}
ObjectGuid DoSearchForTargets(ObjectGuid lastTargetGUID)
{
std::list<Creature*> targets;
me->GetCreatureListWithEntryInGrid(targets, NPC_TORCH_TOSSING_TARGET_BUNNY, 60.0f);
targets.remove_if([lastTargetGUID](Creature* creature) { return creature->GetGUID() == lastTargetGUID; });
if (!targets.empty())
{
_lastTargetGUID = Trinity::Containers::SelectRandomContainerElement(targets)->GetGUID();
return _lastTargetGUID;
}
return ObjectGuid::Empty;
}
void UpdateAI(uint32 diff) override
{
if (_targetTimer < diff)
{
if (Unit* target = ObjectAccessor::GetUnit(*me, DoSearchForTargets(_lastTargetGUID)))
target->CastSpell(target, SPELL_TARGET_INDICATOR, true);
_targetTimer = 3000;
}
else
_targetTimer -= diff;
}
private:
uint32 _targetTimer;
ObjectGuid _lastTargetGUID;
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_torch_tossing_target_bunny_controllerAI(creature);
}
};
/*######
## Triage quest
######*/
@@ -1416,7 +1478,6 @@ public:
void Reset() override
{
me->SetControlled(true, UNIT_STATE_STUNNED);//disable rotate
me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);//imune to knock aways like blast wave
_events.Reset();
_damageTimes.clear();
@@ -2124,7 +2185,7 @@ public:
// Check if we are near Elune'ara lake south, if so try to summon Omen or a minion
if (me->GetZoneId() == ZONE_MOONGLADE)
{
if (!me->FindNearestCreature(NPC_OMEN, 100.0f, false) && me->GetDistance2d(omenSummonPos.GetPositionX(), omenSummonPos.GetPositionY()) <= 100.0f)
if (!me->FindNearestCreature(NPC_OMEN, 100.0f) && me->GetDistance2d(omenSummonPos.GetPositionX(), omenSummonPos.GetPositionY()) <= 100.0f)
{
switch (urand(0, 9))
{
@@ -2381,12 +2442,136 @@ class npc_stable_master : public CreatureScript
}
};
enum TrainWrecker
{
GO_TOY_TRAIN = 193963,
SPELL_TOY_TRAIN_PULSE = 61551,
SPELL_WRECK_TRAIN = 62943,
ACTION_WRECKED = 1,
EVENT_DO_JUMP = 1,
EVENT_DO_FACING = 2,
EVENT_DO_WRECK = 3,
EVENT_DO_DANCE = 4,
MOVEID_CHASE = 1,
MOVEID_JUMP = 2
};
class npc_train_wrecker : public CreatureScript
{
public:
npc_train_wrecker() : CreatureScript("npc_train_wrecker") { }
struct npc_train_wreckerAI : public NullCreatureAI
{
npc_train_wreckerAI(Creature* creature) : NullCreatureAI(creature), _isSearching(true), _nextAction(0), _timer(1 * IN_MILLISECONDS) { }
GameObject* VerifyTarget() const
{
if (GameObject* target = ObjectAccessor::GetGameObject(*me, _target))
return target;
me->HandleEmoteCommand(EMOTE_ONESHOT_RUDE);
me->DespawnOrUnsummon(3 * IN_MILLISECONDS);
return nullptr;
}
void UpdateAI(uint32 diff) override
{
if (_isSearching)
{
if (diff < _timer)
_timer -= diff;
else
{
if (GameObject* target = me->FindNearestGameObject(GO_TOY_TRAIN, 15.0f))
{
_isSearching = false;
_target = target->GetGUID();
me->SetWalk(true);
me->GetMotionMaster()->MovePoint(MOVEID_CHASE, target->GetNearPosition(3.0f, target->GetAngle(me)));
}
else
_timer = 3 * IN_MILLISECONDS;
}
}
else
{
switch (_nextAction)
{
case EVENT_DO_JUMP:
if (GameObject* target = VerifyTarget())
me->GetMotionMaster()->MoveJump(*target, 5.0, 10.0, MOVEID_JUMP);
_nextAction = 0;
break;
case EVENT_DO_FACING:
if (GameObject* target = VerifyTarget())
{
me->SetFacingTo(target->GetOrientation());
me->HandleEmoteCommand(EMOTE_ONESHOT_ATTACK1H);
_timer = 1.5 * IN_MILLISECONDS;
_nextAction = EVENT_DO_WRECK;
}
else
_nextAction = 0;
break;
case EVENT_DO_WRECK:
if (diff < _timer)
{
_timer -= diff;
break;
}
if (GameObject* target = VerifyTarget())
{
me->CastSpell(target, SPELL_WRECK_TRAIN, false);
target->AI()->DoAction(ACTION_WRECKED);
_timer = 2 * IN_MILLISECONDS;
_nextAction = EVENT_DO_DANCE;
}
else
_nextAction = 0;
break;
case EVENT_DO_DANCE:
if (diff < _timer)
{
_timer -= diff;
break;
}
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_DANCE);
me->DespawnOrUnsummon(5 * IN_MILLISECONDS);
_nextAction = 0;
break;
default:
break;
}
}
}
void MovementInform(uint32 /*type*/, uint32 id) override
{
if (id == MOVEID_CHASE)
_nextAction = EVENT_DO_JUMP;
else if (id == MOVEID_JUMP)
_nextAction = EVENT_DO_FACING;
}
private:
bool _isSearching;
uint8 _nextAction;
uint32 _timer;
ObjectGuid _target;
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_train_wreckerAI(creature);
}
};
void AddSC_npcs_special()
{
new npc_air_force_bots();
new npc_lunaclaw_spirit();
new npc_chicken_cluck();
new npc_dancing_flames();
new npc_torch_tossing_target_bunny_controller();
new npc_doctor();
new npc_injured_patient();
new npc_garments_of_quests();
@@ -2404,4 +2589,5 @@ void AddSC_npcs_special()
new npc_spring_rabbit();
new npc_imp_in_a_ball();
new npc_stable_master();
new npc_train_wrecker();
}