您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ IsPassiveSpell函数代码示例

51自学网 2021-06-01 21:42:17
  C++
这篇教程C++ IsPassiveSpell函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中IsPassiveSpell函数的典型用法代码示例。如果您正苦于以下问题:C++ IsPassiveSpell函数的具体用法?C++ IsPassiveSpell怎么用?C++ IsPassiveSpell使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了IsPassiveSpell函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: DETAIL_LOG

void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket ){    DETAIL_LOG("CMSG_PET_SPELL_AUTOCAST");    uint64 guid;    uint32 spellid;    uint8  state;                                           //1 for on, 0 for off    recvPacket >> guid >> spellid >> state;    if (!_player->GetPet() && !_player->GetCharm())        return;    if (ObjectAccessor::FindPlayer(guid))        return;    Creature* pet=ObjectAccessor::GetCreatureOrPetOrVehicle(*_player,guid);    if (!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))    {        sLog.outError( "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );        return;    }    // do not add not learned spells/ passive spells    if (!pet->HasSpell(spellid) || IsPassiveSpell(spellid))        return;    CharmInfo *charmInfo = pet->GetCharmInfo();    if (!charmInfo)    {        sLog.outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());        return;    }    if (pet->isCharmed())                                                            //state can be used as boolean        pet->GetCharmInfo()->ToggleCreatureAutocast(spellid, state);    else        ((Pet*)pet)->ToggleAutocast(spellid, state);    charmInfo->SetSpellAutocast(spellid,state);}
开发者ID:Tasssadar,项目名称:catcore,代码行数:41,


示例2: HandleCancelAuraOpcode

void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket){    uint32 spellId;    recvPacket >> spellId;    SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);    if (!spellInfo)        return;    // not allow remove non positive spells and spells with attr SPELL_ATTR_CANT_CANCEL    if (spellInfo->Attributes & SPELL_ATTR0_CANT_CANCEL)        return;    // channeled spell case (it currently casted then)    if (IsChanneledSpell(spellInfo))    {        if (Spell* spell = _player->GetCurrentSpell(CURRENT_CHANNELED_SPELL))        {            if (spell->m_spellInfo->Id == spellId)                spell->cancel();        }        return;    }    // non channeled case:    // don't allow remove non positive spells    // don't allow cancelling passive auras (some of them are visible)    if (!IsPositiveSpell(spellId) || IsPassiveSpell(spellId))        return;    // non channeled case    if (!IsPositiveSpell(spellId))        return;    _player->RemoveAurasDueToSpellByCancel(spellId);}
开发者ID:Aminxhm,项目名称:OregonCore,代码行数:36,


示例3: DETAIL_LOG

void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket ){    DETAIL_LOG("WORLD: CMSG_PET_CAST_SPELL");    recvPacket.hexlike();    recvPacket.print_storage();    //2 - 0 - 0 - 43 - 129 - 0 - 80 - 241 | - 42 - 211 - 253 - 0 | - 0 | - 2 |- 96 - 0 - 0 - 0 | - 0 - 26    //- 164 - 59 - 196 - 174 - 98 - 131 | - 194 - 182 - 171 - 218| - 67 - 0 - 48 - 93| - 0 - 196 - 32    //- 177| - 242 - 193 - 22 - 110 - 224 - 67 - 203 - 166 | - 68 - 61 - 133 - 1| - 240 - 66 - 1 - 183 |    //- 0 - 0 - 0 - 217| - 2 - 43 - 129 - 80 - 241 - 0 - 10 - 0 - 0 - 0 - 0 - 76 - 109 - 175 - 0    //- 238 - 115 - 58 - 196 - 20 - 110 - 121 - 194 - 187 - 107 - 217 - 67 - 32 - 44 - 27 - 62 - 217    //- 1 - 36 - 129 - 80 - 241 - 0 - 0 - 160 - 64 - 0 - 0 - 160 - 64 - 0 - 0 - 160 - 64 - 192 - 233    //- 172 - 62 - 4 - 0 - 0 - 0 - 7 - 230 - 0 - 0 - 0 -    //5 - 0 - 0 - 43 - 129 - 0 - 80 - 241 | - 85 - 211 - 253 - 0 | - 0 | - 2 | - 96 - 0 - 0 - 0 | - 0 - 69 - 60 - 61    //- 196 - 171 - 248 - 107| - 194 - 8 - 236 - 218 | - 67 - 0 - 177 - 11 | - 46 - 196 - 89 - 16 | - 14 - 195    //- 5 - 38 - 231 - 67 - 23 - 221 | - 110 - 62 - 15 - 3 | - 240 - 66 -| 1 - 183 | - 0 - 0 - 0 - 217 | - 5 - 43    //- 129 - 80 - 241 - 0 - 10 - 0 - 0 - 0 - 0 - 233 - 41 - 203 - 0 - 106 - 207 - 59 - 196 - 179 - 173 - 83    //- 194 - 8 - 108 - 217 - 67 - 127 - 153 - 170 - 64 - 217 - 4 - 36 - 129 - 80 - 241 - 0 - 0 - 160 - 64    //- 0 - 0 - 160 - 64 - 0 - 0 - 160 - 64 - 7 - 77 - 175 - 64 - 4 - 0 - 0 - 0 - 7 - 195 - 0 - 0 - 0 -    uint64 guid;    uint32 spellid;    uint8  cast_count;    uint8  unk_flags;                                       // flags (if 0x02 - some additional data are received)    recvPacket >> guid >> cast_count >> spellid >> unk_flags;    DEBUG_LOG("WORLD: CMSG_PET_CAST_SPELL, cast_count: %u, spellid %u, unk_flags %u", cast_count, spellid, unk_flags);    if (!_player->GetPet() && !_player->GetCharm())        return;    if (GUID_HIPART(guid) == HIGHGUID_PLAYER)        return;    Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player,guid);    if (!pet || (pet != _player->GetPet() && pet!= _player->GetCharm()))    {        sLog.outError( "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );        return;    }    if (pet->GetGlobalCooldown() > 0)        return;    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);    if (!spellInfo)    {        sLog.outError("WORLD: unknown PET spell id %i", spellid);        return;    }    // do not cast not learned spells    if (!pet->HasSpell(spellid) || IsPassiveSpell(spellInfo))        return;    SpellCastTargets targets;    //float elevation, speed;    //uint8 pos1, pos2;    recvPacket >> targets.ReadForCaster(pet);    //recvPacket >> elevation >> speed;    //recvPacket >> pos1 >> pos2;    pet->clearUnitState(UNIT_STAT_MOVING);        //mask: 96, elevation: 0.167906, speed: 120.002441, pos1: 1, pos: 183     //sLog.outDebug("mask: %u, elevation: %f, speed: %f, pos1: %u, pos: %u", targets.m_targetMask, elevation, speed, pos1, pos2);     sLog.outDebug("guid: %u, sX: %f, sY:%f, sZ: %f", targets.getUnitTargetGUID(),targets.m_srcX,targets.m_srcY,targets.m_srcZ);    sLog.outDebug("guid: %u, sX: %f, sY:%f, sZ: %f", targets.getUnitTargetGUID(),targets.m_destX,targets.m_destY,targets.m_destZ);    Spell *spell = new Spell(pet, spellInfo, false);    spell->m_cast_count = cast_count;                       // probably pending spell cast    spell->m_targets = targets;    SpellCastResult result = spell->CheckPetCast(NULL);    if (result == SPELL_CAST_OK)    {        pet->AddCreatureSpellCooldown(spellid);        if (pet->isPet())        {            //10% chance to play special pet attack talk, else growl            //actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell            if(((Pet*)pet)->getPetType() == SUMMON_PET && (urand(0, 100) < 10))                pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);            else                pet->SendPetAIReaction(guid);        }        spell->prepare(&(spell->m_targets));    }    else    {        pet->SendPetCastFail(spellid, result);        if (!pet->HasSpellCooldown(spellid))            GetPlayer()->SendClearCooldown(spellid, pet);//.........这里部分代码省略.........
开发者ID:3raZar3,项目名称:Dark-Ice,代码行数:101,


示例4: DETAIL_LOG

void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket ){    DETAIL_LOG("WORLD: CMSG_PET_CAST_SPELL");    recvPacket.hexlike();    recvPacket.print_storage();    //2 - 0 - 0 - 43 - 129 - 0 - 80 - 241 | - 42 - 211 - 253 - 0 | - 0 | - 2 |- 96 - 0 - 0 - 0 | - 0 - 26    //- 164 - 59 - 196 - 174 - 98 - 131 | - 194 - 182 - 171 - 218| - 67 - 0 - 48 - 93| - 0 - 196 - 32    //- 177| - 242 - 193 - 22 - 110 - 224 - 67 - 203 - 166 | - 68 - 61 - 133 - 1| - 240 - 66 - 1 - 183 |    //- 0 - 0 - 0 - 217| - 2 - 43 - 129 - 80 - 241 - 0 - 10 - 0 - 0 - 0 - 0 - 76 - 109 - 175 - 0    //- 238 - 115 - 58 - 196 - 20 - 110 - 121 - 194 - 187 - 107 - 217 - 67 - 32 - 44 - 27 - 62 - 217    //- 1 - 36 - 129 - 80 - 241 - 0 - 0 - 160 - 64 - 0 - 0 - 160 - 64 - 0 - 0 - 160 - 64 - 192 - 233    //- 172 - 62 - 4 - 0 - 0 - 0 - 7 - 230 - 0 - 0 - 0 -    //5 - 0 - 0 - 43 - 129 - 0 - 80 - 241 | - 85 - 211 - 253 - 0 | - 0 | - 2 | - 96 - 0 - 0 - 0 | - 0 - 69 - 60 - 61    //- 196 - 171 - 248 - 107| - 194 - 8 - 236 - 218 | - 67 - 0 - 177 - 11 | - 46 - 196 - 89 - 16 | - 14 - 195    //- 5 - 38 - 231 - 67 - 23 - 221 | - 110 - 62 - 15 - 3 | - 240 - 66 -| 1 - 183 | - 0 - 0 - 0 - 217 | - 5 - 43    //- 129 - 80 - 241 - 0 - 10 - 0 - 0 - 0 - 0 - 233 - 41 - 203 - 0 - 106 - 207 - 59 - 196 - 179 - 173 - 83    //- 194 - 8 - 108 - 217 - 67 - 127 - 153 - 170 - 64 - 217 - 4 - 36 - 129 - 80 - 241 - 0 - 0 - 160 - 64    //- 0 - 0 - 160 - 64 - 0 - 0 - 160 - 64 - 7 - 77 - 175 - 64 - 4 - 0 - 0 - 0 - 7 - 195 - 0 - 0 - 0 -    ObjectGuid guid;    uint32 spellid;    uint8  cast_count;    uint8  unk_flags;                                       // flags (if 0x02 - some additional data are received)    recvPacket >> guid >> cast_count >> spellid >> unk_flags;    DEBUG_LOG("WORLD: CMSG_PET_CAST_SPELL, %s, cast_count: %u, spellid %u, unk_flags %u", guid.GetString().c_str(), cast_count, spellid, unk_flags);    if (guid.IsPlayer())        return;    Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid);    if (!pet || (guid != _player->GetPetGuid() && guid != _player->GetCharmGuid()))    {        sLog.outError("HandlePetCastSpellOpcode: %s isn't pet of %s .", guid.GetString().c_str(), GetPlayer()->GetGuidStr().c_str());        return;    }    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);    if (!spellInfo)    {        sLog.outError("WORLD: unknown PET spell id %i", spellid);        return;    }    if (pet->GetCharmInfo() && pet->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))        return;    // do not cast not learned spells    if (!pet->HasSpell(spellid) || IsPassiveSpell(spellInfo))        return;    SpellCastTargets targets;    recvPacket >> targets.ReadForCaster(pet);    pet->clearUnitState(UNIT_STAT_MOVING);    Spell *spell = new Spell(pet, spellInfo, false);    spell->m_cast_count = cast_count;                       // probably pending spell cast    spell->m_targets = targets;    SpellCastResult result = spell->CheckPetCast(NULL);    if (result == SPELL_CAST_OK)    {        pet->AddCreatureSpellCooldown(spellid);        if (pet->IsPet())        {            //10% chance to play special pet attack talk, else growl            //actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell            if(((Pet*)pet)->getPetType() == SUMMON_PET && (urand(0, 100) < 10))                pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);            else                pet->SendPetAIReaction();        }        spell->prepare(&(spell->m_targets));    }    else    {        pet->SendPetCastFail(spellid, result);        if (!pet->HasSpellCooldown(spellid))            GetPlayer()->SendClearCooldown(spellid, pet);        spell->finish(false);        delete spell;    }}
开发者ID:Wisznu,项目名称:mangos,代码行数:92,


示例5: DETAIL_LOG

void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket){    DETAIL_LOG("WORLD: CMSG_PET_CAST_SPELL");    ObjectGuid guid;    uint32 spellid;    uint8  cast_count;    uint8  unk_flags;                                       // flags (if 0x02 - some additional data are received)    recvPacket >> guid >> cast_count >> spellid >> unk_flags;    DEBUG_LOG("WORLD: CMSG_PET_CAST_SPELL, %s, cast_count: %u, spellid %u, unk_flags %u", guid.GetString().c_str(), cast_count, spellid, unk_flags);    Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid);    if (!pet || (guid != _player->GetPetGuid() && guid != _player->GetCharmGuid()))    {        sLog.outError("HandlePetCastSpellOpcode: %s isn't pet of %s .", guid.GetString().c_str(), GetPlayer()->GetGuidStr().c_str());        return;    }    SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);    if (!spellInfo)    {        sLog.outError("WORLD: unknown PET spell id %i", spellid);        return;    }    if (pet->GetCharmInfo() && pet->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))        return;    // do not cast not learned spells    if (!pet->HasSpell(spellid) || IsPassiveSpell(spellInfo))        return;    SpellCastTargets targets;    recvPacket >> targets.ReadForCaster(pet);    pet->clearUnitState(UNIT_STAT_MOVING);    Spell* spell = new Spell(pet, spellInfo, false);    spell->m_cast_count = cast_count;                       // probably pending spell cast    spell->m_targets = targets;    SpellCastResult result = spell->CheckPetCast(NULL);    if (result == SPELL_CAST_OK)    {        pet->AddCreatureSpellCooldown(spellid);        if (pet->IsPet())        {            // 10% chance to play special pet attack talk, else growl            // actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell            if (((Pet*)pet)->getPetType() == SUMMON_PET && (urand(0, 100) < 10))                pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);            else                pet->SendPetAIReaction();        }        spell->prepare(&(spell->m_targets));    }    else    {        pet->SendPetCastFail(spellid, result);        if (!pet->HasSpellCooldown(spellid))            GetPlayer()->SendClearCooldown(spellid, pet);        spell->finish(false);        delete spell;    }}
开发者ID:Archives,项目名称:OutdoorPVP,代码行数:72,


示例6: DEBUG_LOG

void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket){    uint32 spellId;    recvPacket >> spellId;    // ignore for remote control state (for player case)    Unit* mover = _player->GetMover();    if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)    {        recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet        return;    }    DEBUG_LOG("WORLD: got cast spell packet, spellId - %u, data length = " SIZEFMTD,              spellId, recvPacket.size());    SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);    if (!spellInfo)    {        sLog.outError("WORLD: unknown spell id %u", spellId);        recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet        return;    }    if (mover->GetTypeId() == TYPEID_PLAYER)    {        // not have spell in spellbook or spell passive and not casted by client        if (!((Player*)mover)->HasActiveSpell(spellId) || IsPassiveSpell(spellInfo))        {            sLog.outError("World: Player %u casts spell %u which he shouldn't have", mover->GetGUIDLow(), spellId);            // cheater? kick? ban?            recvPacket.rpos(recvPacket.wpos());             // prevent spam at ignore packet            return;        }    }    else    {        // not have spell in spellbook or spell passive and not casted by client        if (!((Creature*)mover)->HasSpell(spellId) || IsPassiveSpell(spellInfo))        {            // cheater? kick? ban?            recvPacket.rpos(recvPacket.wpos());             // prevent spam at ignore packet            return;        }    }    // client provided targets    SpellCastTargets targets;    recvPacket >> targets.ReadForCaster(_player);    // auto-selection buff level base at target level (in spellInfo)    if (Unit* target = targets.getUnitTarget())    {        // if rank not found then function return nullptr but in explicit cast case original spell can be casted and later failed with appropriate error message        if (SpellEntry const* actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(spellInfo, _player, target))            spellInfo = actualSpellInfo;    }    Spell* spell = new Spell(_player, spellInfo, false);	spell->SpellStart(&targets);}
开发者ID:51kfa,项目名称:mangos-classic,代码行数:63,


示例7: CHECK_PACKET_SIZE

//.........这里部分代码省略.........                case REACT_AGGRESSIVE:                      //activete                    if(pet->GetTypeId() == TYPEID_UNIT)                        ((Creature*)pet)->SetReactState( ReactStates(spellid) );                    break;            }            break;        case ACT_DISABLED:                                  //0x8100    spell (disabled), ignore        case ACT_CAST:                                      //0x0100        case ACT_ENABLED:                                   //0xc100    spell        {            Unit* unit_target = NULL;            if (((Creature*)pet)->GetGlobalCooldown() > 0)                return;            if(guid2)                unit_target = ObjectAccessor::GetUnit(*_player,guid2);            // do not cast unknown spells            SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid );            if(!spellInfo)            {                sLog.outError("WORLD: unknown PET spell id %i", spellid);                return;            }            for(uint32 i = 0; i < 3;i++)            {                if(spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENEMY_SRC || spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENEMY_DST || spellInfo->EffectImplicitTargetA[i] == TARGET_DEST_DYNOBJ_ENEMY)                    return;            }            // do not cast not learned spells            if(!pet->HasSpell(spellid) || IsPassiveSpell(spellid))                return;            //  Clear the flags as if owner clicked 'attack'. AI will reset them            //  after AttackStart, even if spell failed            if (pet->GetCharmInfo())            {                pet->GetCharmInfo()->SetIsAtStay(false);                pet->GetCharmInfo()->SetIsCommandAttack(true);                pet->GetCharmInfo()->SetIsReturning(false);                pet->GetCharmInfo()->SetIsFollowing(false);            }            Spell *spell = new Spell(pet, spellInfo, false);            int16 result = spell->PetCanCast(unit_target);                                                            //auto turn to target unless possessed            if(result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->isPossessed())            {                pet->SetInFront(unit_target);                if( unit_target->GetTypeId() == TYPEID_PLAYER )                    pet->SendUpdateToPlayer( (Player*)unit_target );                if(Unit* powner = pet->GetCharmerOrOwner())                    if(powner->GetTypeId() == TYPEID_PLAYER)                        pet->SendUpdateToPlayer((Player*)powner);                result = -1;            }            if(result == -1)            {                ((Creature*)pet)->AddCreatureSpellCooldown(spellid);                if (((Creature*)pet)->isPet())
开发者ID:de-dima,项目名称:243,代码行数:67,


示例8: object

//.........这里部分代码省略.........                    if (pet->GetTypeId() == TYPEID_UNIT)                        pet->ToCreature()->SetReactState(ReactStates(spellid));                    break;            }            break;        case ACT_DISABLED:                                  // 0x81    spell (disabled), ignore        case ACT_PASSIVE:                                   // 0x01        case ACT_ENABLED:                                   // 0xC1    spell        {            Unit* unit_target = NULL;            if (guid2)                unit_target = ObjectAccessor::GetUnit(*_player,guid2);            // do not cast unknown spells            SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);            if (!spellInfo)            {                sLog->outError("WORLD: unknown PET spell id %i", spellid);                return;            }            if (spellInfo->StartRecoveryCategory > 0)                if (pet->ToCreature()->GetGlobalCooldown() > 0)                    return;            for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)            {                if (spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENEMY_SRC || spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENEMY_DST || spellInfo->EffectImplicitTargetA[i] == TARGET_DEST_DYNOBJ_ENEMY)                    return;            }            // do not cast not learned spells            if (!pet->HasSpell(spellid) || IsPassiveSpell(spellid))                return;            //  Clear the flags as if owner clicked 'attack'. AI will reset them            //  after AttackStart, even if spell failed            if (pet->GetCharmInfo())            {                pet->GetCharmInfo()->SetIsAtStay(false);                pet->GetCharmInfo()->SetIsCommandAttack(true);                pet->GetCharmInfo()->SetIsReturning(false);                pet->GetCharmInfo()->SetIsFollowing(false);            }            Spell *spell = new Spell(pet, spellInfo, false);            SpellCastResult result = spell->CheckPetCast(unit_target);            //auto turn to target unless possessed            if (result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->isPossessed() && !pet->IsVehicle())            {                if (unit_target)                {                    pet->SetInFront(unit_target);                    if (unit_target->GetTypeId() == TYPEID_PLAYER)                        pet->SendUpdateToPlayer((Player*)unit_target);                }                else if (Unit *unit_target2 = spell->m_targets.getUnitTarget())                {                    pet->SetInFront(unit_target2);                    if (unit_target2->GetTypeId() == TYPEID_PLAYER)                        pet->SendUpdateToPlayer((Player*)unit_target2);                }                if (Unit* powner = pet->GetCharmerOrOwner())
开发者ID:sprokopiev,项目名称:TrinityCore,代码行数:67,


示例9: DETAIL_LOG

void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket){    DETAIL_LOG("WORLD: CMSG_PET_CAST_SPELL");    ObjectGuid guid;    uint32 spellid;    recvPacket >> guid >> spellid;    DEBUG_LOG("WORLD: CMSG_PET_CAST_SPELL, %s, spellid %u", guid.GetString().c_str(), spellid);    Unit* petUnit = _player->GetMap()->GetUnit(guid);    if (!petUnit || (guid != _player->GetPetGuid() && !_player->HasCharm(guid)))    {        sLog.outError("HandlePetSpellAutocastOpcode. %s isn't pet of %s .", guid.GetString().c_str(), _player->GetGuidStr().c_str());        return;    }    //TODO: all those typecasting are probably not needed anymore    Creature* petCreature = petUnit->GetTypeId() == TYPEID_UNIT ? static_cast<Creature*>(petUnit) : nullptr;    Pet* pet = (petCreature && petCreature->IsPet()) ? static_cast<Pet*>(petUnit) : nullptr;    SpellEntry const* spellInfo = sSpellTemplate.LookupEntry<SpellEntry>(spellid);    if (!spellInfo)    {        sLog.outError("WORLD: unknown PET spell id %i", spellid);        return;    }    if (!petUnit->IsSpellReady(*spellInfo))        return;    // do not cast not learned spells    if (!petUnit->HasSpell(spellid) || IsPassiveSpell(spellInfo))        return;    SpellCastTargets targets;    recvPacket >> targets.ReadForCaster(petUnit);    petUnit->clearUnitState(UNIT_STAT_MOVING);    Spell* spell = new Spell(petUnit, spellInfo, TRIGGERED_PET_CAST);    spell->m_targets = targets;    SpellCastResult result = spell->CheckPetCast(nullptr);    if (result == SPELL_CAST_OK)    {        if (pet)            pet->CheckLearning(spellid);        spell->SpellStart(&(spell->m_targets));    }    else    {        petUnit->SendPetCastFail(spellid, result);        if (petCreature && petCreature->IsSpellReady(spellid))            GetPlayer()->SendClearCooldown(spellid, petUnit);        spell->finish(false);        delete spell;    }}
开发者ID:Phatcat,项目名称:mangos-classic,代码行数:64,


示例10: DETAIL_LOG

void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket){    DETAIL_LOG("WORLD: CMSG_PET_CAST_SPELL");    ObjectGuid guid;    uint32 spellid;    uint8  cast_count;    uint8  cast_flags;                                      // flags (if 0x02 - some additional data are received)    recvPacket >> guid >> cast_count >> spellid >> cast_flags;    DEBUG_LOG("WORLD: CMSG_PET_CAST_SPELL, %s, cast_count: %u, spellid %u, cast_flags %u", guid.GetString().c_str(), cast_count, spellid, cast_flags);    Creature* pet = _player->GetMap()->GetAnyTypeCreature(guid);    if (!pet || (guid != _player->GetPetGuid() && guid != _player->GetCharmGuid()))    {        sLog.outError("HandlePetCastSpellOpcode: %s isn't pet of %s .", guid.GetString().c_str(), _player->GetGuidStr().c_str());        return;    }    SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);    if (!spellInfo)    {        sLog.outError("WORLD: unknown PET spell id %i", spellid);        return;    }    if (pet->GetCharmInfo() && pet->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))        return;    Aura* triggeredByAura = pet->GetTriggeredByClientAura(spellid);    // do not cast not learned spells    if ((!triggeredByAura && !pet->HasSpell(spellid)) || IsPassiveSpell(spellInfo))        return;    SpellCastTargets targets;    recvPacket >> targets.ReadForCaster(pet);    targets.ReadAdditionalData(recvPacket, cast_flags);    pet->clearUnitState(UNIT_STAT_MOVING);    Spell* spell = new Spell(pet, spellInfo, triggeredByAura ? true : false, pet->GetObjectGuid(), triggeredByAura ? triggeredByAura->GetSpellProto() : nullptr);    spell->m_cast_count = cast_count;                       // probably pending spell cast    spell->m_targets = targets;    SpellCastResult result = triggeredByAura ? SPELL_CAST_OK : spell->CheckPetCast(nullptr);    if (result == SPELL_CAST_OK)    {        pet->AddCreatureSpellCooldown(spellid);        spell->SpellStart(&(spell->m_targets), triggeredByAura);    }    else    {        Unit* owner = pet->GetCharmerOrOwner();        if (owner && owner->GetTypeId() == TYPEID_PLAYER && !triggeredByAura)            Spell::SendCastResult((Player*)owner, spellInfo, 0, result, true);        if (!pet->HasSpellCooldown(spellid) && !triggeredByAura)            GetPlayer()->SendClearCooldown(spellid, pet);        spell->finish(false);        delete spell;    }}
开发者ID:Zilvereyes,项目名称:cMcata,代码行数:68,


示例11: UNIT_ACTION_BUTTON_ACTION

//.........这里部分代码省略.........        case ACT_DISABLED:                                  // 0x81    spell (disabled), ignore        case ACT_PASSIVE:                                   // 0x01        case ACT_ENABLED:                                   // 0xC1    spell        {            ((Pet*)pet)->SetIsRetreating();            ((Pet*)pet)->SetSpellOpener();            Unit* unit_target = targetGuid ? _player->GetMap()->GetUnit(targetGuid) : nullptr;            // do not cast unknown spells            SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);            if (!spellInfo)            {                sLog.outError("WORLD: unknown PET spell id %i", spellid);                return;            }            if (pet->GetCharmInfo() && pet->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))                return;            for (int i = 0; i < MAX_EFFECT_INDEX; ++i)            {                SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(i));                if (!spellEffect)                    continue;                if (spellEffect->EffectImplicitTargetA == TARGET_ALL_ENEMY_IN_AREA                    || spellEffect->EffectImplicitTargetA == TARGET_ALL_ENEMY_IN_AREA_INSTANT                    || spellEffect->EffectImplicitTargetA == TARGET_ALL_ENEMY_IN_AREA_CHANNELED)                    return;            }            // do not cast not learned spells            if (!pet->HasSpell(spellid) || IsPassiveSpell(spellInfo))                return;            pet->clearUnitState(UNIT_STAT_MOVING);            Spell* spell = new Spell(pet, spellInfo, false);            SpellCastResult result = spell->CheckPetCast(unit_target);            const SpellRangeEntry* sRange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);            if (unit_target && !(pet->IsWithinDistInMap(unit_target, sRange->maxRange) && pet->IsWithinLOSInMap(unit_target))                 && !(GetPlayer()->IsFriendlyTo(unit_target) || pet->HasAuraType(SPELL_AURA_MOD_POSSESS)))            {                ((Pet*)pet)->SetSpellOpener(spellid, sRange->minRange, sRange->maxRange);                spell->finish(false);                delete spell;                pet->AttackStop();                pet->GetMotionMaster()->Clear();                ((Creature*)pet)->AI()->AttackStart(unit_target);                 // 10% chance to play special warlock pet attack talk, else growl                if (((Creature*)pet)->IsPet() && ((Pet*)pet)->getPetType() == SUMMON_PET && pet != unit_target && roll_chance_i(10))                    pet->SendPetTalk((uint32)PET_TALK_ATTACK);                pet->SendPetAIReaction();                return;            }            // auto turn to target unless possessed            if (result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->HasAuraType(SPELL_AURA_MOD_POSSESS))
开发者ID:Zilvereyes,项目名称:cMcata,代码行数:67,


示例12: CHECK_PACKET_SIZE

//.........这里部分代码省略.........        case REACT_PASSIVE:                         //passive        case REACT_DEFENSIVE:                       //recovery        case REACT_AGGRESSIVE:                      //activete            charmInfo->SetReactState( ReactStates(spellid) );            break;        }        break;    case ACT_DISABLED:                                  // 0x8100    spell (disabled), ignore    case ACT_PASSIVE:                                   // 0x0100    case ACT_ENABLED:                                   // 0xC100    spell    {        Unit* unit_target = NULL;        if (((Creature*)pet)->GetGlobalCooldown() > 0)            return;        if(guid2)            unit_target = ObjectAccessor::GetUnit(*_player,guid2);        // do not cast unknown spells        SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid );        if(!spellInfo)        {            sLog.outError("WORLD: unknown PET spell id %i", spellid);            return;        }        for(uint32 i = 0; i < 3; ++i)        {            if(spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA || spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_INSTANT || spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_CHANNELED)                return;        }        // do not cast not learned spells        if(!pet->HasSpell(spellid) || IsPassiveSpell(spellid))            return;        pet->clearUnitState(UNIT_STAT_FOLLOW);        Spell *spell = new Spell(pet, spellInfo, false);        SpellCastResult result = spell->CheckPetCast(unit_target);        //auto turn to target unless possessed        if(result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->HasAuraType(SPELL_AURA_MOD_POSSESS))        {            if(unit_target)            {                pet->SetInFront(unit_target);                if (unit_target->GetTypeId() == TYPEID_PLAYER)                    pet->SendUpdateToPlayer( (Player*)unit_target );            }            else if(Unit *unit_target2 = spell->m_targets.getUnitTarget())            {                pet->SetInFront(unit_target2);                if (unit_target2->GetTypeId() == TYPEID_PLAYER)                    pet->SendUpdateToPlayer( (Player*)unit_target2 );            }            if (Unit* powner = pet->GetCharmerOrOwner())                if(powner->GetTypeId() == TYPEID_PLAYER)                    pet->SendUpdateToPlayer((Player*)powner);            result = SPELL_CAST_OK;        }        if(result == SPELL_CAST_OK)        {            ((Creature*)pet)->AddCreatureSpellCooldown(spellid);
开发者ID:psvajaz,项目名称:mangos,代码行数:67,


示例13: flags

void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket){    uint32 spellId;    uint8  cast_count, cast_flags;    recvPacket >> cast_count;    recvPacket >> spellId;    recvPacket >> cast_flags;                               // flags (if 0x02 - some additional data are received)    // ignore for remote control state (for player case)    Unit* mover = _player->GetMover();    if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)    {        recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet        return;    }    DEBUG_LOG("WORLD: CMSG_CAST_SPELL, spellId - %u, cast_count: %u, unk_flags %u, data length = " SIZEFMTD,              spellId, cast_count, cast_flags, recvPacket.size());    SpellEntry const* spellInfo = sSpellTemplate.LookupEntry<SpellEntry>(spellId);    if (!spellInfo)    {        sLog.outError("WORLD: unknown spell id %u", spellId);        recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet        return;    }    Aura* triggeredByAura = mover->GetTriggeredByClientAura(spellId);    if (mover->GetTypeId() == TYPEID_PLAYER)    {        // not have spell in spellbook or spell passive and not casted by client        if ((!((Player*)mover)->HasActiveSpell(spellId) && !triggeredByAura) || IsPassiveSpell(spellInfo))        {            sLog.outError("World: %s casts spell %u which he shouldn't have", mover->GetGuidStr().c_str(), spellId);            // cheater? kick? ban?            recvPacket.rpos(recvPacket.wpos());             // prevent spam at ignore packet            return;        }    }    else    {        // not have spell in spellbook or spell passive and not casted by client        if (!((Creature*)mover)->HasSpell(spellId) || IsPassiveSpell(spellInfo))        {            // cheater? kick? ban?            recvPacket.rpos(recvPacket.wpos());             // prevent spam at ignore packet            return;        }    }    // client provided targets    SpellCastTargets targets;#ifdef BUILD_PLAYERBOT    recvPacket >> targets.ReadForCaster(mover);#else    recvPacket >> targets.ReadForCaster(_player);#endif    // some spell cast packet including more data (for projectiles)    targets.ReadAdditionalSpellData(recvPacket, cast_flags);    // auto-selection buff level base at target level (in spellInfo)    if (Unit* target = targets.getUnitTarget())    {        // if rank not found then function return nullptr but in explicit cast case original spell can be casted and later failed with appropriate error message        if (SpellEntry const* actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(spellInfo, target->getLevel()))            spellInfo = actualSpellInfo;    }    Spell* spell = new Spell(mover, spellInfo, triggeredByAura ? TRIGGERED_OLD_TRIGGERED : TRIGGERED_NONE, mover->GetObjectGuid(), triggeredByAura ? triggeredByAura->GetSpellProto() : nullptr);    spell->m_cast_count = cast_count;                       // set count of casts    spell->SpellStart(&targets, triggeredByAura);}
开发者ID:michalpolko,项目名称:cmangos,代码行数:76,


示例14: flags

void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket){    uint32 spellId;    uint8  cast_count, unk_flags;    recvPacket >> cast_count;    recvPacket >> spellId;    recvPacket >> unk_flags;                                // flags (if 0x02 - some additional data are received)    // ignore for remote control state (for player case)    Unit* mover = _player->m_mover;    if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)    {        recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet        return;    }    sLog.outDebug("WORLD: got cast spell packet, spellId - %u, cast_count: %u, unk_flags %u, data length = %i",        spellId, cast_count, unk_flags, (uint32)recvPacket.size());    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );    if (!spellInfo)    {        sLog.outError("WORLD: unknown spell id %u", spellId);        recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet        return;    }    if (mover->GetTypeId() == TYPEID_PLAYER)    {        // not have spell in spellbook or spell passive and not casted by client        if (!((Player*)mover)->HasActiveSpell (spellId) || IsPassiveSpell(spellId) )        {            //cheater? kick? ban?            recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet            return;        }    }    else    {        // not have spell in spellbook or spell passive and not casted by client        if (!((Creature*)mover)->HasSpell(spellId) || IsPassiveSpell(spellId) )        {            //cheater? kick? ban?            recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet            return;        }    }    // Client is resending autoshot cast opcode when other spell is casted during shoot rotation    // Skip it to prevent "interrupt" message    if (IsAutoRepeatRangedSpell(spellInfo) && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)        && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)->m_spellInfo == spellInfo)        return;    // can't use our own spells when we're in possession of another unit,    if (_player->isPossessing())        return;    // client provided targets    SpellCastTargets targets;    if (!targets.read(&recvPacket,mover))    {        recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet        return;    }    // some spell cast packet including more data (for projectiles?)    if (unk_flags & 0x02)    {        //recvPacket.read_skip<float>();                      // unk1, coords?        //recvPacket.read_skip<float>();                      // unk1, coords?        uint8 unk1;        recvPacket >> unk1;                                 // >> 1 or 0        if (unk1)        {            recvPacket.read_skip<uint32>();                 // >> MSG_MOVE_STOP            uint64 guid;                                    // guid - unused            if (!recvPacket.readPackGUID(guid))                return;            MovementInfo movementInfo;            ReadMovementInfo(recvPacket, &movementInfo);        }    }
开发者ID:Sanzzes,项目名称:wopc-core,代码行数:85,


示例15: UNIT_ACTION_BUTTON_ACTION

//.........这里部分代码省略.........            switch (spellid)            {                case REACT_PASSIVE:                         // passive                {                    petUnit->AttackStop(true, true);                    charmInfo->SetSpellOpener();                }                case REACT_DEFENSIVE:                       // recovery                case REACT_AGGRESSIVE:                      // activete                {                    petUnit->AI()->SetReactState(ReactStates(spellid));                    break;                }            }            break;        case ACT_DISABLED:                                  // 0x81    spell (disabled), ignore        case ACT_PASSIVE:                                   // 0x01        case ACT_ENABLED:                                   // 0xC1    spell        {            charmInfo->SetIsRetreating();            charmInfo->SetSpellOpener();            Unit* unit_target = targetGuid ? _player->GetMap()->GetUnit(targetGuid) : nullptr;            // do not cast unknown spells            SpellEntry const* spellInfo = sSpellTemplate.LookupEntry<SpellEntry>(spellid);            if (!spellInfo)            {                sLog.outError("WORLD: unknown PET spell id %i", spellid);                return;            }            // do not cast not learned spells            if (IsPassiveSpell(spellInfo) || !petUnit->HasSpell(spellid))                return;            if (!petUnit->IsSpellReady(*spellInfo))                return;            for (unsigned int i : spellInfo->EffectImplicitTargetA)            {                if (i == TARGET_ENUM_UNITS_ENEMY_AOE_AT_SRC_LOC                        || i == TARGET_ENUM_UNITS_ENEMY_AOE_AT_DEST_LOC                        || i == TARGET_ENUM_UNITS_ENEMY_AOE_AT_DYNOBJ_LOC)                    return;            }            petUnit->clearUnitState(UNIT_STAT_MOVING);            uint32 flags = TRIGGERED_NONE;            if (!petUnit->hasUnitState(UNIT_STAT_POSSESSED))                flags |= TRIGGERED_PET_CAST;            Spell* spell = new Spell(petUnit, spellInfo, flags);            SpellCastResult result = spell->CheckPetCast(unit_target);            const SpellRangeEntry* sRange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);            if (unit_target && !(petUnit->IsWithinDistInMap(unit_target, sRange->maxRange) && petUnit->IsWithinLOSInMap(unit_target))                    && petUnit->CanAttackNow(unit_target))            {                charmInfo->SetSpellOpener(spellid, sRange->minRange, sRange->maxRange);                spell->finish(false);                delete spell;
开发者ID:Phatcat,项目名称:mangos-classic,代码行数:66,


示例16: CHECK_PACKET_SIZE

void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket ){    sLog.outDetail("WORLD: CMSG_PET_CAST_SPELL");    CHECK_PACKET_SIZE(recvPacket,8+1+4+1);    uint64 guid;    uint32 spellid;    uint8  cast_count;    uint8  unk_flags;                                       // flags (if 0x02 - some additional data are received)    recvPacket >> guid >> cast_count >> spellid >> unk_flags;    sLog.outDebug("WORLD: CMSG_PET_CAST_SPELL, cast_count: %u, spellid %u, unk_flags %u", cast_count, spellid, unk_flags);    if(!_player->GetPet() && !_player->GetCharm())        return;    if (GUID_HIPART(guid) == HIGHGUID_PLAYER)        return;    Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player,guid);    if(!pet || (pet != _player->GetPet() && pet!= _player->GetCharm()))    {        sLog.outError( "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s ./n", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );        return;    }    if (pet->GetGlobalCooldown() > 0)        return;    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);    if(!spellInfo)    {        sLog.outError("WORLD: unknown PET spell id %i/n", spellid);        return;    }    // do not cast not learned spells    if(!pet->HasSpell(spellid) || IsPassiveSpell(spellid))        return;    SpellCastTargets targets;    if(!targets.read(&recvPacket,pet))        return;    pet->clearUnitState(UNIT_STAT_FOLLOW);    Spell *spell = new Spell(pet, spellInfo, false);    spell->m_cast_count = cast_count;                       // probably pending spell cast    spell->m_targets = targets;    int16 result = spell->PetCanCast(NULL);    if(result == -1)    {        pet->AddCreatureSpellCooldown(spellid);        if(pet->isPet())        {            Pet* p = (Pet*)pet;            p->CheckLearning(spellid);            //10% chance to play special pet attack talk, else growl            //actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell            if(p->getPetType() == SUMMON_PET && (urand(0, 100) < 10))                pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);            else                pet->SendPetAIReaction(guid);        }        spell->prepare(&(spell->m_targets));    }    else    {        pet->SendPetCastFail(spellid, result);        if(!pet->HasSpellCooldown(spellid))            pet->SendPetClearCooldown(spellid);        spell->finish(false);        delete spell;    }}
开发者ID:Anarchy,项目名称:mangos,代码行数:80,


示例17: flags

void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket){    uint32 spellId;    uint8  cast_count, unk_flags;    recvPacket >> cast_count;    recvPacket >> spellId;    recvPacket >> unk_flags;                                // flags (if 0x02 - some additional data are received)    // ignore for remote control state (for player case)    Unit* mover = _player->m_mover;    if(mover != _player && mover->GetTypeId()==TYPEID_PLAYER)        return;    sLog.outDebug("WORLD: got cast spell packet, spellId - %u, cast_count: %u, unk_flags %u, data length = %i",        spellId, cast_count, unk_flags, (uint32)recvPacket.size());    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );    if(!spellInfo)    {        sLog.outError("WORLD: unknown spell id %u", spellId);        return;    }    if(mover->GetTypeId()==TYPEID_PLAYER)    {        // not have spell in spellbook or spell passive and not casted by client        if (!((Player*)mover)->HasActiveSpell (spellId) || IsPassiveSpell(spellId) )        {            //cheater? kick? ban?            return;        }    }    else    {        // not have spell in spellbook or spell passive and not casted by client        if (!((Creature*)mover)->HasSpell(spellId) || IsPassiveSpell(spellId) )        {            //cheater? kick? ban?            return;        }    }    // Client is resending autoshot cast opcode when other spell is casted during shoot rotation    // Skip it to prevent "interrupt" message    if (IsAutoRepeatRangedSpell(spellInfo) && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)        && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)->m_spellInfo == spellInfo)        return;    // can't use our own spells when we're in possession of another unit,    if(_player->isPossessing())        return;    // client provided targets    SpellCastTargets targets;    if(!targets.read(&recvPacket,mover))        return;    // auto-selection buff level base at target level (in spellInfo)    if(targets.getUnitTarget())    {        SpellEntry const *actualSpellInfo = spellmgr.SelectAuraRankForPlayerLevel(spellInfo,targets.getUnitTarget()->getLevel());        // if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message        if(actualSpellInfo)            spellInfo = actualSpellInfo;    }    Spell *spell = new Spell(mover, spellInfo, false);    spell->m_cast_count = cast_count;                       // set count of casts    spell->prepare(&targets);}
开发者ID:pfchrono,项目名称:mangos-mods,代码行数:72,


示例18: uint32

void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket){    sLog->outDetail("WORLD: CMSG_PET_CAST_SPELL");    uint64 guid;    uint8  castCount;    uint32 spellId;    uint8  castFlags;    recvPacket >> guid >> castCount >> spellId >> castFlags;    sLog->outDebug("WORLD: CMSG_PET_CAST_SPELL, guid: " UI64FMTD ", castCount: %u, spellId %u, castFlags %u", guid, castCount, spellId, castFlags);    // This opcode is also sent from charmed and possessed units (players and creatures)    if (!_player->GetGuardianPet() && !_player->GetCharm())        return;    Unit* caster = ObjectAccessor::GetUnit(*_player, guid);    if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm()))    {        sLog->outError("HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName());        return;    }    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);    if (!spellInfo)    {        sLog->outError("WORLD: unknown PET spell id %i", spellId);        return;    }    if (spellInfo->StartRecoveryCategory > 0) // Check if spell is affected by GCD        if (caster->GetTypeId() == TYPEID_UNIT && caster->ToCreature()->GetGlobalCooldown() > 0)        {            caster->SendPetCastFail(spellId, SPELL_FAILED_NOT_READY);            return;        }    // do not cast not learned spells    if (!caster->HasSpell(spellId) || IsPassiveSpell(spellId))        return;    SpellCastTargets targets;    targets.read(recvPacket, caster);    HandleClientCastFlags(recvPacket, castFlags, targets);    caster->ClearUnitState(UNIT_STAT_FOLLOW);    Spell *spell = new Spell(caster, spellInfo, false);    spell->m_cast_count = castCount;                    // probably pending spell cast    spell->m_targets = targets;    // TODO: need to check victim?    SpellCastResult result;    if (caster->m_movedPlayer)        result = spell->CheckPetCast(caster->m_movedPlayer->GetSelectedUnit());    else        result = spell->CheckPetCast(NULL);    if (result == SPELL_CAST_OK)    {        if (caster->GetTypeId() == TYPEID_UNIT)        {            Creature* pet = caster->ToCreature();            pet->AddCreatureSpellCooldown(spellId);            if (pet->isPet())            {                Pet* p = (Pet*)pet;                // 10% chance to play special pet attack talk, else growl                // actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell                if (p->getPetType() == SUMMON_PET && (urand(0, 100) < 10))                    pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);                else                    pet->SendPetAIReaction(guid);            }        }        spell->prepare(&(spell->m_targets));    }    else    {        caster->SendPetCastFail(spellId, result);        if (caster->GetTypeId() == TYPEID_PLAYER)        {            if (!caster->ToPlayer()->HasSpellCooldown(spellId))                GetPlayer()->SendClearCooldown(spellId, caster);        }        else        {            if (!caster->ToCreature()->HasSpellCooldown(spellId))                GetPlayer()->SendClearCooldown(spellId, caster);        }        spell->finish(false);        delete spell;    }}
开发者ID:sprokopiev,项目名称:TrinityCore,代码行数:97,


示例19: flags

void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket){    uint32 spellId;    uint8  cast_count, unk_flags;    recvPacket >> cast_count;    recvPacket >> spellId;    recvPacket >> unk_flags;                                // flags (if 0x02 - some additional data are received)    // ignore for remote control state (for player case)    Unit* mover = _player->GetMover();    if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)    {        recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet        return;    }    DEBUG_LOG("WORLD: got cast spell packet, spellId - %u, cast_count: %u, unk_flags %u, data length = " SIZEFMTD,              spellId, cast_count, unk_flags, recvPacket.size());    SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);    if (!spellInfo)    {        sLog.outError("WORLD: unknown spell id %u", spellId);        recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet        return;    }    Aura* triggeredByAura = mover->GetTriggeredByClientAura(spellId);    if (mover->GetTypeId() == TYPEID_PLAYER)    {        // not have spell in spellbook or spell passive and not casted by client        if ((!((Player*)mover)->HasActiveSpell(spellId) && !triggeredByAura) || IsPassiveSpell(spellInfo))        {            sLog.outError("World: %s casts spell %u which he shouldn't have", mover->GetGuidStr().c_str(), spellId);            // cheater? kick? ban?            recvPacket.rpos(recvPacket.wpos());             // prevent spam at ignore packet            return;        }    }    else    {        // not have spell in spellbook or spell passive and not casted by client        if (!((Creature*)mover)->HasSpell(spellId) || IsPassiveSpell(spellInfo))        {            // cheater? kick? ban?            recvPacket.rpos(recvPacket.wpos());             // prevent spam at ignore packet            return;        }    }    // client provided targets    SpellCastTargets targets;    recvPacket >> targets.ReadForCaster(mover);    // some spell cast packet including more data (for projectiles?)    if (unk_flags & 0x02)    {        uint8 unk1;        recvPacket >> Unused<float>();                      // unk1, coords?        recvPacket >> Unused<float>();                      // unk1, coords?        recvPacket >> unk1;                                 // >> 1 or 0        if (unk1)        {            ObjectGuid guid;                                // guid - unused            MovementInfo movementInfo;            recvPacket >> Unused<uint32>();                 // >> MSG_MOVE_STOP            recvPacket >> guid.ReadAsPacked();            recvPacket >> movementInfo;        }    }
开发者ID:natedahl32,项目名称:portal,代码行数:75,


示例20: uint32

void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket ){    sLog.outDetail("WORLD: CMSG_PET_CAST_SPELL");    uint64 guid;    uint32 spellid;    recvPacket >> guid >> spellid;    if (!_player->GetPet() && !_player->GetCharm())        return;    Creature* pet = _player->GetMap()->GetCreatureOrPet(guid);    if (!pet || (pet != _player->GetPet() && pet!= _player->GetCharm()))    {        sLog.outError( "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)),GetPlayer()->GetName() );        return;    }    if (pet->GetGlobalCooldown() > 0)        return;    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);    if (!spellInfo)    {        sLog.outError("WORLD: unknown PET spell id %i", spellid);        return;    }    // do not cast not learned spells    if (!pet->HasSpell(spellid) || IsPassiveSpell(spellid))        return;    SpellCastTargets targets;    recvPacket >> targets.ReadForCaster(pet);    pet->clearUnitState(UNIT_STAT_MOVING);    Spell *spell = new Spell(pet, spellInfo, false);    spell->m_targets = targets;    SpellCastResult result = spell->CheckPetCast(NULL);    if (result == SPELL_CAST_OK)    {        pet->AddCreatureSpellCooldown(spellid);        if (pet->isPet())        {            Pet* p = (Pet*)pet;            p->CheckLearning(spellid);            //10% chance to play special pet attack talk, else growl            //actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell            if(p->getPetType() == SUMMON_PET && (urand(0, 100) < 10))                pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);            else                pet->SendPetAIReaction(guid);        }        spell->prepare(&(spell->m_targets));    }    else    {        pet->SendPetCastFail(spellid, result);        if (!pet->HasSpellCooldown(spellid))            GetPlayer()->SendClearCooldown(spellid, pet);        spell->finish(false);        delete spell;    }}
开发者ID:dythzer,项目名称:mangoszero,代码行数:71,


示例21: HandleCancelAuraOpcode

void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket){    uint32 spellId;    recvPacket >> spellId;	if (spellId == 23182 || spellId == 25040 || spellId == 23205)		return;    SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);    if (!spellInfo)        return;    if (spellInfo->HasAttribute(SPELL_ATTR_CANT_CANCEL))        return;    if (IsPassiveSpell(spellInfo))        return;    if (!IsPositiveSpell(spellId))    {        // ignore for remote control state        if (!_player->IsSelfMover())        {            // except own aura spells            bool allow = false;            for (int k = 0; k < MAX_EFFECT_INDEX; ++k)            {                if (spellInfo->EffectApplyAuraName[k] == SPELL_AURA_MOD_POSSESS ||                        spellInfo->EffectApplyAuraName[k] == SPELL_AURA_MOD_POSSESS_PET)                {                    allow = true;                    break;                }            }            // this also include case when aura not found            if (!allow)                return;        }        else            return;    }    // channeled spell case (it currently casted then)    if (IsChanneledSpell(spellInfo))    {        if (Spell* curSpell = _player->GetCurrentSpell(CURRENT_CHANNELED_SPELL))            if (curSpell->m_spellInfo->Id == spellId)                _player->InterruptSpell(CURRENT_CHANNELED_SPELL);        return;    }    SpellAuraHolder* holder = _player->GetSpellAuraHolder(spellId);    // not own area auras can't be cancelled (note: maybe need to check for aura on holder and not general on spell)    if (holder && holder->GetCasterGuid() != _player->GetObjectGuid() && HasAreaAuraEffect(holder->GetSpellProto()))        return;    // non channeled case    _player->RemoveAurasDueToSpellByCancel(spellId);}
开发者ID:51kfa,项目名称:mangos-classic,代码行数:61,


示例22: flags

void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket){    uint32 spellId;    uint8  cast_count, unk_flags;    recvPacket >> cast_count;    recvPacket >> spellId;    recvPacket.read_skip<uint32>();    recvPacket >> unk_flags;                                // flags (if 0x02 - some additional data are received)    // ignore for remote control state (for player case)    Unit* _mover = GetPlayer()->GetMover();    if (_mover != GetPlayer() && _mover->GetTypeId()==TYPEID_PLAYER)    {        recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet        return;    }    DEBUG_LOG("WORLD: got cast spell packet, spellId - %u, cast_count: %u, unk_flags %u, data length = %i",        spellId, cast_count, unk_flags, (uint32)recvPacket.size());    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );    if(!spellInfo)    {        sLog.outError("WORLD: unknown spell id %u", spellId);        recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet        return;    }    //  Players on vehicles may cast many simple spells (like knock) from self    Unit* mover = NULL;    if (spellInfo->AttributesEx6 & SPELL_ATTR_EX6_UNK12 && _mover->IsCharmerOrOwnerPlayerOrPlayerItself())        mover = _mover->GetCharmerOrOwnerPlayerOrPlayerItself();    else        mover = _mover;    // casting own spells on some vehicles    if (mover->GetObjectGuid().IsVehicle() && mover->GetCharmerOrOwnerPlayerOrPlayerItself())    {        Player *plr = mover->GetCharmerOrOwnerPlayerOrPlayerItself();        if (mover->GetVehicleKit()->GetSeatInfo(plr) &&           (mover->GetVehicleKit()->GetSeatInfo(plr)->m_flags & SEAT_FLAG_CAN_ATTACK ||            mover->GetVehicleKit()->GetSeatInfo(plr)->m_flags & SEAT_FLAG_CAN_CAST ))            mover = plr;    }    if (mover->GetTypeId()==TYPEID_PLAYER)    {        // not have spell in spellbook or spell passive and not casted by client        if (!((Player*)mover)->HasActiveSpell (spellId) || IsPassiveSpell(spellInfo))        {            sLog.outError("World: Player %u casts spell %u which he shouldn't have", mover->GetGUIDLow(), spellId);            //cheater? kick? ban?            recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet            return;        }    }    else    {        // not have spell in spellbook or spell passive and not casted by client        if (!((Creature*)mover)->HasSpell(spellId) || IsPassiveSpell(spellInfo))        {            //cheater? kick? ban?            recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet            return;        }    }    // client provided targets    SpellCastTargets targets;    recvPacket >> targets.ReadForCaster(mover);    // some spell cast packet including more data (for projectiles?)    if (unk_flags & 0x02)    {        uint8 unk1;        recvPacket >> Unused<float>();                      // unk1, coords?        recvPacket >> Unused<float>();                      // unk1, coords?        recvPacket >> unk1;                                 // >> 1 or 0        if(unk1)        {            recvPacket.rfinish();            /*ObjectGuid guid;                                // guid - unused            MovementInfo movementInfo;            recvPacket >> Unused<uint32>();                 // >> MSG_MOVE_STOP            recvPacket >> guid.ReadAsPacked();            recvPacket >> movementInfo;*/        }    }
开发者ID:Bootz,项目名称:StrawberryCore,代码行数:94,


示例23: UNIT_ACTION_BUTTON_ACTION

//.........这里部分代码省略.........                case REACT_PASSIVE:                         //passive                case REACT_DEFENSIVE:                       //recovery                case REACT_AGGRESSIVE:                      //activete                    charmInfo->SetReactState( ReactStates(spellid) );                    break;            }            break;        case ACT_DISABLED:                                  // 0x81    spell (disabled), ignore        case ACT_PASSIVE:                                   // 0x01        case ACT_ENABLED:                                   // 0xC1    spell        {            Unit* unit_target = NULL;            if (!targetGuid.IsEmpty())                unit_target = _player->GetMap()->GetUnit(targetGuid);            // do not cast unknown spells            SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid );            if (!spellInfo)            {                sLog.outError("WORLD: unknown PET spell id %i", spellid);                return;            }            if (pet->GetCharmInfo() && pet->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))                return;            for(int i = 0; i < MAX_EFFECT_INDEX;++i)            {                if(spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA || spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_INSTANT || spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_CHANNELED)                    return;            }            // do not cast not learned spells            if(!pet->HasSpell(spellid) || IsPassiveSpell(spellInfo))                return;            pet->clearUnitState(UNIT_STAT_MOVING);            Spell *spell = new Spell(pet, spellInfo, false);            SpellCastResult result = spell->CheckPetCast(unit_target);            //auto turn to target unless possessed            if(result == SPELL_FAILED_UNIT_NOT_INFRONT && !pet->HasAuraType(SPELL_AURA_MOD_POSSESS))            {                if(unit_target)                {                    pet->SetInFront(unit_target);                    if (unit_target->GetTypeId() == TYPEID_PLAYER)                        pet->SendCreateUpdateToPlayer( (Player*)unit_target );                }                else if(Unit *unit_target2 = spell->m_targets.getUnitTarget())                {                    pet->SetInFront(unit_target2);                    if (unit_target2->GetTypeId() == TYPEID_PLAYER)                        pet->SendCreateUpdateToPlayer( (Player*)unit_target2 );                }                if (Unit* powner = pet->GetCharmerOrOwner())                    if(powner->GetTypeId() == TYPEID_PLAYER)                        pet->SendCreateUpdateToPlayer((Player*)powner);                result = SPELL_CAST_OK;            }            if(result == SPELL_CAST_OK)            {                ((Creature*)pet)->AddCreatureSpellCooldown(spellid);
开发者ID:Wisznu,项目名称:mangos,代码行数:67,


示例24: LoadDBCStores

//.........这里部分代码省略.........    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sMovieStore,               dbcPath,"Movie.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestSortStore,           dbcPath,"QuestSort.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sPvPDifficultyStore,       dbcPath,"PvpDifficulty.dbc");    for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)        if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))            if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS)                assert(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestXPStore,             dbcPath,"QuestXP.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sQuestFactionRewardStore,  dbcPath,"QuestFactionReward.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sRandomPropertiesPointsStore, dbcPath,"RandPropPoints.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sScalingStatDistributionStore, dbcPath,"ScalingStatDistribution.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sScalingStatValuesStore,   dbcPath,"ScalingStatValues.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSkillLineStore,           dbcPath,"SkillLine.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSkillLineAbilityStore,    dbcPath,"SkillLineAbility.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSoundEntriesStore,        dbcPath,"SoundEntries.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellStore,               dbcPath,"Spell.dbc", &CustomSpellEntryfmt, &CustomSpellEntryIndex);    for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)    {        SpellEntry const * spell = sSpellStore.LookupEntry(i);        if (spell && spell->Category)            sSpellCategoryStore[spell->Category].insert(i);    }    for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j)    {        SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j);        if (!skillLine)            continue;        SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);        if (spellInfo && IsPassiveSpell(spellInfo->Id))        {            for (uint32 i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i)            {                CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(i);                if (!cFamily)                    continue;                if (skillLine->skillId != cFamily->skillLine[0] && skillLine->skillId != cFamily->skillLine[1])                    continue;                if (spellInfo->spellLevel)                    continue;                if (skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL)                    continue;                sPetFamilySpellsStore[i].insert(spellInfo->Id);            }        }    }    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellCastTimesStore,      dbcPath,"SpellCastTimes.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellDifficultyStore,     dbcPath,"SpellDifficulty.dbc", &CustomSpellDifficultyfmt, &CustomSpellDifficultyIndex);    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellDurationStore,       dbcPath,"SpellDuration.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellFocusObjectStore,    dbcPath,"SpellFocusObject.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellItemEnchantmentStore,dbcPath,"SpellItemEnchantment.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellItemEnchantmentConditionStore,dbcPath,"SpellItemEnchantmentCondition.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRadiusStore,         dbcPath,"SpellRadius.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRangeStore,          dbcPath,"SpellRange.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRuneCostStore,       dbcPath,"SpellRuneCost.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellShapeshiftStore,     dbcPath,"SpellShapeshiftForm.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sStableSlotPricesStore,    dbcPath,"StableSlotPrices.dbc");    LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSummonPropertiesStore,    dbcPath,"SummonProperties.dbc");
开发者ID:Elevim,项目名称:RG-332,代码行数:67,


示例25: flags

void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket){    uint32 spellId;    uint8  cast_count, unk_flags;    recvPacket >> cast_count;    recvPacket >> spellId;    recvPacket >> unk_flags;                                // flags (if 0x02 - some additional data are received)    // ignore for remote control state (for player case)    Unit* mover = _player->m_mover;    if(mover != _player && mover->GetTypeId()==TYPEID_PLAYER)    {        recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet        return;    }    // vehicle spells are handled by CMSG_PET_CAST_SPELL,    // but player is still able to cast own spells    if(_player->GetCharmGUID() && _player->GetCharmGUID() == _player->GetVehicleGUID())        mover = _player;    sLog.outDebug("WORLD: got cast spell packet, spellId - %u, cast_count: %u, unk_flags %u, data length = %i",        spellId, cast_count, unk_flags, (uint32)recvPacket.size());    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );    if(!spellInfo)    {        sLog.outError("WORLD: unknown spell id %u", spellId);        recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet        return;    }    if(mover->GetTypeId()==TYPEID_PLAYER)    {        // not have spell in spellbook or spell passive and not casted by client        if (!((Player*)mover)->HasActiveSpell (spellId) || IsPassiveSpell(spellId) )        {            sLog.outError("World: Player %u casts spell %u which he shouldn't have", mover->GetGUIDLow(), spellId);            //cheater? kick? ban?            recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet            return;        }    }    else    {        // not have spell in spellbook or spell passive and not casted by client        if (!((Creature*)mover)->HasSpell(spellId) || IsPassiveSpell(spellId) )        {            //cheater? kick? ban?            recvPacket.rpos(recvPacket.wpos());                 // prevent spam at ignore packet            return;        }    }    // client provided targets    SpellCastTargets targets;    recvPacket >> targets.ReadForCaster(mover);    // some spell cast packet including more data (for projectiles?)    if (unk_flags & 0x02)    {        uint8 unk1;        recvPacket >> Unused<float>();                      // unk1, coords?        recvPacket >> Unused<float>();                      // unk1, coords?        recvPacket >> unk1;                                 // >> 1 or 0        if(unk1)        {            ObjectGuid guid;                                // guid - unused            MovementInfo movementInfo;            recvPacket >> Unused<uint32>();                 // >> MSG_MOVE_STOP            recvPacket >> guid.ReadAsPacked();            recvPacket >> movementInfo;        }    }
开发者ID:Bootz,项目名称:diamondcore,代码行数:78,


示例26: UpdateAllies

void PetAI::Reset(){    m_primaryTargetGuid.Clear();    m_savedTargetGuid.Clear();    m_attackDistanceRecheckTimer.SetInterval(TIME_INTERVAL_LOOK);    m_attackDistanceRecheckTimer.Reset();    m_updateAlliesTimer.SetInterval(ALLIES_UPDATE_TIME);    m_updateAlliesTimer.Reset();    UpdateAllies();    for (uint8 i = PET_SPELL_PASSIVE; i < PET_SPELL_MAX; ++i)        m_spellType[i].clear();    m_AIType = PET_AI_PASSIVE;    m_attackDistance  = 0.0f;    float f_range   = 0.0f;    if (!m_creature->GetCharmInfo())        return;    uint32 spellsSize = m_creature->IsPet() ? ((Pet*)m_creature)->GetPetAutoSpellSize() : m_creature->GetPetAutoSpellSize();    uint8 rangedDamageSpells = 0;    uint8 meleeDamageSpells = 0;    // classification for pet spells    for (uint32 i = 0; i < spellsSize; ++i)    {        uint32 spellID = m_creature->IsPet() ? ((Pet*)m_creature)->GetPetAutoSpellOnPos(i) : m_creature->GetPetAutoSpellOnPos(i);        if (!spellID)            continue;        SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellID);        if (!spellInfo)            continue;        if (IsPassiveSpell(spellInfo))        {            m_spellType[PET_SPELL_PASSIVE].insert(spellID);            continue;        }        if (IsNonCombatSpell(spellInfo))        {            // Voidwalker Consume Shadows            if (IsChanneledSpell(spellInfo))                m_spellType[PET_SPELL_HEAL].insert(spellID);            else                m_spellType[PET_SPELL_NONCOMBAT].insert(spellID);            continue;        }        // need more correct define this type        if (IsSpellReduceThreat(spellInfo) || IsChanneledSpell(spellInfo))        {            m_spellType[PET_SPELL_DEFENCE].insert(spellID);            continue;        }        // Voracious Appetite && Cannibalize && Carrion Feeder        if (spellInfo->HasAttribute(SPELL_ATTR_ABILITY) && spellInfo->HasAttribute(SPELL_ATTR_EX2_ALLOW_DEAD_TARGET))        {            m_spellType[PET_SPELL_HEAL].insert(spellID);            continue;        }        if (IsPositiveSpell(spellInfo) && IsSpellAppliesAura(spellInfo))        {            m_spellType[PET_SPELL_BUFF].insert(spellID);            continue;        }        if (spellInfo->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY))        {            m_spellType[PET_SPELL_FREEACTION].insert(spellID);            continue;        }        // don't have SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY !        if (spellInfo->HasAttribute(SPELL_ATTR_EX_CANT_REFLECTED) ||            spellInfo->HasAttribute(SPELL_ATTR_EX7_HAS_CHARGE_EFFECT))        {            m_spellType[PET_SPELL_ATTACKSTART].insert(spellID);            continue;        }        if (IsSpellIncreaseThreat(spellInfo))        {            m_spellType[PET_SPELL_THREAT].insert(spellID);            continue;        }        // all non-combat spells classified.        switch (spellInfo->rangeIndex)        {            case SPELL_RANGE_IDX_COMBAT:            {                if (IsSpellCauseDamage(spellInfo))                {                    m_spellType[PET_SPELL_MELEE].insert(spellID);                    ++meleeDamageSpells;//.........这里部分代码省略.........
开发者ID:Kuvaldin,项目名称:mangos,代码行数:101,



注:本文中的IsPassiveSpell函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ IsPathDiv函数代码示例
C++ IsPGPError函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。