Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-04-04 07:53:51 -06:00
committed by GitHub
35 changed files with 8418 additions and 82 deletions

View File

@@ -219,6 +219,12 @@ void CreatureAI::EnterEvadeMode()
}
}
Reset();
if (me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons!
{
me->GetVehicleKit()->Reset(true);
}
// despawn bosses at reset - only verified tbc/woltk bosses with this reset type - add bosses in last line respectively (dungeon/raid) and increase array limit
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(me->GetEntry());
if (cInfo && cInfo->HasFlagsExtra(CREATURE_FLAG_EXTRA_HARD_RESET))
@@ -226,14 +232,6 @@ void CreatureAI::EnterEvadeMode()
me->DespawnOnEvade();
me->m_Events.AddEvent(new PhasedRespawn(*me), me->m_Events.CalculateTime(20000));
}
else // bosses will run back to the spawnpoint at reset
{
Reset();
if (me->IsVehicle()) // use the same sequence of addtoworld, aireset may remove all summons!
{
me->GetVehicleKit()->Reset(true);
}
}
}
/*void CreatureAI::AttackedBy(Unit* attacker)

View File

@@ -2013,18 +2013,6 @@ void Creature::DespawnOnEvade()
{
SetVisible(false);
AI()->SummonedCreatureDespawnAll();
RemoveEvadeAuras();
float x, y, z, o;
GetRespawnPosition(x, y, z, &o);
SetHomePosition(x, y, z, o);
SetPosition(x, y, z, o);
if (IsFalling())
{
RemoveUnitMovementFlag(MOVEMENTFLAG_FALLING);
}
StopMoving();
}
void Creature::RespawnOnEvade()

View File

@@ -2272,8 +2272,8 @@ void WorldObject::SetZoneScript()
{
if (Map* map = FindMap())
{
if (map->IsDungeon())
m_zoneScript = (ZoneScript*)map->ToInstanceMap()->GetInstanceScript();
if (InstanceMap* instanceMap = map->ToInstanceMap())
m_zoneScript = reinterpret_cast<ZoneScript*>(instanceMap->GetInstanceScript());
else if (!map->IsBattlegroundOrArena())
{
uint32 zoneId = GetZoneId();

View File

@@ -2009,13 +2009,8 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptr<Charact
return;
}
// xinef: check money
bool valid = Player::TeamIdForRace(oldRace) == Player::TeamIdForRace(factionChangeInfo->Race);
if ((level < 10 && money <= 0) || (level > 10 && level <= 30 && money <= 3000000) || (level > 30 && level <= 50 && money <= 10000000) ||
(level > 50 && level <= 70 && money <= 50000000) || (level > 70 && money <= 200000000))
valid = true;
if (!valid)
uint32 maxMoney = sWorld->getIntConfig(CONFIG_CHANGE_FACTION_MAX_MONEY);
if (maxMoney && money > maxMoney)
{
SendCharFactionChange(CHAR_CREATE_CHARACTER_GOLD_LIMIT, factionChangeInfo.get());
return;

View File

@@ -227,7 +227,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
ObjectGuid guid;
std::vector<uint32> nodes;
nodes.resize(2);
GetPlayer()->SetCanTeleport(true);
recvData >> guid >> nodes[0] >> nodes[1];
LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXI from {} to {}", nodes[0], nodes[1]);
Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
@@ -251,6 +251,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
void WorldSession::SendActivateTaxiReply(ActivateTaxiReply reply)
{
GetPlayer()->SetCanTeleport(true);
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
data << uint32(reply);
SendPacket(&data);

View File

@@ -4474,10 +4474,22 @@ void Spell::SendSpellStart()
if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
castFlags |= CAST_FLAG_PROJECTILE;
if ((m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet()))
&& m_spellInfo->PowerType != POWER_HEALTH && m_powerCost != 0)
if (m_caster->GetTypeId() == TYPEID_PLAYER || m_caster->IsPet())
{
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
switch (m_spellInfo->PowerType)
{
case POWER_HEALTH:
break;
case POWER_RUNE:
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
break;
default:
if (m_powerCost != 0)
{
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
}
break;
}
}
if (m_spellInfo->RuneCostID && m_spellInfo->PowerType == POWER_RUNE)
@@ -4532,10 +4544,23 @@ void Spell::SendSpellGo()
if (m_spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || m_spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
castFlags |= CAST_FLAG_PROJECTILE; // arrows/bullets visual
if ((m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet()))
&& m_spellInfo->PowerType != POWER_HEALTH && m_powerCost != 0) // should only be sent to self, but the current messaging doesn't make that possible
// should only be sent to self, but the current messaging doesn't make that possible
if (m_caster->GetTypeId() == TYPEID_PLAYER || m_caster->IsPet())
{
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
switch (m_spellInfo->PowerType)
{
case POWER_HEALTH:
break;
case POWER_RUNE:
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
break;
default:
if (m_powerCost != 0)
{
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
}
break;
}
}
if ((m_caster->GetTypeId() == TYPEID_PLAYER)

View File

@@ -398,6 +398,7 @@ enum WorldIntConfigs
CONFIG_LOOT_NEED_BEFORE_GREED_ILVL_RESTRICTION,
CONFIG_LFG_MAX_KICK_COUNT,
CONFIG_LFG_KICK_PREVENTION_TIMER,
CONFIG_CHANGE_FACTION_MAX_MONEY,
INT_CONFIG_VALUE_COUNT
};

View File

@@ -1264,6 +1264,8 @@ void World::LoadConfigSettings(bool reload)
m_bool_configs[CONFIG_ALLOW_JOIN_BG_AND_LFG] = sConfigMgr->GetOption<bool>("JoinBGAndLFG.Enable", false);
m_int_configs[CONFIG_CHANGE_FACTION_MAX_MONEY] = sConfigMgr->GetOption<uint32>("ChangeFaction.MaxMoney", 0);
///- Read the "Data" directory from the config file
std::string dataPath = sConfigMgr->GetOption<std::string>("DataDir", "./");
if (dataPath.empty() || (dataPath.at(dataPath.length() - 1) != '/' && dataPath.at(dataPath.length() - 1) != '\\'))