[7191] Some command related fixes.

* Allow use spell shift-link in .aura and .unaura commands
* Drop commented code and update .reset level command for support DK case.
  Also command for other classes will reset leve not to 1 but to config starting level value
This commit is contained in:
VladimirMangos 2009-01-27 03:28:21 +03:00
parent 2e3e3f0dbb
commit 8292567376
3 changed files with 17 additions and 47 deletions

View file

@ -3419,10 +3419,6 @@ bool ChatHandler::HandleReviveCommand(const char* args)
bool ChatHandler::HandleAuraCommand(const char* args)
{
char* px = strtok((char*)args, " ");
if (!px)
return false;
Unit *target = getSelectedUnit();
if(!target)
{
@ -3431,7 +3427,9 @@ bool ChatHandler::HandleAuraCommand(const char* args)
return false;
}
uint32 spellID = (uint32)atoi(px);
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spellID = extractSpellIdFromLink((char*)args);
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellID );
if(spellInfo)
{
@ -3455,10 +3453,6 @@ bool ChatHandler::HandleAuraCommand(const char* args)
bool ChatHandler::HandleUnAuraCommand(const char* args)
{
char* px = strtok((char*)args, " ");
if (!px)
return false;
Unit *target = getSelectedUnit();
if(!target)
{
@ -3474,7 +3468,11 @@ bool ChatHandler::HandleUnAuraCommand(const char* args)
return true;
}
uint32 spellID = (uint32)atoi(px);
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spellID = extractSpellIdFromLink((char*)args);
if(!spellID)
return false;
target->RemoveAurasDueToSpell(spellID);
return true;
@ -4324,19 +4322,6 @@ static bool HandleResetStatsOrLevelHelper(Player* player)
uint8 powertype = cEntry->powerType;
uint32 unitfield;
if(powertype == POWER_RAGE)
unitfield = 0x1100EE00;
else if(powertype == POWER_ENERGY)
unitfield = 0x00000000;
else if(powertype == POWER_MANA)
unitfield = 0x0000EE00;
else
{
sLog.outError("Invalid default powertype %u for player (class %u)",powertype,player->getClass());
return false;
}
// reset m_form if no aura
if(!player->HasAuraType(SPELL_AURA_MOD_SHAPESHIFT))
player->m_form = FORM_NONE;
@ -4366,8 +4351,6 @@ static bool HandleResetStatsOrLevelHelper(Player* player)
}
}
// set UNIT_FIELD_BYTES_1 to init state but preserve m_form value
player->SetUInt32Value(UNIT_FIELD_BYTES_1, unitfield);
player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP );
player->SetByteValue(UNIT_FIELD_BYTES_2, 3, player->m_form);
@ -4410,7 +4393,13 @@ bool ChatHandler::HandleResetLevelCommand(const char * args)
if(!HandleResetStatsOrLevelHelper(player))
return false;
player->SetLevel(1);
// set starting level
uint32 start_level = player->getClass() != CLASS_DEATH_KNIGHT
? sWorld.getConfig(CONFIG_START_PLAYER_LEVEL)
: sWorld.getConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);
player->SetLevel(start_level);
player->InitRunes();
player->InitStatsForLevel(true);
player->InitTaxiNodesForLevel();
player->InitGlyphsForLevel();
@ -4457,6 +4446,7 @@ bool ChatHandler::HandleResetStatsCommand(const char * args)
if(!HandleResetStatsOrLevelHelper(player))
return false;
player->InitRunes();
player->InitStatsForLevel(true);
player->InitTaxiNodesForLevel();
player->InitGlyphsForLevel();

View file

@ -544,25 +544,6 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
uint8 powertype = cEntry->powerType;
//uint32 unitfield;
/*switch(powertype)
{
case POWER_ENERGY:
case POWER_MANA:
unitfield = 0x00000000;
break;
case POWER_RAGE:
unitfield = 0x00110000;
break;
case POWER_RUNIC_POWER:
unitfield = 0x0000EE00; //TODO: find correct unitfield here
break;
default:
sLog.outError("Invalid default powertype %u for player (class %u)",powertype,class_);
return false;
}*/
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f);
@ -587,7 +568,6 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
uint32 RaceClassGender = ( race ) | ( class_ << 8 ) | ( gender << 16 );
SetUInt32Value(UNIT_FIELD_BYTES_0, ( RaceClassGender | ( powertype << 24 ) ) );
//SetUInt32Value(UNIT_FIELD_BYTES_1, unitfield);
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP );
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE );
SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7190"
#define REVISION_NR "7191"
#endif // __REVISION_NR_H__