mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
Allow use .modify bit on units
Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
parent
b7d11eb418
commit
d6c58df0e6
1 changed files with 8 additions and 10 deletions
|
|
@ -1677,14 +1677,14 @@ bool ChatHandler::HandleModifyMoneyCommand(const char* args)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Edit Player field
|
//Edit Unit field
|
||||||
bool ChatHandler::HandleModifyBitCommand(const char* args)
|
bool ChatHandler::HandleModifyBitCommand(const char* args)
|
||||||
{
|
{
|
||||||
if( !*args )
|
if( !*args )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Player *chr = getSelectedPlayer();
|
Unit *unit = this->getSelectedUnit();
|
||||||
if (chr == NULL)
|
if (!unit)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
|
|
@ -1692,7 +1692,7 @@ bool ChatHandler::HandleModifyBitCommand(const char* args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(chr, 0))
|
if (unit->GetTypeId() == TYPEID_PLAYER && HasLowerSecurity((Player *)unit, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char* pField = strtok((char*)args, " ");
|
char* pField = strtok((char*)args, " ");
|
||||||
|
|
@ -1706,13 +1706,12 @@ bool ChatHandler::HandleModifyBitCommand(const char* args)
|
||||||
uint16 field = atoi(pField);
|
uint16 field = atoi(pField);
|
||||||
uint32 bit = atoi(pBit);
|
uint32 bit = atoi(pBit);
|
||||||
|
|
||||||
if (field < 1 || field >= PLAYER_END)
|
if (field < OBJECT_END || field >= unit->GetValuesCount())
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_BAD_VALUE);
|
SendSysMessage(LANG_BAD_VALUE);
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bit < 1 || bit > 32)
|
if (bit < 1 || bit > 32)
|
||||||
{
|
{
|
||||||
SendSysMessage(LANG_BAD_VALUE);
|
SendSysMessage(LANG_BAD_VALUE);
|
||||||
|
|
@ -1720,17 +1719,16 @@ bool ChatHandler::HandleModifyBitCommand(const char* args)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( chr->HasFlag( field, (1<<(bit-1)) ) )
|
if ( unit->HasFlag( field, (1<<(bit-1)) ) )
|
||||||
{
|
{
|
||||||
chr->RemoveFlag( field, (1<<(bit-1)) );
|
unit->RemoveFlag( field, (1<<(bit-1)) );
|
||||||
PSendSysMessage(LANG_REMOVE_BIT, bit, field);
|
PSendSysMessage(LANG_REMOVE_BIT, bit, field);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
chr->SetFlag( field, (1<<(bit-1)) );
|
unit->SetFlag( field, (1<<(bit-1)) );
|
||||||
PSendSysMessage(LANG_SET_BIT, bit, field);
|
PSendSysMessage(LANG_SET_BIT, bit, field);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue