Show
Ignore:
Timestamp:
11/19/08 13:39:06 (17 years ago)
Author:
yumileroy
Message:

[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.

Original author: KingPin?
Date: 2008-10-29 17:09:32-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Level2.cpp

    r112 r132  
    4444#include <map> 
    4545#include "GlobalEvents.h" 
     46 
     47#include "TargetedMovementGenerator.h"                      // for HandleNpcUnFollowCommand 
    4648 
    4749static uint32 ReputationRankStrIndex[MAX_REPUTATION_RANK] = 
     
    40534055        return true; 
    40544056} 
     4057 
     4058bool ChatHandler::HandleRepairitemsCommand(const char* /*args*/) 
     4059{ 
     4060    Player *target = getSelectedPlayer(); 
     4061 
     4062    if(!target) 
     4063    { 
     4064        PSendSysMessage(LANG_NO_CHAR_SELECTED); 
     4065        SetSentErrorMessage(true); 
     4066        return false; 
     4067        } 
     4068 
     4069    // Repair items 
     4070    target->DurabilityRepairAll(false, 0, false); 
     4071 
     4072    PSendSysMessage(LANG_YOU_REPAIR_ITEMS, target->GetName()); 
     4073    if(needReportToTarget(target)) 
     4074        ChatHandler(target).PSendSysMessage(LANG_YOUR_ITEMS_REPAIRED, GetName()); 
     4075    return true; 
     4076} 
     4077 
     4078bool ChatHandler::HandleNpcFollowCommand(const char* /*args*/) 
     4079{ 
     4080    Player *player = m_session->GetPlayer(); 
     4081    Creature *creature = getSelectedCreature(); 
     4082 
     4083    if(!creature) 
     4084    { 
     4085        PSendSysMessage(LANG_SELECT_CREATURE); 
     4086        SetSentErrorMessage(true); 
     4087        return false; 
     4088    } 
     4089 
     4090    // Follow player - Using pet's default dist and angle 
     4091    creature->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); 
     4092 
     4093    PSendSysMessage(LANG_CREATURE_FOLLOW_YOU_NOW, creature->GetName()); 
     4094    return true; 
     4095} 
     4096 
     4097bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/) 
     4098{ 
     4099    Player *player = m_session->GetPlayer(); 
     4100    Creature *creature = getSelectedCreature(); 
     4101 
     4102    if(!creature) 
     4103    { 
     4104        PSendSysMessage(LANG_SELECT_CREATURE); 
     4105        SetSentErrorMessage(true); 
     4106        return false; 
     4107    } 
     4108 
     4109    if (creature->GetMotionMaster()->empty() || 
     4110        creature->GetMotionMaster()->GetCurrentMovementGeneratorType ()!=TARGETED_MOTION_TYPE) 
     4111    { 
     4112        PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU); 
     4113        SetSentErrorMessage(true); 
     4114        return false; 
     4115    } 
     4116 
     4117    TargetedMovementGenerator<Creature> const* mgen 
     4118        = static_cast<TargetedMovementGenerator<Creature> const*>((creature->GetMotionMaster()->top())); 
     4119 
     4120    if(mgen->GetTarget()!=player) 
     4121    { 
     4122        PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU); 
     4123        SetSentErrorMessage(true); 
     4124        return false; 
     4125    } 
     4126 
     4127    // reset movement 
     4128    creature->GetMotionMaster()->MovementExpired(true); 
     4129 
     4130    PSendSysMessage(LANG_CREATURE_NOT_FOLLOW_YOU_NOW, creature->GetName()); 
     4131    return true; 
     4132}