Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-04-14 21:08:07 +08:00
74 changed files with 1482 additions and 2371 deletions

View File

@@ -395,88 +395,85 @@ struct npc_echo_of_medivh : public ScriptedAI
for (uint8 col = 0; col < MAX_COL; ++col)
{
BoardCell const& cell = _boards[row][col];
if (cell.pieceGUID == piece->GetGUID())
if (cell.pieceGUID != piece->GetGUID())
continue;
std::vector<KarazhanChessOrientationType> orientations;
switch (orientation)
{
std::vector<KarazhanChessOrientationType> orientations;
switch (orientation)
case ORI_SE:
orientations = { ORI_NE, ORI_E, ORI_S, ORI_SW };
break;
case ORI_S:
orientations = { ORI_E, ORI_SE, ORI_SW, ORI_W };
break;
case ORI_SW:
orientations = { ORI_SE, ORI_S, ORI_W, ORI_NW };
break;
case ORI_W:
orientations = { ORI_NE, ORI_SW, ORI_NW, ORI_N };
break;
case ORI_NW:
orientations = { ORI_SW, ORI_W, ORI_N, ORI_NE };
break;
case ORI_N:
orientations = { ORI_W, ORI_NW, ORI_NE, ORI_E };
break;
case ORI_NE:
orientations = { ORI_NW, ORI_N, ORI_E, ORI_SE };
break;
case ORI_E:
orientations = { ORI_N, ORI_NE, ORI_SE, ORI_S };
break;
default:
break;
}
for (KarazhanChessOrientationType orient : orientations)
{
uint8 newRow = row;
uint8 newCol = col;
switch (orient)
{
case ORI_SE:
orientations = { ORI_NE, ORI_E, ORI_S, ORI_SW };
newRow -= 1;
break;
case ORI_S:
orientations = { ORI_E, ORI_SE, ORI_SW, ORI_W };
newRow -= 1;
newCol -= 1;
break;
case ORI_SW:
orientations = { ORI_SE, ORI_S, ORI_W, ORI_NW };
newCol -= 1;
break;
case ORI_W:
orientations = { ORI_NE, ORI_SW, ORI_NW, ORI_N };
newRow += 1;
newCol -= 1;
break;
case ORI_NW:
orientations = { ORI_SW, ORI_W, ORI_N, ORI_NE };
newRow += 1;
break;
case ORI_N:
orientations = { ORI_W, ORI_NW, ORI_NE, ORI_E };
newRow += 1;
newCol += 1;
break;
case ORI_NE:
orientations = { ORI_NW, ORI_N, ORI_E, ORI_SE };
newCol += 1;
break;
case ORI_E:
orientations = { ORI_N, ORI_NE, ORI_SE, ORI_S };
newRow -= 1;
newCol += 1;
break;
default:
break;
}
for (KarazhanChessOrientationType orient : orientations)
{
uint8 newRow = row;
uint8 newCol = col;
switch (orient)
{
case ORI_SE:
newRow -= 1;
break;
case ORI_S:
newRow -= 1;
newCol -= 1;
break;
case ORI_SW:
newCol -= 1;
break;
case ORI_W:
newRow += 1;
newCol -= 1;
break;
case ORI_NW:
newRow += 1;
break;
case ORI_N:
newRow += 1;
newCol += 1;
break;
case ORI_NE:
newCol += 1;
break;
case ORI_E:
newRow -= 1;
newCol += 1;
break;
default:
break;
}
if (newRow < MAX_ROW && newCol < MAX_COL && newRow >= 0 && newCol >= 0)
if (Creature* targetPiece = ObjectAccessor::GetCreature(*me, _boards[newRow][newCol].pieceGUID))
{
if (!IsFriendly(piece, targetPiece))
{
return targetPiece;
}
}
}
return nullptr;
}
return nullptr;
}
}

View File

@@ -153,7 +153,7 @@ uint32 const GoBonfireCity[COUNT_GO_BONFIRE_CITY] = { 181332, 181333, 181334, 18
class MidsummerPlayerScript : public PlayerScript
{
public:
MidsummerPlayerScript() : PlayerScript("MidsummerPlayerScript")
MidsummerPlayerScript() : PlayerScript("MidsummerPlayerScript", {PLAYERHOOK_ON_UPDATE_ZONE})
{
}

View File

@@ -66,6 +66,7 @@ enum Summons
CREATURE_DOOMFIRE_SPIRIT = 18104,
CREATURE_ANCIENT_WISP = 17946,
CREATURE_CHANNEL_TARGET = 22418,
DISPLAY_ID_TRIGGER = 11686
};
enum Events
@@ -279,13 +280,6 @@ struct boss_archimonde : public BossAI
DoCastVictim(SPELL_RED_SKY_EFFECT);
DoCastVictim(SPELL_HAND_OF_DEATH);
}, 3s);
ScheduleTimedEvent(2500ms, [&]
{
if (!(me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim())))
{
DoCastRandomTarget(SPELL_FINGER_OF_DEATH);
}
}, 3500ms);
});
}
@@ -301,7 +295,7 @@ struct boss_archimonde : public BossAI
if (Creature* nordrassil = me->SummonCreature(CREATURE_CHANNEL_TARGET, nordrassilPosition, TEMPSUMMON_TIMED_DESPAWN, 1200000))
{
nordrassil->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
nordrassil->SetDisplayId(11686); //TODO: make enum
nordrassil->SetDisplayId(DISPLAY_ID_TRIGGER);
DoCast(nordrassil, SPELL_DRAIN_WORLD_TREE);
_isChanneling = true;
nordrassil->AI()->DoCast(me, SPELL_DRAIN_WORLD_TREE_2, true);
@@ -365,6 +359,26 @@ struct boss_archimonde : public BossAI
}
}
}, 5s);
ScheduleTimedEvent(5000ms, [&]
{
bool noPlayersInRange = true;
if (Map* map = me->GetMap())
{
map->DoForAllPlayers([&noPlayersInRange, this](Player* player)
{
if (me->IsWithinMeleeRange(player))
{
noPlayersInRange = false;
return false;
}
return true;
});
}
if (noPlayersInRange)
{
DoCastRandomTarget(SPELL_FINGER_OF_DEATH);
}
}, 3500ms);
instance->SetData(DATA_SPAWN_WAVES, 1);
}

View File

@@ -68,7 +68,7 @@ public:
context.Repeat(18s, 20s);
}).Schedule(45s, 55s, [this](TaskContext context)
{
DoCastRandomTarget(SPELL_DOOM, 0, 100.f);
DoCastRandomTarget(SPELL_DOOM, 0, 100.f, true, false, false);
Talk(SAY_DOOM);
context.Repeat();
}).Schedule(10min, [this](TaskContext context)

View File

@@ -160,7 +160,7 @@ public:
{
Unit* target = GetTarget();
if (target->GetPower(POWER_MANA) == 0)
if (target->GetPower(POWER_MANA) < aurEff->GetBaseAmount())
{
target->CastSpell(target, SPELL_MARK_DAMAGE, true, nullptr, aurEff);
// Remove aura

View File

@@ -163,7 +163,7 @@ struct boss_alar : public BossAI
if (me->isMoving())
return true;
return me->IsWithinMeleeRange(victim);
return _hasPretendedToDie || me->IsWithinMeleeRange(victim);
}
void EnterEvadeMode(EvadeReason why) override

View File

@@ -807,7 +807,7 @@ struct npc_lord_sanguinar : public ScriptedAI
{
Talk(SAY_SANGUINAR_AGGRO);
}
ScheduleTimedEvent(6s, 20s, [&]{
ScheduleTimedEvent(0s, 2s, [&]{
DoCastSelf(SPELL_BELLOWING_ROAR);
}, 30s, 40s);
}

View File

@@ -169,7 +169,15 @@ public:
class CharacterActionIpLogger : public PlayerScript
{
public:
CharacterActionIpLogger() : PlayerScript("CharacterActionIpLogger") { }
CharacterActionIpLogger() :
PlayerScript("CharacterActionIpLogger",
{
PLAYERHOOK_ON_CREATE,
PLAYERHOOK_ON_LOGIN,
PLAYERHOOK_ON_LOGOUT
})
{
}
// CHARACTER_CREATE = 7
void OnCreate(Player* player) override
@@ -256,7 +264,14 @@ public:
class CharacterDeleteActionIpLogger : public PlayerScript
{
public:
CharacterDeleteActionIpLogger() : PlayerScript("CharacterDeleteActionIpLogger") { }
CharacterDeleteActionIpLogger() :
PlayerScript("CharacterDeleteActionIpLogger",
{
PLAYERHOOK_ON_DELETE,
PLAYERHOOK_ON_FAILED_DELETE
})
{
}
// CHARACTER_DELETE = 10
void OnDelete(ObjectGuid guid, uint32 accountId) override

View File

@@ -25,7 +25,17 @@
class ChatLogScript : public PlayerScript
{
public:
ChatLogScript() : PlayerScript("ChatLogScript") { }
ChatLogScript() :
PlayerScript("ChatLogScript",
{
PLAYERHOOK_ON_CHAT,
PLAYERHOOK_ON_CHAT_WITH_GROUP,
PLAYERHOOK_ON_CHAT_WITH_GUILD,
PLAYERHOOK_ON_CHAT_WITH_CHANNEL,
PLAYERHOOK_ON_CHAT_WITH_RECEIVER
})
{
}
void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg) override
{

View File

@@ -27,7 +27,7 @@ enum ApprenticeAnglerQuestEnum
class QuestApprenticeAnglerPlayerScript : public PlayerScript
{
public:
QuestApprenticeAnglerPlayerScript() : PlayerScript("QuestApprenticeAnglerPlayerScript")
QuestApprenticeAnglerPlayerScript() : PlayerScript("QuestApprenticeAnglerPlayerScript", {PLAYERHOOK_ON_PLAYER_COMPLETE_QUEST})
{
}

View File

@@ -24,7 +24,7 @@
class ServerMailReward : public PlayerScript
{
public:
ServerMailReward() : PlayerScript("ServerMailReward") { }
ServerMailReward() : PlayerScript("ServerMailReward", {PLAYERHOOK_ON_LOGIN}) { }
// CHARACTER_LOGIN = 8
void OnLogin(Player* player) override