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

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

51自学网 2021-06-03 08:40:28
  C++
这篇教程C++ targets函数代码示例写得很实用,希望能帮到您。

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

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

示例1: GetPlayer

void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket){	CHECK_INWORLD_RETURN;		PlayerPointer p_User = GetPlayer();	DEBUG_LOG("WORLD","Received use Item packet, data length = %i",recvPacket.size());	int8 tmp1,slot;	uint8 unk; // 3.0.2 added unk	uint64 item_guid;	uint8 cn;	uint32 spellId = 0;	uint32 glyphIndex;	recvPacket >> tmp1 >> slot >> cn >> spellId >> item_guid >> glyphIndex >> unk;	ItemPointer tmpItem = NULLITEM;	tmpItem = p_User->GetItemInterface()->GetInventoryItem(tmp1,slot);	if (!tmpItem)		tmpItem = p_User->GetItemInterface()->GetInventoryItem(slot);	if (!tmpItem)		return;	ItemPrototype *itemProto = tmpItem->GetProto();	if(!itemProto)		return;	if(_player->getDeathState()==CORPSE)		return;	if(itemProto->Bonding == ITEM_BIND_ON_USE)		tmpItem->SoulBind();	if(sScriptMgr.CallScriptedItem(tmpItem,_player))		return;	if(itemProto->QuestId)	{		// Item Starter		Quest *qst = QuestStorage.LookupEntry(itemProto->QuestId);		if(!qst) 			return;		if( sQuestMgr.PlayerMeetsReqs(_player, qst, false) != QMGR_QUEST_AVAILABLE || qst->min_level > _player->getLevel() )			return;        WorldPacket data;        sQuestMgr.BuildQuestDetails(&data, qst, tmpItem, 0, language, _player);		SendPacket(&data);	}		SpellCastTargets targets(recvPacket, _player->GetGUID());	uint32 x;	for(x = 0; x < 5; x++)	{		if(itemProto->Spells[x].Trigger == USE)		{			if(itemProto->Spells[x].Id)			{				spellId = itemProto->Spells[x].Id;				break;			}		}	}	if(!spellId)		return;	// check for spell id	SpellEntry *spellInfo = dbcSpell.LookupEntryForced( spellId );	if(!spellInfo)	{		OUT_DEBUG("WORLD: unknown spell id %i/n", spellId);		return;	}	if (spellInfo->AuraInterruptFlags & AURA_INTERRUPT_ON_STAND_UP)	{		if (p_User->CombatStatus.IsInCombat() || p_User->IsMounted())		{			_player->GetItemInterface()->BuildInventoryChangeError(tmpItem,NULLITEM,INV_ERR_CANT_DO_IN_COMBAT);			return;		}			if(p_User->GetStandState()!=STANDSTATE_SIT)			p_User->SetStandState(STANDSTATE_SIT);	}	if(itemProto->RequiredLevel)	{		if(_player->getLevel() < itemProto->RequiredLevel)		{			_player->GetItemInterface()->BuildInventoryChangeError(tmpItem,NULLITEM,INV_ERR_ITEM_RANK_NOT_ENOUGH);			return;		}	}	if(itemProto->RequiredSkill)	{		if(!_player->_HasSkillLine(itemProto->RequiredSkill))		{			_player->GetItemInterface()->BuildInventoryChangeError(tmpItem,NULLITEM,INV_ERR_ITEM_RANK_NOT_ENOUGH);			return;		}//.........这里部分代码省略.........
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:101,


示例2: switch

void EyeOfTheStorm::HookOnAreaTrigger(Player* plr, uint32 id){	int32 tid = -1;	int32 bonusid = -1;	switch(id)	{		case 4476:			// BE Tower			tid = EOTS_TOWER_BE;			break;		case 4568:			// BE Tower bonus			bonusid = EOTS_TOWER_BE;			break;		case 4514:			// Fel Reaver Tower			tid = EOTS_TOWER_FELREAVER;			break;		case 4569:			// Fel Reaver Tower bonus			bonusid = EOTS_TOWER_FELREAVER;			break;		case 4518:			// Draenei Tower			tid = EOTS_TOWER_DRAENEI;			break;		case 4571:			// Draenei Tower bonus			bonusid = EOTS_TOWER_DRAENEI;			break;		case 4516:			// Mage Tower			tid = EOTS_TOWER_MAGE;			break;		case 4570:			// Mage Tower bonus			bonusid = EOTS_TOWER_MAGE;			break;		default:			sLog.Error("EyeOfTheStorm", "Encountered unhandled areatrigger id %u", id);			return;			break;	}	if(plr->IsDead())		// on ne buff pas les joueurs morts ;)		return;	if(bonusid > -1)	{		uint32 spellid = 0;		uint32 x = (uint32)bonusid;		if(EOTSm_buffs[x] && EOTSm_buffs[x]->IsInWorld())		{			spellid = EOTSm_buffs[x]->GetInfo()->sound3;			SpellEntry* sp = dbcSpell.LookupEntryForced(spellid);			if(sp)			{				Spell* pSpell = sSpellFactoryMgr.NewSpell(plr, sp, true, NULL);				SpellCastTargets targets(plr->GetGUID());				pSpell->prepare(&targets);			}			EOTSm_buffs[x]->Despawn(0, EOTS_BUFF_RESPAWN_TIME);		}	}	if(tid < 0)		return;#ifdef ANTI_CHEAT	if(!m_started)	{		Anticheat_Log->writefromsession(plr->GetSession(), "%s tried to hook the flag in eye of the storm before battleground (ID %u) started.", plr->GetName(), this->m_id);		SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, plr->GetGUID(), "%s will be removed from the game for cheating.", plr->GetName());		// Remove player from battleground.		this->RemovePlayer(plr, false);		// Kick	player from server.		plr->Kick(MSTIME_6SECONDS);		return;	}#endif	uint32 team = plr->GetTeam();	if(plr->GetLowGUID() != m_flagHolder)		return;	int32 val;	uint32 i;	uint32 towers = 0;	if(team == TEAM_ALLIANCE)		val = EOTS_BANNER_ALLIANCE;	else		val = EOTS_BANNER_HORDE;	if(!m_CPBanner[tid] || m_CPBanner[tid]->GetEntry() != static_cast<uint32>(val))		return;			// not captured by our team	for(i = 0; i < EOTS_TOWER_COUNT; ++i)	{		if(m_CPBanner[i] && m_CPBanner[i]->GetEntry() == static_cast<uint32>(val))			towers++;	}	/*	Points from flag captures	* 1 towers controlled = 75 points	* 2 towers controlled = 85 points	* 3 towers controlled = 100 points	* 4 towers controlled = 500 points//.........这里部分代码省略.........
开发者ID:lev1976g,项目名称:NoxicCore,代码行数:101,


示例3: switch

void WarsongGulch::HookOnAreaTrigger(Player * plr, uint32 id){	int32 buffslot = -1;	switch(id)	{	case 3686:	  // Speed		buffslot = 0;		break;	case 3687:	  // Speed (Horde)		buffslot = 1;		break;	case 3706:	  // Restoration		buffslot = 2;		break;	case 3708:	  // Restoration (Horde)		buffslot = 3;		break;	case 3707:	  // Berserking		buffslot = 4;		break;	case 3709:	  // Berserking (Horde)		buffslot = 5;		break;	}	if(buffslot >= 0)	{		if(m_buffs[buffslot] != 0 && m_buffs[buffslot]->IsInWorld())		{			/* apply the buff */			SpellEntry * sp = dbcSpell.LookupEntry(m_buffs[buffslot]->GetInfo()->sound3);			Spell * s = new Spell(plr, sp, true, 0);			SpellCastTargets targets(plr->GetGUID());			s->prepare(&targets);			/* despawn the gameobject (not delete!) */			m_buffs[buffslot]->Despawn(0, BUFF_RESPAWN_TIME);		}		return;	}	if(((id == 3646 && plr->IsTeamAlliance()) || (id == 3647 && plr->IsTeamHorde())) && (plr->m_bgHasFlag && m_flagHolders[plr->GetTeam()] == plr->GetLowGUID()))	{		if(m_flagHolders[plr->IsTeamHorde() ? TEAM_ALLIANCE : TEAM_HORDE] != 0 || m_dropFlags[plr->IsTeamHorde() ? TEAM_ALLIANCE : TEAM_HORDE]->IsInWorld())		{			/* can't cap while flag dropped */			return;		}		float distance = plr->IsTeamAlliance() ? plr->CalcDistance(1540.29f, 1481.34f, 352.64f) :plr->CalcDistance(915.367f, 1433.78f, 346.089f);		if (distance > 50.0f)		{			//50 yards from the spawn, gtfo hacker.			sCheatLog.writefromsession(plr->GetSession(),"Tried to capture the flag in WSG while being more then 50 yards away. (%f yards)",plr->CalcDistance(915.367f, 1433.78f, 346.089f));			plr->GetSession()->Disconnect();			return;		}		/* remove the bool from the player so the flag doesn't drop */		m_flagHolders[plr->GetTeam()] = 0;		plr->m_bgHasFlag = 0;		/* remove flag aura from player */		plr->RemoveAura(23333+(plr->GetTeam() * 2));		/* capture flag points */		plr->m_bgScore.MiscData[BG_SCORE_WSG_FLAGS_CAPTURED]++;		PlaySoundToAll( plr->IsTeamHorde() ? SOUND_HORDE_SCORES : SOUND_ALLIANCE_SCORES );		if( plr->IsTeamHorde() )			SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "%s captured the Alliance flag!", plr->GetName() );		else			SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "%s captured the Horde flag!", plr->GetName() );		SetWorldState( plr->IsTeamHorde() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 1 );		// Remove the Other Flag		if (m_homeFlags[plr->IsTeamHorde() ? TEAM_ALLIANCE : TEAM_HORDE]->IsInWorld())			m_homeFlags[plr->IsTeamHorde() ? TEAM_ALLIANCE : TEAM_HORDE]->RemoveFromWorld(false);		// Add the Event to respawn the Flags		sEventMgr.AddEvent(this, &WarsongGulch::EventReturnFlags, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG, 20000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);		/* give each player on that team bonus honor and reputation*/		uint32 honorToAdd = 2 * m_honorPerKill;		uint32 repToAdd = m_isWeekend ? 45 : 35;		uint32 fact = plr->IsTeamHorde() ? 889 : 890; /*Warsong Outriders : Sliverwing Sentinels*/		for(set<Player*>::iterator itr = m_players[plr->GetTeam()].begin(); itr != m_players[plr->GetTeam()].end(); ++itr)		{			(*itr)->m_bgScore.BonusHonor += honorToAdd;			HonorHandler::AddHonorPointsToPlayer((*itr), honorToAdd);			plr->ModStanding(fact, repToAdd);		}		m_scores[plr->GetTeam()]++;		if(m_scores[plr->GetTeam()] == 3)		{			/* victory! */			m_ended = true;			m_winningteam = (uint8)plr->GetTeam();//.........这里部分代码省略.........
开发者ID:vata,项目名称:wowice,代码行数:101,


示例4: check

double CrossEntropyError::calculate_minimum_selection_performance(void) const{    // Control sentence    #ifdef __OPENNN_DEBUG__    check();    #endif    // Neural network stuff    const MultilayerPerceptron* multilayer_perceptron_pointer = neural_network_pointer->get_multilayer_perceptron_pointer();    const size_t inputs_number = multilayer_perceptron_pointer->get_inputs_number();    const size_t outputs_number = multilayer_perceptron_pointer->get_outputs_number();    // Data set stuff    const Instances& instances = data_set_pointer->get_instances();    const size_t selection_instances_number = instances.count_selection_instances_number();    const Vector<size_t> selection_indices = instances.arrange_selection_indices();    size_t selection_index;    const Variables& variables = data_set_pointer->get_variables();    const Vector<size_t> inputs_indices = variables.arrange_inputs_indices();    const Vector<size_t> targets_indices = variables.arrange_targets_indices();    // Performance functional    Vector<double> inputs(inputs_number);    Vector<double> outputs(outputs_number);    Vector<double> targets(outputs_number);    double minimum_selection_performance = 0.0;    int i = 0;    #pragma omp parallel for private(i, selection_index, inputs, outputs, targets) reduction(- : minimum_selection_performance)    for(i = 0; i < (int)selection_instances_number; i++)    {        selection_index = selection_indices[i];       // Input vector       inputs = data_set_pointer->get_instance(selection_index, inputs_indices);       // Output vector       outputs = multilayer_perceptron_pointer->calculate_outputs(inputs);       // Target vector       targets = data_set_pointer->get_instance(selection_index, targets_indices);       // Cross entropy error       for(size_t j = 0; j < outputs_number; j++)       {           if(outputs[j] == 0.0)           {               outputs[j] = 1.0e-6;           }           else if(outputs[j] == 1.0)           {               outputs[j] = 0.999999;           }           if(targets[j] == 0.0)           {               targets[j] = 1.0e-6;           }           else if(targets[j] == 1.0)           {               targets[j] = 0.999999;           }           minimum_selection_performance -= targets[j]*log(outputs[j]/targets[j]) + (1.0 - targets[j])*log((1.0 - outputs[j])/(1.0 - targets[j]));       }    }    return(minimum_selection_performance);}
开发者ID:Grace,项目名称:OpenNN,代码行数:88,


示例5: targets

  /**   * @function setInitControl   */  void drchubo_Basics::SetInitControl() {    // Set info to controller    mCb.setSize( mNumActuatedJoints );        mCb.setJoints( mActuatedJoints );    // Set target to keep : Initial hard-coded values    std::vector<double> targets( mNumActuatedJoints );    for( int i = 0; i < mNumActuatedJoints; ++i ) {      targets[i] = mActuatedJoints[i]->GetAngle(0).Radian();     }      mCb.setTargets(targets);      // Set PID initial values    // Left Leg    mCb.initPID( 0, 50, 0, 5, 0, 0, 50, -50 );    mCb.initPID( 1, 50, 0, 5, 0, 0, 50, -50 );    mCb.initPID( 2, 50, 0, 5, 0, 0, 50, -50 );    mCb.initPID( 3, 1000, 0, 5, 0, 0, 1000, -1000 ); // LKP    mCb.initPID( 4, 200, 0, 10, 0, 0, 200, -200 ); // LAP    mCb.initPID( 5, 50, 0, 5, 0, 0, 50, -50 );    // Right Leg    mCb.initPID( 6, 50, 0, 5, 0, 0, 50, -50 );    mCb.initPID( 7, 50, 0, 5, 0, 0, 50, -50 );    mCb.initPID( 8, 50, 0, 5, 0, 0, 50, -50 );    mCb.initPID( 9, 1000, 0, 5, 0, 0, 1000, -1000 ); // RKP    mCb.initPID( 10, 200, 0, 10, 0, 0, 200, -200 ); // RAP    mCb.initPID( 11, 50, 0, 5, 0, 0, 50, -50 );        // Left Arm    mCb.initPID( 12, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 13, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 14, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 15, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 16, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 17, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 18, 50, 0, 0, 0, 0, 50, -50 );    // Right Arm    mCb.initPID( 19, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 20, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 21, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 22, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 23, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 24, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 25, 50, 0, 0, 0, 0, 50, -50 );    // Torso and neck    mCb.initPID( 26, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 27, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 28, 50, 0, 0, 0, 0, 50, -50 );    // Left and right fingers ( 3 + 3 = 6 )    mCb.initPID( 29, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 30, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 31, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 32, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 33, 50, 0, 0, 0, 0, 50, -50 );    mCb.initPID( 34, 50, 0, 0, 0, 0, 50, -50 );  }
开发者ID:ehuang3,项目名称:drchubo,代码行数:67,


示例6: targets

int BioScan::caTarget( Id channel, vector< Id >& ret ){	return targets( channel, "IkSrc", ret, "CaConc" );}
开发者ID:BhallaLab,项目名称:moose-thalamocortical,代码行数:4,


示例7: LOG_DETAIL

void WorldSession::HandleCastSpellOpcode(WorldPacket & recvPacket){	CHECK_INWORLD_RETURN	uint32 spellId;	uint8 cn, unk; //Alice : Added to 3.0.2	recvPacket >> cn >> spellId  >> unk;	// check for spell id	SpellEntry* spellInfo = dbcSpell.LookupEntryForced(spellId);	if(!spellInfo)	{		LOG_DETAIL("ERROR: WORLD: unknown spell id %i", spellId);		return;	}	if(!_player->isAlive() && _player->GetShapeShift() != FORM_SPIRITOFREDEMPTION && !(spellInfo->Attributes & ATTRIBUTES_DEAD_CASTABLE)) //They're dead, not in spirit of redemption and the spell can't be cast while dead.		return;	LOG_DETAIL("WORLD: got cast spell packet, spellId - %i (%s), data length = %i",	           spellId, spellInfo->Name, recvPacket.size());	// Cheat Detection only if player and not from an item	// this could fuck up things but meh it's needed ALOT of the newbs are using WPE now	// WPE allows them to mod the outgoing packet and basically choose what ever spell they want :(	if(!GetPlayer()->HasSpell(spellId))	{		sCheatLog.writefromsession(this, "Cast spell %lu but doesn't have that spell.", spellId);		LOG_DETAIL("WORLD: Spell isn't cast because player /'%s/' is cheating", GetPlayer()->GetName());		return;	}	if(spellInfo->Attributes & ATTRIBUTES_PASSIVE)	{		sCheatLog.writefromsession(this, "Cast passive spell %lu.", spellId);		LOG_DETAIL("WORLD: Spell isn't cast because player /'%s/' is cheating", GetPlayer()->GetName());		return;	}	if(GetPlayer()->GetOnMeleeSpell() != spellId)	{		//autoshot 75		if((spellInfo->AttributesExB & ATTRIBUTESEXB_ACTIVATE_AUTO_SHOT) /*spellInfo->Attributes == 327698*/)	// auto shot..		{			//sLog.outString( "HandleSpellCast: Auto Shot-type spell cast (id %u, name %s)" , spellInfo->Id , spellInfo->Name );			Item* weapon = GetPlayer()->GetItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_RANGED);			if(!weapon)				return;			uint32 spellid;			switch(weapon->GetProto()->SubClass)			{				case 2:			 // bows				case 3:			 // guns				case 18:		 // crossbow					spellid = SPELL_RANGED_GENERAL;					break;				case 16:			// thrown					spellid = SPELL_RANGED_THROW;					break;				case 19:			// wands					spellid = SPELL_RANGED_WAND;					break;				default:					spellid = 0;					break;			}			if(!spellid)				spellid = spellInfo->Id;			if(!_player->m_onAutoShot)			{				_player->m_AutoShotTarget = _player->GetSelection();				uint32 duration = _player->GetBaseAttackTime(RANGED);				SpellCastTargets targets(recvPacket, GetPlayer()->GetGUID());				if(!targets.m_unitTarget)				{					LOG_DEBUG("Cancelling auto-shot cast because targets.m_unitTarget is null!");					return;				}				SpellEntry* sp = dbcSpell.LookupEntry(spellid);				_player->m_AutoShotSpell = sp;				_player->m_AutoShotDuration = duration;				//This will fix fast clicks				if(_player->m_AutoShotAttackTimer < 500)					_player->m_AutoShotAttackTimer = 500;				_player->m_onAutoShot = true;			}			return;		}		if(_player->m_currentSpell)		{			if(_player->m_currentSpell->getState() == SPELL_STATE_CASTING)			{				// cancel the existing channel spell, cast this one				_player->m_currentSpell->cancel();//.........这里部分代码省略.........
开发者ID:dberga,项目名称:arcbliz,代码行数:101,


示例8: GetPlayer

//.........这里部分代码省略.........	// Let's check if the item even has that spell	for(int i = 0; i < 5; ++i)	{		if(itemProto->Spells[i].Trigger == USE && itemProto->Spells[i].Id == spellId)		{			found = true;			break;//found 1 already		}	}	// Let's see if it is an onuse spellid	if(tmpItem->HasOnUseSpellID(spellId))		found = true;	// We didn't find the spell, so the player is probably trying to cheat	// with an edited itemcache.wdb	//	// Altough this could also happen after a DB update	// if he/she didn't delete his/her cache.	if(found == false)	{		this->Disconnect();		Anticheat_Log->writefromsession(this, "Player tried to use an item with a spell that didn't match the spell in the database.");		Anticheat_Log->writefromsession(this, "Possibly corrupted or intentionally altered itemcache.wdb");		Anticheat_Log->writefromsession(this, "Itemid: %lu", itemProto->ItemId);		Anticheat_Log->writefromsession(this, "Spellid: %lu", spellId);		Anticheat_Log->writefromsession(this, "Player was disconnected");		return;	}	SpellCastTargets targets(recvPacket, _player->GetGUID());	SpellEntry* spellInfo = dbcSpell.LookupEntryForced(spellId);	if(spellInfo == NULL)	{		LOG_DETAIL("ERROR: WORLD: unknown spell id %i", spellId);		return;	}	if(spellInfo->AuraInterruptFlags & AURA_INTERRUPT_ON_STAND_UP)	{		if(p_User->CombatStatus.IsInCombat() || p_User->IsMounted())		{			_player->GetItemInterface()->BuildInventoryChangeError(tmpItem, NULL, INV_ERR_CANT_DO_IN_COMBAT);			return;		}		if(p_User->GetStandState() != 1)			p_User->SetStandState(STANDSTATE_SIT);		// loop through the auras and removing existing eating spells	}	else   // cebernic: why not stand up	{		if(!p_User->CombatStatus.IsInCombat() && !p_User->IsMounted())		{			if(p_User->GetStandState())			{				p_User->SetStandState(STANDSTATE_STAND);			}		}	}	// cebernic: remove stealth on using item
开发者ID:dberga,项目名称:arcbliz,代码行数:67,


示例9: targets

void WorldSession::HandleUseItemOpcode(WorldPackets::Spells::UseItem& packet){    Player* user = _player;    // ignore for remote control state    if (user->m_mover != user)        return;    Item* item = user->GetUseableItemByPos(packet.PackSlot, packet.Slot);    if (!item)    {        user->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);        return;    }    if (item->GetGUID() != packet.CastItem)    {        user->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);        return;    }    ItemTemplate const* proto = item->GetTemplate();    if (!proto)    {        user->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL);        return;    }    // some item classes can be used only in equipped state    if (proto->GetInventoryType() != INVTYPE_NON_EQUIP && !item->IsEquipped())    {        user->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, NULL);        return;    }    InventoryResult msg = user->CanUseItem(item);    if (msg != EQUIP_ERR_OK)    {        user->SendEquipError(msg, item, NULL);        return;    }    // only allow conjured consumable, bandage, poisons (all should have the 2^21 item flag set in DB)    if (proto->GetClass() == ITEM_CLASS_CONSUMABLE && !(proto->GetFlags() & ITEM_FLAG_USEABLE_IN_ARENA) && user->InArena())    {        user->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, item, NULL);        return;    }    // don't allow items banned in arena    if (proto->GetFlags() & ITEM_FLAG_NOT_USEABLE_IN_ARENA && user->InArena())    {        user->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, item, NULL);        return;    }    if (user->IsInCombat())    {        for (uint32 i = 0; i < proto->Effects.size(); ++i)        {            if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(proto->Effects[i]->SpellID))            {                if (!spellInfo->CanBeUsedInCombat())                {                    user->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, item, NULL);                    return;                }            }        }    }    // check also  BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory)    if (item->GetTemplate()->GetBonding() == BIND_WHEN_USE || item->GetTemplate()->GetBonding() == BIND_WHEN_PICKED_UP || item->GetTemplate()->GetBonding() == BIND_QUEST_ITEM)    {        if (!item->IsSoulBound())        {            item->SetState(ITEM_CHANGED, user);            item->SetBinding(true);        }    }    SpellCastTargets targets(user, packet.Cast);    // Note: If script stop casting it must send appropriate data to client to prevent stuck item in gray state.    if (!sScriptMgr->OnItemUse(user, item, targets))    {        // no script or script not process request by self        user->CastItemUseSpell(item, targets, packet.Cast.CastID, packet.Cast.Misc);    }}
开发者ID:RafoxSama,项目名称:TrinityCore,代码行数:90,


示例10: TC_LOG_ERROR

void WorldSession::HandleCastSpellOpcode(WorldPackets::Spells::CastSpell& cast){    // ignore for remote control state (for player case)    Unit* mover = _player->m_mover;    if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)        return;    SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cast.Cast.SpellID);    if (!spellInfo)    {        TC_LOG_ERROR("network", "WORLD: unknown spell id %u", cast.Cast.SpellID);        return;    }    if (spellInfo->IsPassive())        return;    Unit* caster = mover;    if (caster->GetTypeId() == TYPEID_UNIT && !caster->ToCreature()->HasSpell(spellInfo->Id))    {        // If the vehicle creature does not have the spell but it allows the passenger to cast own spells        // change caster to player and let him cast        if (!_player->IsOnVehicle(caster) || spellInfo->CheckVehicle(_player) != SPELL_CAST_OK)            return;        caster = _player;    }    // check known spell or raid marker spell (which not requires player to know it)    if (caster->GetTypeId() == TYPEID_PLAYER && !caster->ToPlayer()->HasActiveSpell(spellInfo->Id) && !spellInfo->HasEffect(SPELL_EFFECT_CHANGE_RAID_MARKER))        return;    // Check possible spell cast overrides    spellInfo = caster->GetCastSpellInfo(spellInfo);    // Client is resending autoshot cast opcode when other spell is cast during shoot rotation    // Skip it to prevent "interrupt" message    if (spellInfo->IsAutoRepeatRangedSpell() && caster->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)        && caster->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(caster, cast.Cast);    // auto-selection buff level base at target level (in spellInfo)    if (targets.GetUnitTarget())    {        SpellInfo const* actualSpellInfo = spellInfo->GetAuraRankForLevel(targets.GetUnitTarget()->getLevel());        // if rank not found then function return NULL but in explicit cast case original spell can be cast and later failed with appropriate error message        if (actualSpellInfo)            spellInfo = actualSpellInfo;    }    Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE, ObjectGuid::Empty, false);    spell->m_cast_count = cast.Cast.CastID;                         // set count of casts    spell->m_misc.Raw.Data[0] = cast.Cast.Misc[0];    spell->m_misc.Raw.Data[1] = cast.Cast.Misc[1];    spell->prepare(&targets);}
开发者ID:RafoxSama,项目名称:TrinityCore,代码行数:64,


示例11: SendEnchantTimeUpdate

void Item::ApplyEnchantmentBonus(uint32 Slot, bool Apply){    if (m_owner == NULL)        return;    EnchantmentMap::iterator itr = Enchantments.find(Slot);    if (itr == Enchantments.end())        return;    EnchantEntry* Entry = itr->second.Enchantment;    uint32 RandomSuffixAmount = itr->second.RandomSuffix;    if (itr->second.BonusApplied == Apply)        return;    itr->second.BonusApplied = Apply;    if (Apply)    {        // Send the enchantment time update packet.        SendEnchantTimeUpdate(itr->second.Slot, itr->second.Duration);    }    // Apply the visual on the player.    uint32 ItemSlot = m_owner->GetItemInterface()->GetInventorySlotByGuid(GetGUID()) * PLAYER_VISIBLE_ITEM_LENGTH;   //VLack: for 3.1.1 "* 18" is a bad idea, now it's "* 2"; but this could have been calculated based on UpdateFields.h! This is PLAYER_VISIBLE_ITEM_LENGTH    uint32 VisibleBase = PLAYER_VISIBLE_ITEM_1_ENCHANTMENT + ItemSlot;    if (VisibleBase <= PLAYER_VISIBLE_ITEM_19_ENCHANTMENT)        m_owner->SetUInt32Value(VisibleBase, Apply ? Entry->Id : 0);   //On 3.1 we can't add a Slot to the base now, as we no longer have multiple fields for storing them. This in some cases will try to write for example 3 visuals into one place, but now every item has only one field for this, and as we can't choose which visual to have, we'll accept the last one.    else        LOG_ERROR("Item::ApplyEnchantmentBonus visual out of range! Tried to address UInt32 field %i !!!", VisibleBase);    // Another one of those for loop that where not indented properly god knows what will break    // but i made it actually affect the code below it    for (uint32 c = 0; c < 3; c++)    {        if (Entry->type[c])        {            // Depending on the enchantment type, take the appropriate course of action.            switch (Entry->type[c])            {            case 1:         // Trigger spell on melee attack.            {                if (Apply)                {                    if (Entry->spell[c] != 0)                        m_owner->AddProcTriggerSpell(Entry->spell[c], 0, m_owner->GetGUID(), Entry->min[c], PROC_ON_MELEE_ATTACK, 0, NULL, NULL, this);                }                else                {                    m_owner->RemoveProcTriggerSpell(Entry->spell[c], m_owner->GetGUID(), GetGUID());                }            }                break;            case 2:         // Mod damage done.            {                int32 val = Entry->min[c];                if (RandomSuffixAmount)                    val = RANDOM_SUFFIX_MAGIC_CALCULATION(RandomSuffixAmount, GetItemRandomSuffixFactor());                if (Apply)                    m_owner->ModPosDamageDoneMod(SCHOOL_NORMAL, val);                else                    m_owner->ModPosDamageDoneMod(SCHOOL_NORMAL, -val);                m_owner->CalcDamage();            }                break;            case 3:         // Cast spell (usually means apply aura)            {                if (Apply)                {                    SpellCastTargets targets(m_owner->GetGUID());                    SpellEntry* sp;                    Spell* spell;                    if (Entry->spell[c] != 0)                    {                        sp = dbcSpell.LookupEntryForced(Entry->spell[c]);                        if (sp == NULL)                            continue;                        spell = sSpellFactoryMgr.NewSpell(m_owner, sp, true, 0);                        spell->i_caster = this;                        spell->prepare(&targets);                    }                }                else                {                    if (Entry->spell[c] != 0)                        m_owner->RemoveAuraByItemGUID(Entry->spell[c], GetGUID());                }            }                break;            case 4:         // Modify physical resistance            {                int32 val = Entry->min[c];                if (RandomSuffixAmount)                    val = RANDOM_SUFFIX_MAGIC_CALCULATION(RandomSuffixAmount, GetItemRandomSuffixFactor());//.........这里部分代码省略.........
开发者ID:lev1976g,项目名称:easywow,代码行数:101,


示例12: make

  static  P2P_Compressed<typename Context::kernel_type>*  make(Context& c, BoxPairIter first, BoxPairIter last) {    typename Context::source_iterator first_source = c.source_begin();    typename Context::source_iterator first_target = c.target_begin();    unsigned num_targets = c.target_tree().bodies();    //unsigned num_sources = c.source_tree().bodies();    unsigned num_box_pairs = last - first;    // Interaction list for each target box    // (target_first,target_last) -> {(source_first, source_last), ...}    // TODO: faster?    typedef std::pair<unsigned, unsigned> upair;    std::vector<std::vector<upair> > target2sources(num_targets);    // A list of target ranges we've seen: {(target_first, target_last), ...}    std::vector<upair> target_ranges;    for ( ; first != last; ++first) {      const typename BoxPairIter::value_type& bpair = *first;      const typename Context::source_box_type& source_box = bpair.first;      const typename Context::target_box_type& target_box = bpair.second;      // Target boxes need to be leaf boxes because the computations are      // grouped by disjoint target ranges      // TODO: Generalize?      FMMTL_ASSERT(target_box.is_leaf());			// Target range			unsigned i_begin = c.target_begin(target_box) - first_target;      unsigned i_end   = c.target_end(target_box) - first_target;			// Source range			unsigned j_begin = c.source_begin(source_box) - first_source;			unsigned j_end   = c.source_end(source_box) - first_source;      // If this is the first time we've seen this target range      if (target2sources[i_begin].empty())        target_ranges.push_back(upair(i_begin, i_end));      target2sources[i_begin].push_back(upair(j_begin,j_end));    }    unsigned num_target_ranges = target_ranges.size();    // Construct a compressed interaction list    std::vector<unsigned> target_ptr(num_target_ranges + 1);    target_ptr[0] = 0;    std::vector<upair> source_ranges(num_box_pairs);    std::vector<upair>::iterator source_ranges_curr = source_ranges.begin();    // For all the target ranges    for (unsigned k = 0; k < num_target_ranges; ++k) {      // Copy the source ranges that interact with the kth target range      unsigned i_begin = target_ranges[k].first;      source_ranges_curr = std::copy(target2sources[i_begin].begin(),                                     target2sources[i_begin].end(),                                     source_ranges_curr);      // Record the stop index      target_ptr[k+1] = source_ranges_curr - source_ranges.begin();    }    // Sanity checking    FMMTL_ASSERT(target_ptr.back() == source_ranges.size());    FMMTL_ASSERT(source_ranges_curr == source_ranges.end());    // Copy the source and target ranges into contiguous vectors    std::vector<source_type> sources(c.source_begin(), c.source_end());    std::vector<target_type> targets(c.target_begin(), c.target_end());    return new P2P_Compressed<Kernel>(target_ranges,                                      target_ptr,                                      source_ranges,                                      sources,                                      targets);  }
开发者ID:kgourgou,项目名称:fmmtl,代码行数:77,


示例13: targets

 int LinearMatrix::targetCount() const {    return targets().size(); }
开发者ID:blackhearted,项目名称:ember-plus,代码行数:4,


示例14: createNToN

void createNToN(model::Node* router, int nodeNumber, glow::Dispatcher* dispatcher){   auto nToN = new model::Node(nodeNumber, router, "nToN");   nToN->setDescription("Non-Linear N:N");   auto labels = new model::Node(1, nToN, "labels");   auto targetLabels = new model::Node(1, labels, "targets");   auto sourceLabels = new model::Node(2, labels, "sources");   auto parameters = new model::Node(2, nToN, "parameters");   auto targetParams = new model::Node(1, parameters, "targets");   auto sourceParams = new model::Node(2, parameters, "sources");   auto xpointParams = new model::Node(3, parameters, "connections");   auto targets = model::matrix::Signal::Vector();   auto sources = model::matrix::Signal::Vector();   auto number = 0;   for(int index = 0; index < 4; index++)   {      number += 3;      auto targetLabel = new model::StringParameter(number, targetLabels, identOf("t", number), dispatcher);      targetLabel->setValue(identOf("AES-T", number));      targets.insert(targets.end(), new model::matrix::Signal(number));      auto targetNode = new model::Node(number, targetParams, identOf("t", number));      (new model::IntegerParameter(1, targetNode, "targetGain", dispatcher, -128, 15))->setValue(-64);      (new model::StringParameter(2, targetNode, "targetMode", dispatcher))->setValue("something");      auto sourceLabel = new model::StringParameter(number, sourceLabels, identOf("s", number), dispatcher);      sourceLabel->setValue(identOf("AES-S", number));      sources.insert(sources.end(), new model::matrix::Signal(number));      auto sourceNode = new model::Node(number, sourceParams, identOf("s", number));      (new model::IntegerParameter(1, sourceNode, "sourceGain", dispatcher, -128, 15))->setValue(-64);   }   auto const gainParameterNumber = 1;   for(auto target : targets)   {      auto targetNode = new model::Node(target->number(), xpointParams, identOf("t", target->number()));      for(auto source : sources)      {         auto sourceNode = new model::Node(source->number(), targetNode, identOf("s", source->number()));         (new model::IntegerParameter(gainParameterNumber, sourceNode, "gain", dispatcher, -128, 15))->setValue(0);      }   }   auto matrix = new model::matrix::NToNNonlinearMatrix(3, nToN, "matrix", dispatcher, targets.begin(), targets.end(), sources.begin(), sources.end());   matrix->setLabelsPath(labels->path());   matrix->setParametersPath(parameters->path());   matrix->setGainParameterNumber(gainParameterNumber);   for(auto target : matrix->targets())   {      if(target->number() % 2 == 0)      {         auto source = matrix->getSource(target->number());         matrix->connect(target, &source, &source + 1, nullptr);      }   }}
开发者ID:timblankman,项目名称:ember-plus,代码行数:65,


示例15: GetGUID

//.........这里部分代码省略.........                        for( itr = m_owner->m_procSpells.begin(); itr != m_owner->m_procSpells.end(); )                        {                            SpellId = itr->spellId;                            /*itr2 = itr;*/                            /*++itr;*/                            if( SpellId == Entry->spell[c] )                            {                                //m_owner->m_procSpells.erase(itr2);                                itr->deleted = true;                            }                            ++itr;                        }                    }                }break;            case 2:      // Mod damage done.                {                    int32 val = Entry->min[c];                    if( RandomSuffixAmount )                        val = RANDOM_SUFFIX_MAGIC_CALCULATION( RandomSuffixAmount, GetItemRandomSuffixFactor() );                    if( Apply )                        m_owner->DamageDonePosMod[0] += val;                    else                        m_owner->DamageDonePosMod[0] -= val;                    m_owner->UpdateStats();                }break;            case 3:      // Cast spell (usually means apply aura)                {                    if( Apply )                    {                        SpellCastTargets targets( m_owner->GetGUID() );                        SpellEntry* sp;                        if( Entry->spell[c] != 0 )                        {                            sp = dbcSpell.LookupEntryForced( Entry->spell[c] );                            if( sp == NULL )                                continue;                            Spell* spell = NULLSPELL;                            //Never found out why,                            //but this Blade of Life's Inevitability spell must be casted by the item, not owner.                            if( m_itemProto->ItemId != 34349  )                                spell = (new Spell( m_owner, sp, true, NULLAURA ));                            else                                spell = (new Spell( TO_ITEM(this), sp, true, NULLAURA ));                            spell->i_caster = TO_ITEM(this);                            spell->prepare( &targets );                        }                    }                    else                    {                        if( Entry->spell[c] != 0 )                            m_owner->RemoveAura( Entry->spell[c] );                    }                }break;            case 4:      // Modify physical resistance                {                    int32 val = Entry->min[c];                    if( RandomSuffixAmount )                        val = RANDOM_SUFFIX_MAGIC_CALCULATION( RandomSuffixAmount, GetItemRandomSuffixFactor() );
开发者ID:Sandshroud,项目名称:Sandshroud-Prodigy,代码行数:67,


示例16: switch

void ArathiBasin::HookOnAreaTrigger(Player * plr, uint32 id){	uint32 spellid= 0;	int32 buffslot = -1;	switch(id)	{	case 3866:			// stables		buffslot=AB_BUFF_STABLES;		break;	case 3867:			// farm		buffslot=AB_BUFF_FARM;				break;	case 3870:			// blacksmith		buffslot=AB_BUFF_BLACKSMITH;		break;	case 3869:			// mine		buffslot=AB_BUFF_MINE;		break;	case 3868:			// lumbermill		buffslot=AB_BUFF_LUMBERMILL;		break;	case 3948:			// alliance/horde exits	case 3949:		{			RemovePlayer(plr,false);			return;		}break;	case 4020:			// Trollbane Hall	case 4021:			// Defiler's Den		return;		break;	default:		Log.Error("ArathiBasin", "Encountered unhandled areatrigger id %u", id);		return;		break;	}	if(plr->IsDead())		// don't apply to dead players... :P		return;		uint32 x = (uint32)buffslot;	if(m_buffs[x] && m_buffs[x]->IsInWorld())	{		// apply the spell		spellid = m_buffs[x]->GetInfo()->sound3;		m_buffs[x]->RemoveFromWorld(false);		// respawn it in buffrespawntime		sEventMgr.AddEvent(this,&ArathiBasin::SpawnBuff,x,EVENT_AB_RESPAWN_BUFF,AB_BUFF_RESPAWN_TIME,1,EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT);		// cast the spell on the player		SpellEntry * sp = dbcSpell.LookupEntryForced(spellid);		if(sp)		{			Spell * pSpell = new Spell(plr, sp, true, NULL);			SpellCastTargets targets(plr->GetGUID());			pSpell->prepare(&targets);		}	}}
开发者ID:Naqvamp,项目名称:Underworld_Core,代码行数:65,


示例17: UpdatePvPData

void WarsongGulch::HookFlagDrop(Player * plr, GameObject * obj){	/* picking up a dropped flag */	if(m_dropFlags[plr->GetTeam()] != obj)	{		/* are we returning it? */		if( (obj->GetEntry() == 179785 && plr->IsTeamAlliance()) ||			(obj->GetEntry() == 179786 && plr->IsTeamHorde()) )		{			uint32 x = plr->GetTeam() ? 0 : 1;			sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + (plr->IsTeamHorde() ? TEAM_ALLIANCE : TEAM_HORDE));			if( m_dropFlags[x]->IsInWorld() )				m_dropFlags[x]->RemoveFromWorld(false);			if(m_homeFlags[x]->IsInWorld() == false)				m_homeFlags[x]->PushToWorld(m_mapMgr);			plr->m_bgScore.MiscData[BG_SCORE_WSG_FLAGS_RETURNED]++;			UpdatePvPData();			if( plr->IsTeamHorde() )				SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Horde flag was returned to its base by %s!", plr->GetName() );			else				SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Alliance flag was returned to its base by %s!", plr->GetName() );			SetWorldState(plr->IsTeamHorde() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 1);			PlaySoundToAll(plr->IsTeamHorde() ? SOUND_HORDE_RETURNED : SOUND_ALLIANCE_RETURNED);		}		return;	}	map<uint32,uint32>::iterator itr = plr->m_forcedReactions.find(1059);	if (itr != plr->m_forcedReactions.end()) {		return;	}	if( plr->IsTeamAlliance() )		sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG);	else		sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + 1);	if( m_dropFlags[plr->GetTeam()]->IsInWorld() )		m_dropFlags[plr->GetTeam()]->RemoveFromWorld(false);	m_flagHolders[plr->GetTeam()] = plr->GetLowGUID();	plr->m_bgHasFlag = true;	/* This is *really* strange. Even though the A9 create sent to the client is exactly the same as the first one, if	 * you spawn and despawn it, then spawn it again it will not show. So we'll assign it a new guid, hopefully that	 * will work.	 * - Burlex	 */	m_dropFlags[plr->GetTeam()]->SetNewGuid(m_mapMgr->GenerateGameobjectGuid());		SpellEntry * pSp = dbcSpell.LookupEntry(23333 + (plr->GetTeam() * 2));	Spell * sp = new Spell(plr, pSp, true, 0);	SpellCastTargets targets(plr->GetGUID());	sp->prepare(&targets);	SetWorldState(plr->IsTeamHorde() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 2);	if( plr->IsTeamHorde() )		SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Alliance's flag has been taken by %s !", plr->GetName() );	else		SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Horde's flag has been taken by %s !", plr->GetName() );}
开发者ID:vata,项目名称:wowice,代码行数:65,


示例18: OUT_DEBUG

void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket){	CHECK_INWORLD_RETURN;	if(_player->getDeathState()==CORPSE)		return;	uint32 spellId;	uint8 cn, unk; // 3.0.2 unk	recvPacket >> cn >> spellId  >> unk;	if(!spellId)	{		OUT_DEBUG("WORLD: unknown spell id %i/n", spellId);		return;	}	// check for spell id	SpellEntry *spellInfo = dbcSpell.LookupEntryForced(spellId);	if(!spellInfo || !sHookInterface.OnCastSpell(_player, spellInfo))	{		OUT_DEBUG("WORLD: unknown spell id %i/n", spellId);		return;	}	OUT_DEBUG("WORLD: got cast spell packet, spellId - %i (%s), data length = %i",		spellId, spellInfo->Name, recvPacket.size());		// Cheat Detection only if player and not from an item	// this could fuck up things but meh it's needed ALOT of the newbs are using WPE now	// WPE allows them to mod the outgoing packet and basicly choose what ever spell they want :(	if( !GetPlayer()->HasSpell(spellId) || spellInfo->Attributes & ATTRIBUTES_PASSIVE )	{		// Some spells the player doesn't actually know, but are given to him by his current shapeshift.		// These spells should be allowed to be cast.		uint8 shapeshift = GetPlayer()->GetShapeShift();		SpellShapeshiftForm * ssf = dbcSpellShapeshiftForm.LookupEntryForced(shapeshift);		if(!ssf) return;		bool ok = false;		for(uint8 i = 0; i < 7; ++i)			if( ssf->spells[i] == spellId)				ok = true;		if( !ok )			return;	}	if (GetPlayer()->GetOnMeleeSpell() != spellId)	{		//autoshot 75		if((spellInfo->Flags3 & FLAGS3_ACTIVATE_AUTO_SHOT) /*spellInfo->Attributes == 327698*/)	// auto shot..		{			//sLog.outString( "HandleSpellCast: Auto Shot-type spell cast (id %u, name %s)" , spellInfo->Id , spellInfo->Name );			ItemPointer weapon = GetPlayer()->GetItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_RANGED);			if(!weapon) 				return;			uint32 spellid;			switch(weapon->GetProto()->SubClass)			{			case 2:			 // bows			case 3:			 // guns            case 18:		 // crossbow				spellid = SPELL_RANGED_GENERAL;				break;			case 16:			// thrown				spellid = SPELL_RANGED_THROW;				break;			case 19:			// wands				spellid = SPELL_RANGED_WAND;				break;			default:				spellid = 0;				break;			}		   			if(!spellid) 				spellid = spellInfo->Id;						if(!_player->m_onAutoShot)			{				_player->m_AutoShotTarget = _player->GetSelection();				uint32 duration = _player->GetUInt32Value(UNIT_FIELD_RANGEDATTACKTIME);				SpellCastTargets targets(recvPacket,GetPlayer()->GetGUID());				if(!targets.m_unitTarget)				{					sLog.outString( "Cancelling auto-shot cast because targets.m_unitTarget is null!" );					return;				}				SpellEntry *sp = dbcSpell.LookupEntry(spellid);							_player->m_AutoShotSpell = sp;				_player->m_AutoShotDuration = duration;				//This will fix fast clicks				if(_player->m_AutoShotAttackTimer < 500)					_player->m_AutoShotAttackTimer = 500;				_player->m_onAutoShot = true;			}			return;//.........这里部分代码省略.........
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:101,



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


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