*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); 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())); CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
Cell cell(pair); Cell cell(pair);
cell.data.Part.reserved = ALL_DISTRICT; cell.data.Part.reserved = district;
cell.SetNoCreate(); cell.SetNoCreate();
std::list<Creature*> NPCList; 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; }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())); CellPair pair(Trinity::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
Cell cell(pair); Cell cell(pair);
cell.data.Part.reserved = ALL_DISTRICT; cell.data.Part.reserved = district;
cell.SetNoCreate(); cell.SetNoCreate();
std::list<GameObject*> GOList; 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); void DoTeleportAll(float x, float y, float z, float o);
//Get a single creature of given entry //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 //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 //Returns friendly unit with the most amount of hp missing from max hp
Unit* DoSelectLowestHpFriendly(float range, uint32 MinHPDiff = 1); 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);
ASSERT(*text); ASSERT(*text);
//if(m_session->GetSecurity() == 0) if(m_session->GetSecurity() == 0)
// return 0; return 0;
/// chat case (.command or !command format) /// chat case (.command or !command format)
if(m_session) if(m_session)
@@ -869,7 +869,7 @@ int ChatHandler::ParseCommands(const char* text)
if(text[0] == '!' || text[0] == '.') if(text[0] == '!' || text[0] == '.')
++text; ++text;
if(!ExecuteCommandInTable(getCommandTable(), text, fullcmd) && m_session->GetSecurity() > SEC_PLAYER) if(!ExecuteCommandInTable(getCommandTable(), text, fullcmd))
SendSysMessage(LANG_NO_CMD); SendSysMessage(LANG_NO_CMD);
return 1; return 1;
+80 -56
View File
@@ -1679,71 +1679,95 @@ bool ChatHandler::HandleNpcFactionIdCommand(const char* args)
//kick player //kick player
bool ChatHandler::HandleKickPlayerCommand(const char *args) bool ChatHandler::HandleKickPlayerCommand(const char *args)
{ {
if(!*args)
return false;
const char* kickName = strtok((char*)args, " "); const char* kickName = strtok((char*)args, " ");
if(!kickName)
{
SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
std::string name = kickName;
if(!normalizePlayerName(name))
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
if(m_session && name==m_session->GetPlayer()->GetName())
{
SendSysMessage(LANG_COMMAND_KICKSELF);
SetSentErrorMessage(true);
return false;
}
Player* player = objmgr.GetPlayer(kickName);
if(!player)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
if(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"); char* kickReason = strtok(NULL, "\n");
std::string reason = "No Reason"; std::string reason = "No Reason";
std::string kicker = "Console";
if(kickReason) if(kickReason)
{reason = kickReason;} reason = kickReason;
if(m_session)
kicker = m_session->GetPlayer()->GetName();
if(sWorld.KickPlayer(name.c_str())) if(!kickName)
{ {
if(sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1) Player* player = getSelectedPlayer();
if(!player)
{ {
sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, name.c_str(), m_session->GetPlayer()->GetName(), reason.c_str()); SendSysMessage(LANG_NO_CHAR_SELECTED);
SetSentErrorMessage(true);
return false;
}
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);
SetSentErrorMessage(true);
return false;
}
if(m_session && name==m_session->GetPlayer()->GetName())
{
SendSysMessage(LANG_COMMAND_KICKSELF);
SetSentErrorMessage(true);
return false;
}
Player* player = objmgr.GetPlayer(kickName);
if(!player)
{
SendSysMessage(LANG_PLAYER_NOT_FOUND);
SetSentErrorMessage(true);
return false;
}
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;
}
if(sWorld.KickPlayer(name.c_str()))
{
if(sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
{
sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, name.c_str(), kicker.c_str(), reason.c_str());
}
else
{
PSendSysMessage(LANG_COMMAND_KICKMESSAGE, name.c_str(), kicker.c_str(), reason.c_str());
}
} }
else else
{ {
PSendSysMessage(LANG_COMMAND_KICKMESSAGE, name.c_str(), m_session->GetPlayer()->GetName(), reason.c_str()); PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER, name.c_str());
} return false;
} }
else }
{
PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER, name.c_str());
return false;
}
return true; return true;
} }
+1 -1
View File
@@ -100,8 +100,8 @@ WaypointMovementGenerator<Creature>::Initialize(Creature &u)
StopedByPlayer = false; StopedByPlayer = false;
if(!path_id) if(!path_id)
path_id = u.GetWaypointPath(); path_id = u.GetWaypointPath();
/*i_currentNode = 0;
waypoints = WaypointMgr.GetPath(path_id); waypoints = WaypointMgr.GetPath(path_id);
/*i_currentNode = 0;
if(waypoints && waypoints->size()) if(waypoints && waypoints->size())
{ {
Traveller<Creature> traveller(u); Traveller<Creature> traveller(u);