aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/146_world.sql2
-rw-r--r--src/game/Creature.cpp19
-rw-r--r--src/game/SpellAuras.cpp43
-rw-r--r--src/game/SpellEffects.cpp68
-rw-r--r--src/game/Unit.cpp129
-rw-r--r--src/game/Unit.h13
6 files changed, 139 insertions, 135 deletions
diff --git a/sql/updates/146_world.sql b/sql/updates/146_world.sql
index 67de357f841..9bfdb2f9be3 100644
--- a/sql/updates/146_world.sql
+++ b/sql/updates/146_world.sql
@@ -5,7 +5,7 @@ CREATE TABLE `spell_linked_spell` (
`spell_trigger` int(10) NOT NULL,
`spell_effect` int(10) NOT NULL default '0',
`type` smallint(3) unsigned NOT NULL default '0',
- `comment` text NOT NULL default '',
+ `comment` text NOT NULL,
PRIMARY KEY (`spell_trigger`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 315a1b1f368..3a1565d2a88 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -10,12 +10,12 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Common.h"
@@ -121,7 +121,7 @@ Unit(), i_AI(NULL),
lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLeaderGUID(0),
m_lootMoney(0), m_lootRecipient(0),
m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f),
-m_gossipOptionLoaded(false),m_emoteState(0), m_isPet(false), m_isTotem(false),
+m_gossipOptionLoaded(false), m_emoteState(0), m_isPet(false), m_isTotem(false),
m_regenTimer(2000), m_defaultMovementType(IDLE_MOTION_TYPE), m_equipmentId(0),
m_AlreadyCallAssistence(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false),
m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),m_creatureInfo(NULL), m_DBTableGuid(0)
@@ -574,7 +574,6 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
TrainerSpellData const* trainer_spells = GetTrainerSpells();
-
if(!trainer_spells || trainer_spells->spellList.empty())
{
sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.",
@@ -834,6 +833,7 @@ void Creature::OnGossipSelect(Player* player, uint32 option)
uint32 action=gossipmenu.GetItem(option).m_gAction;
uint32 zoneid=GetZoneId();
uint64 guid=GetGUID();
+
GossipOption const *gossip=GetGossipOption( action );
uint32 textid;
if(!gossip)
@@ -851,13 +851,13 @@ void Creature::OnGossipSelect(Player* player, uint32 option)
{
case GOSSIP_OPTION_GOSSIP:
player->PlayerTalkClass->CloseGossip();
- player->PlayerTalkClass->SendTalking( textid );
+ player->PlayerTalkClass->SendTalking(textid);
break;
case GOSSIP_OPTION_OUTDOORPVP:
sOutdoorPvPMgr.HandleGossipOption(player, GetGUID(), option);
break;
case GOSSIP_OPTION_SPIRITHEALER:
- if( player->isDead() )
+ if (player->isDead())
CastSpell(this,17251,true,NULL,NULL,player->GetGUID());
break;
case GOSSIP_OPTION_QUESTGIVER:
@@ -1393,7 +1393,7 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force)
{
if (force)
{
- for (uint8 i=0;i<3;i++)
+ for (uint8 i = 0; i < 3; i++)
{
SetUInt32Value( UNIT_VIRTUAL_ITEM_SLOT_DISPLAY + i, 0);
SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO + (i * 2), 0);
@@ -1409,7 +1409,7 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force)
return;
m_equipmentId = equip_entry;
- for (uint8 i=0;i<3;i++)
+ for (uint8 i = 0; i < 3; i++)
{
SetUInt32Value( UNIT_VIRTUAL_ITEM_SLOT_DISPLAY + i, einfo->equipmodel[i]);
SetUInt32Value( UNIT_VIRTUAL_ITEM_INFO + (i * 2), einfo->equipinfo[i]);
@@ -2022,7 +2022,6 @@ char const* Creature::GetScriptName() const
return ObjectMgr::GetCreatureTemplate(GetEntry())->ScriptName;
}
-
VendorItemData const* Creature::GetVendorItems() const
{
return objmgr.GetNpcVendorItemList(GetEntry());
@@ -2052,7 +2051,7 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem)
uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
if((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount )
{
- m_vendorItemCounts.erase(itr);
+ m_vendorItemCounts.erase(itr);
return vItem->maxcount;
}
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 5cecf67d401..21d224ea0e4 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -10,12 +10,12 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Common.h"
@@ -2911,7 +2911,6 @@ void Aura::HandleModPossess(bool apply, bool Real)
if(m_target->GetTypeId() == TYPEID_PLAYER)
((Player*)m_target)->setFactionForRace(m_target->getRace());
-
else if(m_target->GetTypeId() == TYPEID_UNIT)
{
CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo();
@@ -4624,36 +4623,22 @@ void Aura::HandleComprehendLanguage(bool apply, bool Real)
void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real)
{
- // Special case with temporary increase max/current health
- switch(GetId())
+ if(Real)
{
- case 12976: // Warrior Last Stand triggered spell
- case 28726: // Nightmare Seed ( Nightmare Seed )
- case 34511: // Valor (Bulwark of Kings, Bulwark of the Ancient Kings)
- case 44055: // Tremendous Fortitude (Battlemaster's Alacrity)
+ if(apply)
{
- if(Real)
- {
- if(apply)
- {
- m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply);
- m_target->ModifyHealth(m_modifier.m_amount);
- }
- else
- {
- if (int32(m_target->GetHealth()) > m_modifier.m_amount)
- m_target->ModifyHealth(-m_modifier.m_amount);
- else
- m_target->SetHealth(1);
- m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply);
- }
- }
- return;
+ m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply);
+ m_target->ModifyHealth(m_modifier.m_amount);
+ }
+ else
+ {
+ if (int32(m_target->GetHealth()) > m_modifier.m_amount)
+ m_target->ModifyHealth(-m_modifier.m_amount);
+ else
+ m_target->SetHealth(1);
+ m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply);
}
}
-
- // generic case
- m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply);
}
void Aura::HandleAuraModIncreaseMaxHealth(bool apply, bool Real)
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index d0aa63305c3..db7134c375c 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -10,12 +10,12 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Common.h"
@@ -3918,56 +3918,36 @@ void Spell::EffectTameCreature(uint32 /*i*/)
if(creatureTarget->isPet())
return;
- if(m_caster->getClass() == CLASS_HUNTER)
- {
- // cast finish successfully
- //SendChannelUpdate(0);
- finish();
-
- Pet* pet = new Pet(HUNTER_PET);
-
- if(!pet->CreateBaseAtCreature(creatureTarget))
- {
- delete pet;
- return;
- }
+ if(m_caster->getClass() != CLASS_HUNTER)
+ return;
- creatureTarget->setDeathState(JUST_DIED);
- creatureTarget->RemoveCorpse();
- creatureTarget->SetHealth(0); // just for nice GM-mode view
+ // cast finish successfully
+ //SendChannelUpdate(0);
+ finish();
- pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID());
- pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID());
- pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction());
- pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
+ Pet* pet = m_caster->CreateTamedPetFrom(creatureTarget,m_spellInfo->Id);
- if(!pet->InitStatsForLevel(creatureTarget->getLevel()))
- {
- sLog.outError("ERROR: InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
- delete pet;
- return;
- }
+ // kill original creature
+ creatureTarget->setDeathState(JUST_DIED);
+ creatureTarget->RemoveCorpse();
+ creatureTarget->SetHealth(0); // just for nice GM-mode view
- // prepare visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()-1);
+ // prepare visual effect for levelup
+ pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()-1);
- pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true);
- // this enables pet details window (Shift+P)
- pet->AIM_Initialize();
- pet->InitPetCreateSpells();
- pet->SetHealth(pet->GetMaxHealth());
+ // add to world
+ MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet);
- MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet);
+ // visual effect for levelup
+ pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel());
- // visual effect for levelup
- pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel());
+ // caster have pet now
+ m_caster->SetPet(pet);
- if(m_caster->GetTypeId() == TYPEID_PLAYER)
- {
- m_caster->SetPet(pet);
- pet->SavePetToDB(PET_SAVE_AS_CURRENT);
- ((Player*)m_caster)->PetSpellInitialize();
- }
+ if(m_caster->GetTypeId() == TYPEID_PLAYER)
+ {
+ pet->SavePetToDB(PET_SAVE_AS_CURRENT);
+ ((Player*)m_caster)->PetSpellInitialize();
}
}
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index e0f242313a7..12485d94f47 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -10,12 +10,12 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Common.h"
@@ -1696,56 +1696,60 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
RemainingDamage -= currentAbsorb;
}
- AuraList const& vSplitDamageFlat = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_FLAT);
- for(AuraList::const_iterator i = vSplitDamageFlat.begin(), next; i != vSplitDamageFlat.end() && RemainingDamage >= 0; i = next)
+ // only split damage if not damaing yourself
+ if(pVictim != this)
{
- next = i; ++next;
+ AuraList const& vSplitDamageFlat = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_FLAT);
+ for(AuraList::const_iterator i = vSplitDamageFlat.begin(), next; i != vSplitDamageFlat.end() && RemainingDamage >= 0; i = next)
+ {
+ next = i; ++next;
- // check damage school mask
- if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0)
- continue;
+ // check damage school mask
+ if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0)
+ continue;
- // Damage can be splitted only if aura has an alive caster
- Unit *caster = (*i)->GetCaster();
- if(!caster || caster == pVictim || !caster->IsInWorld() || !caster->isAlive())
- continue;
+ // Damage can be splitted only if aura has an alive caster
+ Unit *caster = (*i)->GetCaster();
+ if(!caster || caster == pVictim || !caster->IsInWorld() || !caster->isAlive())
+ continue;
- int32 currentAbsorb;
- if (RemainingDamage >= (*i)->GetModifier()->m_amount)
- currentAbsorb = (*i)->GetModifier()->m_amount;
- else
- currentAbsorb = RemainingDamage;
+ int32 currentAbsorb;
+ if (RemainingDamage >= (*i)->GetModifier()->m_amount)
+ currentAbsorb = (*i)->GetModifier()->m_amount;
+ else
+ currentAbsorb = RemainingDamage;
- RemainingDamage -= currentAbsorb;
+ RemainingDamage -= currentAbsorb;
- SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, currentAbsorb, schoolMask, 0, 0, false, 0, false);
+ SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, currentAbsorb, schoolMask, 0, 0, false, 0, false);
- CleanDamage cleanDamage = CleanDamage(currentAbsorb, BASE_ATTACK, MELEE_HIT_NORMAL);
- DealDamage(caster, currentAbsorb, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
- }
+ CleanDamage cleanDamage = CleanDamage(currentAbsorb, BASE_ATTACK, MELEE_HIT_NORMAL);
+ DealDamage(caster, currentAbsorb, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
+ }
- AuraList const& vSplitDamagePct = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_PCT);
- for(AuraList::const_iterator i = vSplitDamagePct.begin(), next; i != vSplitDamagePct.end() && RemainingDamage >= 0; i = next)
- {
- next = i; ++next;
+ AuraList const& vSplitDamagePct = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_PCT);
+ for(AuraList::const_iterator i = vSplitDamagePct.begin(), next; i != vSplitDamagePct.end() && RemainingDamage >= 0; i = next)
+ {
+ next = i; ++next;
- // check damage school mask
- if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0)
- continue;
+ // check damage school mask
+ if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0)
+ continue;
- // Damage can be splitted only if aura has an alive caster
- Unit *caster = (*i)->GetCaster();
- if(!caster || caster == pVictim || !caster->IsInWorld() || !caster->isAlive())
- continue;
+ // Damage can be splitted only if aura has an alive caster
+ Unit *caster = (*i)->GetCaster();
+ if(!caster || caster == pVictim || !caster->IsInWorld() || !caster->isAlive())
+ continue;
- int32 splitted = int32(RemainingDamage * (*i)->GetModifier()->m_amount / 100.0f);
+ int32 splitted = int32(RemainingDamage * (*i)->GetModifier()->m_amount / 100.0f);
- RemainingDamage -= splitted;
+ RemainingDamage -= splitted;
- SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitted, schoolMask, 0, 0, false, 0, false);
+ SendSpellNonMeleeDamageLog(caster, (*i)->GetSpellProto()->Id, splitted, schoolMask, 0, 0, false, 0, false);
- CleanDamage cleanDamage = CleanDamage(splitted, BASE_ATTACK, MELEE_HIT_NORMAL);
- DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
+ CleanDamage cleanDamage = CleanDamage(splitted, BASE_ATTACK, MELEE_HIT_NORMAL);
+ DealDamage(caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
+ }
}
*absorb = damage - RemainingDamage - *resist;
@@ -1944,7 +1948,7 @@ void Unit::DoAttackDamage (Unit *pVictim, uint32 *damage, CleanDamage *cleanDama
float basetime = float(pVictim->getAttackTimer(BASE_ATTACK));
// after parry nearest next attack time will reduced at %40 from full attack time.
- // The delay cannot be reduced to less than 20% of your weapon's base swing delay.
+ // The delay cannot be reduced to less than 20% of your weapon base swing delay.
if (pVictim->haveOffhandWeapon() && offtime < basetime)
{
float percent20 = pVictim->GetAttackTime(OFF_ATTACK)*0.20;
@@ -6489,21 +6493,21 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, int32 scriptId, uint
{
case 836: // Improved Blizzard (Rank 1)
{
- if( !procSpell || procSpell->SpellVisual!=9487)
+ if (!procSpell || procSpell->SpellVisual!=9487)
return false;
triggered_spell_id = 12484;
break;
}
case 988: // Improved Blizzard (Rank 2)
{
- if( !procSpell || procSpell->SpellVisual!=9487)
+ if (!procSpell || procSpell->SpellVisual!=9487)
return false;
triggered_spell_id = 12485;
break;
}
case 989: // Improved Blizzard (Rank 3)
{
- if( !procSpell || procSpell->SpellVisual!=9487)
+ if (!procSpell || procSpell->SpellVisual!=9487)
return false;
triggered_spell_id = 12486;
break;
@@ -7302,6 +7306,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f; break;
}
}
+
// .. taken pct: dummy auras
AuraList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
for(AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
@@ -7535,7 +7540,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
CastingTime = 0;
}
// Holy Nova - 14%
- else if ((spellProto->SpellFamilyFlags & 0x400000LL) && spellProto->SpellIconID == 1874)
+ else if ((spellProto->SpellFamilyFlags & 0x400000LL) && spellProto->SpellIconID == 1874)
{
CastingTime = 500;
}
@@ -7775,7 +7780,6 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount,
spellProto->Id == 38395 || spellProto->Id == 40972)
return healamount;
-
int32 AdvertisedBenefit = SpellBaseHealingBonus(GetSpellSchoolMask(spellProto));
uint32 CastingTime = GetSpellCastTime(spellProto);
@@ -7880,7 +7884,7 @@ uint32 Unit::SpellHealingBonus(SpellEntry const *spellProto, uint32 healamount,
break;
case SPELLFAMILY_PRIEST:
// Holy Nova - 14%
- if ((spellProto->SpellFamilyFlags & 0x8000000LL) && spellProto->SpellIconID == 1874)
+ if ((spellProto->SpellFamilyFlags & 0x8000000LL) && spellProto->SpellIconID == 1874)
CastingTime = 500;
break;
case SPELLFAMILY_PALADIN:
@@ -8642,7 +8646,7 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList)
// raw invisibility
bool invisible = (m_invisibilityMask != 0 || u->m_invisibilityMask !=0);
-
+
// detectable invisibility case
if( invisible && (
// Invisible units, always are visible for units under same invisibility type
@@ -10375,7 +10379,7 @@ void Unit::SendPetSpellCooldown (uint32 spellid, time_t cooltime)
WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4+4);
data << uint64(GetGUID());
- data << uint8(0x0);
+ data << uint8(0x0); // flags (0x1, 0x2)
data << uint32(spellid);
data << uint32(cooltime);
@@ -10886,3 +10890,34 @@ void Unit::RemovePetAura(PetAura const* petSpell)
if(Pet* pet = GetPet())
pet->RemoveAurasDueToSpell(petSpell->GetAura(pet->GetEntry()));
}
+
+Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id)
+{
+ Pet* pet = new Pet(HUNTER_PET);
+
+ if(!pet->CreateBaseAtCreature(creatureTarget))
+ {
+ delete pet;
+ return NULL;
+ }
+
+ pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, this->GetGUID());
+ pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, this->GetGUID());
+ pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,this->getFaction());
+ pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
+
+ if(!pet->InitStatsForLevel(creatureTarget->getLevel()))
+ {
+ sLog.outError("ERROR: Pet::InitStatsForLevel() failed for creature (Entry: %u)!",creatureTarget->GetEntry());
+ delete pet;
+ return NULL;
+ }
+
+ pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true);
+ // this enables pet details window (Shift+P)
+ pet->AIM_Initialize();
+ pet->InitPetCreateSpells();
+ pet->SetHealth(pet->GetMaxHealth());
+
+ return pet;
+}
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 695fcde8e48..66988b0a1b7 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -10,7 +10,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
@@ -216,6 +216,8 @@ enum HitInfo
HITINFO_ABSORB = 0x00000020, // plays absorb sound
HITINFO_RESIST = 0x00000040, // resisted atleast some damage
HITINFO_CRITICALHIT = 0x00000080,
+ HITINFO_UNK2 = 0x00000100, // wotlk?
+ HITINFO_UNK3 = 0x00002000, // wotlk?
HITINFO_GLANCING = 0x00004000,
HITINFO_CRUSHING = 0x00008000,
HITINFO_NOACTION = 0x00010000,
@@ -512,7 +514,7 @@ enum NPCFlags
UNIT_NPC_FLAG_AUCTIONEER = 0x00200000, // 100%
UNIT_NPC_FLAG_STABLEMASTER = 0x00400000, // 100%
UNIT_NPC_FLAG_GUILD_BANKER = 0x00800000, // cause client to send 997 opcode
- UNIT_NPC_FLAG_UNK3 = 0x01000000, // cause client to send 1015 opcode
+ UNIT_NPC_FLAG_SPELLCLICK = 0x01000000, // cause client to send 1015 opcode (spell click)
UNIT_NPC_FLAG_GUARD = 0x10000000, // custom flag for guards
UNIT_NPC_FLAG_OUTDOORPVP = 0x20000000, // custom flag for outdoor pvp creatures
};
@@ -647,8 +649,8 @@ struct CharmInfo
CommandStates GetCommandState() { return m_CommandState; }
bool HasCommandState(CommandStates state) { return (m_CommandState == state); }
void SetReactState(ReactStates st) { m_reactState = st; }
- ReactStates GetReactState() { return m_reactState; }
- bool HasReactState(ReactStates state) { return (m_reactState == state); }
+ ReactStates GetReactState() { return m_reactState; }
+ bool HasReactState(ReactStates state) { return (m_reactState == state); }
void InitPossessCreateSpells();
void InitCharmCreateSpells();
@@ -992,6 +994,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
CharmInfo* GetCharmInfo() { return m_charmInfo; }
CharmInfo* InitCharmInfo(Unit* charm);
+ Pet* CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id = 0);
+
bool AddAura(Aura *aur);
void RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
@@ -1329,6 +1333,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
bool HandleProcTriggerSpell(Unit *pVictim,uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlags,WeaponAttackType attType,uint32 cooldown);
bool HandleHasteAuraProc(Unit *pVictim, SpellEntry const *spellProto, uint32 effIndex, uint32 damage, Aura* triggredByAura, SpellEntry const * procSpell, uint32 procFlag,uint32 cooldown);
bool HandleOverrideClassScriptAuraProc(Unit *pVictim, int32 scriptId, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell,uint32 cooldown);
+
uint32 m_state; // Even derived shouldn't modify
uint32 m_CombatTimer;
uint32 m_lastManaUse; // msecs