Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-02-22 23:34:59 +08:00
16 changed files with 259 additions and 31 deletions

View File

@@ -532,7 +532,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_DEL_CHAR_ACTION_EXCEPT_SPEC, "DELETE FROM character_action WHERE spec<>? AND guid = ?", CONNECTION_ASYNC);
// Items that hold loot or money
PrepareStatement(CHAR_SEL_ITEMCONTAINER_ITEMS, "SELECT containerGUID, itemid, count, item_index, randomPropertyId, randomSuffix, follow_loot_rules, freeforall, is_blocked, is_counted, is_underthreshold, needs_quest, conditionLootId FROM item_loot_storage", CONNECTION_SYNCH);
PrepareStatement(CHAR_SEL_ITEMCONTAINER_ITEMS, "SELECT containerGUID, itemid, item_index, count, randomPropertyId, randomSuffix, follow_loot_rules, freeforall, is_blocked, is_counted, is_underthreshold, needs_quest, conditionLootId FROM item_loot_storage", CONNECTION_SYNCH);
PrepareStatement(CHAR_DEL_ITEMCONTAINER_SINGLE_ITEM, "DELETE FROM item_loot_storage WHERE containerGUID = ? AND itemid = ? AND count = ? AND item_index = ? LIMIT 1", CONNECTION_ASYNC);
PrepareStatement(CHAR_INS_ITEMCONTAINER_SINGLE_ITEM, "INSERT INTO item_loot_storage (containerGUID, itemid, item_index, count, randomPropertyId, randomSuffix, follow_loot_rules, freeforall, is_blocked, is_counted, is_underthreshold, needs_quest, conditionLootId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(CHAR_DEL_ITEMCONTAINER_CONTAINER, "DELETE FROM item_loot_storage WHERE containerGUID = ?", CONNECTION_ASYNC);

View File

@@ -990,6 +990,10 @@ InventoryResult Guild::BankMoveItemData::CanStore(Item* pItem, bool swap)
if (pItem->IsSoulBound())
return EQUIP_ERR_CANT_DROP_SOULBOUND;
// Prevent swapping limited duration items into guild bank
if (pItem->GetTemplate()->Duration > 0)
return EQUIP_ERR_ITEMS_CANT_BE_SWAPPED;
// Make sure destination bank tab exists
if (m_container >= m_pGuild->_GetPurchasedTabsSize())
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;

View File

@@ -1346,6 +1346,12 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
return;
}
if (item->GetTemplate()->Duration > 0)
{
_player->SendEquipError(EQUIP_ERR_UNIQUE_CANT_BE_WRAPPED, item, nullptr);
return;
}
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GIFT);

View File

@@ -66,20 +66,14 @@ enum Spells
enum Misc
{
MAX_ADVISORS = 2,
NPC_SEER_OLUM = 22820,
GO_CAGE = 185952,
GO_CAGE = 185474
};
const Position advisorsPosition[MAX_ADVISORS] =
{
{ 448.37f, -544.71f, -7.54f, 0.00f },
{ 457.37f, -544.71f, -7.54f, 0.00f }
};
const Position olumWalk = { 456.17194f, -544.31866f, -7.5470476f, 0.00f };
struct boss_fathomlord_karathress : public BossAI
{
boss_fathomlord_karathress(Creature* creature) : BossAI(creature, DATA_FATHOM_LORD_KARATHRESS) { }
boss_fathomlord_karathress(Creature* creature) : BossAI(creature, DATA_FATHOM_LORD_KARATHRESS){ }
void Reset() override
{
@@ -103,16 +97,8 @@ struct boss_fathomlord_karathress : public BossAI
void JustSummoned(Creature* summon) override
{
summons.Summon(summon);
if (summon->GetEntry() == NPC_SEER_OLUM)
{
summon->SetWalk(true);
summon->GetMotionMaster()->MovePoint(0, advisorsPosition[MAX_ADVISORS - 1], false);
}
else
{
summon->Attack(me->GetVictim(), false);
summon->SetInCombatWithZone();
}
summon->Attack(me->GetVictim(), false);
summon->SetInCombatWithZone();
}
void KilledUnit(Unit* /*victim*/) override
@@ -132,10 +118,16 @@ struct boss_fathomlord_karathress : public BossAI
{
Talk(SAY_DEATH);
BossAI::JustDied(killer);
me->SummonCreature(NPC_SEER_OLUM, advisorsPosition[MAX_ADVISORS-2], TEMPSUMMON_TIMED_DESPAWN, 3600000);
if (GameObject* gobject = me->FindNearestGameObject(GO_CAGE, 100.0f))
if (GameObject* cage = me->FindNearestGameObject(GO_CAGE, 100.0f))
{
gobject->SetGoState(GO_STATE_ACTIVE);
cage->SetGoState(GO_STATE_ACTIVE);
}
if (Creature* olum = instance->GetCreature(DATA_SEER_OLUM))
{
olum->SetWalk(true);
olum->GetMotionMaster()->MovePoint(0, olumWalk, false);
olum->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
olum->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
}
}

View File

@@ -37,6 +37,7 @@ ObjectData const creatureData[] =
{ NPC_LEOTHERAS_THE_BLIND, DATA_LEOTHERAS_THE_BLIND },
{ NPC_FATHOM_LORD_KARATHRESS, DATA_FATHOM_LORD_KARATHRESS },
{ NPC_LADY_VASHJ, DATA_LADY_VASHJ },
{ NPC_SEER_OLUM, DATA_SEER_OLUM },
{ 0, 0 }
};
@@ -129,6 +130,10 @@ public:
if (Creature* vashj = GetCreature(DATA_LADY_VASHJ))
vashj->AI()->JustSummoned(creature);
break;
case NPC_SEER_OLUM:
creature->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
creature->RemoveNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
break;
default:
break;
}

View File

@@ -45,7 +45,8 @@ enum DataTypes
DATA_ALIVE_KEEPERS = 22,
DATA_BRIDGE_ACTIVATED = 23,
DATA_ACTIVATE_SHIELD = 24,
DATA_STRANGE_POOL = 25
DATA_STRANGE_POOL = 25,
DATA_SEER_OLUM = 26
};
enum SSNPCs
@@ -61,6 +62,8 @@ enum SSNPCs
NPC_FATHOM_GUARD_TIDALVESS = 21965,
NPC_FATHOM_GUARD_CARIBDIS = 21964,
NPC_SEER_OLUM = 22820,
NPC_COILFANG_SHATTERER = 21301,
NPC_COILFANG_PRIESTESS = 21220,

View File

@@ -824,6 +824,18 @@ struct npc_capernian : public ScriptedAI
me->SetReactState(REACT_PASSIVE);
}
void AttackStart(Unit* who) override
{
if (who && who->isTargetableForAttack() && me->GetReactState() != REACT_PASSIVE)
{
if (me->Attack(who, false))
{
me->GetMotionMaster()->MoveChase(who, 45.0f, 0);
me->AddThreat(who, 0.0f);
}
}
}
void JustEngagedWith(Unit* /*who*/) override
{
if (!_hasDied)
@@ -831,7 +843,17 @@ struct npc_capernian : public ScriptedAI
Talk(SAY_CAPERNIAN_AGGRO);
}
ScheduleTimedEvent(0ms, [&]{
DoCastVictim(SPELL_CAPERNIAN_FIREBALL);
if (!me->CanCastSpell(SPELL_CAPERNIAN_FIREBALL))
{
me->ResumeChasingVictim();
}
else
{
me->GetMotionMaster()->MoveChase(me->GetVictim(), 45.0f);
DoCastVictim(SPELL_CAPERNIAN_FIREBALL);
}
}, 2500ms);
ScheduleTimedEvent(7000ms, 10000ms, [&]{
DoCastRandomTarget(SPELL_CONFLAGRATION, 0, 30.0f);
@@ -961,7 +983,7 @@ struct npc_thaladred : public ScriptedAI
ScheduleTimedEvent(100ms, [&]
{
DoResetThreatList();
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
{
me->AddThreat(target, 10000000.0f);
Talk(EMOTE_THALADRED_FIXATE, target);

View File

@@ -632,24 +632,33 @@ public:
return true;
}
void SendActionMenu(Player* player, GameObject* /*go*/, uint32 action)
void SendActionMenu(Player* player, GameObject* go, uint32 action)
{
switch (action)
{
case GOSSIP_ACTION_INFO_DEF + 1:
player->CastSpell(player, SPELL_SUMMON_GEZZARAK_THE_HUNTRESS, false);
_result = player->CastSpell(player, SPELL_SUMMON_GEZZARAK_THE_HUNTRESS, false);
break;
case GOSSIP_ACTION_INFO_DEF + 2:
player->CastSpell(player, SPELL_SUMMON_DARKSCREECHER_AKKARAI, false);
_result = player->CastSpell(player, SPELL_SUMMON_DARKSCREECHER_AKKARAI, false);
break;
case GOSSIP_ACTION_INFO_DEF + 3:
player->CastSpell(player, SPELL_SUMMON_KARROG, false);
_result = player->CastSpell(player, SPELL_SUMMON_KARROG, false);
break;
case GOSSIP_ACTION_INFO_DEF + 4:
player->CastSpell(player, SPELL_SUMMON_VAKKIZ_THE_WINDRAGER, false);
_result = player->CastSpell(player, SPELL_SUMMON_VAKKIZ_THE_WINDRAGER, false);
break;
default:
_result = SPELL_CAST_OK;
break;
}
if (_result == SPELL_CAST_OK)
{
go->DespawnOrUnsummon();
}
}
private:
SpellCastResult _result;
};
/*######