Skip to content

Commit

Permalink
area triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
hatersgit committed Nov 21, 2023
1 parent 426fb6c commit 6ba3846
Show file tree
Hide file tree
Showing 15 changed files with 1,971 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class ActivateClassSpecHandler : public ForgeTopicHandler
player->learnSpell(info->Effects[i].TriggerSpell);
}
else
player->learnSpell(spell, SPEC_MASK_ALL, false);
player->learnSpell(spell);
}
}
}
Expand Down
26 changes: 26 additions & 0 deletions src/server/game/AI/CoreAI/AreaTriggerAI.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* 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, see <http://www.gnu.org/licenses/>.
*/

#include "AreaTriggerAI.h"

AreaTriggerAI::AreaTriggerAI(AreaTrigger* a) : at(a)
{
}

AreaTriggerAI::~AreaTriggerAI()
{
}
71 changes: 71 additions & 0 deletions src/server/game/AI/CoreAI/AreaTriggerAI.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* 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, see <http://www.gnu.org/licenses/>.
*/

#ifndef ACORE_AREATRIGGERAI_H
#define ACORE_AREATRIGGERAI_H

#include "Define.h"

class AreaTrigger;
class Unit;

class AreaTriggerAI
{
protected:
AreaTrigger* const at;
public:
explicit AreaTriggerAI(AreaTrigger* a);
virtual ~AreaTriggerAI();

// Called when the AreaTrigger has just been initialized, just before added to map
virtual void OnInitialize() { }

// Called when the AreaTrigger has just been created
virtual void OnCreate() { }

// Called on each AreaTrigger update
virtual void OnUpdate(uint32 /*diff*/) { }

// Called on each AreaTrigger proc, timer defined by at->SetPeriodicProcTimer(uint32)
virtual void OnPeriodicProc() { }

// Called when the AreaTrigger reach splineIndex
virtual void OnSplineIndexReached(int /*splineIndex*/) { }

// Called when the AreaTrigger reach its destination
virtual void OnDestinationReached() { }

// Called when an unit enter the AreaTrigger
virtual void OnUnitEnter(Unit* /*unit*/) { }

// Called when an unit exit the AreaTrigger, or when the AreaTrigger is removed
virtual void OnUnitExit(Unit* /*unit*/) { }

// Called when the AreaTrigger is removed
virtual void OnRemove() { }

// Pass parameters between AI
virtual void DoAction(int32 /*param*/) { }
};

class NullAreaTriggerAI : public AreaTriggerAI
{
public:
explicit NullAreaTriggerAI(AreaTrigger* areaTrigger) : AreaTriggerAI(areaTrigger) { }
};

#endif
Loading

0 comments on commit 6ba3846

Please sign in to comment.