mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
[svn] * Added npc follow, waterwalk, repairitems commands. Patch by dythzer
* Prevent adding more than 5 people to raid - Apoc * fixed typo from one of our previous commits. * Fixed two strings in core, thanx to warhead for patch. --HG-- branch : trunk
This commit is contained in:
@@ -44,6 +44,8 @@
|
||||
#include <map>
|
||||
#include "GlobalEvents.h"
|
||||
|
||||
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
|
||||
|
||||
static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] =
|
||||
{
|
||||
LANG_REP_HATED, LANG_REP_HOSTILE, LANG_REP_UNFRIENDLY, LANG_REP_NEUTRAL,
|
||||
@@ -4052,3 +4054,79 @@ bool ChatHandler::HandleServerCorpsesCommand(const char* /*args*/)
|
||||
CorpsesErase();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleRepairitemsCommand(const char* /*args*/)
|
||||
{
|
||||
Player *target = getSelectedPlayer();
|
||||
|
||||
if(!target)
|
||||
{
|
||||
PSendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Repair items
|
||||
target->DurabilityRepairAll(false, 0, false);
|
||||
|
||||
PSendSysMessage(LANG_YOU_REPAIR_ITEMS, target->GetName());
|
||||
if(needReportToTarget(target))
|
||||
ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, GetName());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleNpcFollowCommand(const char* /*args*/)
|
||||
{
|
||||
Player *player = m_session->GetPlayer();
|
||||
Creature *creature = getSelectedCreature();
|
||||
|
||||
if(!creature)
|
||||
{
|
||||
PSendSysMessage(LANG_SELECT_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Follow player - Using pet's default dist and angle
|
||||
creature->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
|
||||
|
||||
PSendSysMessage(LANG_CREATURE_FOLLOW_YOU_NOW, creature->GetName());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/)
|
||||
{
|
||||
Player *player = m_session->GetPlayer();
|
||||
Creature *creature = getSelectedCreature();
|
||||
|
||||
if(!creature)
|
||||
{
|
||||
PSendSysMessage(LANG_SELECT_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (creature->GetMotionMaster()->empty() ||
|
||||
creature->GetMotionMaster()->GetCurrentMovementGeneratorType ()!=TARGETED_MOTION_TYPE)
|
||||
{
|
||||
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
TargetedMovementGenerator<Creature> const* mgen
|
||||
= static_cast<TargetedMovementGenerator<Creature> const*>((creature->GetMotionMaster()->top()));
|
||||
|
||||
if(mgen->GetTarget()!=player)
|
||||
{
|
||||
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// reset movement
|
||||
creature->GetMotionMaster()->MovementExpired(true);
|
||||
|
||||
PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU_NOW, creature->GetName());
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user