当前位置: 首页>>代码示例>>C++>>正文


C++ Spell::GetProto方法代码示例

本文整理汇总了C++中Spell::GetProto方法的典型用法代码示例。如果您正苦于以下问题:C++ Spell::GetProto方法的具体用法?C++ Spell::GetProto怎么用?C++ Spell::GetProto使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Spell的用法示例。


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

示例1: ScriptedBackToOrig

void GameEventMgr::ScriptedBackToOrig(uint32 event_id)
{
	GameEventScriptMap::iterator event_backup = m_GameEventScriptBackup.find(event_id);
	if( event_backup == m_GameEventScriptBackup.end() )
		return;

	set<EventScript*>::iterator itr = event_backup->second.begin();
	for( itr; itr != event_backup->second.end(); itr++ )
	{
		uint32 mapid = (*itr)->mapid;
		uint32 sql_id = (*itr)->sql_id;
		uint8 type = (*itr)->type;
		uint32 data1 = (*itr)->data_1;
		uint32 data2 = (*itr)->data_2;
		uint32 data3 = (*itr)->data_3;

		MapMgr * mapmgr = sInstanceMgr.GetMapMgr( mapid );
		if( mapmgr == NULL )
			return;

		Creature *c;
		GameObject *go;
		if(type < GAMEOBJECT_CHANGE_STATE)
		{
			c = mapmgr->GetSqlIdCreature( sql_id );
			if( c == NULL ) return;
		}
		else
		{
			go = mapmgr->GetSqlIdGameObject( sql_id );
			if( go == NULL ) return;
		}

		switch( type )
		{
			case CREATURE_CHANGE_SCRIPTED_CHANGE:
			{
				CALL_SCRIPT_EVENT(c, GameEventFinish)(event_id);
			} break;
			case CREATURE_CHANGE_EMOTE:
			{
				c->Emote(EmoteType(data1));
				c->SetEmoteState(data2);
				c->SetStandState(static_cast<uint8>(data3));
			} break;

			case CREATURE_CHANGE_DISPLAYID:
			{
				c->SetDisplayId(data1);
				c->SetNativeDisplayId(data2);
				c->SetMount(data3);

				c->EventModelChange();
			} break;

			case CREATURE_CHANGE_WEAPON:
			{
				c->SetEquippedItem(MELEE, data1);
				c->SetEquippedItem(OFFHAND, data2);
				c->SetEquippedItem(RANGED, data3);
			} break;

			case CREATURE_CHANGE_REACT:
			{
				c->SetFaction(data1);
				c->SetUInt32Value(UNIT_NPC_FLAGS, data2);
				c->SetUInt32Value(UNIT_FIELD_FLAGS, data3);
			} break;

			case CREATURE_CAST_SPELL_ON_EVENT_STOP:
			{
				SpellEntry * sp = dbcSpell.LookupEntryForced( data1 );
				if( sp == NULL )
					return;

				SpellCastTime * casttime = dbcSpellCastTime.LookupEntry(sp->CastingTimeIndex);
				Spell * spell = sSpellFactoryMgr.NewSpell(c, sp, false, NULL);

				SpellCastTargets t(0);

				// force self casting
				if( data2 )
				{
					t.m_unitTarget = c->GetGUID();
				}
				else
				{
					spell->GenerateTargets(&t);
					spell->m_targets = t;
				}

				if (objmgr.IsSpellDisabled(spell->GetProto()->Id) || spell->CanCast(false) != SPELL_CANCAST_OK || !spell->HasPower() || c->m_silenced || c->IsStunned() || c->IsFeared() )
				{
					delete spell;
					return;
				}

				if( casttime->CastTime > 0 )
					c->GetAIInterface()->StopMovement(casttime->CastTime);

//.........这里部分代码省略.........
开发者ID:Demensis,项目名称:arcemu,代码行数:101,代码来源:GameEventManager.cpp

示例2: DoScript


//.........这里部分代码省略.........
			es->data_3 = c->GetEquippedItem(RANGED);
			c->SetEquippedItem(MELEE, data1);
			c->SetEquippedItem(OFFHAND, data2);
			c->SetEquippedItem(RANGED, data3);
		} break;

		case CREATURE_CHANGE_REACT:
		{
			es->data_1 = c->GetFaction();
			c->SetFaction(data1);
			es->data_2 = c->GetUInt32Value(UNIT_NPC_FLAGS);
			c->SetUInt32Value(UNIT_NPC_FLAGS, data2);
			es->data_3 = c->GetUInt32Value(UNIT_FIELD_FLAGS);
			c->SetUInt32Value(UNIT_FIELD_FLAGS, data3);
		} break;

		case CREATURE_CAST_SPELL_ON_EVENT_START:
		{
			SpellEntry * sp = dbcSpell.LookupEntryForced( data1 );
			if( sp == NULL )
				return;

			SpellCastTime * casttime = dbcSpellCastTime.LookupEntry(sp->CastingTimeIndex);
			Spell * spell = sSpellFactoryMgr.NewSpell(c, sp, false, NULL);

			SpellCastTargets t(0);

			// force self casting
			if( data2 )
			{
				t.m_unitTarget = c->GetGUID();
			}
			else
			{
				spell->GenerateTargets(&t);
				spell->m_targets = t;
			}

			if (objmgr.IsSpellDisabled(spell->GetProto()->Id) || spell->CanCast(false) != SPELL_CANCAST_OK || !spell->HasPower() || c->m_silenced || c->IsStunned() || c->IsFeared() )
			{
				delete spell;
				return;
			}

			if( casttime->CastTime > 0 )
				c->GetAIInterface()->StopMovement(casttime->CastTime);

			spell->prepare(&t);

		} break;

		case CREATURE_CAST_SPELL_ON_EVENT_STOP:
		{
			// this time just backup it, we will procez it on event end
			es->data_1 = data1;
			es->data_2 = data2;
		} break;

		case CREATURE_CHANGE_UPDATE_FIELD:
		{
			es->data_1 = data1;
			es->data_2 = c->GetUInt32Value(data1);
			c->SetUInt32Value(data1, data2);
		} break;

		case CREATURE_CHANGE_DESPAWN:
		{
			GameEventMap::iterator itr = CheckAndReturnEvent( event_id );
			if( itr == m_GameEventMap.end() )
				return;

			uint32 current_time = mktime(&g_localTime);
			// this is calculated in seconds and added 1 extra second as timer for spawn and despawn
			uint32 respawntime = itr->second->end_time - current_time + 1;
			// values here are in miliseconds
			c->Despawn(0, respawntime*1000);
			delete es;
			return;
		} break;

		case GAMEOBJECT_CHANGE_STATE:
		{
			es->data_1 = (uint32)go->GetState();
			go->SetState((uint8)data1);
		} break;
	}

	// insert event into storage
	GameEventScriptMap::iterator itr = m_GameEventScriptBackup.find(event_id);
	if( itr == m_GameEventScriptBackup.end() )
	{
		set< EventScript* > s;
		s.insert( es );
		m_GameEventScriptBackup.insert(make_pair(event_id, s));
	}
	else
	{
		itr->second.insert( es );
	}
}
开发者ID:Demensis,项目名称:arcemu,代码行数:101,代码来源:GameEventManager.cpp


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