Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2025-02-11 22:35:57 +08:00
62 changed files with 1532 additions and 1969 deletions
@@ -267,6 +267,8 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_DEL_ALL_GAME_EVENT_CONDITION_SAVE, "DELETE FROM game_event_condition_save WHERE eventEntry = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_DEL_GAME_EVENT_CONDITION_SAVE, "DELETE FROM game_event_condition_save WHERE eventEntry = ? AND condition_id = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_INS_GAME_EVENT_CONDITION_SAVE, "INSERT INTO game_event_condition_save (eventEntry, condition_id, done) VALUES (?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(CHAR_SEL_GAME_EVENT_CONDITION_SAVE_DATA, "SELECT eventEntry, condition_id, done FROM game_event_condition_save", CONNECTION_SYNCH);
PrepareStatement(CHAR_SEL_GAME_EVENT_SAVE_DATA, "SELECT eventEntry, state, next_start FROM game_event_save", CONNECTION_SYNCH);
// Petitions
PrepareStatement(CHAR_DEL_ALL_PETITION_SIGNATURES, "DELETE FROM petition_sign WHERE playerguid = ?", CONNECTION_ASYNC);
@@ -218,6 +218,8 @@ enum CharacterDatabaseStatements : uint32
CHAR_DEL_ALL_GAME_EVENT_CONDITION_SAVE,
CHAR_DEL_GAME_EVENT_CONDITION_SAVE,
CHAR_INS_GAME_EVENT_CONDITION_SAVE,
CHAR_SEL_GAME_EVENT_CONDITION_SAVE_DATA,
CHAR_SEL_GAME_EVENT_SAVE_DATA,
CHAR_INS_ARENA_TEAM,
CHAR_INS_ARENA_TEAM_MEMBER,
@@ -84,6 +84,21 @@ void WorldDatabaseConnection::DoPrepareStatements()
PrepareStatement(WORLD_SEL_GAMEOBJECT_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM gameobject WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? AND (phaseMask & ?) <> 0 ORDER BY order_", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_CREATURE_NEAREST, "SELECT guid, id1, id2, id3, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM creature WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? AND (phaseMask & ?) <> 0 ORDER BY order_", CONNECTION_SYNCH);
PrepareStatement(WORLD_INS_CREATURE, "INSERT INTO creature (guid, id1, id2, id3, map, spawnMask, phaseMask, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, wander_distance, currentwaypoint, curhealth, curmana, MovementType, npcflag, unit_flags, dynamicflags) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(WORLD_SEL_GAME_EVENTS, "SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, holidayStage, description, world_event, announce FROM game_event", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_PREREQUISITE_DATA, "SELECT eventEntry, prerequisite_event FROM game_event_prerequisite", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_CREATURE_DATA, "SELECT guid, eventEntry FROM game_event_creature", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_GAMEOBJECT_DATA, "SELECT guid, eventEntry FROM game_event_gameobject", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_MODEL_EQUIPMENT_DATA, "SELECT creature.guid, creature.id1, creature.id2, creature.id3, game_event_model_equip.eventEntry, game_event_model_equip.modelid, game_event_model_equip.equipment_id FROM creature JOIN game_event_model_equip ON creature.guid=game_event_model_equip.guid", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_QUEST_DATA, "SELECT id, quest, eventEntry FROM game_event_creature_quest", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_GAMEOBJECT_QUEST_DATA, "SELECT id, quest, eventEntry FROM game_event_gameobject_quest", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_QUEST_CONDITION_DATA, "SELECT quest, eventEntry, condition_id, num FROM game_event_quest_condition", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_CONDITION_DATA, "SELECT eventEntry, condition_id, req_num, max_world_state_field, done_world_state_field FROM game_event_condition", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_NPC_FLAGS, "SELECT guid, eventEntry, npcflag FROM game_event_npcflag", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_QUEST_SEASONAL_RELATIONS, "SELECT questId, eventEntry FROM game_event_seasonal_questrelation", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_BATTLEGROUND_DATA, "SELECT eventEntry, bgflag FROM game_event_battleground_holiday", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_POOL_DATA, "SELECT pool_template.entry, game_event_pool.eventEntry FROM pool_template JOIN game_event_pool ON pool_template.entry = game_event_pool.pool_entry", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_ARENA_SEASON, "SELECT eventEntry FROM game_event_arena_seasons WHERE season = ?", CONNECTION_SYNCH);
PrepareStatement(WORLD_SEL_GAME_EVENT_HOLIDAY_DATES, "SELECT id, date_id, date_value, holiday_duration FROM holiday_dates", CONNECTION_SYNCH);
PrepareStatement(WORLD_DEL_GAME_EVENT_CREATURE, "DELETE FROM game_event_creature WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_DEL_GAME_EVENT_MODEL_EQUIP, "DELETE FROM game_event_model_equip WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(WORLD_SEL_GAME_EVENT_NPC_VENDOR, "SELECT eventEntry, guid, item, maxcount, incrtime, ExtendedCost FROM game_event_npc_vendor ORDER BY guid, slot ASC", CONNECTION_SYNCH);
@@ -90,6 +90,21 @@ enum WorldDatabaseStatements : uint32
WORLD_SEL_CREATURE_NEAREST,
WORLD_SEL_GAMEOBJECT_TARGET,
WORLD_INS_CREATURE,
WORLD_SEL_GAME_EVENTS,
WORLD_SEL_GAME_EVENT_PREREQUISITE_DATA,
WORLD_SEL_GAME_EVENT_CREATURE_DATA,
WORLD_SEL_GAME_EVENT_GAMEOBJECT_DATA,
WORLD_SEL_GAME_EVENT_MODEL_EQUIPMENT_DATA,
WORLD_SEL_GAME_EVENT_QUEST_DATA,
WORLD_SEL_GAME_EVENT_GAMEOBJECT_QUEST_DATA,
WORLD_SEL_GAME_EVENT_QUEST_CONDITION_DATA,
WORLD_SEL_GAME_EVENT_CONDITION_DATA,
WORLD_SEL_GAME_EVENT_NPC_FLAGS,
WORLD_SEL_GAME_EVENT_QUEST_SEASONAL_RELATIONS,
WORLD_SEL_GAME_EVENT_BATTLEGROUND_DATA,
WORLD_SEL_GAME_EVENT_POOL_DATA,
WORLD_SEL_GAME_EVENT_ARENA_SEASON,
WORLD_SEL_GAME_EVENT_HOLIDAY_DATES,
WORLD_DEL_GAME_EVENT_CREATURE,
WORLD_DEL_GAME_EVENT_MODEL_EQUIP,
WORLD_SEL_GAME_EVENT_NPC_VENDOR,
+4 -1
View File
@@ -806,7 +806,10 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
return nullptr;
}
creature->SetFaction(BattlefieldFactions[teamId]);
// no need to set faction for neutral team
if (teamId == TEAM_ALLIANCE || teamId == TEAM_HORDE)
creature->SetFaction(BattlefieldFactions[teamId]);
creature->SetHomePosition(x, y, z, o);
// force using DB speeds -- do we really need this?
+11 -17
View File
@@ -525,7 +525,7 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, cinfo->HoverHeight);
SetCanDualWield(cinfo->flags_extra & CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK);
SetCanDualWield(cinfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK));
// checked at loading
m_defaultMovementType = MovementGeneratorType(cinfo->MovementType);
@@ -556,7 +556,7 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
uint32 npcflag, unit_flags, dynamicflags;
ObjectMgr::ChooseCreatureFlags(cInfo, npcflag, unit_flags, dynamicflags, data);
if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT)
if (cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_WORLDEVENT))
ReplaceAllNpcFlags(NPCFlags(npcflag | sGameEventMgr->GetNPCFlag(this)));
else
ReplaceAllNpcFlags(NPCFlags(npcflag));
@@ -571,7 +571,7 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
ReplaceAllDynamicFlags(dynamicflags);
SetCanDualWield(cInfo->flags_extra & CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK);
SetCanDualWield(cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK));
SetAttackTime(BASE_ATTACK, cInfo->BaseAttackTime);
SetAttackTime(OFF_ATTACK, cInfo->BaseAttackTime);
@@ -637,7 +637,7 @@ bool Creature::UpdateEntry(uint32 Entry, const CreatureData* data, bool changele
InitializeReactState();
if (!IsPet() && cInfo->flags_extra & CREATURE_FLAG_EXTRA_NO_TAUNT)
if (!IsPet() && cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_TAUNT))
{
ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_ATTACK_ME, true);
@@ -1200,7 +1200,7 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, u
LastUsedScriptID = GetScriptId();
if (IsSpiritHealer() || IsSpiritGuide() || (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GHOST_VISIBILITY))
if (IsSpiritHealer() || IsSpiritGuide() || HasFlagsExtra(CREATURE_FLAG_EXTRA_GHOST_VISIBILITY))
{
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
@@ -1213,7 +1213,7 @@ bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, u
if (Entry == VISUAL_WAYPOINT)
SetVisible(false);
if (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING)
if (HasFlagsExtra(CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING))
AddUnitState(UNIT_STATE_IGNORE_PATHFINDING);
return true;
@@ -2175,12 +2175,8 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds forceRespawnTimer)
RemoveCorpse(true);
if (forceRespawnTimer > Seconds::zero())
{
if (GetMap())
{
GetMap()->ScheduleCreatureRespawn(GetGUID(), forceRespawnTimer);
}
}
}
void Creature::DespawnOrUnsummon(Milliseconds msTimeToDespawn /*= 0*/, Seconds forcedRespawnTimer)
@@ -2203,7 +2199,7 @@ void Creature::DespawnOnEvade(Seconds respawnDelay)
if (TempSummon* whoSummon = ToTempSummon())
{
LOG_WARN("entities.unit", "DespawnOnEvade called on a temporary summon.");
GetMap()->ScheduleCreatureRespawn(GetGUID(), respawnDelay, GetHomePosition());
whoSummon->UnSummon();
return;
}
@@ -3184,8 +3180,7 @@ bool Creature::IsDungeonBoss() const
if (GetOwnerGUID().IsPlayer())
return false;
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(GetEntry());
return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS);
return HasFlagsExtra(CREATURE_FLAG_EXTRA_DUNGEON_BOSS);
}
bool Creature::IsImmuneToKnockback() const
@@ -3193,8 +3188,7 @@ bool Creature::IsImmuneToKnockback() const
if (GetOwnerGUID().IsPlayer())
return false;
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(GetEntry());
return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK);
return HasFlagsExtra(CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK);
}
bool Creature::HasWeapon(WeaponAttackType type) const
@@ -3464,7 +3458,7 @@ void Creature::UpdateMovementFlags()
return;
// Creatures with CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE should control MovementFlags in your own scripts
if (info->flags_extra & CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE)
if (info->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE))
return;
float ground = GetFloorZ();
@@ -3820,7 +3814,7 @@ void Creature::ModifyThreatPercentTemp(Unit* victim, int32 percent, Milliseconds
bool Creature::IsDamageEnoughForLootingAndReward() const
{
return (m_creatureInfo->flags_extra & CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ) || (_playerDamageReq == 0 && _damagedByPlayer);
return m_creatureInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ) || (_playerDamageReq == 0 && _damagedByPlayer);
}
void Creature::LowerPlayerDamageReq(uint32 unDamage, bool damagedByPlayer /*= true*/)
+6 -5
View File
@@ -70,10 +70,11 @@ public:
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
void SetCorpseRemoveTime(uint32 delay);
[[nodiscard]] uint32 GetCorpseDelay() const { return m_corpseDelay; }
[[nodiscard]] bool HasFlagsExtra(uint32 flag) const { return GetCreatureTemplate()->HasFlagsExtra(flag); }
[[nodiscard]] bool IsRacialLeader() const { return GetCreatureTemplate()->RacialLeader; }
[[nodiscard]] bool IsCivilian() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
[[nodiscard]] bool IsTrigger() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER; }
[[nodiscard]] bool IsGuard() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GUARD; }
[[nodiscard]] bool IsCivilian() const { return HasFlagsExtra(CREATURE_FLAG_EXTRA_CIVILIAN); }
[[nodiscard]] bool IsTrigger() const { return HasFlagsExtra(CREATURE_FLAG_EXTRA_TRIGGER); }
[[nodiscard]] bool IsGuard() const { return HasFlagsExtra(CREATURE_FLAG_EXTRA_GUARD); }
CreatureMovementData const& GetMovementTemplate() const;
[[nodiscard]] bool CanWalk() const { return GetMovementTemplate().IsGroundAllowed(); }
[[nodiscard]] bool CanSwim() const override;
@@ -127,7 +128,7 @@ public:
[[nodiscard]] bool IsDungeonBoss() const;
[[nodiscard]] bool IsImmuneToKnockback() const;
[[nodiscard]] bool IsAvoidingAOE() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_AVOID_AOE; }
[[nodiscard]] bool IsAvoidingAOE() const { return HasFlagsExtra(CREATURE_FLAG_EXTRA_AVOID_AOE); }
uint8 getLevelForTarget(WorldObject const* target) const override; // overwrite Unit::getLevelForTarget for boss level support
@@ -272,7 +273,7 @@ public:
bool HasSearchedAssistance() { return m_AlreadySearchedAssistance; }
bool CanAssistTo(Unit const* u, Unit const* enemy, bool checkfaction = true) const;
bool _IsTargetAcceptable(Unit const* target) const;
[[nodiscard]] bool CanIgnoreFeignDeath() const { return (GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_IGNORE_FEIGN_DEATH) != 0; }
[[nodiscard]] bool CanIgnoreFeignDeath() const { return HasFlagsExtra(CREATURE_FLAG_EXTRA_IGNORE_FEIGN_DEATH); }
// pussywizard: Updated at faction change, disable move in line of sight if actual faction is not hostile to anyone
void UpdateMoveInLineOfSightState();
@@ -310,13 +310,9 @@ void TempSummon::UnSummon(uint32 msTime)
if (WorldObject* owner = GetSummoner())
{
if (owner->IsCreature() && owner->ToCreature()->IsAIEnabled)
{
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
}
else if (owner->IsGameObject() && owner->ToGameObject()->AI())
{
owner->ToGameObject()->AI()->SummonedCreatureDespawn(this);
}
}
AddObjectToRemoveList();
+1 -7
View File
@@ -12721,17 +12721,11 @@ bool Player::isHonorOrXPTarget(Unit* victim) const
// Victim level less gray level
if (v_level <= k_grey)
{
return false;
}
if (victim->IsCreature())
{
if (victim->IsTotem() || victim->IsCritter() || victim->IsPet() || (victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP))
{
if (victim->IsTotem() || victim->IsCritter() || victim->IsPet() || victim->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_XP))
return false;
}
}
return true;
}
+1 -1
View File
@@ -1375,7 +1375,7 @@ public:
[[nodiscard]] Player* GetTrader() const { return m_trade ? m_trade->GetTrader() : nullptr; }
[[nodiscard]] TradeData* GetTradeData() const { return m_trade; }
void TradeCancel(bool sendback);
void TradeCancel(bool sendback, TradeStatus status = TRADE_STATUS_TRADE_CANCELED);
CinematicMgr* GetCinematicMgr() const { return _cinematicMgr; }
@@ -4085,7 +4085,7 @@ void Player::SendSellError(SellResult msg, Creature* creature, ObjectGuid guid,
GetSession()->SendPacket(&data);
}
void Player::TradeCancel(bool sendback)
void Player::TradeCancel(bool sendback, TradeStatus status /*= TRADE_STATUS_TRADE_CANCELED*/)
{
if (m_trade)
{
@@ -4093,9 +4093,9 @@ void Player::TradeCancel(bool sendback)
// send yellow "Trade canceled" message to both traders
if (sendback)
GetSession()->SendCancelTrade();
GetSession()->SendCancelTrade(status);
trader->GetSession()->SendCancelTrade();
trader->GetSession()->SendCancelTrade(status);
// cleanup
delete m_trade;
@@ -6066,7 +6066,7 @@ Item* Player::_LoadItem(CharacterDatabaseTransaction trans, uint32 zoneId, uint3
GameEventMgr::ActiveEvents const& activeEventsList = sGameEventMgr->GetActiveEventList();
for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr)
{
if (uint32(events[*itr].holiday_id) == proto->HolidayId)
if (uint32(events[*itr].HolidayId) == proto->HolidayId)
{
remove = false;
break;
@@ -6724,7 +6724,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map
if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, target_map, this))
{
GetSession()->SendAreaTriggerMessage("{}", GetSession()->GetAcoreString(LANG_INSTANCE_CLOSED));
GetSession()->SendAreaTriggerMessage(LANG_INSTANCE_CLOSED);
return false;
}
@@ -6862,11 +6862,11 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map
{
ObjectMgr::GetLocaleString(il->Name, loc_idx, name);
}
GetSession()->SendAreaTriggerMessage(GetSession()->GetAcoreString(LANG_LEVEL_MINREQUIRED_AND_ITEM), ar->levelMin, name.c_str());
GetSession()->SendAreaTriggerMessage(LANG_LEVEL_MINREQUIRED_AND_ITEM, ar->levelMin, name);
}
else if (LevelMin)
{
GetSession()->SendAreaTriggerMessage(GetSession()->GetAcoreString(LANG_LEVEL_MINREQUIRED), LevelMin);
GetSession()->SendAreaTriggerMessage(LANG_LEVEL_MINREQUIRED, LevelMin);
}
else if (ilvlRequirementNotMet)
{
@@ -6924,11 +6924,11 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map
if (LevelMin)
{
GetSession()->SendAreaTriggerMessage(GetSession()->GetAcoreString(LANG_LEVEL_MINREQUIRED), LevelMin);
GetSession()->SendAreaTriggerMessage(LANG_LEVEL_MINREQUIRED, LevelMin);
}
else if (LevelMax)
{
GetSession()->SendAreaTriggerMessage(GetSession()->GetAcoreString(LANG_ACCESS_REQUIREMENT_MAX_LEVEL), LevelMax);
GetSession()->SendAreaTriggerMessage(LANG_ACCESS_REQUIREMENT_MAX_LEVEL, LevelMax);
}
else if (mapDiff->hasErrorMessage && !errorAlreadyPrinted)
{
@@ -980,9 +980,7 @@ void Player::UpdateWeaponSkill(Unit* victim, WeaponAttackType attType, Item* ite
if (GetShapeshiftForm() == FORM_TREE)
return; // use weapon but not skill up
if (victim->IsCreature() &&
(victim->ToCreature()->GetCreatureTemplate()->flags_extra &
CREATURE_FLAG_EXTRA_NO_SKILL_GAINS))
if (victim->IsCreature() && victim->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_SKILL_GAINS))
return;
uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON);
@@ -1168,7 +1166,7 @@ bool Player::UpdatePosition(float x, float y, float z, float orientation,
SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
if (GetTrader() && !IsWithinDistInMap(GetTrader(), INTERACTION_DISTANCE))
GetSession()->SendCancelTrade();
GetSession()->SendCancelTrade(TRADE_STATUS_TRADE_CANCELED);
CheckAreaExploreAndOutdoor();
@@ -582,7 +582,22 @@ void MotionTransport::DelayedTeleportTransport()
float destX, destY, destZ, destO;
obj->m_movementInfo.transport.pos.GetPosition(destX, destY, destZ, destO);
TransportBase::CalculatePassengerPosition(destX, destY, destZ, &destO, x, y, z, o);
if (!obj->ToPlayer()->TeleportTo(newMapId, destX, destY, destZ, destO, TELE_TO_NOT_LEAVE_TRANSPORT))
Player* player = obj->ToPlayer();
// Vehicle passengers are dropped in the middle of nowhere, so lets try to eject them, add to the transport and teleport
// this needs to be revisited to properly restore vehicles with passengers after transport teleportation
if (player->IsVehicle())
if (Vehicle* vehicleKit = player->GetVehicleKit())
for (SeatMap::iterator itr = vehicleKit->Seats.begin(); itr != vehicleKit->Seats.end(); ++itr)
if (Player* passenger = ObjectAccessor::GetPlayer(*player, itr->second.Passenger.Guid))
{
passenger->ExitVehicle();
AddPassenger(passenger, true);
if (!passenger->TeleportTo(newMapId, destX, destY, destZ, destO, TELE_TO_NOT_LEAVE_TRANSPORT))
_passengers.erase(passenger);
}
if (!player->TeleportTo(newMapId, destX, destY, destZ, destO, TELE_TO_NOT_LEAVE_TRANSPORT))
_passengers.erase(obj);
}
break;
+13 -20
View File
@@ -2856,7 +2856,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy
//LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
}
// Xinef: do not allow to dodge with CREATURE_FLAG_EXTRA_NO_DODGE flag
else if (victim->IsPlayer() || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_DODGE))
else if (victim->IsPlayer() || !(victim->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_DODGE)))
{
// Reduce dodge chance by attacker expertise rating
if (IsPlayer())
@@ -2898,7 +2898,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy
else
parry_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25;
if (victim->IsPlayer() || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY))
if (victim->IsPlayer() || !(victim->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_PARRY)))
{
tmp = parry_chance;
@@ -2915,7 +2915,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy
}
}
if (victim->IsPlayer() || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK))
if (victim->IsPlayer() || !(victim->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_BLOCK)))
{
tmp = block_chance;
@@ -2957,7 +2957,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy
if (getLevelForTarget(victim) >= victim->getLevelForTarget(this) + 4 &&
// can be from by creature (if can) or from controlled player that considered as creature
!IsControlledByPlayer() &&
!(IsCreature() && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS))
!(IsCreature() && ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS)))
{
// when their weapon skill is 15 or more above victim's defense skill
tmp = victimDefenseSkill;
@@ -2984,10 +2984,8 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(Unit const* victim, WeaponAttackTy
if (tmp > 0 && roll < (sum += tmp))
{
LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT <{}, {})", sum - tmp, sum);
if (IsCreature() && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
{
if (IsCreature() && (ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_CRIT)))
LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT DISABLED)");
}
else
return MELEE_HIT_CRIT;
}
@@ -3122,7 +3120,7 @@ bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttac
{
// Check creatures flags_extra for disable block
if (victim->IsCreature() &&
victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)
victim->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_BLOCK))
return false;
float blockChance = victim->GetUnitBlockChance();
@@ -10453,10 +10451,9 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
creature->SendAIReaction(AI_REACTION_HOSTILE);
/// @todo: Implement aggro range, detection range and assistance range templates
if (!(creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_DONT_CALL_ASSISTANCE))
{
if (!(creature->HasFlagsExtra(CREATURE_FLAG_EXTRA_DONT_CALL_ASSISTANCE)))
creature->CallAssistance();
}
creature->SetAssistanceTimer(sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD));
SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
@@ -15144,7 +15141,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32& duration,
Unit const* source = casterOwner ? casterOwner : caster;
if ((target->IsPlayer()
|| target->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)
|| target->ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_ALL_DIMINISH))
&& source->IsPlayer())
duration = limitduration;
}
@@ -15153,7 +15150,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32& duration,
if (group == DIMINISHING_TAUNT)
{
if (IsCreature() && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS))
if (IsCreature() && (ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS)))
{
DiminishingLevels diminish = Level;
switch (diminish)
@@ -15180,7 +15177,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32& duration,
// Some diminishings applies to mobs too (for example, Stun)
else if ((GetDiminishingReturnsGroupType(group) == DRTYPE_PLAYER
&& ((targetOwner ? (targetOwner->IsPlayer()) : (IsPlayer()))
|| (IsCreature() && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)))
|| (IsCreature() && ToCreature()->HasFlagsExtra(CREATURE_FLAG_EXTRA_ALL_DIMINISH))))
|| GetDiminishingReturnsGroupType(group) == DRTYPE_ALL)
{
DiminishingLevels diminish = Level;
@@ -18057,7 +18054,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
if (instanceMap->IsDungeon() && player)
if (instanceMap->IsRaidOrHeroicDungeon())
if (creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
if (creature->HasFlagsExtra(CREATURE_FLAG_EXTRA_INSTANCE_BIND))
instanceMap->ToInstanceMap()->PermBindAllPlayers();
}
}
@@ -20997,16 +20994,12 @@ void Unit::PatchValuesUpdate(ByteBuffer& valuesUpdateBuf, BuildValuesCachePosPoi
break;
}
if (cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
if (cinfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_TRIGGER))
{
if (target->IsGameMaster() && target->GetSession()->IsGMAccount())
{
displayId = cinfo->GetFirstVisibleModel()->CreatureDisplayID;
}
else
{
displayId = cinfo->GetFirstInvisibleModel()->CreatureDisplayID;
}
}
}
File diff suppressed because it is too large Load Diff
+86 -72
View File
@@ -38,17 +38,17 @@ enum GameEventState
struct GameEventFinishCondition
{
float reqNum; // required number // use float, since some events use percent
float done; // done number
uint32 max_world_state; // max resource count world state update id
uint32 done_world_state; // done resource count world state update id
float ReqNum; // required number // use float, since some events use percent
float Done; // done number
uint32 MaxWorldState; // max resource count world state update id
uint32 DoneWorldState; // done resource count world state update id
};
struct GameEventQuestToEventConditionNum
{
uint16 event_id;
uint32 condition;
float num;
uint16 EventId;
uint32 Condition;
float Num;
};
typedef std::map<uint32 /*condition id*/, GameEventFinishCondition> GameEventConditionMap;
@@ -56,37 +56,37 @@ typedef std::map<uint32 /*condition id*/, GameEventFinishCondition> GameEventCon
struct GameEventData
{
GameEventData() = default;
uint32 eventId;
time_t start{1}; // occurs after this time
time_t end{0}; // occurs before this time
time_t nextstart{0}; // after this time the follow-up events count this phase completed
uint32 occurence{0}; // time between end and start
uint32 length{0}; // length of the event (minutes) after finishing all conditions
HolidayIds holiday_id{HOLIDAY_NONE};
uint8 holidayStage;
GameEventState state{GAMEEVENT_NORMAL}; // state of the game event, these are saved into the game_event table on change!
GameEventConditionMap conditions; // conditions to finish
std::set<uint16 /*gameevent id*/> prerequisite_events; // events that must be completed before starting this event
std::string description;
uint8 announce; // if 0 dont announce, if 1 announce, if 2 take config value
uint32 EventId;
time_t Start{1}; // occurs after this time
time_t End{0}; // occurs before this time
time_t NextStart{0}; // after this time the follow-up events count this phase completed
uint32 Occurence{0}; // time between end and start
uint32 Length{0}; // length of the event (minutes) after finishing all conditions
HolidayIds HolidayId{HOLIDAY_NONE};
uint8 HolidayStage;
GameEventState State{GAMEEVENT_NORMAL}; // state of the game event, these are saved into the game_event table on change!
GameEventConditionMap Conditions; // conditions to finish
std::set<uint16 /*gameevent id*/> PrerequisiteEvents; // events that must be completed before starting this event
std::string Description;
uint8 Announce; // if 0 dont announce, if 1 announce, if 2 take config value
[[nodiscard]] bool isValid() const { return length > 0 || state > GAMEEVENT_NORMAL; }
[[nodiscard]] bool isValid() const { return Length > 0 || State > GAMEEVENT_NORMAL; }
};
struct ModelEquip
{
uint32 modelid;
uint32 modelid_prev;
uint8 equipment_id;
uint8 equipement_id_prev;
uint32 ModelId;
uint32 ModelIdPrev;
uint8 EquipmentId;
uint8 EquipementIdPrev;
};
struct NPCVendorEntry
{
uint32 entry; // creature entry
uint32 item; // item id
int32 maxcount; // 0 for infinite
uint32 incrtime; // time for restore items amount if maxcount != 0
uint32 Entry; // creature entry
uint32 Item; // item id
int32 MaxCount; // 0 for infinite
uint32 Incrtime; // time for restore items amount if maxcount != 0
uint32 ExtendedCost;
};
@@ -105,46 +105,62 @@ public:
typedef std::set<uint16> ActiveEvents;
typedef std::vector<GameEventData> GameEventDataMap;
[[nodiscard]] ActiveEvents const& GetActiveEventList() const { return m_ActiveEvents; }
[[nodiscard]] GameEventDataMap const& GetEventMap() const { return mGameEvent; }
[[nodiscard]] ActiveEvents const& GetActiveEventList() const { return _activeEvents; }
[[nodiscard]] GameEventDataMap const& GetEventMap() const { return _gameEvent; }
[[nodiscard]] bool CheckOneGameEvent(uint16 entry) const;
[[nodiscard]] uint32 NextCheck(uint16 entry) const;
void LoadFromDB();
void LoadHolidayDates();
uint32 Update();
bool IsActiveEvent(uint16 event_id) { return (m_ActiveEvents.find(event_id) != m_ActiveEvents.end()); }
bool IsActiveEvent(uint16 eventId) { return (_activeEvents.find(eventId) != _activeEvents.end()); }
uint32 StartSystem();
void Initialize();
void StartArenaSeason();
void StartInternalEvent(uint16 event_id);
bool StartEvent(uint16 event_id, bool overwrite = false);
void StopEvent(uint16 event_id, bool overwrite = false);
void HandleQuestComplete(uint32 quest_id); // called on world event type quest completions
void StartInternalEvent(uint16 eventId);
bool StartEvent(uint16 eventId, bool overwrite = false);
void StopEvent(uint16 eventId, bool overwrite = false);
void HandleQuestComplete(uint32 questId); // called on world event type quest completions
uint32 GetNPCFlag(Creature* cr);
// Load the game event npc vendor table from the DB
void LoadEventVendors();
[[nodiscard]] uint32 GetHolidayEventId(uint32 holidayId) const;
private:
void SendWorldStateUpdate(Player* player, uint16 event_id);
void AddActiveEvent(uint16 event_id) { m_ActiveEvents.insert(event_id); }
void RemoveActiveEvent(uint16 event_id) { m_ActiveEvents.erase(event_id); }
void ApplyNewEvent(uint16 event_id);
void UnApplyEvent(uint16 event_id);
void GameEventSpawn(int16 event_id);
void GameEventUnspawn(int16 event_id);
void ChangeEquipOrModel(int16 event_id, bool activate);
void UpdateEventQuests(uint16 event_id, bool activate);
void UpdateWorldStates(uint16 event_id, bool Activate);
void UpdateEventNPCFlags(uint16 event_id);
void UpdateEventNPCVendor(uint16 event_id, bool activate);
void LoadEvents();
void LoadEventSaveData();
void LoadEventPrerequisiteData();
void LoadEventCreatureData();
void LoadEventGameObjectData();
void LoadEventModelEquipmentChangeData();
void LoadEventQuestData();
void LoadEventGameObjectQuestData();
void LoadEventQuestConditionData();
void LoadEventConditionData();
void LoadEventConditionSaveData();
void LoadEventNPCFlags();
void LoadEventSeasonalQuestRelations();
void LoadEventBattlegroundData();
void LoadEventPoolData();
void SendWorldStateUpdate(Player* player, uint16 eventId);
void AddActiveEvent(uint16 eventId) { _activeEvents.insert(eventId); }
void RemoveActiveEvent(uint16 eventId) { _activeEvents.erase(eventId); }
void ApplyNewEvent(uint16 eventId);
void UnApplyEvent(uint16 eventId);
void GameEventSpawn(int16 eventId);
void GameEventUnspawn(int16 eventId);
void ChangeEquipOrModel(int16 eventId, bool activate);
void UpdateEventQuests(uint16 eventId, bool activate);
void UpdateWorldStates(uint16 eventId, bool Activate);
void UpdateEventNPCFlags(uint16 eventId);
void UpdateEventNPCVendor(uint16 eventId, bool activate);
void UpdateBattlegroundSettings();
void RunSmartAIScripts(uint16 event_id, bool activate); //! Runs SMART_EVENT_GAME_EVENT_START/_END SAI
bool CheckOneGameEventConditions(uint16 event_id);
void SaveWorldEventStateToDB(uint16 event_id);
bool hasCreatureQuestActiveEventExcept(uint32 quest_id, uint16 event_id);
bool hasGameObjectQuestActiveEventExcept(uint32 quest_id, uint16 event_id);
bool hasCreatureActiveEventExcept(ObjectGuid::LowType creature_guid, uint16 event_id);
bool hasGameObjectActiveEventExcept(ObjectGuid::LowType go_guid, uint16 event_id);
void RunSmartAIScripts(uint16 eventId, bool activate); //! Runs SMART_EVENT_GAME_EVENT_START/_END SAI
bool CheckOneGameEventConditions(uint16 eventId);
void SaveWorldEventStateToDB(uint16 eventId);
bool HasCreatureQuestActiveEventExcept(uint32 quest_id, uint16 eventId);
bool HasGameObjectQuestActiveEventExcept(uint32 quest_id, uint16 eventId);
bool HasCreatureActiveEventExcept(ObjectGuid::LowType creature_guid, uint16 eventId);
bool HasGameObjectActiveEventExcept(ObjectGuid::LowType go_guid, uint16 eventId);
void SetHolidayEventTime(GameEventData& event);
typedef std::list<ObjectGuid::LowType> GuidLowList;
@@ -165,29 +181,27 @@ private:
typedef std::vector<NPCFlagList> GameEventNPCFlagMap;
typedef std::vector<uint32> GameEventBitmask;
typedef std::unordered_map<uint32, std::vector<uint32>> GameEventSeasonalQuestsMap;
GameEventQuestMap mGameEventCreatureQuests;
GameEventQuestMap mGameEventGameObjectQuests;
GameEventNPCVendorMap mGameEventVendors;
GameEventModelEquipMap mGameEventModelEquip;
//GameEventGuidMap mGameEventCreatureGuids;
//GameEventGuidMap mGameEventGameobjectGuids;
GameEventIdMap mGameEventPoolIds;
GameEventDataMap mGameEvent;
GameEventBitmask mGameEventBattlegroundHolidays;
QuestIdToEventConditionMap mQuestToEventConditions;
GameEventNPCFlagMap mGameEventNPCFlags;
ActiveEvents m_ActiveEvents;
bool isSystemInit;
GameEventQuestMap _gameEventCreatureQuests;
GameEventQuestMap _gameEventGameObjectQuests;
GameEventNPCVendorMap _gameEventVendors;
GameEventModelEquipMap _gameEventModelEquip;
GameEventIdMap _gameEventPoolIds;
GameEventDataMap _gameEvent;
GameEventBitmask _gameEventBattlegroundHolidays;
QuestIdToEventConditionMap _questToEventConditions;
GameEventNPCFlagMap _gameEventNPCFlags;
ActiveEvents _activeEvents;
bool _isSystemInit;
GameEventSeasonalQuestsMap _gameEventSeasonalQuestsMap;
public:
GameEventGuidMap mGameEventCreatureGuids;
GameEventGuidMap mGameEventGameobjectGuids;
std::vector<uint32> modifiedHolidays;
GameEventGuidMap GameEventCreatureGuids;
GameEventGuidMap GameEventGameobjectGuids;
std::vector<uint32> ModifiedHolidays;
};
#define sGameEventMgr GameEventMgr::instance()
bool IsHolidayActive(HolidayIds id);
bool IsEventActive(uint16 event_id);
bool IsEventActive(uint16 eventId);
#endif
+2 -2
View File
@@ -1651,7 +1651,7 @@ CreatureModel const* ObjectMgr::ChooseDisplayId(CreatureTemplate const* cinfo, C
if (CreatureModel const* model = cinfo->GetModelWithDisplayId(data->displayid))
return model;
if (!(cinfo->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER))
if (!cinfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_TRIGGER))
if (CreatureModel const* model = cinfo->GetRandomValidModel())
return model;
@@ -2233,7 +2233,7 @@ void ObjectMgr::LoadCreatures()
data.equipmentId = 0;
}
}
if ((cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) || (data.id2 && cInfo2->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) || (data.id3 && cInfo3->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND))
if (cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_INSTANCE_BIND) || (data.id2 && cInfo2->HasFlagsExtra(CREATURE_FLAG_EXTRA_INSTANCE_BIND)) || (data.id3 && cInfo3->HasFlagsExtra(CREATURE_FLAG_EXTRA_INSTANCE_BIND)))
{
if (!mapEntry->IsDungeon())
LOG_ERROR("sql.sql", "Table `creature` have creature (SpawnId: {} Entries: {}, {}, {}) with a `creature_template`.`flags_extra` in one or more entries including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.",
+2 -2
View File
@@ -153,8 +153,8 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
data.append(dataBuffer);
/// @todo: Fix this, how we do know how many and what holidays to send?
data << uint32(sGameEventMgr->modifiedHolidays.size());
for (uint32 entry : sGameEventMgr->modifiedHolidays)
data << uint32(sGameEventMgr->ModifiedHolidays.size());
for (uint32 entry : sGameEventMgr->ModifiedHolidays)
{
HolidaysEntry const* holiday = sHolidaysStore.LookupEntry(entry);
+1 -1
View File
@@ -743,7 +743,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
return;
}
if ((creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_SELL_VENDOR) != 0)
if (creature->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_SELL_VENDOR))
{
_player->SendSellError(SELL_ERR_CANT_SELL_TO_THIS_MERCHANT, creature, itemguid, 0);
return;
+4 -12
View File
@@ -70,14 +70,12 @@ void WorldSession::SendTradeStatus(TradeStatus status)
void WorldSession::HandleIgnoreTradeOpcode(WorldPacket& /*recvPacket*/)
{
LOG_DEBUG("network", "WORLD: Ignore Trade {}", _player->GetGUID().ToString());
// recvPacket.print_storage();
_player->TradeCancel(true, TRADE_STATUS_IGNORE_YOU);
}
void WorldSession::HandleBusyTradeOpcode(WorldPacket& /*recvPacket*/)
{
LOG_DEBUG("network", "WORLD: Busy Trade {}", _player->GetGUID().ToString());
// recvPacket.print_storage();
_player->TradeCancel(true, TRADE_STATUS_BUSY);
}
void WorldSession::SendUpdateTrade(bool trader_data /*= true*/)
@@ -526,12 +524,12 @@ void WorldSession::HandleBeginTradeOpcode(WorldPacket& /*recvPacket*/)
SendTradeStatus(TRADE_STATUS_OPEN_WINDOW);
}
void WorldSession::SendCancelTrade()
void WorldSession::SendCancelTrade(TradeStatus status)
{
if (PlayerRecentlyLoggedOut() || PlayerLogout())
return;
SendTradeStatus(TRADE_STATUS_TRADE_CANCELED);
SendTradeStatus(status);
}
void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/)
@@ -620,12 +618,6 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
return;
}
if (pOther->GetSocial()->HasIgnore(GetPlayer()->GetGUID()))
{
SendTradeStatus(TRADE_STATUS_IGNORE_YOU);
return;
}
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeamId() != _player->GetTeamId())
{
SendTradeStatus(TRADE_STATUS_WRONG_FACTION);
+4 -4
View File
@@ -3724,14 +3724,14 @@ void Map::RemoveOldCorpses()
}
}
void Map::ScheduleCreatureRespawn(ObjectGuid creatureGuid, Milliseconds respawnTimer)
void Map::ScheduleCreatureRespawn(ObjectGuid creatureGuid, Milliseconds respawnTimer, Position pos)
{
_creatureRespawnScheduler.Schedule(respawnTimer, [this, creatureGuid](TaskContext)
_creatureRespawnScheduler.Schedule(respawnTimer, [this, creatureGuid, pos](TaskContext)
{
if (Creature* creature = GetCreature(creatureGuid))
{
creature->Respawn();
}
else
SummonCreature(creatureGuid.GetEntry(), pos);
});
}
+1 -1
View File
@@ -596,7 +596,7 @@ public:
TaskScheduler _creatureRespawnScheduler;
void ScheduleCreatureRespawn(ObjectGuid /*creatureGuid*/, Milliseconds /*respawnTimer*/);
void ScheduleCreatureRespawn(ObjectGuid /*creatureGuid*/, Milliseconds /*respawnTimer*/, Position pos = Position());
void LoadCorpseData();
void DeleteCorpseData();
+1 -1
View File
@@ -167,7 +167,7 @@ Map::EnterState MapMgr::PlayerCannotEnter(uint32 mapid, Player* player, bool log
{
// probably there must be special opcode, because client has this string constant in GlobalStrings.lua
/// @todo: this is not a good place to send the message
player->GetSession()->SendAreaTriggerMessage(player->GetSession()->GetAcoreString(LANG_INSTANCE_RAID_GROUP_ONLY), mapName);
player->GetSession()->SendAreaTriggerMessage(LANG_INSTANCE_RAID_GROUP_ONLY, mapName);
LOG_DEBUG("maps", "MAP: Player '{}' must be in a raid group to enter instance '{}'", player->GetName(), mapName);
return Map::CANNOT_ENTER_NOT_IN_RAID;
}
+1 -1
View File
@@ -74,7 +74,7 @@ uint32 Acore::XP::Gain(Player* player, Unit* unit, bool isBattleGround /*= false
uint32 gain = 0;
if (!creature || (!creature->IsTotem() && !creature->IsPet() && !creature->IsCritter() &&
!(creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP)))
!creature->HasFlagsExtra(CREATURE_FLAG_EXTRA_NO_XP)))
{
float xpMod = 1.0f;
+2 -2
View File
@@ -372,7 +372,7 @@ public:
void SendAreaTriggerMessage(std::string_view str);
template<typename... Args>
void SendAreaTriggerMessage(std::string fmt, Args&&... args)
void SendAreaTriggerMessage(char const* fmt, Args&&... args)
{
if (!m_playerLoading)
SendAreaTriggerMessage(Acore::StringFormat(fmt, std::forward<Args>(args)...));
@@ -466,7 +466,7 @@ public:
void SendTradeStatus(TradeStatus status);
void SendUpdateTrade(bool trader_data = true);
void SendCancelTrade();
void SendCancelTrade(TradeStatus status);
void SendPetitionQueryOpcode(ObjectGuid petitionguid);
@@ -3107,6 +3107,7 @@ void SpellMgr::LoadSpellInfoCorrections()
// Tail Smash (Sindragosa)
ApplySpellFix({ 71077 }, [](SpellInfo* spellInfo)
{
spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LINE_OF_SIGHT;
spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_DEST_CASTER_BACK);
spellInfo->Effects[EFFECT_0].TargetB = SpellImplicitTargetInfo(TARGET_UNIT_DEST_AREA_ENEMY);
spellInfo->Effects[EFFECT_1].TargetA = SpellImplicitTargetInfo(TARGET_DEST_CASTER_BACK);
+3 -3
View File
@@ -881,9 +881,9 @@ std::string WorldState::GetSunsReachPrintout()
}
};
output += "Sunwell Plateau Gate Phase " + std::to_string(m_sunsReachData.m_gate) + " (" + formatGatePhase(m_sunsReachData.m_gate) + ")" + ":\n";
output += " 0. Gate 1 (Agamath): " + std::string(m_sunsReachData.m_gate >= SUNWELL_AGAMATH_GATE1_OPEN ? "Open " : "Closed ") + std::to_string(m_sunsReachData.m_sunsReachReclamationCounters[COUNTER_AGAMATH_THE_FIRST_GATE]) + " (" + std::to_string(m_sunsReachData.GetSunwellGatePercentage(SUNWELL_ALL_GATES_CLOSED)) + "%)\n";
output += " 1. Gate 2 (Rohendor): " + std::string(m_sunsReachData.m_gate >= SUNWELL_ROHENDOR_GATE2_OPEN ? "Open " : "Closed ") + std::to_string(m_sunsReachData.m_sunsReachReclamationCounters[COUNTER_ROHENDOR_THE_SECOND_GATE]) + " (" + std::to_string(m_sunsReachData.GetSunwellGatePercentage(SUNWELL_AGAMATH_GATE1_OPEN)) + "%)\n";
output += " 2. Gate 3 (Archonisus): " + std::string(m_sunsReachData.m_gate >= SUNWELL_ARCHONISUS_GATE3_OPEN ? "Open " : "Closed ") + std::to_string(m_sunsReachData.m_sunsReachReclamationCounters[COUNTER_ARCHONISUS_THE_FINAL_GATE]) + " (" + std::to_string(m_sunsReachData.GetSunwellGatePercentage(SUNWELL_ROHENDOR_GATE2_OPEN)) + "%)\n";
output += " 0. Gate 1 (Agamath): " + std::string(m_sunsReachData.m_gate >= SUNWELL_AGAMATH_GATE1_OPEN ? "Open " : "Closed ") + std::to_string(m_sunsReachData.m_gateCounters[COUNTER_AGAMATH_THE_FIRST_GATE]) + " (" + std::to_string(m_sunsReachData.GetSunwellGatePercentage(SUNWELL_ALL_GATES_CLOSED)) + "%)\n";
output += " 1. Gate 2 (Rohendor): " + std::string(m_sunsReachData.m_gate >= SUNWELL_ROHENDOR_GATE2_OPEN ? "Open " : "Closed ") + std::to_string(m_sunsReachData.m_gateCounters[COUNTER_ROHENDOR_THE_SECOND_GATE]) + " (" + std::to_string(m_sunsReachData.GetSunwellGatePercentage(SUNWELL_AGAMATH_GATE1_OPEN)) + "%)\n";
output += " 2. Gate 3 (Archonisus): " + std::string(m_sunsReachData.m_gate >= SUNWELL_ARCHONISUS_GATE3_OPEN ? "Open " : "Closed ") + std::to_string(m_sunsReachData.m_gateCounters[COUNTER_ARCHONISUS_THE_FINAL_GATE]) + " (" + std::to_string(m_sunsReachData.GetSunwellGatePercentage(SUNWELL_ROHENDOR_GATE2_OPEN)) + "%)\n";
return output;
}
+12 -12
View File
@@ -68,9 +68,9 @@ public:
GameEventData const& eventData = events[eventId];
if (handler->GetSession())
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, eventId, eventId, eventData.description, active);
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, eventId, eventId, eventData.Description, active);
else
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, eventId, eventData.description, active);
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, eventId, eventData.Description, active);
++counter;
}
@@ -104,17 +104,17 @@ public:
bool active = activeEvents.find(eventId) != activeEvents.end();
std::string activeStr = active ? handler->GetAcoreString(LANG_ACTIVE) : "";
std::string startTimeStr = Acore::Time::TimeToTimestampStr(Seconds(eventData.start));
std::string endTimeStr = Acore::Time::TimeToTimestampStr(Seconds(eventData.end));
std::string startTimeStr = Acore::Time::TimeToTimestampStr(Seconds(eventData.Start));
std::string endTimeStr = Acore::Time::TimeToTimestampStr(Seconds(eventData.End));
uint32 delay = sGameEventMgr->NextCheck(eventId);
time_t nextTime = GameTime::GetGameTime().count() + delay;
std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? Acore::Time::TimeToTimestampStr(Seconds(nextTime)) : "-";
std::string nextStr = nextTime >= eventData.Start && nextTime < eventData.End ? Acore::Time::TimeToTimestampStr(Seconds(nextTime)) : "-";
std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE, true);
std::string lengthStr = secsToTimeString(eventData.length * MINUTE, true);
std::string occurenceStr = secsToTimeString(eventData.Occurence * MINUTE, true);
std::string lengthStr = secsToTimeString(eventData.Length * MINUTE, true);
handler->PSendSysMessage(LANG_EVENT_INFO, uint16(eventId), eventData.description, activeStr,
handler->PSendSysMessage(LANG_EVENT_INFO, uint16(eventId), eventData.Description, activeStr,
startTimeStr, endTimeStr, occurenceStr, lengthStr,
nextStr);
@@ -141,11 +141,11 @@ public:
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
if (activeEvents.find(eventId) != activeEvents.end())
{
handler->SendErrorMessage(LANG_EVENT_ALREADY_ACTIVE, uint16(eventId), eventData.description);
handler->SendErrorMessage(LANG_EVENT_ALREADY_ACTIVE, uint16(eventId), eventData.Description);
return false;
}
handler->PSendSysMessage(LANG_EVENT_STARTED, uint16(eventId), eventData.description);
handler->PSendSysMessage(LANG_EVENT_STARTED, uint16(eventId), eventData.Description);
sGameEventMgr->StartEvent(eventId, true);
return true;
}
@@ -171,11 +171,11 @@ public:
if (activeEvents.find(eventId) == activeEvents.end())
{
handler->SendErrorMessage(LANG_EVENT_NOT_ACTIVE, uint16(eventId), eventData.description);
handler->SendErrorMessage(LANG_EVENT_NOT_ACTIVE, uint16(eventId), eventData.Description);
return false;
}
handler->PSendSysMessage(LANG_EVENT_STOPPED, uint16(eventId), eventData.description);
handler->PSendSysMessage(LANG_EVENT_STOPPED, uint16(eventId), eventData.Description);
sGameEventMgr->StopEvent(eventId, true);
return true;
}
+3 -17
View File
@@ -269,17 +269,13 @@ public:
static bool HandleLookupEventCommand(ChatHandler* handler, Tail namePart)
{
if (namePart.empty())
{
return false;
}
std::wstring wNamePart;
// converting string that we try to find to lower case
if (!Utf8toWStr(namePart, wNamePart))
{
return false;
}
wstrToLower(wNamePart);
@@ -294,11 +290,9 @@ public:
{
GameEventData const& eventData = events[id];
std::string descr = eventData.description;
std::string descr = eventData.Description;
if (descr.empty())
{
continue;
}
if (Utf8FitTo(descr, wNamePart))
{
@@ -311,25 +305,17 @@ public:
std::string active = activeEvents.find(id) != activeEvents.end() ? handler->GetAcoreString(LANG_ACTIVE) : "";
if (handler->GetSession())
{
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.description, active);
}
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, id, id, eventData.Description, active);
else
{
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.description, active);
}
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, id, eventData.Description, active);
if (!found)
{
found = true;
}
}
}
if (!found)
{
handler->SendSysMessage(LANG_NOEVENTFOUND);
}
return true;
}
@@ -83,7 +83,7 @@ public:
handler->PSendSysMessage("Invalid subphase, see \".worldstate sunsreach subphase\" for usage");
return false;
}
sWorldState->HandleSunsReachSubPhaseTransition(subphase);;
sWorldState->HandleSunsReachSubPhaseTransition(subphase);
handler->PSendSysMessage(sWorldState->GetSunsReachPrintout());
return true;
}
@@ -354,9 +354,8 @@ struct npc_madrigosa : public NullCreatureAI
}
break;
case EVENT_SPAWN_FELMYST:
DoCastAOE(SPELL_SUMMON_FELBLAZE, true);
me->DespawnOrUnsummon(1);
if (Creature* felmyst = instance->GetCreature(DATA_FELMYST))
felmyst->AI()->DoAction(ACTION_START_EVENT);
break;
}
}
@@ -100,30 +100,30 @@ private:
struct boss_felmyst : public BossAI
{
boss_felmyst(Creature* creature) : BossAI(creature, DATA_FELMYST)
{
bool appear = instance->GetBossState(DATA_BRUTALLUS) == DONE;
creature->SetVisible(appear);
creature->SetStandState(UNIT_STAND_STATE_SLEEP);
creature->SetReactState(REACT_PASSIVE);
}
boss_felmyst(Creature* creature) : BossAI(creature, DATA_FELMYST) { }
void DoAction(int32 param) override
void InitializeAI() override
{
if (param == ACTION_START_EVENT)
me->SetReactState(REACT_PASSIVE);
if (instance->GetBossState(DATA_FELMYST) == TO_BE_DECIDED)
{
me->SetVisible(true);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetStandState(UNIT_STAND_STATE_SLEEP);
me->SetImmuneToPC(true);
StartIntro();
}
else
{
me->SetCanFly(true);
me->SetDisableGravity(true);
me->SendMovementFlagUpdate();
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, true);
}
}
void Reset() override
{
BossAI::Reset();
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_PASSIVE);
me->SetDisableGravity(false);
me->m_Events.KillAllEvents(false);
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_FOG_OF_CORRUPTION_CHARM);
}
@@ -131,10 +131,18 @@ struct boss_felmyst : public BossAI
void JustEngagedWith(Unit* who) override
{
BossAI::JustEngagedWith(who);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->CastSpell(me, SPELL_NOXIOUS_FUMES, true);
me->m_Events.AddEventAtOffset([&] {
Talk(YELL_BERSERK);
DoCastSelf(SPELL_BERSERK, true);
}, 10min);
if (!scheduler.IsGroupScheduled(GROUP_START_INTRO))
StartIntro();
me->GetMotionMaster()->Clear();
Position landPos = who->GetPosition();
me->m_Events.AddEventAtOffset([&, landPos] {
me->GetMotionMaster()->MovePoint(POINT_GROUND, landPos, false, true);
}, 2s);
}
void KilledUnit(Unit* victim) override
@@ -146,6 +154,7 @@ struct boss_felmyst : public BossAI
void JustDied(Unit* killer) override
{
BossAI::JustDied(killer);
me->m_Events.KillAllEvents(false);
Talk(YELL_DEATH);
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_FOG_OF_CORRUPTION_CHARM);
@@ -161,8 +170,10 @@ struct boss_felmyst : public BossAI
if (point == POINT_GROUND)
{
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
me->SetCanFly(false);
me->SetDisableGravity(false);
me->SendMovementFlagUpdate();
SetInvincibility(false);
me->m_Events.AddEventAtOffset([&] {
me->SetReactState(REACT_AGGRESSIVE);
@@ -171,7 +182,7 @@ struct boss_felmyst : public BossAI
me->SetTarget(me->GetVictim()->GetGUID());
me->ResumeChasingVictim();
}, 1s);
}, 2s);
ScheduleTimedEvent(7500ms, [&] {
DoCastVictim(SPELL_CLEAVE);
@@ -238,6 +249,7 @@ struct boss_felmyst : public BossAI
me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
me->SetDisableGravity(true);
me->SendMovementFlagUpdate();
SetInvincibility(true);
me->m_Events.AddEventAtOffset([&] {
me->GetMotionMaster()->MovePoint(POINT_AIR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 15.0f, false, true);
@@ -304,30 +316,16 @@ struct boss_felmyst : public BossAI
me->m_Events.AddEventAtOffset([&] {
Talk(YELL_BIRTH);
me->SetCanFly(true);
me->SetDisableGravity(true);
me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
me->SendMovementFlagUpdate();
me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
}, 7s);
me->m_Events.AddEventAtOffset([&] {
me->GetMotionMaster()->MovePoint(POINT_AIR, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 10.0f, false, true);
me->SetImmuneToPC(false);
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, true);
}, 8500ms);
me->m_Events.AddEventAtOffset([&] {
me->SetInCombatWithZone();
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->CastSpell(me, SPELL_NOXIOUS_FUMES, true);
me->GetMotionMaster()->MovePoint(POINT_MISC, 1472.18f, 603.38f, 34.0f, false, true);
me->m_Events.AddEventAtOffset([&] {
me->GetMotionMaster()->MovePoint(POINT_GROUND, me->GetPositionX(), me->GetPositionY(), me->GetMapHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()), false, true);
}, 3s);
me->m_Events.AddEventAtOffset([&] {
Talk(YELL_BERSERK);
DoCastSelf(SPELL_BERSERK, true);
}, 10min);
}, 10500ms);
});
}
@@ -106,12 +106,6 @@ struct boss_kalecgos : public BossAI
return true;
}
void JustReachedHome() override
{
BossAI::JustReachedHome();
me->SetVisible(true);
}
void Reset() override
{
BossAI::Reset();
@@ -175,7 +169,6 @@ struct boss_kalecgos : public BossAI
}, 4s);
me->m_Events.AddEventAtOffset([&] {
me->SetVisible(false);
EnterEvadeMode();
}, 9s);
@@ -251,10 +244,11 @@ struct boss_kalecgos : public BossAI
DoCastAOE(SPELL_SPECTRAL_BLAST);
}, 15s, 25s);
me->m_Events.AddEventAtOffset([&] {
scheduler.Schedule(16s, [this](TaskContext)
{
me->SummonCreature(NPC_KALEC, 1702.21f, 931.7f, -74.56f, 5.07f, TEMPSUMMON_MANUAL_DESPAWN);
me->SummonCreature(NPC_SATHROVARR, 1704.62f, 927.78f, -73.9f, 2.0f, TEMPSUMMON_MANUAL_DESPAWN);
}, 16s);
});
me->SetStandState(UNIT_STAND_STATE_STAND);
Talk(SAY_EVIL_AGGRO);
@@ -282,10 +276,7 @@ enum Kalec
struct boss_kalec : public ScriptedAI
{
boss_kalec(Creature* creature) : ScriptedAI(creature)
{
SetInvincibility(true);
}
boss_kalec(Creature* creature) : ScriptedAI(creature) { }
void Reset() override
{
@@ -89,6 +89,18 @@ public:
LoadSummonData(summonData);
}
void Load(char const* data) override
{
InstanceScript::Load(data);
scheduler.Schedule(3s, [this](TaskContext /*context*/)
{
if (IsBossDone(DATA_BRUTALLUS) && !IsBossDone(DATA_FELMYST))
if (Creature* madrigosa = GetCreature(DATA_MADRIGOSA))
madrigosa->CastSpell((Unit*)nullptr, SPELL_SUMMON_FELBLAZE, true);
});
}
void OnPlayerEnter(Player* player) override
{
instance->LoadGrid(1477.94f, 643.22f);
@@ -106,6 +106,11 @@ enum GameObjectIds
GO_ORB_OF_THE_BLUE_DRAGONFLIGHT4 = 188116
};
enum SpellIds
{
SPELL_SUMMON_FELBLAZE = 45069 // Felblaze? Summons Felmyst
};
template <class AI, class T>
inline AI* GetSunwellPlateauAI(T* obj)
{
@@ -1114,10 +1114,9 @@ public:
return !_caster->IsWithinLOSInMap(unit);
// for players and pets check only dynamic los (ice block gameobjects)
float ox, oy, oz;
_caster->GetPosition(ox, oy, oz);
DynamicMapTree const& dTree = unit->GetMap()->GetDynamicMapTree();
return !dTree.isInLineOfSight(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ() + 2.f, ox, oy, oz + 2.f, unit->GetPhaseMask(), VMAP::ModelIgnoreFlags::Nothing);
if (unit->IsUnit() && unit->ToUnit()->HasUnitState(UNIT_STATE_MELEE_ATTACKING) && unit->ToUnit()->IsWithinMeleeRange(_caster))
return false;
return !_caster->IsWithinLOSInMap(unit, VMAP::ModelIgnoreFlags::Nothing, LINEOFSIGHT_CHECK_GOBJECT_M2, 0, _caster->GetCombatReach() * 0.7);
}
private:
@@ -1161,17 +1161,6 @@ public:
{
IsSindragosaIntroDone = true;
HandleDropAttempt();
if (instance->IsHeroic())
{
if (HeroicAttempts)
{
Events.ScheduleEvent(EVENT_RESPAWN_SINDRAGOSA, 30s);
}
}
else
{
Events.ScheduleEvent(EVENT_RESPAWN_SINDRAGOSA, 30s);
}
}
if (state == DONE && !instance->IsHeroic() && LichKingHeroicAvailable)
{
@@ -369,6 +369,9 @@ public:
break;
case NPC_ALGALON:
m_uiAlgalonGUID = creature->GetGUID();
if (!m_algalonTimer)
creature->DespawnOrUnsummon();
break;
case NPC_HARPOON_FIRE_STATE:
{
@@ -811,17 +814,6 @@ public:
go->EnableCollision(false);
}
if (data == FAIL)
{
scheduler.Schedule(5s, [this](TaskContext)
{
if (m_algalonTimer && (m_algalonTimer <= 60 || m_algalonTimer == TIMER_ALGALON_TO_SUMMON))
{
instance->SummonCreature(NPC_ALGALON, AlgalonLandPos);
}
});
}
break;
// Achievement
@@ -444,7 +444,9 @@ public:
void MoveInLineOfSight(Unit* who) override
{
if (!who || !who->IsInWorld() || who->GetZoneId() != 4395)
// 4395 Dalaran
// 4569 Sewer Exit Pipe
if (!who || !who->IsInWorld()|| who->GetZoneId() != 4395 || who->GetAreaId() == 4569)
return;
if (!me->IsWithinDist(who, 5.0f, false))
@@ -5400,6 +5400,38 @@ class spell_gen_proc_on_victim : public AuraScript
}
};
enum TranslocateSpells
{
SPELL_TRANSLOCATION_DOWN = 45368,
SPELL_TRANSLOCATION_UP = 45371
};
class spell_gen_translocate : public SpellScript
{
PrepareSpellScript(spell_gen_translocate);
public:
spell_gen_translocate(uint32 spellId) : SpellScript(), _spellId(spellId) {}
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ _spellId });
}
void HandleScript()
{
GetCaster()->CastSpell(GetCaster(), _spellId);
}
void Register() override
{
AfterCast += SpellCastFn(spell_gen_translocate::HandleScript);
}
private:
uint32 _spellId;
};
void AddSC_generic_spell_scripts()
{
RegisterSpellScript(spell_silithyst);
@@ -5560,4 +5592,6 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_set_health);
RegisterSpellScript(spell_pet_spellhit_expertise_spellpen_scaling);
RegisterSpellScript(spell_gen_proc_on_victim);
RegisterSpellScriptWithArgs(spell_gen_translocate, "spell_gen_translocate_down", SPELL_TRANSLOCATION_DOWN);
RegisterSpellScriptWithArgs(spell_gen_translocate, "spell_gen_translocate_up", SPELL_TRANSLOCATION_UP);
}