HG 698.
--HG-- branch : trunk
This commit is contained in:
+3
-3
@@ -859,6 +859,8 @@ int ChatHandler::ParseCommands(const char* text)
|
||||
if(strlen(text) < 2)
|
||||
return 0;
|
||||
|
||||
std::string fullcmd = text; // original `text` can't be used. It content destroyed in command code processing.
|
||||
|
||||
/// ignore messages staring from many dots.
|
||||
if(text[0] == '.' && text[1] == '.' || text[0] == '!' && text[1] == '!')
|
||||
return 0;
|
||||
@@ -867,9 +869,7 @@ int ChatHandler::ParseCommands(const char* text)
|
||||
if(text[0] == '!' || text[0] == '.')
|
||||
++text;
|
||||
|
||||
std::string fullcmd = text; // original `text` can't be used. It content destroyed in command code processing.
|
||||
|
||||
if(!ExecuteCommandInTable(getCommandTable(), text, fullcmd))
|
||||
if(!ExecuteCommandInTable(getCommandTable(), text, fullcmd) && m_session->GetSecurity() > SEC_PLAYER)
|
||||
SendSysMessage(LANG_NO_CMD);
|
||||
|
||||
return 1;
|
||||
|
||||
+62
-70
@@ -1679,80 +1679,72 @@ bool ChatHandler::HandleNpcFactionIdCommand(const char* args)
|
||||
//kick player
|
||||
bool ChatHandler::HandleKickPlayerCommand(const char *args)
|
||||
{
|
||||
char* kickName = strtok((char*)args, " ");
|
||||
char* kickReason = strtok(NULL, "\n");
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
const char* kickName = strtok((char*)args, " ");
|
||||
if(!kickName)
|
||||
{
|
||||
|
||||
if (!kickName)
|
||||
{
|
||||
Player* player = getSelectedPlayer();
|
||||
|
||||
if(!player)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(player==m_session->GetPlayer())
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_KICKSELF);
|
||||
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;
|
||||
}
|
||||
|
||||
player->GetSession()->KickPlayer();
|
||||
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");
|
||||
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());
|
||||
}
|
||||
else
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_KICKMESSAGE, name.c_str(), m_session->GetPlayer()->GetName(), reason.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string name = kickName;
|
||||
std::string reason = "No Reason";
|
||||
if(kickReason)
|
||||
reason = kickReason;
|
||||
|
||||
if(!normalizePlayerName(name))
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER, name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if(m_session && name==m_session->GetPlayer()->GetName())
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_KICKSELF);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(objmgr.GetPlayer(kickName)->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))
|
||||
{
|
||||
if(sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
|
||||
{
|
||||
sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, name.c_str(), m_session->GetPlayer()->GetName(), reason.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_KICKMESSAGE, name.c_str(), m_session->GetPlayer()->GetName(), reason.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
PSendSysMessage(LANG_COMMAND_KICKNOTFOUNDPLAYER, name.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//show info of player
|
||||
|
||||
+61
-54
@@ -731,43 +731,57 @@ bool ChatHandler::HandleLoadScriptsCommand(const char* args)
|
||||
|
||||
bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args)
|
||||
{
|
||||
char* arg1 = strtok((char*)args, " ");
|
||||
if( !arg1 )
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
/// must be NULL if targeted syntax and must be not nULL if not targeted
|
||||
char* arg2 = strtok(NULL, " ");
|
||||
|
||||
std::string targetAccountName;
|
||||
uint32 targetAccountId = 0;
|
||||
uint32 targetSecurity = 0;
|
||||
uint32 gm = 0;
|
||||
char* arg1 = strtok((char*)args, " ");
|
||||
char* arg2 = strtok(NULL, " ");
|
||||
|
||||
/// only target player different from self allowed (if targetPlayer!=NULL then not console)
|
||||
Player* targetPlayer = getSelectedPlayer();
|
||||
if(targetPlayer && m_session->GetPlayer()!=targetPlayer)
|
||||
if(getSelectedPlayer() && arg1 && !arg2)
|
||||
{
|
||||
/// wrong command syntax or unexpected targeting
|
||||
if(arg2)
|
||||
return false;
|
||||
targetAccountId = getSelectedPlayer()->GetSession()->GetAccountId();
|
||||
accmgr.GetName(targetAccountId, targetAccountName);
|
||||
Player* targetPlayer = getSelectedPlayer();
|
||||
gm = atoi(arg1);
|
||||
|
||||
/// security level expected in arg2 after this if.
|
||||
arg2 = arg1;
|
||||
|
||||
targetAccountId = targetPlayer->GetSession()->GetAccountId();
|
||||
targetSecurity = targetPlayer->GetSession()->GetSecurity();
|
||||
if(!accmgr.GetName(targetAccountId,targetAccountName))
|
||||
// Check for invalid specified GM level.
|
||||
if ( (gm < SEC_PLAYER || gm > SEC_ADMINISTRATOR) )
|
||||
{
|
||||
PSendSysMessage(LANG_ACCOUNT_NOT_EXIST,targetAccountName.c_str());
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
// Check if targets GM level and specified GM level is not higher than current gm level
|
||||
targetSecurity = targetPlayer->GetSession()->GetSecurity();
|
||||
if(targetSecurity >= m_session->GetSecurity() || gm >= m_session->GetSecurity() )
|
||||
{
|
||||
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Decide which string to show
|
||||
if(m_session->GetPlayer()!=targetPlayer)
|
||||
{
|
||||
PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
|
||||
}else{
|
||||
PSendSysMessage(LANG_YOURS_SECURITY_CHANGED, m_session->GetPlayer()->GetName(), gm);
|
||||
}
|
||||
|
||||
loginDatabase.PExecute("UPDATE account SET gmlevel = '%d' WHERE id = '%u'", gm, targetAccountId);
|
||||
return true;
|
||||
}else
|
||||
{
|
||||
/// wrong command syntax (second arg expected)
|
||||
// Check for second parameter
|
||||
if(!arg2)
|
||||
return false;
|
||||
|
||||
|
||||
// Check for account
|
||||
targetAccountName = arg1;
|
||||
if(!AccountMgr::normilizeString(targetAccountName))
|
||||
{
|
||||
@@ -775,41 +789,34 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args)
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for invalid specified GM level.
|
||||
gm = atoi(arg2);
|
||||
if ( (gm < SEC_PLAYER || gm > SEC_ADMINISTRATOR) )
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
targetAccountId = accmgr.GetId(arg1);
|
||||
/// m_session==NULL only for console
|
||||
uint32 plSecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE;
|
||||
|
||||
targetAccountId = accmgr.GetId(targetAccountName);
|
||||
/// can set security level only for target with less security and to less security that we have
|
||||
/// This is also reject self apply in fact
|
||||
targetSecurity = accmgr.GetSecurity(targetAccountId);
|
||||
if(targetSecurity >= plSecurity || gm >= plSecurity )
|
||||
{
|
||||
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
|
||||
loginDatabase.PExecute("UPDATE account SET gmlevel = '%d' WHERE id = '%u'", gm, targetAccountId);
|
||||
return true;
|
||||
}
|
||||
|
||||
int32 gm = (int32)atoi(arg2);
|
||||
if ( gm < SEC_PLAYER || gm > SEC_ADMINISTRATOR )
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// m_session==NULL only for console
|
||||
uint32 plSecurity = m_session ? m_session->GetSecurity() : SEC_CONSOLE;
|
||||
|
||||
/// can set security level only for target with less security and to less security that we have
|
||||
/// This is also reject self apply in fact
|
||||
if(targetSecurity >= plSecurity || uint32(gm) >= plSecurity )
|
||||
{
|
||||
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(targetPlayer)
|
||||
{
|
||||
ChatHandler(targetPlayer).PSendSysMessage(LANG_YOURS_SECURITY_CHANGED,GetName(), gm);
|
||||
targetPlayer->GetSession()->SetSecurity(gm);
|
||||
}
|
||||
|
||||
PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
|
||||
loginDatabase.PExecute("UPDATE account SET gmlevel = '%i' WHERE id = '%u'", gm, targetAccountId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Set password for account
|
||||
|
||||
@@ -214,6 +214,7 @@ class Pet : public Creature
|
||||
|
||||
uint64 GetAuraUpdateMask() { return m_auraUpdateMask; }
|
||||
void SetAuraUpdateMask(uint8 slot) { m_auraUpdateMask |= (uint64(1) << slot); }
|
||||
void UnsetAuraUpdateMask(uint8 slot) { m_auraUpdateMask &= ~(uint64(1) << slot); }
|
||||
void ResetAuraUpdateMask() { m_auraUpdateMask = 0; }
|
||||
|
||||
DeclinedName const* GetDeclinedNames() const { return m_declinedname; }
|
||||
|
||||
@@ -2156,6 +2156,7 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
void SetGroupUpdateFlag(uint32 flag) { m_groupUpdateMask |= flag; }
|
||||
uint64 GetAuraUpdateMask() { return m_auraUpdateMask; }
|
||||
void SetAuraUpdateMask(uint8 slot) { m_auraUpdateMask |= (uint64(1) << slot); }
|
||||
void UnsetAuraUpdateMask(uint8 slot) { m_auraUpdateMask &= ~(uint64(1) << slot); }
|
||||
Player* GetNextRandomRaidMember(float radius);
|
||||
PartyResult CanUninviteFromGroup() const;
|
||||
|
||||
|
||||
+12
-4
@@ -1127,6 +1127,14 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
|
||||
|
||||
if( m_caster != unit )
|
||||
{
|
||||
if (unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID())
|
||||
{
|
||||
if (unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
|
||||
{
|
||||
m_caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if( !m_caster->IsFriendlyTo(unit) )
|
||||
{
|
||||
// for delayed spells ignore not visible explicit target
|
||||
@@ -1536,10 +1544,10 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
|
||||
case TARGET_UNIT_TARGET_ANY: // SelectMagnetTarget()?
|
||||
case TARGET_UNIT_TARGET_PARTY:
|
||||
case TARGET_UNIT_SINGLE_UNKNOWN:
|
||||
TagUnitMap.push_back(m_targets.getUnitTarget());
|
||||
TagUnitMap.push_back(target);
|
||||
break;
|
||||
case TARGET_UNIT_PARTY_TARGET:
|
||||
m_caster->GetPartyMember(TagUnitMap, radius);
|
||||
target->GetPartyMember(TagUnitMap, radius);
|
||||
break;
|
||||
case TARGET_UNIT_TARGET_ENEMY:
|
||||
if(Unit* pUnitTarget = SelectMagnetTarget())
|
||||
@@ -2148,11 +2156,11 @@ void Spell::cancel()
|
||||
{
|
||||
Unit* unit = m_caster->GetGUID()==(*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
|
||||
if( unit && unit->isAlive() )
|
||||
unit->RemoveAurasDueToSpell(m_spellInfo->Id);
|
||||
unit->RemoveAurasDueToCasterSpell(m_spellInfo->Id, m_caster->GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
m_caster->RemoveAurasDueToSpell(m_spellInfo->Id);
|
||||
m_caster->RemoveAurasDueToCasterSpell(m_spellInfo->Id, m_caster->GetGUID());
|
||||
SendChannelUpdate(0);
|
||||
SendInterrupted(0);
|
||||
SendCastResult(SPELL_FAILED_INTERRUPTED);
|
||||
|
||||
@@ -882,7 +882,7 @@ void Aura::_AddAura()
|
||||
SendAuraUpdate(false);
|
||||
|
||||
// update for out of range group members
|
||||
m_target->UpdateAuraForGroup(slot);
|
||||
m_target->UpdateAuraForGroup(slot, true);
|
||||
}
|
||||
}
|
||||
else // use found slot
|
||||
@@ -970,7 +970,7 @@ void Aura::_RemoveAura()
|
||||
SendAuraUpdate(true);
|
||||
|
||||
// update for out of range group members
|
||||
m_target->UpdateAuraForGroup(slot);
|
||||
m_target->UpdateAuraForGroup(slot, false);
|
||||
|
||||
if( IsSealSpell(GetSpellProto()) )
|
||||
m_target->ModifyAuraState(AURA_STATE_JUDGEMENT,false);
|
||||
|
||||
+11
-5
@@ -11199,6 +11199,8 @@ void Unit::CleanupsBeforeDelete()
|
||||
{
|
||||
if(m_uint32Values) // only for fully created object
|
||||
{
|
||||
UnpossessSelf(false);
|
||||
RemoveAllFromVision();
|
||||
InterruptNonMeleeSpells(true);
|
||||
m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
|
||||
CombatStop();
|
||||
@@ -11208,8 +11210,6 @@ void Unit::CleanupsBeforeDelete()
|
||||
RemoveAllAuras();
|
||||
RemoveAllGameObjects();
|
||||
RemoveAllDynObjects();
|
||||
UnpossessSelf(false);
|
||||
RemoveAllFromVision();
|
||||
GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
|
||||
}
|
||||
RemoveFromWorld();
|
||||
@@ -12400,7 +12400,7 @@ uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectT
|
||||
return CastingTime;
|
||||
}
|
||||
|
||||
void Unit::UpdateAuraForGroup(uint8 slot)
|
||||
void Unit::UpdateAuraForGroup(uint8 slot, bool apply)
|
||||
{
|
||||
if(GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
@@ -12408,7 +12408,10 @@ void Unit::UpdateAuraForGroup(uint8 slot)
|
||||
if(player->GetGroup())
|
||||
{
|
||||
player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_AURAS);
|
||||
player->SetAuraUpdateMask(slot);
|
||||
if(apply)
|
||||
player->SetAuraUpdateMask(slot);
|
||||
else
|
||||
player->UnsetAuraUpdateMask(slot);
|
||||
}
|
||||
}
|
||||
else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
|
||||
@@ -12420,7 +12423,10 @@ void Unit::UpdateAuraForGroup(uint8 slot)
|
||||
if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && ((Player*)owner)->GetGroup())
|
||||
{
|
||||
((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_AURAS);
|
||||
pet->SetAuraUpdateMask(slot);
|
||||
if(apply)
|
||||
pet->SetAuraUpdateMask(slot);
|
||||
else
|
||||
pet->UnsetAuraUpdateMask(slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1449,7 +1449,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
void UpdateReactives(uint32 p_time);
|
||||
|
||||
// group updates
|
||||
void UpdateAuraForGroup(uint8 slot);
|
||||
void UpdateAuraForGroup(uint8 slot, bool apply);
|
||||
|
||||
// pet auras
|
||||
typedef std::set<PetAura const*> PetAuraSet;
|
||||
|
||||
@@ -94,10 +94,14 @@ template<>
|
||||
void
|
||||
WaypointMovementGenerator<Creature>::Initialize(Creature &u)
|
||||
{
|
||||
u.StopMoving();
|
||||
if(!path_id)
|
||||
path_id = u.GetWaypointPath();
|
||||
waypoints = WaypointMgr.GetPath(path_id);
|
||||
u.StopMoving();
|
||||
i_currentNode = -1; // uint32, become 0 in the first update
|
||||
i_nextMoveTime.Reset(0);
|
||||
StopedByPlayer = false;
|
||||
if(!path_id)
|
||||
path_id = u.GetWaypointPath();
|
||||
/*i_currentNode = 0;
|
||||
waypoints = WaypointMgr.GetPath(path_id);
|
||||
if(waypoints && waypoints->size())
|
||||
{
|
||||
Traveller<Creature> traveller(u);
|
||||
@@ -105,7 +109,7 @@ WaypointMovementGenerator<Creature>::Initialize(Creature &u)
|
||||
InitTraveller(u,node);
|
||||
i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z);
|
||||
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
template<>
|
||||
|
||||
Reference in New Issue
Block a user