Merge branch 'master' of git://github.com/TrinityCore/TrinityCore into mmaps
This commit is contained in:
commit
c3a049df82
8 files changed
+89
-82
No files matched your search
@@ -297,14 +297,13 @@ void ScriptedAI::DoTeleportTo(const float position[4])
|
||||
|
||||
void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o)
|
||||
{
|
||||
if (!unit || unit->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
if (unit)
|
||||
sLog->outError("TSCR: Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
|
||||
if (!unit)
|
||||
return;
|
||||
}
|
||||
|
||||
CAST_PLR(unit)->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
|
||||
if (Player* player = unit->ToPlayer())
|
||||
player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
|
||||
else
|
||||
sLog->outError("TSCR: Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
|
||||
}
|
||||
|
||||
void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
|
||||
|
||||
@@ -4593,40 +4593,38 @@ bool ChatHandler::HandleUnFreezeCommand(const char *args)
|
||||
{
|
||||
std::string name;
|
||||
Player* player;
|
||||
char *TargetName = strtok((char*)args, " "); //get entered name
|
||||
if (!TargetName) //if no name entered use target
|
||||
{
|
||||
player = getSelectedPlayer();
|
||||
if (player) //prevent crash with creature as target
|
||||
name = player->GetName();
|
||||
}
|
||||
char* targetName = strtok((char*)args, " "); // Get entered name
|
||||
|
||||
else // if name entered
|
||||
if (targetName)
|
||||
{
|
||||
name = TargetName;
|
||||
name = targetName;
|
||||
normalizePlayerName(name);
|
||||
player = sObjectAccessor->FindPlayerByName(name.c_str());
|
||||
}
|
||||
else // If no name was entered - use target
|
||||
{
|
||||
player = getSelectedPlayer();
|
||||
if (player)
|
||||
name = player->GetName();
|
||||
}
|
||||
|
||||
//effect
|
||||
if (player)
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
|
||||
|
||||
//Reset player faction + allow combat + allow duels
|
||||
// Reset player faction + allow combat + allow duels
|
||||
player->setFactionForRace(player->getRace());
|
||||
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
|
||||
//allow movement and spells
|
||||
// Remove Freeze spell (allowing movement and spells)
|
||||
player->RemoveAurasDueToSpell(9454);
|
||||
|
||||
//save player
|
||||
// Save player
|
||||
player->SaveToDB();
|
||||
}
|
||||
|
||||
if (!player)
|
||||
else
|
||||
{
|
||||
if (TargetName)
|
||||
if (targetName)
|
||||
{
|
||||
// Check for offline players
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_GUID_BY_NAME);
|
||||
@@ -4638,12 +4636,13 @@ bool ChatHandler::HandleUnFreezeCommand(const char *args)
|
||||
SendSysMessage(LANG_COMMAND_FREEZE_WRONG);
|
||||
return true;
|
||||
}
|
||||
//if player found: delete his freeze aura
|
||||
Field* fields=result->Fetch();
|
||||
uint64 pguid = fields[0].GetUInt64();
|
||||
|
||||
// If player found: delete his freeze aura
|
||||
Field* fields = result->Fetch();
|
||||
uint32 lowGuid = fields[0].GetUInt32();
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_AURA_FROZEN);
|
||||
stmt->setUInt32(0, pguid);
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str());
|
||||
|
||||
@@ -1542,7 +1542,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe
|
||||
|
||||
// Magic damage, check for resists
|
||||
// Ignore spells that cant be resisted
|
||||
if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0 && (spellInfo->AttributesEx4 & SPELL_ATTR4_IGNORE_RESISTANCES) == 0)
|
||||
if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0 && (spellInfo && (spellInfo->AttributesEx4 & SPELL_ATTR4_IGNORE_RESISTANCES) == 0))
|
||||
{
|
||||
float victimResistance = float(victim->GetResistance(schoolMask));
|
||||
victimResistance += float(GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
|
||||
|
||||
@@ -59,24 +59,24 @@ void ConfusedMovementGenerator<T>::Initialize(T &unit)
|
||||
|
||||
if ((is_water && !is_water_ok) || (!is_water && !is_land_ok))
|
||||
{
|
||||
//! Ignore bad generated path. Use the current or previous position.
|
||||
i_waypoints[idx][0] = idx > 0 ? i_waypoints[idx-1][0] : x;
|
||||
i_waypoints[idx][1] = idx > 0 ? i_waypoints[idx-1][1] : y;
|
||||
//! Cannot use coordinates outside our InhabitType. Use the current or previous position.
|
||||
wanderX = idx > 0 ? i_waypoints[idx-1][0] : x;
|
||||
wanderY = idx > 0 ? i_waypoints[idx-1][1] : y;
|
||||
}
|
||||
|
||||
unit.UpdateAllowedPositionZ(wanderX, wanderY, z);
|
||||
|
||||
//! Positions are now fine - apply them to this waypoint
|
||||
i_waypoints[idx][0] = wanderX;
|
||||
i_waypoints[idx][1] = wanderY;
|
||||
i_waypoints[idx][2] = z;
|
||||
}
|
||||
else
|
||||
{
|
||||
//! Ignore bad generated path. Use the current or previous position.
|
||||
i_waypoints[idx][0] = idx > 0 ? i_waypoints[idx-1][0] : x;
|
||||
i_waypoints[idx][1] = idx > 0 ? i_waypoints[idx-1][1] : y;
|
||||
//! Trying to access path outside line of sight. Skip this by using the current or previous position.
|
||||
wanderX = idx > 0 ? i_waypoints[idx-1][0] : x;
|
||||
wanderY = idx > 0 ? i_waypoints[idx-1][1] : y;
|
||||
}
|
||||
|
||||
unit.UpdateAllowedPositionZ(wanderX, wanderY, z);
|
||||
|
||||
//! Positions are fine - apply them to this waypoint
|
||||
i_waypoints[idx][0] = wanderX;
|
||||
i_waypoints[idx][1] = wanderY;
|
||||
i_waypoints[idx][2] = z;
|
||||
}
|
||||
|
||||
unit.StopMoving();
|
||||
|
||||
@@ -809,11 +809,11 @@ public:
|
||||
{
|
||||
for (std::list<Creature*>::const_iterator itr = MinionList.begin(); itr != MinionList.end(); ++itr)
|
||||
{
|
||||
if (CAST_CRE(*itr)->GetOwner()->GetGUID() == me->GetOwner()->GetGUID())
|
||||
if ((*itr)->GetOwner()->GetGUID() == me->GetOwner()->GetGUID())
|
||||
{
|
||||
if (CAST_CRE(*itr)->isInCombat() && CAST_CRE(*itr)->getAttackerForHelper())
|
||||
if ((*itr)->isInCombat() && (*itr)->getAttackerForHelper())
|
||||
{
|
||||
AttackStart(CAST_CRE(*itr)->getAttackerForHelper());
|
||||
AttackStart((*itr)->getAttackerForHelper());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -826,10 +826,11 @@ public:
|
||||
{
|
||||
if (Unit* owner = me->GetOwner())
|
||||
{
|
||||
if (owner->GetTypeId() == TYPEID_PLAYER && CAST_PLR(owner)->isInCombat())
|
||||
Player* plrOwner = owner->ToPlayer();
|
||||
if (plrOwner && plrOwner->isInCombat())
|
||||
{
|
||||
if (CAST_PLR(owner)->getAttackerForHelper() && CAST_PLR(owner)->getAttackerForHelper()->GetEntry() == GHOSTS)
|
||||
AttackStart(CAST_PLR(owner)->getAttackerForHelper());
|
||||
if (plrOwner->getAttackerForHelper() && plrOwner->getAttackerForHelper()->GetEntry() == GHOSTS)
|
||||
AttackStart(plrOwner->getAttackerForHelper());
|
||||
else
|
||||
FindMinions(owner);
|
||||
}
|
||||
|
||||
@@ -490,14 +490,14 @@ public:
|
||||
{
|
||||
if (PlayerGUID)
|
||||
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
|
||||
CAST_PLR(player)->FailQuest(QUEST_UNEXPECTED_RESULT);
|
||||
player->FailQuest(QUEST_UNEXPECTED_RESULT);
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 /*diff*/)
|
||||
{
|
||||
if (KillCount >= 3 && PlayerGUID)
|
||||
if (Player* player = Unit::GetPlayer(*me, PlayerGUID))
|
||||
CAST_PLR(player)->CompleteQuest(QUEST_UNEXPECTED_RESULT);
|
||||
player->CompleteQuest(QUEST_UNEXPECTED_RESULT);
|
||||
|
||||
if (Summon)
|
||||
{
|
||||
|
||||
@@ -129,8 +129,8 @@ public:
|
||||
PlayerGUID = caster->GetGUID();
|
||||
if (PlayerGUID)
|
||||
{
|
||||
Unit* player = Unit::GetUnit(*me, PlayerGUID);
|
||||
if (player && CAST_PLR(player)->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE)
|
||||
Player* player = Unit::GetPlayer(*me, PlayerGUID);
|
||||
if (player && player->GetQuestStatus(QUESTG) == QUEST_STATUS_INCOMPLETE)
|
||||
DoCast(player, 45110, true);
|
||||
}
|
||||
DoCast(me, ENRAGE);
|
||||
|
||||
@@ -979,16 +979,14 @@ public:
|
||||
//uint8 QirajiWaspCount = 0;
|
||||
for (uint8 i = 0; i < 67; ++i)
|
||||
{
|
||||
float X = SpawnLocation[locIndex + i].x;
|
||||
float Y = SpawnLocation[locIndex + i].y;
|
||||
float Z = SpawnLocation[locIndex + i].z;
|
||||
float O = SpawnLocation[locIndex + i].o;
|
||||
float x = SpawnLocation[locIndex + i].x;
|
||||
float y = SpawnLocation[locIndex + i].y;
|
||||
float z = SpawnLocation[locIndex + i].z;
|
||||
float o = SpawnLocation[locIndex + i].o;
|
||||
uint32 desptimer = WavesInfo[WaveCount].DespTimer;
|
||||
Creature* spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, X, Y, Z, O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer);
|
||||
|
||||
if (spawn)
|
||||
if (Creature* spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer))
|
||||
{
|
||||
spawn->LoadCreaturesAddon();
|
||||
if (spawn->GetEntry() == 15423)
|
||||
spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID, 15427+rand()%4);
|
||||
if (i >= 30) WaveCount = 1;
|
||||
@@ -998,9 +996,11 @@ public:
|
||||
|
||||
if (WaveCount < 5) //1-4 Wave
|
||||
{
|
||||
mob_qiraj_war_spawn::mob_qiraj_war_spawnAI* spawnAI = CAST_AI(mob_qiraj_war_spawn::mob_qiraj_war_spawnAI, spawn->AI());
|
||||
spawnAI->MobGUID = me->GetGUID();
|
||||
spawnAI->PlayerGUID = PlayerGUID;
|
||||
if (mob_qiraj_war_spawn::mob_qiraj_war_spawnAI* spawnAI = CAST_AI(mob_qiraj_war_spawn::mob_qiraj_war_spawnAI, spawn->AI()))
|
||||
{
|
||||
spawnAI->MobGUID = me->GetGUID();
|
||||
spawnAI->PlayerGUID = PlayerGUID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1017,27 +1017,27 @@ public:
|
||||
|
||||
if (Group* EventGroup = player->GetGroup())
|
||||
{
|
||||
Player* GroupMember;
|
||||
Player* groupMember;
|
||||
|
||||
uint8 GroupMemberCount = 0;
|
||||
uint8 DeadMemberCount = 0;
|
||||
uint8 FailedMemberCount = 0;
|
||||
|
||||
const Group::MemberSlotList members = EventGroup->GetMemberSlots();
|
||||
Group::MemberSlotList const members = EventGroup->GetMemberSlots();
|
||||
|
||||
for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr)
|
||||
{
|
||||
GroupMember = (Unit::GetPlayer(*me, itr->guid));
|
||||
if (!GroupMember)
|
||||
groupMember = (Unit::GetPlayer(*me, itr->guid));
|
||||
if (!groupMember)
|
||||
continue;
|
||||
if (!GroupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) == QUEST_STATUS_INCOMPLETE)
|
||||
if (!groupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && groupMember->GetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) == QUEST_STATUS_INCOMPLETE)
|
||||
{
|
||||
GroupMember->FailQuest(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD);
|
||||
groupMember->FailQuest(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD);
|
||||
++FailedMemberCount;
|
||||
}
|
||||
++GroupMemberCount;
|
||||
|
||||
if (GroupMember->isDead())
|
||||
if (groupMember->isDead())
|
||||
++DeadMemberCount;
|
||||
}
|
||||
|
||||
@@ -1081,8 +1081,13 @@ public:
|
||||
void mob_qiraj_war_spawn::mob_qiraj_war_spawnAI::JustDied(Unit* /*slayer*/)
|
||||
{
|
||||
me->RemoveCorpse();
|
||||
if (Creature* Mob = (Unit::GetCreature(*me, MobGUID)))
|
||||
CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, Mob->AI())->LiveCounter();
|
||||
|
||||
if (!MobGUID)
|
||||
return;
|
||||
|
||||
if (Creature* mob = Unit::GetCreature(*me, MobGUID))
|
||||
if (npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI* triggerAI = CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, mob->AI()))
|
||||
triggerAI->LiveCounter();
|
||||
|
||||
};
|
||||
|
||||
@@ -1099,15 +1104,13 @@ public:
|
||||
{
|
||||
if (quest->GetQuestId() == QUEST_A_PAWN_ON_THE_ETERNAL_BOARD)
|
||||
{
|
||||
|
||||
if (Unit* Anachronos_Quest_Trigger = go->FindNearestCreature(15454, 100, player))
|
||||
if (Creature* trigger = go->FindNearestCreature(15454, 100, player))
|
||||
{
|
||||
|
||||
Unit* Merithra = Anachronos_Quest_Trigger->SummonCreature(15378, -8034.535f, 1535.14f, 2.61f, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000);
|
||||
Unit* Caelestrasz = Anachronos_Quest_Trigger->SummonCreature(15379, -8032.767f, 1533.148f, 2.61f, 1.5f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000);
|
||||
Unit* Arygos = Anachronos_Quest_Trigger->SummonCreature(15380, -8034.52f, 1537.843f, 2.61f, 5.7f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000);
|
||||
/* Unit* Fandral = */ Anachronos_Quest_Trigger->SummonCreature(15382, -8028.462f, 1535.843f, 2.61f, 3.141592f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000);
|
||||
Creature* Anachronos = Anachronos_Quest_Trigger->SummonCreature(15381, -8028.75f, 1538.795f, 2.61f, 4, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000);
|
||||
Unit* Merithra = trigger->SummonCreature(15378, -8034.535f, 1535.14f, 2.61f, 0, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000);
|
||||
Unit* Caelestrasz = trigger->SummonCreature(15379, -8032.767f, 1533.148f, 2.61f, 1.5f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000);
|
||||
Unit* Arygos = trigger->SummonCreature(15380, -8034.52f, 1537.843f, 2.61f, 5.7f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000);
|
||||
/* Unit* Fandral = */ trigger->SummonCreature(15382, -8028.462f, 1535.843f, 2.61f, 3.141592f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000);
|
||||
Creature* Anachronos = trigger->SummonCreature(15381, -8028.75f, 1538.795f, 2.61f, 4, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 220000);
|
||||
|
||||
if (Merithra)
|
||||
{
|
||||
@@ -1135,11 +1138,16 @@ public:
|
||||
|
||||
if (Anachronos)
|
||||
{
|
||||
CAST_AI(npc_anachronos_the_ancient::npc_anachronos_the_ancientAI, Anachronos->AI())->PlayerGUID = player->GetGUID();
|
||||
CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Failed=false;
|
||||
CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->PlayerGUID = player->GetGUID();
|
||||
CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->EventStarted=true;
|
||||
CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Announced=true;
|
||||
if (npc_anachronos_the_ancient::npc_anachronos_the_ancientAI* anachronosAI = CAST_AI(npc_anachronos_the_ancient::npc_anachronos_the_ancientAI, Anachronos->AI()))
|
||||
anachronosAI->PlayerGUID = player->GetGUID();
|
||||
|
||||
if (npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI* triggerAI = CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, trigger->AI()))
|
||||
{
|
||||
triggerAI->Failed = false;
|
||||
triggerAI->PlayerGUID = player->GetGUID();
|
||||
triggerAI->EventStarted = true;
|
||||
triggerAI->Announced = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user