diff options
| author | megamage <none@none> | 2009-05-17 10:57:55 -0500 |
|---|---|---|
| committer | megamage <none@none> | 2009-05-17 10:57:55 -0500 |
| commit | 3569f949d7ea0cd5c0acb6a5caf29b8990847071 (patch) | |
| tree | afcf983debdebf69e307864c3372ff53435dd350 /src/game/Unit.cpp | |
| parent | d2ef2c0500e86bc966b2d71bbd00acea0e924e41 (diff) | |
[7839] Rafactoring player targeting code in chat command and related cleanups/improvments.
* New extractOptFirstArg function for easy get 2 args in case option playe name as first arg.
* New extractPlayerTarget function for get player pointer/guid/name for online/offline player base at provided name
or if not provided by current seelction with error cases processing.
* Property apply mute/unmute in case use different character name from loggined currently for account.
* .reset commands can be used from console now
* .repairitems comamnd can be used from console now but only to online player.
Author: VladimirMangos
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
| -rw-r--r-- | src/game/Unit.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6e0eb316e51..7a21328acb8 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -11767,20 +11767,30 @@ void CharmInfo::InitCharmCreateSpells() bool CharmInfo::AddSpellToAB(uint32 oldid, uint32 newid, ActiveStates newstate) { - for(uint8 i = 0; i < 10; i++) + // new spell already listed for example in case prepered switch to lesser rank in Pet::removeSpell + for(uint8 i = 0; i < 10; ++i) + if (PetActionBar[i].Type == ACT_DISABLED || PetActionBar[i].Type == ACT_ENABLED || PetActionBar[i].Type == ACT_PASSIVE) + if (newid && PetActionBar[i].SpellOrAction == newid) + return true; + + // old spell can be leasted for example in case learn high rank + for(uint8 i = 0; i < 10; ++i) { - if((PetActionBar[i].Type == ACT_DISABLED || PetActionBar[i].Type == ACT_ENABLED || PetActionBar[i].Type == ACT_PASSIVE) && PetActionBar[i].SpellOrAction == oldid) + if (PetActionBar[i].Type == ACT_DISABLED || PetActionBar[i].Type == ACT_ENABLED || PetActionBar[i].Type == ACT_PASSIVE) { - PetActionBar[i].SpellOrAction = newid; - if(!oldid) + if (PetActionBar[i].SpellOrAction == oldid) { - if(newstate == ACT_DECIDE) - PetActionBar[i].Type = ACT_DISABLED; - else - PetActionBar[i].Type = newstate; - } + PetActionBar[i].SpellOrAction = newid; + if (!oldid) + { + if (newstate == ACT_DECIDE) + PetActionBar[i].Type = ACT_DISABLED; + else + PetActionBar[i].Type = newstate; + } - return true; + return true; + } } } return false; @@ -12795,6 +12805,7 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id) pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true); // this enables pet details window (Shift+P) pet->InitPetCreateSpells(); + //pet->InitLevelupSpellsForLevel(); pet->InitTalentForLevel(); pet->SetHealth(pet->GetMaxHealth()); |
