*Merge with Trinity 702.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-28 16:27:45 -06:00
5 changed files with 90 additions and 66 deletions
+4 -4
View File
@@ -740,11 +740,11 @@ void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
i_pl->TeleportTo(m_creature->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
}
Unit* ScriptedAI::FindCreature(uint32 entry, uint32 range)
Unit* ScriptedAI::FindCreature(uint32 entry, uint32 range, uint32 district)
{
CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
Cell cell(pair);
cell.data.Part.reserved = ALL_DISTRICT;
cell.data.Part.reserved = district;
cell.SetNoCreate();
std::list<Creature*> NPCList;
@@ -765,11 +765,11 @@ Unit* ScriptedAI::FindCreature(uint32 entry, uint32 range)
}else error_log("SD2 ERROR: Entry: %u not found!", entry); return NULL;
}
GameObject* ScriptedAI::FindGameObject(uint32 entry)
GameObject* ScriptedAI::FindGameObject(uint32 entry, uint32 district)
{
CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
Cell cell(pair);
cell.data.Part.reserved = ALL_DISTRICT;
cell.data.Part.reserved = district;
cell.SetNoCreate();
std::list<GameObject*> GOList;
+2 -2
View File
@@ -149,10 +149,10 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
void DoTeleportAll(float x, float y, float z, float o);
//Get a single creature of given entry
Unit* FindCreature(uint32 entry, uint32 range);
Unit* FindCreature(uint32 entry, uint32 range, uint32 district = ALL_DISTRICT);
//Get a single gameobject of given entry
GameObject* FindGameObject(uint32 entry);
GameObject* FindGameObject(uint32 entry, uint32 district = ALL_DISTRICT);
//Returns friendly unit with the most amount of hp missing from max hp
Unit* DoSelectLowestHpFriendly(float range, uint32 MinHPDiff = 1);
+3 -3
View File
@@ -845,8 +845,8 @@ int ChatHandler::ParseCommands(const char* text)
ASSERT(text);
ASSERT(*text);
//if(m_session->GetSecurity() == 0)
// return 0;
if(m_session->GetSecurity() == 0)
return 0;
/// chat case (.command or !command format)
if(m_session)
@@ -869,7 +869,7 @@ int ChatHandler::ParseCommands(const char* text)
if(text[0] == '!' || text[0] == '.')
++text;
if(!ExecuteCommandInTable(getCommandTable(), text, fullcmd) && m_session->GetSecurity() > SEC_PLAYER)
if(!ExecuteCommandInTable(getCommandTable(), text, fullcmd))
SendSysMessage(LANG_NO_CMD);
return 1;
+38 -14
View File
@@ -1679,20 +1679,48 @@ bool ChatHandler::HandleNpcFactionIdCommand(const char* args)
//kick player
bool ChatHandler::HandleKickPlayerCommand(const char *args)
{
if(!*args)
return false;
const char* kickName = strtok((char*)args, " ");
char* kickReason = strtok(NULL, "\n");
std::string reason = "No Reason";
std::string kicker = "Console";
if(kickReason)
reason = kickReason;
if(m_session)
kicker = m_session->GetPlayer()->GetName();
if(!kickName)
{
Player* player = getSelectedPlayer();
if(!player)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
std::string name = kickName;
if(player==m_session->GetPlayer())
{
SendSysMessage(LANG_COMMAND_KICKSELF);
SetSentErrorMessage(true);
return false;
}
if(sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
{
sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, player->GetName(), kicker.c_str(), reason.c_str());
}
else
{
PSendSysMessage(LANG_COMMAND_KICKMESSAGE, player->GetName(), kicker.c_str(), reason.c_str());
}
player->GetSession()->KickPlayer();
}
else
{
std::string name = kickName;
if(!normalizePlayerName(name))
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
@@ -1715,27 +1743,23 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
return false;
}
if(player->GetSession()->GetSecurity() > m_session->GetSecurity())
if(m_session && player->GetSession()->GetSecurity() > m_session->GetSecurity())
{
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); //maybe replacement string for this later on
SetSentErrorMessage(true);
return false;
}
char* kickReason = strtok(NULL, "\n");
std::string reason = "No Reason";
if(kickReason)
{reason = kickReason;}
if(sWorld.KickPlayer(name.c_str()))
{
if(sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
{
sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, name.c_str(), m_session->GetPlayer()->GetName(), reason.c_str());
sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, name.c_str(), kicker.c_str(), reason.c_str());
}
else
{
PSendSysMessage(LANG_COMMAND_KICKMESSAGE, name.c_str(), m_session->GetPlayer()->GetName(), reason.c_str());
PSendSysMessage(LANG_COMMAND_KICKMESSAGE, name.c_str(), kicker.c_str(), reason.c_str());
}
}
else
@@ -1743,7 +1767,7 @@ bool ChatHandler::HandleKickPlayerCommand(const char *args)
PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER, name.c_str());
return false;
}
}
return true;
}
+1 -1
View File
@@ -100,8 +100,8 @@ WaypointMovementGenerator<Creature>::Initialize(Creature &u)
StopedByPlayer = false;
if(!path_id)
path_id = u.GetWaypointPath();
/*i_currentNode = 0;
waypoints = WaypointMgr.GetPath(path_id);
/*i_currentNode = 0;
if(waypoints && waypoints->size())
{
Traveller<Creature> traveller(u);