Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions src/bindings/scripts/scripts/zone/ashenvale_forest/ashenvale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,89 @@ bool ItemUse_item_Totemic_Beacon(Player *player, Item* _Item, SpellCastTargets c
return false;
}

#define NPC_ICECALLERBRIATHA 25949

struct TRINITY_DLL_DECL npc_Heretic_EmisaryAI : public ScriptedAI
{
npc_Heretic_EmisaryAI(Creature* c) : ScriptedAI(c) {}

uint32 TalkTimer;
uint32 Phase;
uint32 Check;
Unit * player;
Creature * Briatha;
bool EventStarted;

void Reset()
{
Phase = 0;

TalkTimer = 5000;
EventStarted = false;
}

void MoveInLineOfSight(Unit * unit)
{
if(unit->GetTypeId() == TYPEID_PLAYER && unit->HasAura(46337, 0) && ((Player*)unit)->GetQuestStatus(11891) == QUEST_STATUS_INCOMPLETE)
{
EventStarted = true;
player = unit;
Briatha = me->GetMap()->GetCreature(me->GetMap()->GetCreatureGUID(NPC_ICECALLERBRIATHA));
}
}

void UpdateAI(const uint32 diff)
{
if (!me->getVictim())
{
if (EventStarted && Briatha)
{
if (TalkTimer < diff)
{
switch(Phase)
{
case 0:
Briatha->Say("These stones should be the last of them. Our coordination with Neptulon's forces will be impeccable.", LANG_NEUTRAL, 0);
Phase++;
break;
case 1:
me->Say("Yess. The Tidehunter will be pleased at this development. The Firelord's hold will weaken.", LANG_NEUTRAL, 0);
Phase++;
break;
case 2:
Briatha->Say("And your own preparations? Will the Frost Lord have a path to the portal?", LANG_NEUTRAL, 0);
Phase++;
break;
case 3:
me->Say("Skar'this has informed us well. We have worked our way into the slave pens and await your cryomancerss.", LANG_NEUTRAL, 0);
Phase++;
break;
case 4:
Briatha->Say("The ritual in Coilfang will bring Ahune through once he is fully prepared, and the resulting clash between Firelord and Frostlord will rend the foundations of this world. Our ultimate goals are in reach at last...", LANG_NEUTRAL, 0);
Phase = 0;
if(player->HasAura(46337, 0))
((Player*)player)->AreaExploredOrEventHappens(11891);
EventStarted = false;
break;
}
TalkTimer = 5000;
}
else
TalkTimer -= diff;
}
return;
}

DoMeleeAttackIfReady();
}
};

CreatureAI* GetAI_npc_Heretic_Emisary(Creature *_Creature)
{
return new npc_Heretic_EmisaryAI(_Creature);
}


void AddSC_ashenvale()
{
Script *newscript;
Expand Down Expand Up @@ -573,4 +656,9 @@ void AddSC_ashenvale()
newscript->pItemUse = &ItemUse_item_Totemic_Beacon;
newscript->RegisterSelf();

newscript = new Script;
newscript->Name="npc_Heretic_Emisary";
newscript->GetAI = &GetAI_npc_Heretic_Emisary;
newscript->RegisterSelf();

}
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,52 @@ struct TRINITY_DLL_DECL npc_shattered_hand_berserkerAI : public ScriptedAI
}
};


///////
/// Ice Stone
///////

#define GOSSIP_ICE_STONE "Place your hands on stone"

#define NPC_GLACIAL_TEMPLAR 26216

bool GossipHello_go_ice_stone(Player *player, GameObject* _GO)
{
if( player->GetQuestStatus(11954) == QUEST_STATUS_INCOMPLETE )
{
player->ADD_GOSSIP_ITEM(0, GOSSIP_ICE_STONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
}
player->SEND_GOSSIP_MENU(_GO->GetGOInfo()->questgiver.gossipID, _GO->GetGUID());
return true;
}

void SendActionMenu_go_ice_stone(Player *player, GameObject* _GO, uint32 action)
{
_GO->SetGoState(GO_STATE_ACTIVE);
_GO->SetRespawnTime(300);
player->CLOSE_GOSSIP_MENU();

float x,y,z;
player->GetClosePoint(x,y,z, 0.0f, 2.0f, frand(0, M_PI));

switch(action)
{
case GOSSIP_ACTION_INFO_DEF:
player->SummonCreature(NPC_GLACIAL_TEMPLAR, x,y,z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 600000);
break;
}
}

bool GossipSelect_go_ice_stone(Player *player, GameObject* _GO, uint32 sender, uint32 action )
{
switch(sender)
{
case GOSSIP_SENDER_MAIN: SendActionMenu_go_ice_stone(player, _GO, action); break;
}
return true;
}


CreatureAI* GetAI_npc_shattered_hand_berserker(Creature *_Creature)
{
return new npc_shattered_hand_berserkerAI(_Creature);
Expand Down Expand Up @@ -823,4 +869,10 @@ void AddSC_hellfire_peninsula()
newscript->Name="npc_shattered_hand_berserker";
newscript->GetAI = &GetAI_npc_shattered_hand_berserker;
newscript->RegisterSelf();

newscript = new Script;
newscript->Name="go_ice_stone";
newscript->pGOHello = &GossipHello_go_ice_stone;
newscript->pGOSelect = &GossipSelect_go_ice_stone;
newscript->RegisterSelf();
}
10 changes: 6 additions & 4 deletions src/game/AntiCheat.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ACRequest : public ACE_Method_Request
}

// is on taxi
if (pPlayer->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_TAXI_FLIGHT) || !pPlayer->m_taxi.empty())
if (pPlayer->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_TAXI_FLIGHT) || pPlayer->m_taxi.GetTaxiSource())
return -1;

// speed rate differs from prev packet
Expand Down Expand Up @@ -147,11 +147,13 @@ class ACRequest : public ACE_Method_Request
return 0;
}

pPlayer->m_AC_count++;
pPlayer->m_AC_timer = IN_MILISECONDS; // 1 sek
pPlayer->AC.IncrementAlertCount();

// we really need it ? :p
//pPlayer->AC.SetTimer(IN_MILISECONDS);

//if (!(pPlayer->m_AC_count %5))
sWorld.SendGMText(LANG_ANTICHEAT, pPlayer->GetName(), pPlayer->m_AC_count, m_speed, m_speed*fClientRate);
sWorld.SendGMText(LANG_ANTICHEAT, pPlayer->GetName(), pPlayer->AC.GetAlertCount(), m_speed, m_speed*fClientRate);

sLog.outCheat("Player %s (GUID: %u / ACCOUNT_ID: %u) moved for distance %f with server speed : %f (client speed: %f). MapID: %u, player's coord before X:%f Y:%f Z:%f. Player's coord now X:%f Y:%f Z:%f. MOVEMENTFLAGS: %u LATENCY: %u. BG/Arena: %s",
pPlayer->GetName(), pPlayer->GetGUIDLow(), pPlayer->GetSession()->GetAccountId(), fDistance2d, m_speed, m_speed*fClientRate, pPlayer->GetMapId(), m_pos.x, m_pos.y, m_pos.z, m_newPacket.pos.x, m_newPacket.pos.y, m_newPacket.pos.z, m_newPacket.GetMovementFlags(), m_latency, pPlayer->GetMap() ? (pPlayer->GetMap()->IsBattleGroundOrArena() ? "Yes" : "No") : "No");
Expand Down
2 changes: 2 additions & 0 deletions src/game/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ SET(game_STAT_SRCS
BattleGroundHandler.cpp
BattleGroundMgr.cpp
BattleGroundMgr.h
Camera.h
Camera.cpp
Cell.h
CellImpl.h
Channel.cpp
Expand Down
159 changes: 159 additions & 0 deletions src/game/Camera.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
/*
* Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#include "Camera.h"
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
#include "Player.h"

Camera::Camera(Player* pl) : m_owner(*pl), m_source(pl)
{
m_source->GetViewPoint().Attach(this);
}

Camera::~Camera()
{
// view of camera should be already reseted to owner (RemoveFromWorld -> Event_RemovedFromWorld -> ResetView)
ASSERT(m_source == &m_owner);

// for symmetry with constructor and way to make viewpoint's list empty
m_source->GetViewPoint().Detach(this);
}

void Camera::ReceivePacket(WorldPacket *data)
{
m_owner.SendDirectMessage(data);
}

void Camera::UpdateForCurrentViewPoint()
{
m_gridRef.unlink();

if (GridType* grid = m_source->GetViewPoint().m_grid)
grid->AddWorldObject(this);

UpdateVisibilityForOwner();
}

void Camera::SetView(WorldObject *obj, bool update_far_sight_field /*= true*/)
{
ASSERT(obj);

if (m_source == obj)
return;

if (!m_owner.IsInMap(obj))
{
sLog.outError("Camera::SetView, viewpoint is not in map with camera's owner");
return;
}

if (!obj->isType(TypeMask(TYPEMASK_DYNAMICOBJECT | TYPEMASK_UNIT)))
{
sLog.outError("Camera::SetView, viewpoint type is not available for client");
return;
}

// detach and deregister from active objects if there are no more reasons to be active
m_source->GetViewPoint().Detach(this);
if (!m_source->isActiveObject())
m_source->GetMap()->RemoveFromActive(m_source);

m_source = obj;

if (!m_source->isActiveObject())
m_source->GetMap()->AddToActive(m_source);

m_source->GetViewPoint().Attach(this);

if (update_far_sight_field)
m_owner.SetUInt64Value(PLAYER_FARSIGHT, (m_source == &m_owner ? 0 : m_source->GetGUID()));

UpdateForCurrentViewPoint();
}

void Camera::Event_ViewPointVisibilityChanged()
{
if (!m_owner.HaveAtClient(m_source))
ResetView();
}

void Camera::ResetView(bool update_far_sight_field /*= true*/)
{
SetView(&m_owner, update_far_sight_field);
}

void Camera::Event_AddedToWorld()
{
GridType* grid = m_source->GetViewPoint().m_grid;
ASSERT(grid);
grid->AddWorldObject(this);

UpdateVisibilityForOwner();
}

void Camera::Event_RemovedFromWorld()
{
if (m_source == &m_owner)
{
m_gridRef.unlink();
return;
}

ResetView();
}

void Camera::Event_Moved()
{
m_gridRef.unlink();
m_source->GetViewPoint().m_grid->AddWorldObject(this);
}

void Camera::UpdateVisibilityOf(WorldObject* target)
{
m_owner.UpdateVisibilityOf(m_source, target);
}

template<class T>
void Camera::UpdateVisibilityOf(T * target, UpdateData &data, std::set<WorldObject*>& vis)
{
m_owner.template UpdateVisibilityOf<T>(m_source, target,data,vis);
}

template void Camera::UpdateVisibilityOf(Player* , UpdateData& , std::set<WorldObject*>& );
template void Camera::UpdateVisibilityOf(Creature* , UpdateData& , std::set<WorldObject*>& );
template void Camera::UpdateVisibilityOf(Corpse* , UpdateData& , std::set<WorldObject*>& );
template void Camera::UpdateVisibilityOf(GameObject* , UpdateData& , std::set<WorldObject*>& );
template void Camera::UpdateVisibilityOf(DynamicObject* , UpdateData& , std::set<WorldObject*>& );

void Camera::UpdateVisibilityForOwner()
{
Trinity::VisibleNotifier notifier(*this);
Cell::VisitAllObjects(m_source, notifier, m_source->GetMap()->GetVisibilityDistance(), false);
notifier.Notify();
}

//////////////////

ViewPoint::~ViewPoint()
{
if (!m_cameras.empty())
{
sLog.outError("ViewPoint destructor called, but some cameras referenced to it");
}
}
Loading