Merge branch 'master' into 4.3.4 [NOTE: There are parts of code marked as "REVIEW - MERGE" That needs some review)
Conflicts: src/server/game/DataStores/DBCStores.cpp src/server/game/DataStores/DBCStores.h src/server/game/DataStores/DBCfmt.h src/server/game/Entities/Unit/Unit.cpp src/server/game/Entities/Unit/Unit.h src/server/game/Handlers/AuctionHouseHandler.cpp src/server/game/Handlers/GroupHandler.cpp src/server/game/Movement/Spline/MovementTypedefs.h src/server/game/Spells/Auras/SpellAuraEffects.cpp src/server/game/Spells/SpellInfo.cpp src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp src/server/scripts/Spells/spell_generic.cpp
This commit is contained in:
commit
1b6fb2b695
211 files changed
+16815
-7664
No files matched your search
@@ -42,13 +42,19 @@ public:
|
||||
{ "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "", NULL },
|
||||
{ NULL, SEC_PLAYER, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand accountLockCommandTable[] =
|
||||
{
|
||||
{ "country", SEC_PLAYER, true, &HandleAccountLockCountryCommand, "", NULL },
|
||||
{ "ip", SEC_PLAYER, true, &HandleAccountLockIpCommand, "", NULL },
|
||||
{ NULL, SEC_PLAYER, false, NULL, "", NULL },
|
||||
};
|
||||
static ChatCommand accountCommandTable[] =
|
||||
{
|
||||
{ "addon", SEC_MODERATOR, false, &HandleAccountAddonCommand, "", NULL },
|
||||
{ "create", SEC_CONSOLE, true, &HandleAccountCreateCommand, "", NULL },
|
||||
{ "delete", SEC_CONSOLE, true, &HandleAccountDeleteCommand, "", NULL },
|
||||
{ "onlinelist", SEC_CONSOLE, true, &HandleAccountOnlineListCommand, "", NULL },
|
||||
{ "lock", SEC_PLAYER, false, &HandleAccountLockCommand, "", NULL },
|
||||
{ "lock", SEC_PLAYER, false, NULL, "", accountLockCommandTable },
|
||||
{ "set", SEC_ADMINISTRATOR, true, NULL, "", accountSetCommandTable },
|
||||
{ "password", SEC_PLAYER, false, &HandleAccountPasswordCommand, "", NULL },
|
||||
{ "", SEC_PLAYER, false, &HandleAccountCommand, "", NULL },
|
||||
@@ -245,7 +251,57 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleAccountLockCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleAccountLockCountryCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
{
|
||||
handler->SendSysMessage(LANG_USE_BOL);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
std::string param = (char*)args;
|
||||
|
||||
if (!param.empty())
|
||||
{
|
||||
if (param == "on")
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY);
|
||||
uint32 ip = inet_addr(handler->GetSession()->GetRemoteAddress().c_str());
|
||||
EndianConvertReverse(ip);
|
||||
stmt->setUInt32(0, ip);
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
std::string country = fields[0].GetString();
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY);
|
||||
stmt->setString(0, country);
|
||||
stmt->setUInt32(1, handler->GetSession()->GetAccountId());
|
||||
LoginDatabase.Execute(stmt);
|
||||
handler->PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED);
|
||||
}
|
||||
else
|
||||
{
|
||||
handler->PSendSysMessage("[IP2NATION] Table empty");
|
||||
sLog->outDebug(LOG_FILTER_AUTHSERVER, "[IP2NATION] Table empty");
|
||||
}
|
||||
}
|
||||
else if (param == "off")
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY);
|
||||
stmt->setString(0, "00");
|
||||
stmt->setUInt32(1, handler->GetSession()->GetAccountId());
|
||||
LoginDatabase.Execute(stmt);
|
||||
handler->PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
handler->SendSysMessage(LANG_USE_BOL);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool HandleAccountLockIpCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
{
|
||||
|
||||
@@ -308,28 +308,121 @@ public:
|
||||
if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName))
|
||||
return false;
|
||||
|
||||
if (target)
|
||||
{
|
||||
// check online security
|
||||
if (handler->HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
char const* newNameStr = strtok(NULL, " ");
|
||||
|
||||
handler->PSendSysMessage(LANG_RENAME_PLAYER, handler->GetNameLink(target).c_str());
|
||||
target->SetAtLoginFlag(AT_LOGIN_RENAME);
|
||||
if (newNameStr)
|
||||
{
|
||||
std::string playerOldName;
|
||||
std::string newName = newNameStr;
|
||||
|
||||
if (target)
|
||||
{
|
||||
// check online security
|
||||
if (handler->HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
playerOldName = target->GetName();
|
||||
}
|
||||
else
|
||||
{
|
||||
// check offline security
|
||||
if (handler->HasLowerSecurity(NULL, targetGuid))
|
||||
return false;
|
||||
|
||||
sObjectMgr->GetPlayerNameByGUID(targetGuid, playerOldName);
|
||||
}
|
||||
|
||||
if (!normalizePlayerName(newName))
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ObjectMgr::CheckPlayerName(newName, true) != CHAR_NAME_SUCCESS)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (WorldSession* session = handler->GetSession())
|
||||
{
|
||||
if (!session->HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RESERVEDNAME) && sObjectMgr->IsReservedName(newName))
|
||||
{
|
||||
handler->SendSysMessage(LANG_RESERVED_NAME);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHECK_NAME);
|
||||
stmt->setString(0, newName);
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
if (result)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_RENAME_PLAYER_ALREADY_EXISTS, newName.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Remove declined name from db
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME);
|
||||
stmt->setUInt32(0, targetGuid);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
if (target)
|
||||
{
|
||||
target->SetName(newName);
|
||||
|
||||
if (WorldSession* session = target->GetSession())
|
||||
session->KickPlayer();
|
||||
}
|
||||
else
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_NAME_BY_GUID);
|
||||
stmt->setString(0, newName);
|
||||
stmt->setUInt32(1, GUID_LOPART(targetGuid));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
sWorld->UpdateCharacterNameData(targetGuid, newName);
|
||||
|
||||
handler->PSendSysMessage(LANG_RENAME_PLAYER_WITH_NEW_NAME, playerOldName.c_str(), newName.c_str());
|
||||
|
||||
if (WorldSession* session = handler->GetSession())
|
||||
{
|
||||
if (Player* player = session->GetPlayer())
|
||||
sLog->outCommand(session->GetAccountId(), "GM %s (Account: %u) forced rename %s to player %s (Account: %u)", player->GetName().c_str(), session->GetAccountId(), newName.c_str(), playerOldName.c_str(), sObjectMgr->GetPlayerAccountIdByGUID(targetGuid));
|
||||
}
|
||||
else
|
||||
sLog->outCommand(0, "CONSOLE forced rename '%s' to '%s' (GUID: %u)", playerOldName.c_str(), newName.c_str(), GUID_LOPART(targetGuid));
|
||||
}
|
||||
else
|
||||
{
|
||||
// check offline security
|
||||
if (handler->HasLowerSecurity(NULL, targetGuid))
|
||||
return false;
|
||||
if (target)
|
||||
{
|
||||
// check online security
|
||||
if (handler->HasLowerSecurity(target, 0))
|
||||
return false;
|
||||
|
||||
std::string oldNameLink = handler->playerLink(targetName);
|
||||
handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
|
||||
handler->PSendSysMessage(LANG_RENAME_PLAYER, handler->GetNameLink(target).c_str());
|
||||
target->SetAtLoginFlag(AT_LOGIN_RENAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
// check offline security
|
||||
if (handler->HasLowerSecurity(NULL, targetGuid))
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
|
||||
stmt->setUInt32(1, GUID_LOPART(targetGuid));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
std::string oldNameLink = handler->playerLink(targetName);
|
||||
handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid));
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt->setUInt16(0, uint16(AT_LOGIN_RENAME));
|
||||
stmt->setUInt32(1, GUID_LOPART(targetGuid));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -592,7 +592,8 @@ public:
|
||||
entry = object->GetEntry();
|
||||
else
|
||||
entry = atoi((char*)args);
|
||||
}
|
||||
} else
|
||||
entry = atoi((char*)args);
|
||||
|
||||
GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(entry);
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
{ "invite", SEC_GAMEMASTER, true, &HandleGuildInviteCommand, "", NULL },
|
||||
{ "uninvite", SEC_GAMEMASTER, true, &HandleGuildUninviteCommand, "", NULL },
|
||||
{ "rank", SEC_GAMEMASTER, true, &HandleGuildRankCommand, "", NULL },
|
||||
{ "rename", SEC_GAMEMASTER, true, &HandleGuildRenameCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand commandTable[] =
|
||||
@@ -193,6 +194,55 @@ public:
|
||||
uint8 newRank = uint8(atoi(rankStr));
|
||||
return targetGuild->ChangeMemberRank(targetGuid, newRank);
|
||||
}
|
||||
|
||||
static bool HandleGuildRenameCommand(ChatHandler* handler, char const* _args)
|
||||
{
|
||||
if (!*_args)
|
||||
return false;
|
||||
|
||||
char *args = (char *)_args;
|
||||
|
||||
char const* oldGuildStr = handler->extractQuotedArg(args);
|
||||
if (!oldGuildStr)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
char const* newGuildStr = handler->extractQuotedArg(strtok(NULL, ""));
|
||||
if (!newGuildStr)
|
||||
{
|
||||
handler->SendSysMessage(LANG_INSERT_GUILD_NAME);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Guild* guild = sGuildMgr->GetGuildByName(oldGuildStr);
|
||||
if (!guild)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, oldGuildStr);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sGuildMgr->GetGuildByName(newGuildStr))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_GUILD_RENAME_ALREADY_EXISTS, newGuildStr);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!guild->SetName(newGuildStr))
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_GUILD_RENAME_DONE, oldGuildStr, newGuildStr);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_guild_commandscript()
|
||||
|
||||
@@ -1586,13 +1586,9 @@ public:
|
||||
EndianConvertReverse(ip);
|
||||
#endif
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY);
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP2NATION_COUNTRY);
|
||||
stmt->setUInt32(0, ip);
|
||||
|
||||
PreparedQueryResult result2 = WorldDatabase.Query(stmt);
|
||||
|
||||
if (result2)
|
||||
if (PreparedQueryResult result2 = LoginDatabase.Query(stmt))
|
||||
{
|
||||
Field* fields2 = result2->Fetch();
|
||||
lastIp.append(" (");
|
||||
|
||||
@@ -95,14 +95,14 @@ public:
|
||||
path.SetUseStraightPath(useStraightPath);
|
||||
bool result = path.CalculatePath(x, y, z);
|
||||
|
||||
PointsArray const& pointPath = path.GetPath();
|
||||
Movement::PointsArray const& pointPath = path.GetPath();
|
||||
handler->PSendSysMessage("%s's path to %s:", target->GetName().c_str(), player->GetName().c_str());
|
||||
handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : "SmoothPath");
|
||||
handler->PSendSysMessage("Result: %s - Length: "SIZEFMTD" - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType());
|
||||
handler->PSendSysMessage("Result: %s - Length: " SIZEFMTD " - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType());
|
||||
|
||||
Vector3 start = path.GetStartPosition();
|
||||
Vector3 end = path.GetEndPosition();
|
||||
Vector3 actualEnd = path.GetActualEndPosition();
|
||||
G3D::Vector3 const &start = path.GetStartPosition();
|
||||
G3D::Vector3 const &end = path.GetEndPosition();
|
||||
G3D::Vector3 const &actualEnd = path.GetActualEndPosition();
|
||||
|
||||
handler->PSendSysMessage("StartPosition (%.3f, %.3f, %.3f)", start.x, start.y, start.z);
|
||||
handler->PSendSysMessage("EndPosition (%.3f, %.3f, %.3f)", end.x, end.y, end.z);
|
||||
@@ -264,7 +264,7 @@ public:
|
||||
|
||||
if (!creatureList.empty())
|
||||
{
|
||||
handler->PSendSysMessage("Found "SIZEFMTD" Creatures.", creatureList.size());
|
||||
handler->PSendSysMessage("Found " SIZEFMTD " Creatures.", creatureList.size());
|
||||
|
||||
uint32 paths = 0;
|
||||
uint32 uStartTime = getMSTime();
|
||||
|
||||
@@ -235,6 +235,10 @@ public:
|
||||
if (player->IsInWorld())
|
||||
ticket->SendResponse(player->GetSession());
|
||||
|
||||
SQLTransaction trans = SQLTransaction(NULL);
|
||||
ticket->SetCompleted();
|
||||
ticket->SaveToDB(trans);
|
||||
|
||||
sTicketMgr->UpdateLastChange();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -371,7 +371,7 @@ public:
|
||||
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
|
||||
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15);
|
||||
|
||||
sCreatureTextMgr->SendChat(creature, SAY_EVENT_ATTACK, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
|
||||
sCreatureTextMgr->SendChat(creature, SAY_DUEL, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player);
|
||||
|
||||
player->CastSpell(creature, SPELL_DUEL, false);
|
||||
player->CastSpell(player, SPELL_DUEL_FLAG, true);
|
||||
@@ -861,59 +861,82 @@ public:
|
||||
## npc_scarlet_miner_cart
|
||||
####*/
|
||||
|
||||
enum Spells_SM
|
||||
enum ScarletMinerCart
|
||||
{
|
||||
SPELL_CART_CHECK = 54173,
|
||||
SPELL_CART_DRAG = 52465
|
||||
SPELL_CART_CHECK = 54173,
|
||||
SPELL_SUMMON_CART = 52463,
|
||||
SPELL_SUMMON_MINER = 52464,
|
||||
SPELL_CART_DRAG = 52465,
|
||||
|
||||
NPC_MINER = 28841
|
||||
};
|
||||
|
||||
class npc_scarlet_miner_cart : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_scarlet_miner_cart() : CreatureScript("npc_scarlet_miner_cart") { }
|
||||
public:
|
||||
npc_scarlet_miner_cart() : CreatureScript("npc_scarlet_miner_cart") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_scarlet_miner_cartAI(creature);
|
||||
}
|
||||
|
||||
struct npc_scarlet_miner_cartAI : public PassiveAI
|
||||
{
|
||||
npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature), minerGUID(0)
|
||||
struct npc_scarlet_miner_cartAI : public PassiveAI
|
||||
{
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
|
||||
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse.
|
||||
}
|
||||
|
||||
uint64 minerGUID;
|
||||
|
||||
void SetGUID(uint64 guid, int32 /*id*/)
|
||||
{
|
||||
minerGUID = guid;
|
||||
}
|
||||
|
||||
void DoAction(int32 /*param*/)
|
||||
{
|
||||
if (Creature* miner = Unit::GetCreature(*me, minerGUID))
|
||||
npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature), _minerGUID(0), _playerGUID(0)
|
||||
{
|
||||
me->SetWalk(false);
|
||||
|
||||
//Not 100% correct, but movement is smooth. Sometimes miner walks faster
|
||||
//than normal, this speed is fast enough to keep up at those times.
|
||||
me->SetSpeed(MOVE_RUN, 1.25f);
|
||||
|
||||
me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0);
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
|
||||
me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse.
|
||||
}
|
||||
}
|
||||
|
||||
void PassengerBoarded(Unit* /*who*/, int8 /*seatId*/, bool apply)
|
||||
void JustSummoned(Creature* summon)
|
||||
{
|
||||
if (summon->GetEntry() == NPC_MINER)
|
||||
{
|
||||
_minerGUID = summon->GetGUID();
|
||||
summon->AI()->SetGUID(_playerGUID);
|
||||
}
|
||||
}
|
||||
|
||||
void SummonedCreatureDespawn(Creature* summon)
|
||||
{
|
||||
if (summon->GetEntry() == NPC_MINER)
|
||||
_minerGUID = 0;
|
||||
}
|
||||
|
||||
void DoAction(int32 /*param*/)
|
||||
{
|
||||
if (Creature* miner = ObjectAccessor::GetCreature(*me, _minerGUID))
|
||||
{
|
||||
me->SetWalk(false);
|
||||
|
||||
// Not 100% correct, but movement is smooth. Sometimes miner walks faster
|
||||
// than normal, this speed is fast enough to keep up at those times.
|
||||
me->SetSpeed(MOVE_RUN, 1.25f);
|
||||
|
||||
me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply)
|
||||
{
|
||||
if (apply)
|
||||
{
|
||||
_playerGUID = who->GetGUID();
|
||||
me->CastSpell((Unit*)NULL, SPELL_SUMMON_MINER, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_playerGUID = 0;
|
||||
if (Creature* miner = ObjectAccessor::GetCreature(*me, _minerGUID))
|
||||
miner->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
uint64 _minerGUID;
|
||||
uint64 _playerGUID;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
if (!apply)
|
||||
if (Creature* miner = Unit::GetCreature(*me, minerGUID))
|
||||
miner->DisappearAndDie();
|
||||
return new npc_scarlet_miner_cartAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
/*####
|
||||
@@ -928,162 +951,130 @@ enum Says_SM
|
||||
|
||||
class npc_scarlet_miner : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_scarlet_miner() : CreatureScript("npc_scarlet_miner") { }
|
||||
public:
|
||||
npc_scarlet_miner() : CreatureScript("npc_scarlet_miner") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_scarlet_minerAI(creature);
|
||||
}
|
||||
|
||||
struct npc_scarlet_minerAI : public npc_escortAI
|
||||
{
|
||||
npc_scarlet_minerAI(Creature* creature) : npc_escortAI(creature)
|
||||
struct npc_scarlet_minerAI : public npc_escortAI
|
||||
{
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
uint32 IntroTimer;
|
||||
uint32 IntroPhase;
|
||||
uint64 carGUID;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
carGUID = 0;
|
||||
IntroTimer = 0;
|
||||
IntroPhase = 0;
|
||||
}
|
||||
|
||||
void InitWaypoint()
|
||||
{
|
||||
AddWaypoint(1, 2389.03f, -5902.74f, 109.014f, 5000);
|
||||
AddWaypoint(2, 2341.812012f, -5900.484863f, 102.619743f);
|
||||
AddWaypoint(3, 2306.561279f, -5901.738281f, 91.792419f);
|
||||
AddWaypoint(4, 2300.098389f, -5912.618652f, 86.014885f);
|
||||
AddWaypoint(5, 2294.142090f, -5927.274414f, 75.316849f);
|
||||
AddWaypoint(6, 2286.984375f, -5944.955566f, 63.714966f);
|
||||
AddWaypoint(7, 2280.001709f, -5961.186035f, 54.228283f);
|
||||
AddWaypoint(8, 2259.389648f, -5974.197754f, 42.359348f);
|
||||
AddWaypoint(9, 2242.882812f, -5984.642578f, 32.827850f);
|
||||
AddWaypoint(10, 2217.265625f, -6028.959473f, 7.675705f);
|
||||
AddWaypoint(11, 2202.595947f, -6061.325684f, 5.882018f);
|
||||
AddWaypoint(12, 2188.974609f, -6080.866699f, 3.370027f);
|
||||
|
||||
if (urand(0, 1))
|
||||
npc_scarlet_minerAI(Creature* creature) : npc_escortAI(creature)
|
||||
{
|
||||
AddWaypoint(13, 2176.483887f, -6110.407227f, 1.855181f);
|
||||
AddWaypoint(14, 2172.516602f, -6146.752441f, 1.074235f);
|
||||
AddWaypoint(15, 2138.918457f, -6158.920898f, 1.342926f);
|
||||
AddWaypoint(16, 2129.866699f, -6174.107910f, 4.380779f);
|
||||
AddWaypoint(17, 2117.709473f, -6193.830078f, 13.3542f, 10000);
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
else
|
||||
|
||||
uint32 IntroTimer;
|
||||
uint32 IntroPhase;
|
||||
uint64 carGUID;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
AddWaypoint(13, 2184.190186f, -6166.447266f, 0.968877f);
|
||||
AddWaypoint(14, 2234.265625f, -6163.741211f, 0.916021f);
|
||||
AddWaypoint(15, 2268.071777f, -6158.750977f, 1.822252f);
|
||||
AddWaypoint(16, 2270.028320f, -6176.505859f, 6.340538f);
|
||||
AddWaypoint(17, 2271.739014f, -6195.401855f, 13.3542f, 10000);
|
||||
carGUID = 0;
|
||||
IntroTimer = 0;
|
||||
IntroPhase = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void InitCartQuest(Player* who)
|
||||
{
|
||||
carGUID = who->GetVehicleBase()->GetGUID();
|
||||
InitWaypoint();
|
||||
Start(false, false, who->GetGUID());
|
||||
SetDespawnAtFar(false);
|
||||
}
|
||||
|
||||
void WaypointReached(uint32 waypointId)
|
||||
{
|
||||
switch (waypointId)
|
||||
void IsSummonedBy(Unit* summoner)
|
||||
{
|
||||
case 1:
|
||||
if (Unit* car = Unit::GetCreature(*me, carGUID))
|
||||
me->SetFacingToObject(car);
|
||||
Talk(SAY_SCARLET_MINER_0);
|
||||
SetRun(true);
|
||||
IntroTimer = 4000;
|
||||
IntroPhase = 1;
|
||||
break;
|
||||
case 17:
|
||||
if (Unit* car = Unit::GetCreature(*me, carGUID))
|
||||
{
|
||||
me->SetFacingToObject(car);
|
||||
car->Relocate(car->GetPositionX(), car->GetPositionY(), me->GetPositionZ() + 1);
|
||||
car->StopMoving();
|
||||
car->RemoveAura(SPELL_CART_DRAG);
|
||||
}
|
||||
Talk(SAY_SCARLET_MINER_1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
carGUID = summoner->GetGUID();
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
if (IntroPhase)
|
||||
void InitWaypoint()
|
||||
{
|
||||
if (IntroTimer <= diff)
|
||||
AddWaypoint(1, 2389.03f, -5902.74f, 109.014f, 5000);
|
||||
AddWaypoint(2, 2341.812012f, -5900.484863f, 102.619743f);
|
||||
AddWaypoint(3, 2306.561279f, -5901.738281f, 91.792419f);
|
||||
AddWaypoint(4, 2300.098389f, -5912.618652f, 86.014885f);
|
||||
AddWaypoint(5, 2294.142090f, -5927.274414f, 75.316849f);
|
||||
AddWaypoint(6, 2286.984375f, -5944.955566f, 63.714966f);
|
||||
AddWaypoint(7, 2280.001709f, -5961.186035f, 54.228283f);
|
||||
AddWaypoint(8, 2259.389648f, -5974.197754f, 42.359348f);
|
||||
AddWaypoint(9, 2242.882812f, -5984.642578f, 32.827850f);
|
||||
AddWaypoint(10, 2217.265625f, -6028.959473f, 7.675705f);
|
||||
AddWaypoint(11, 2202.595947f, -6061.325684f, 5.882018f);
|
||||
AddWaypoint(12, 2188.974609f, -6080.866699f, 3.370027f);
|
||||
|
||||
if (urand(0, 1))
|
||||
{
|
||||
if (IntroPhase == 1)
|
||||
AddWaypoint(13, 2176.483887f, -6110.407227f, 1.855181f);
|
||||
AddWaypoint(14, 2172.516602f, -6146.752441f, 1.074235f);
|
||||
AddWaypoint(15, 2138.918457f, -6158.920898f, 1.342926f);
|
||||
AddWaypoint(16, 2129.866699f, -6174.107910f, 4.380779f);
|
||||
AddWaypoint(17, 2117.709473f, -6193.830078f, 13.3542f, 10000);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddWaypoint(13, 2184.190186f, -6166.447266f, 0.968877f);
|
||||
AddWaypoint(14, 2234.265625f, -6163.741211f, 0.916021f);
|
||||
AddWaypoint(15, 2268.071777f, -6158.750977f, 1.822252f);
|
||||
AddWaypoint(16, 2270.028320f, -6176.505859f, 6.340538f);
|
||||
AddWaypoint(17, 2271.739014f, -6195.401855f, 13.3542f, 10000);
|
||||
}
|
||||
}
|
||||
|
||||
void SetGUID(uint64 guid, int32 /*id = 0*/)
|
||||
{
|
||||
InitWaypoint();
|
||||
Start(false, false, guid);
|
||||
SetDespawnAtFar(false);
|
||||
}
|
||||
|
||||
void WaypointReached(uint32 waypointId)
|
||||
{
|
||||
switch (waypointId)
|
||||
{
|
||||
case 1:
|
||||
if (Unit* car = ObjectAccessor::GetCreature(*me, carGUID))
|
||||
me->SetFacingToObject(car);
|
||||
Talk(SAY_SCARLET_MINER_0);
|
||||
SetRun(true);
|
||||
IntroTimer = 4000;
|
||||
IntroPhase = 1;
|
||||
break;
|
||||
case 17:
|
||||
if (Unit* car = ObjectAccessor::GetCreature(*me, carGUID))
|
||||
{
|
||||
me->SetFacingToObject(car);
|
||||
car->Relocate(car->GetPositionX(), car->GetPositionY(), me->GetPositionZ() + 1);
|
||||
car->StopMoving();
|
||||
car->RemoveAura(SPELL_CART_DRAG);
|
||||
}
|
||||
Talk(SAY_SCARLET_MINER_1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
if (IntroPhase)
|
||||
{
|
||||
if (IntroTimer <= diff)
|
||||
{
|
||||
if (Creature* car = Unit::GetCreature(*me, carGUID))
|
||||
DoCast(car, SPELL_CART_DRAG);
|
||||
IntroTimer = 800;
|
||||
IntroPhase = 2;
|
||||
if (IntroPhase == 1)
|
||||
{
|
||||
if (Creature* car = Unit::GetCreature(*me, carGUID))
|
||||
DoCast(car, SPELL_CART_DRAG);
|
||||
IntroTimer = 800;
|
||||
IntroPhase = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Creature* car = Unit::GetCreature(*me, carGUID))
|
||||
car->AI()->DoAction(0);
|
||||
IntroPhase = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Creature* car = Unit::GetCreature(*me, carGUID))
|
||||
car->AI()->DoAction(0);
|
||||
IntroPhase = 0;
|
||||
}
|
||||
} else IntroTimer-=diff;
|
||||
IntroTimer -= diff;
|
||||
}
|
||||
npc_escortAI::UpdateAI(diff);
|
||||
}
|
||||
npc_escortAI::UpdateAI(diff);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
/*######
|
||||
## go_inconspicuous_mine_car
|
||||
######*/
|
||||
|
||||
enum Spells_Cart
|
||||
{
|
||||
SPELL_CART_SUMM = 52463
|
||||
};
|
||||
|
||||
class go_inconspicuous_mine_car : public GameObjectScript
|
||||
{
|
||||
public:
|
||||
go_inconspicuous_mine_car() : GameObjectScript("go_inconspicuous_mine_car") { }
|
||||
|
||||
bool OnGossipHello(Player* player, GameObject* /*go*/)
|
||||
{
|
||||
if (player->GetQuestStatus(12701) == QUEST_STATUS_INCOMPLETE)
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
// Hack Why Trinity Dont Support Custom Summon Location
|
||||
if (Creature* miner = player->SummonCreature(28841, 2383.869629f, -5900.312500f, 107.996086f, player->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1))
|
||||
{
|
||||
player->CastSpell(player, SPELL_CART_SUMM, true);
|
||||
if (Creature* car = player->GetVehicleCreatureBase())
|
||||
{
|
||||
if (car->GetEntry() == 28817)
|
||||
{
|
||||
car->AI()->SetGUID(miner->GetGUID());
|
||||
CAST_AI(npc_scarlet_miner::npc_scarlet_minerAI, miner->AI())->InitCartQuest(player);
|
||||
} else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello vehicle entry is not correct.");
|
||||
} else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello player is not on the vehicle.");
|
||||
} else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello Scarlet Miner cant be found by script.");
|
||||
return new npc_scarlet_minerAI(creature);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// npc 28912 quest 17217 boss 29001 mob 29007 go 191092
|
||||
@@ -1101,5 +1092,4 @@ void AddSC_the_scarlet_enclave_c1()
|
||||
new npc_scarlet_ghoul();
|
||||
new npc_scarlet_miner();
|
||||
new npc_scarlet_miner_cart();
|
||||
new go_inconspicuous_mine_car();
|
||||
}
|
||||
@@ -98,34 +98,32 @@ public:
|
||||
npc_shadowfang_prisonerAI(Creature* creature) : npc_escortAI(creature)
|
||||
{
|
||||
instance = creature->GetInstanceScript();
|
||||
uiNpcEntry = creature->GetEntry();
|
||||
}
|
||||
|
||||
InstanceScript* instance;
|
||||
uint32 uiNpcEntry;
|
||||
|
||||
void WaypointReached(uint32 waypointId)
|
||||
{
|
||||
switch (waypointId)
|
||||
{
|
||||
case 0:
|
||||
if (uiNpcEntry == NPC_ASH)
|
||||
if (me->GetEntry() == NPC_ASH)
|
||||
Talk(SAY_FREE_AS);
|
||||
else
|
||||
Talk(SAY_FREE_AD);
|
||||
break;
|
||||
case 10:
|
||||
if (uiNpcEntry == NPC_ASH)
|
||||
if (me->GetEntry() == NPC_ASH)
|
||||
Talk(SAY_OPEN_DOOR_AS);
|
||||
else
|
||||
Talk(SAY_OPEN_DOOR_AD);
|
||||
break;
|
||||
case 11:
|
||||
if (uiNpcEntry == NPC_ASH)
|
||||
if (me->GetEntry() == NPC_ASH)
|
||||
DoCast(me, SPELL_UNLOCK);
|
||||
break;
|
||||
case 12:
|
||||
if (uiNpcEntry == NPC_ASH)
|
||||
if (me->GetEntry() == NPC_ASH)
|
||||
Talk(SAY_POST_DOOR_AS);
|
||||
else
|
||||
Talk(SAY_POST1_DOOR_AD);
|
||||
@@ -134,7 +132,7 @@ public:
|
||||
instance->SetData(TYPE_FREE_NPC, DONE);
|
||||
break;
|
||||
case 13:
|
||||
if (uiNpcEntry != NPC_ASH)
|
||||
if (me->GetEntry() != NPC_ASH)
|
||||
Talk(SAY_POST2_DOOR_AD);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -684,7 +684,6 @@ class npc_the_etymidian : public CreatureScript
|
||||
private:
|
||||
uint32 timer;
|
||||
int8 phase;
|
||||
uint32 GOtimer;
|
||||
uint64 playerGUID;
|
||||
uint64 orphanGUID;
|
||||
|
||||
@@ -847,7 +846,6 @@ class npc_alexstraza_the_lifebinder : public CreatureScript
|
||||
uint32 timer;
|
||||
uint64 playerGUID;
|
||||
uint64 orphanGUID;
|
||||
uint64 alexstraszaGUID;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -136,9 +136,7 @@ class boss_tyrannus : public CreatureScript
|
||||
|
||||
void InitializeAI()
|
||||
{
|
||||
if (!instance || static_cast<InstanceMap*>(me->GetMap())->GetScriptId() != sObjectMgr->GetScriptId(PoSScriptName))
|
||||
me->IsAIEnabled = false;
|
||||
else if (instance->GetBossState(DATA_TYRANNUS) != DONE)
|
||||
if (instance->GetBossState(DATA_TYRANNUS) != DONE)
|
||||
Reset();
|
||||
else
|
||||
me->DespawnOrUnsummon();
|
||||
@@ -281,7 +279,7 @@ class boss_tyrannus : public CreatureScript
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new boss_tyrannusAI(creature);
|
||||
return GetPitOfSaronAI<boss_tyrannusAI>(creature);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -387,32 +385,32 @@ class boss_rimefang : public CreatureScript
|
||||
class player_overlord_brandAI : public PlayerAI
|
||||
{
|
||||
public:
|
||||
player_overlord_brandAI(Player* player) : PlayerAI(player)
|
||||
player_overlord_brandAI(Player* player) : PlayerAI(player), _tyrannus(0)
|
||||
{
|
||||
tyrannus = NULL;
|
||||
}
|
||||
|
||||
void SetGUID(uint64 guid, int32 /*type*/)
|
||||
{
|
||||
tyrannus = ObjectAccessor::GetCreature(*me, guid);
|
||||
me->IsAIEnabled = tyrannus != NULL;
|
||||
_tyrannus = guid;
|
||||
}
|
||||
|
||||
void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/)
|
||||
{
|
||||
if (tyrannus->getVictim())
|
||||
me->CastCustomSpell(SPELL_OVERLORD_BRAND_DAMAGE, SPELLVALUE_BASE_POINT0, damage, tyrannus->getVictim(), true, NULL, NULL, tyrannus->GetGUID());
|
||||
if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannus))
|
||||
if (tyrannus->getVictim())
|
||||
me->CastCustomSpell(SPELL_OVERLORD_BRAND_DAMAGE, SPELLVALUE_BASE_POINT0, damage, tyrannus->getVictim(), true, NULL, NULL, tyrannus->GetGUID());
|
||||
}
|
||||
|
||||
void HealDone(Unit* /*target*/, uint32& addHealth)
|
||||
{
|
||||
me->CastCustomSpell(SPELL_OVERLORD_BRAND_HEAL, SPELLVALUE_BASE_POINT0, int32(addHealth*5.5f), tyrannus, true, NULL, NULL, tyrannus->GetGUID());
|
||||
if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannus))
|
||||
me->CastCustomSpell(SPELL_OVERLORD_BRAND_HEAL, SPELLVALUE_BASE_POINT0, int32(addHealth*5.5f), tyrannus, true, NULL, NULL, tyrannus->GetGUID());
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 /*diff*/) { }
|
||||
|
||||
private:
|
||||
Creature* tyrannus;
|
||||
uint64 _tyrannus;
|
||||
};
|
||||
|
||||
class spell_tyrannus_overlord_brand : public SpellScriptLoader
|
||||
@@ -424,6 +422,11 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader
|
||||
{
|
||||
PrepareAuraScript(spell_tyrannus_overlord_brand_AuraScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster() && GetCaster()->GetEntry() == NPC_TYRANNUS;
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTarget()->GetTypeId() != TYPEID_PLAYER)
|
||||
@@ -440,9 +443,10 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader
|
||||
if (GetTarget()->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
delete GetTarget()->GetAI();
|
||||
GetTarget()->SetAI(oldAI);
|
||||
GetTarget()->IsAIEnabled = oldAIState;
|
||||
UnitAI* thisAI = GetTarget()->GetAI();
|
||||
GetTarget()->SetAI(oldAI);
|
||||
delete thisAI;
|
||||
}
|
||||
|
||||
void Register()
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
#ifndef DEF_PIT_OF_SARON_H
|
||||
#define DEF_PIT_OF_SARON_H
|
||||
|
||||
#include "Map.h"
|
||||
#include "Creature.h"
|
||||
|
||||
#define PoSScriptName "instance_pit_of_saron"
|
||||
#define MAX_ENCOUNTER 3
|
||||
|
||||
@@ -94,4 +97,14 @@ enum GameObjectIds
|
||||
GO_HALLS_OF_REFLECTION_PORTCULLIS = 201848,
|
||||
};
|
||||
|
||||
template<class AI>
|
||||
AI* GetPitOfSaronAI(Creature* creature)
|
||||
{
|
||||
if (InstanceMap* instance = creature->GetMap()->ToInstanceMap())
|
||||
if (instance->GetInstanceScript())
|
||||
if (instance->GetScriptId() == sObjectMgr->GetScriptId(PoSScriptName))
|
||||
return new AI(creature);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -73,7 +73,6 @@ enum Spells
|
||||
enum Shadowmourne
|
||||
{
|
||||
QUEST_BLOOD_INFUSION = 24756,
|
||||
ITEM_SHADOW_S_EDGE = 49888,
|
||||
|
||||
SPELL_GUSHING_WOUND = 72132,
|
||||
SPELL_THIRST_QUENCHED = 72154,
|
||||
|
||||
@@ -1131,7 +1131,8 @@ class spell_sindragosa_frost_breath : public SpellScriptLoader
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (target->GetQuestStatus(QUEST_FROST_INFUSION) != QUEST_STATUS_INCOMPLETE)
|
||||
// Check difficulty and quest status
|
||||
if (!(target->GetRaidDifficulty() & RAID_DIFFICULTY_MASK_25MAN) || target->GetQuestStatus(QUEST_FROST_INFUSION) != QUEST_STATUS_INCOMPLETE)
|
||||
return;
|
||||
|
||||
// Check if player has Shadow's Edge equipped and not ready for infusion
|
||||
|
||||
@@ -166,7 +166,7 @@ class boss_kologarn : public CreatureScript
|
||||
left = apply;
|
||||
if (!apply && isEncounterInProgress)
|
||||
{
|
||||
who->ToCreature()->DisappearAndDie();
|
||||
who->ToCreature()->DespawnOrUnsummon();
|
||||
Talk(SAY_LEFT_ARM_GONE);
|
||||
events.ScheduleEvent(EVENT_RESPAWN_LEFT_ARM, 40000);
|
||||
}
|
||||
@@ -177,7 +177,7 @@ class boss_kologarn : public CreatureScript
|
||||
right = apply;
|
||||
if (!apply && isEncounterInProgress)
|
||||
{
|
||||
who->ToCreature()->DisappearAndDie();
|
||||
who->ToCreature()->DespawnOrUnsummon();
|
||||
Talk(SAY_RIGHT_ARM_GONE);
|
||||
events.ScheduleEvent(EVENT_RESPAWN_RIGHT_ARM, 40000);
|
||||
}
|
||||
@@ -529,7 +529,7 @@ class spell_ulduar_stone_grip_absorb : public SpellScriptLoader
|
||||
//! What we do here is remove all harmful aura's related and teleport to safe spot.
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
|
||||
return;
|
||||
|
||||
if (!GetOwner()->ToCreature())
|
||||
@@ -568,22 +568,30 @@ class spell_ulduar_stone_grip : public SpellScriptLoader
|
||||
owner->RemoveAurasDueToSpell(aurEff->GetAmount());
|
||||
}
|
||||
|
||||
void OnRemoveVehicle(AuraEffect const* /*aurEff*/, AuraEffectHandleModes mode)
|
||||
void OnRemoveVehicle(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||
return;
|
||||
|
||||
if (GetOwner()->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
|
||||
Player* caster = GetCaster() ? GetCaster()->ToPlayer() : NULL;
|
||||
if (!caster || !caster->IsOnVehicle(GetOwner()->ToUnit()))
|
||||
return;
|
||||
|
||||
caster->RemoveAurasDueToSpell(GetId());
|
||||
caster->ExitVehicle();
|
||||
caster->GetMotionMaster()->MoveJump(1756.25f + irand(-3, 3), -8.3f + irand(-3, 3), 448.8f, 5.0f, 5.0f);
|
||||
PreventDefaultAction();
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
|
||||
Position exitPosition;
|
||||
exitPosition.m_positionX = 1750.0f;
|
||||
exitPosition.m_positionY = -7.5f + frand(-3.0f, 3.0f);
|
||||
exitPosition.m_positionZ = 457.9322f;
|
||||
|
||||
// Remove pending passengers before exiting vehicle - might cause an Uninstall
|
||||
GetTarget()->GetVehicleKit()->RemovePendingEventsForPassenger(caster);
|
||||
caster->_ExitVehicle(&exitPosition);
|
||||
caster->RemoveAurasDueToSpell(GetId());
|
||||
|
||||
// Temporarily relocate player to vehicle exit dest serverside to send proper fall movement
|
||||
// beats me why blizzard sends these 2 spline packets one after another instantly
|
||||
Position oldPos;
|
||||
caster->GetPosition(&oldPos);
|
||||
caster->Relocate(exitPosition);
|
||||
caster->GetMotionMaster()->MoveFall();
|
||||
caster->Relocate(oldPos);
|
||||
}
|
||||
|
||||
void Register()
|
||||
|
||||
@@ -30,13 +30,12 @@ enum Yells
|
||||
{
|
||||
//Yells Ingvar
|
||||
YELL_AGGRO_1 = 0,
|
||||
YELL_AGGRO_2 = 1,
|
||||
|
||||
YELL_KILL_1 = 1,
|
||||
YELL_DEAD_1 = 2,
|
||||
YELL_DEAD_2 = 3,
|
||||
|
||||
YELL_KILL_1 = 4,
|
||||
YELL_KILL_2 = 5,
|
||||
YELL_AGGRO_2 = 0,
|
||||
YELL_KILL_2 = 1,
|
||||
YELL_DEAD_2 = 2
|
||||
};
|
||||
|
||||
enum Creatures
|
||||
|
||||
@@ -40,7 +40,7 @@ enum WGqueuenpctext
|
||||
WG_NPCQUEUE_TEXT_A_NOWAR = 14782,
|
||||
WG_NPCQUEUE_TEXT_A_QUEUE = 14791,
|
||||
WG_NPCQUEUE_TEXT_A_WAR = 14781,
|
||||
WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507,
|
||||
WG_NPCQUEUE_TEXTOPTION_JOIN = 20077,
|
||||
};
|
||||
|
||||
enum Spells
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
/* ScriptData
|
||||
SDName: Shattrath_City
|
||||
SD%Complete: 100
|
||||
SDComment: Quest support: 10004, 10009, 10211, 10231. Flask vendors, Teleport to Caverns of Time
|
||||
SDComment: Quest support: 10004, 10009, 10211. Flask vendors, Teleport to Caverns of Time
|
||||
SDCategory: Shattrath City
|
||||
EndScriptData */
|
||||
|
||||
@@ -29,7 +29,6 @@ npc_salsalabim
|
||||
npc_shattrathflaskvendors
|
||||
npc_zephyr
|
||||
npc_kservant
|
||||
npc_dirty_larry
|
||||
npc_ishanah
|
||||
npc_khadgar
|
||||
EndContentData */
|
||||
@@ -424,198 +423,6 @@ public:
|
||||
};
|
||||
};
|
||||
|
||||
/*######
|
||||
# npc_dirty_larry
|
||||
######*/
|
||||
|
||||
#define GOSSIP_BOOK "Ezekiel said that you might have a certain book..."
|
||||
|
||||
enum DirtyLarry
|
||||
{
|
||||
SAY_1 = 0,
|
||||
SAY_2 = 1,
|
||||
SAY_3 = 2,
|
||||
SAY_4 = 3,
|
||||
SAY_5 = 4,
|
||||
SAY_GIVEUP = 5,
|
||||
|
||||
QUEST_WBI = 10231,
|
||||
NPC_CREEPJACK = 19726,
|
||||
NPC_MALONE = 19725
|
||||
};
|
||||
|
||||
class npc_dirty_larry : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_dirty_larry() : CreatureScript("npc_dirty_larry") { }
|
||||
|
||||
struct npc_dirty_larryAI : public ScriptedAI
|
||||
{
|
||||
npc_dirty_larryAI(Creature* creature) : ScriptedAI(creature) {}
|
||||
|
||||
bool Event;
|
||||
bool Attack;
|
||||
bool Done;
|
||||
|
||||
uint64 PlayerGUID;
|
||||
|
||||
uint32 SayTimer;
|
||||
uint32 Step;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
Event = false;
|
||||
Attack = false;
|
||||
Done = false;
|
||||
|
||||
PlayerGUID = 0;
|
||||
SayTimer = 0;
|
||||
Step = 0;
|
||||
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
me->setFaction(1194);
|
||||
if (Creature* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20))
|
||||
{
|
||||
Creepjack->AI()->EnterEvadeMode();
|
||||
Creepjack->setFaction(1194);
|
||||
Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
}
|
||||
|
||||
if (Creature* Malone = me->FindNearestCreature(NPC_MALONE, 20))
|
||||
{
|
||||
Malone->AI()->EnterEvadeMode();
|
||||
Malone->setFaction(1194);
|
||||
Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 NextStep(uint32 Step)
|
||||
{
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
|
||||
switch (Step)
|
||||
{
|
||||
case 0:{ me->SetInFront(player);
|
||||
Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20);
|
||||
if (Creepjack)
|
||||
Creepjack->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
||||
Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20);
|
||||
if (Malone)
|
||||
Malone->SetUInt32Value(UNIT_FIELD_BYTES_1, 0);
|
||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); }return 2000;
|
||||
case 1: Talk(SAY_1, player->GetGUID()); return 3000;
|
||||
case 2: Talk(SAY_2, player->GetGUID()); return 5000;
|
||||
case 3: Talk(SAY_3, player->GetGUID()); return 2000;
|
||||
case 4: Talk(SAY_4, player->GetGUID()); return 2000;
|
||||
case 5: Talk(SAY_5, player->GetGUID()); return 2000;
|
||||
case 6: Attack = true; return 2000;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/){}
|
||||
|
||||
void UpdateAI(uint32 diff)
|
||||
{
|
||||
if (SayTimer <= diff)
|
||||
{
|
||||
if (Event)
|
||||
SayTimer = NextStep(++Step);
|
||||
}
|
||||
else
|
||||
SayTimer -= diff;
|
||||
|
||||
if (Attack)
|
||||
{
|
||||
me->setFaction(14);
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
|
||||
{
|
||||
if (Creature* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20))
|
||||
{
|
||||
Creepjack->Attack(player, true);
|
||||
Creepjack->setFaction(14);
|
||||
Creepjack->GetMotionMaster()->MoveChase(player);
|
||||
Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
}
|
||||
|
||||
if (Creature* Malone = me->FindNearestCreature(NPC_MALONE, 20))
|
||||
{
|
||||
Malone->Attack(player, true);
|
||||
Malone->setFaction(14);
|
||||
Malone->GetMotionMaster()->MoveChase(player);
|
||||
Malone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
}
|
||||
DoStartMovement(player);
|
||||
AttackStart(player);
|
||||
}
|
||||
Attack = false;
|
||||
}
|
||||
|
||||
if (HealthBelowPct(5) && !Done)
|
||||
{
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
me->RemoveAllAuras();
|
||||
|
||||
if (Creature* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20))
|
||||
{
|
||||
Creepjack->AI()->EnterEvadeMode();
|
||||
Creepjack->setFaction(1194);
|
||||
Creepjack->GetMotionMaster()->MoveTargetedHome();
|
||||
Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
}
|
||||
|
||||
if (Creature* Malone = me->FindNearestCreature(NPC_MALONE, 20))
|
||||
{
|
||||
Malone->AI()->EnterEvadeMode();
|
||||
Malone->setFaction(1194);
|
||||
Malone->GetMotionMaster()->MoveTargetedHome();
|
||||
Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
}
|
||||
me->setFaction(1194);
|
||||
Done = true;
|
||||
Talk(SAY_GIVEUP);
|
||||
me->DeleteThreatList();
|
||||
me->CombatStop();
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
|
||||
player->GroupEventHappens(QUEST_WBI, me);
|
||||
}
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
|
||||
{
|
||||
player->PlayerTalkClass->ClearMenus();
|
||||
if (action == GOSSIP_ACTION_INFO_DEF+1)
|
||||
{
|
||||
CAST_AI(npc_dirty_larry::npc_dirty_larryAI, creature->AI())->Event = true;
|
||||
CAST_AI(npc_dirty_larry::npc_dirty_larryAI, creature->AI())->PlayerGUID = player->GetGUID();
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OnGossipHello(Player* player, Creature* creature)
|
||||
{
|
||||
if (creature->isQuestGiver())
|
||||
player->PrepareQuestMenu(creature->GetGUID());
|
||||
|
||||
if (player->GetQuestStatus(QUEST_WBI) == QUEST_STATUS_INCOMPLETE)
|
||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BOOK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
|
||||
|
||||
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const
|
||||
{
|
||||
return new npc_dirty_larryAI (creature);
|
||||
}
|
||||
};
|
||||
|
||||
/*######
|
||||
# npc_ishanah
|
||||
######*/
|
||||
@@ -727,7 +534,6 @@ void AddSC_shattrath_city()
|
||||
new npc_shattrathflaskvendors();
|
||||
new npc_zephyr();
|
||||
new npc_kservant();
|
||||
new npc_dirty_larry();
|
||||
new npc_ishanah();
|
||||
new npc_khadgar();
|
||||
}
|
||||
@@ -3585,6 +3585,55 @@ class spell_gen_darkflight : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
enum OrcDisguiseSpells
|
||||
{
|
||||
SPELL_ORC_DISGUISE_TRIGGER = 45759,
|
||||
SPELL_ORC_DISGUISE_MALE = 45760,
|
||||
SPELL_ORC_DISGUISE_FEMALE = 45762,
|
||||
};
|
||||
|
||||
class spell_gen_orc_disguise : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_orc_disguise() : SpellScriptLoader("spell_gen_orc_disguise") { }
|
||||
|
||||
class spell_gen_orc_disguise_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_orc_disguise_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spell*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_MALE) ||
|
||||
!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_FEMALE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Player* target = GetHitPlayer())
|
||||
{
|
||||
uint8 gender = target->getGender();
|
||||
if (!gender)
|
||||
caster->CastSpell(target, SPELL_ORC_DISGUISE_MALE, true);
|
||||
else
|
||||
caster->CastSpell(target, SPELL_ORC_DISGUISE_FEMALE, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_orc_disguise_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_orc_disguise_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_generic_spell_scripts()
|
||||
{
|
||||
new spell_gen_absorb0_hitlimit1();
|
||||
@@ -3672,4 +3721,5 @@ void AddSC_generic_spell_scripts()
|
||||
new spell_gen_running_wild();
|
||||
new spell_gen_two_forms();
|
||||
new spell_gen_darkflight();
|
||||
new spell_gen_orc_disguise();
|
||||
}
|
||||
Reference in new issue
Block a user