void ProjectBuildTarget::SetTargetType(TargetType pt)
{
    TargetType ttold = GetTargetType();
    CompileTargetBase::SetTargetType(pt);
    if (ttold != GetTargetType() && GetTargetType() == ttConsoleOnly)
        SetUseConsoleRunner(true); // by default, use console runner
}
Beispiel #2
0
	void run()
	{
		if ( TYPE_EXE == GetTargetType() )
		{
			GenerateExe();
		}
		else if ( TYPE_APK == GetTargetType() )
		{
			GenerateApk();
		}
	}
Beispiel #3
0
bool pgCast::DropObject(wxFrame *frame, ctlTree *browser, bool cascaded)
{
	wxString sql = wxT("DROP CAST (") + GetSourceType() + wxT(" AS ") + GetTargetType() + wxT(")");
	if (cascaded)
		sql += wxT(" CASCADE");
	return GetDatabase()->ExecuteVoid(sql);
}
bool ProjectBuildTarget::GetUseConsoleRunner() const
{
    if (GetTargetType() == ttConsoleOnly || GetRunHostApplicationInTerminal())
        return m_UseConsoleRunner;

    return false;
}
void ProjectBuildTarget::SetUseConsoleRunner(bool useIt)
{
    if (GetTargetType() == ttConsoleOnly && useIt != m_UseConsoleRunner)
    {
        m_UseConsoleRunner = useIt;
        SetModified(true);
    }
}
Beispiel #6
0
		VOID StdImpact081_T::SendImpactToMe( OWN_IMPACT& rImp, Obj_Character& rMe ) const
		{
			//第一个技能是否可以被触发
			BOOL bFirstHappend = IsHappend(rMe, rImp, 0);

			for(INT nID = 0; nID < MAX_IMPACT_NUM_AT_SAME_TIME; nID++)
			{
				INT iImpactID = GetImpactID(rImp, nID);
				if(INVALID_ID == iImpactID)
				{
					break;
				}
				if(0 == nID)
				{
					//如果第一个技能没有概率触发
					if(!bFirstHappend)
					{
						continue;
					}
				}
				else
				{
					if(INVALID_ID == GetEffectRate( rImp , nID))
					{
						//其它的impact的概率值写-1,认为应该取第一项计算出的概率值
						if(!bFirstHappend)
						{
							continue;
						}
					}
					else
					{
						//单独计算其概率值
						if(!IsHappend(rMe, rImp, nID))
						{
							continue;
						}
					}
				}
				
				Obj_Character* pAttacker = GetBeHitTarget( rMe, rImp );
				if(pAttacker)
				{
					INT iTargetType = GetTargetType( rImp, nID );
					if( iTargetType == TargetTypeMe )
					{
						g_ImpactCore.SendImpactToUnit(rMe, iImpactID, pAttacker->GetID(), 0);
					}
					else
					{
						g_ImpactCore.SendImpactToUnit(*pAttacker, iImpactID, rMe.GetID(), 0);
					}				
				}
			}
		}
Beispiel #7
0
wxString pgCast::GetSql(ctlTree *browser)
{
	if (sql.IsNull())
	{
		sql = wxT("-- Cast: ") + GetQuotedFullIdentifier() + wxT("\n\n")
		      wxT("-- DROP CAST (") + GetSourceType() +
		      wxT(" AS ") + GetTargetType() + wxT(");")
		      wxT("\n\nCREATE CAST (") + GetSourceType() +
		      wxT(" AS ") + GetTargetType();
		if (GetCastFunction().IsNull())
			sql += wxT(")\n  WITHOUT FUNCTION");
		else
			sql += wxT(")\n  WITH FUNCTION ") + GetQuotedSchemaPrefix(GetCastNamespace()) + qtIdent(GetCastFunction()) + wxT("(") + GetSourceType() + wxT(")");
		if (GetCastContext() != wxT("EXPLICIT"))
			sql += wxT("\n  AS ") + GetCastContext();
		sql += wxT(";\n");
	}

	return sql;
}
Beispiel #8
0
PTGNode MkTypedParams (DefTableKeyList l)
{ PTGNode res = PTGNULL; int index = 1;
  while (l != NULLDefTableKeyList)
  { DefTableKey insKey = HeadDefTableKeyList (l);
    res = PTGCommaSeq (res,
      PTGFormalParam 
        (GetTargetType 
           (GetType (insKey, NoKey), PTGNULL),
         index++));
    l = TailDefTableKeyList (l);
  }
  return res;
}
Beispiel #9
0
void edbSynonym::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("Owner"), GetOwner());
		properties->AppendItem(_("Target type"), GetTargetType());
		properties->AppendItem(_("Target schema"), GetTargetSchema());
		properties->AppendItem(_("Target object"), GetTargetObject());
		properties->AppendYesNoItem(_("System synonym?"), GetSystemObject());
	}
}
BYTE Game_UseSkillManager::Update(){
	switch(s_skill.Move()){
	case SELECT_CHOOSE:
		if(s_skill.isActive[s_skill.index]){
			// 決定キーを押した時、ターゲットタイプの選択に移る
			targetType = GetTargetType(GetCntSkillID());
			switch(targetType){
			case USESKILLMANAGER_TARGETTYPE_ONE_DOLL:
				return USESKILLMANAGER_UPDATE_START_CHOOSEDOLL;
				break;
			case USESKILLMANAGER_TARGETTYPE_ALL_DOLLS:
				return USESKILLMANAGER_UPDATE_START_CHOOSEDOLL;
				break;
			case USESKILLMANAGER_TARGETTYPE_DISABLED:
				// エラーが起こった
				g_sound.PlaySE(MYSE_SELECT_FAILED, 1.0f);
				break;
			}
		}else{
			g_sound.PlaySE(MYSE_SELECT_FAILED, 1.0f);
		}
		break;
	case SELECT_CANCEL:
		return USESKILLMANAGER_UPDATE_CANCELED;
		break;
	default:
		switch(g_input.digitalDir){
		case DIGDIR_LEFT:
			page--;
			if(page < 0){
				page += maxPage;
			}
			CheckUsability();
			s_skill.FixIndex(true);
			break;
		case DIGDIR_RIGHT:
			page++;
			if(page >= maxPage){
				page -= maxPage;
			}
			CheckUsability();
			s_skill.FixIndex(true);
			break;
		}

	}
	return USESKILLMANAGER_UPDATE_NONE;
}
Beispiel #11
0
bool Client::IsAllowedToAttack(gemObject * target, bool inform)
{
    csString msg;

    int type = GetTargetType(target);
    if (type == TARGET_NONE)
        msg = "You must select a target to attack.";
    else if (type & TARGET_ITEM)
        msg = "You can't attack an inanimate object.";
    else if (type & TARGET_DEAD)
        msg = "%s is already dead.";
    else if (type & TARGET_FOE)
    {
        gemActor* foe = target->GetActorPtr();
        gemActor* attacker = GetActor();
        CS_ASSERT(foe != NULL); // Since this is a foe it should have a actor.

        gemActor* lastAttacker = NULL;
        if (target->HasKillStealProtection() && !foe->CanBeAttackedBy(attacker, &lastAttacker))
        {
            if (lastAttacker)
            {
                msg.Format("You must be grouped with %s to attack %s.",
                           lastAttacker->GetName(), foe->GetName());
            }
            else
            {
                msg = "You are not allowed to attack right now.";
            }
        }
    }
    else if (type & TARGET_FRIEND)
        msg = "You cannot attack %s.";
    else if (type & TARGET_SELF)
        msg = "You cannot attack yourself.";

    if (!msg.IsEmpty())
    {
        if (inform)
        {
            psserver->SendSystemError(clientnum, msg, target? target->GetName(): "");
        }

        return false;
    }
    return true;
}
Beispiel #12
0
void edbPrivateSynonym::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
    if (properties)
    {
        CreateListColumns(properties);

        properties->AppendItem(_("Public Synonym"), isPublic ? _("Yes") : _("No"));
        properties->AppendItem(_("Name"), GetName());
        if (!isPublic)
            properties->AppendItem(_("Schema"), GetSchema()->GetName());
        properties->AppendItem(_("Owner"), GetOwner());
        properties->AppendItem(_("Target type"), GetTargetType());
        properties->AppendItem(_("Target schema"), GetTargetSchema());
        properties->AppendItem(_("Target object"), GetTargetObject());
        properties->AppendItem(_("System synonym?"), GetSystemObject());
    }
}
Beispiel #13
0
void pgCast::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("OID"), GetOid());
		properties->AppendItem(_("Source type"), GetSourceType());
		properties->AppendItem(_("Target type"), GetTargetType());
		if (GetCastFunction().IsNull())
			properties->AppendItem(_("Function"), _("(binary compatible)"));
		else
			properties->AppendItem(_("Function"), GetCastFunction() + wxT("(") + GetSourceType() + wxT(")"));
		properties->AppendItem(_("Context"), GetCastContext());
		properties->AppendYesNoItem(_("System cast?"), GetSystemObject());
		if (GetConnection()->BackendMinimumVersion(7, 5))
			properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
Beispiel #14
0
void Spell::FillTargetMap(uint32 i)
{
	//Spell::prepare() has already a m_caster->IsInWorld() check so if now the caster is no more in world something bad happened.
	ARCEMU_ASSERT(m_caster->IsInWorld());

	uint32 TargetType = 0;
	TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetA[i], i);

	//never get info from B if it is 0 :P
	if(m_spellInfo->EffectImplicitTargetB[i] != 0)
		TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetB[i], i);

	if(TargetType & SPELL_TARGET_NOT_IMPLEMENTED)
		return;
	if(TargetType & SPELL_TARGET_NO_OBJECT)  //summon spells that appear infront of caster
	{
		HandleTargetNoObject();
		return;
	}


	//always add this guy :P
	if(!(TargetType & (SPELL_TARGET_AREA | SPELL_TARGET_AREA_SELF | SPELL_TARGET_AREA_CURTARGET | SPELL_TARGET_AREA_CONE | SPELL_TARGET_OBJECT_SELF | SPELL_TARGET_OBJECT_PETOWNER)))
	{
		Object* target = m_caster->GetMapMgr()->_GetObject(m_targets.m_unitTarget);
		AddTarget(i, TargetType, target);
	}

	if(TargetType & SPELL_TARGET_OBJECT_SELF)
		AddTarget(i, TargetType, m_caster);
	if(TargetType & (SPELL_TARGET_AREA | SPELL_TARGET_AREA_SELF))  //targetted aoe
		AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
	//TODO: arcemu, doesn't support summon slots?
	/*if (TargetType & SPELL_TARGET_OBJECT_CURTOTEMS && u_caster != NULL)
		for (uint32 i=1; i<5; ++i) //totem slots are 1, 2, 3, 4
			AddTarget(i, TargetType, u_caster->m_summonslot[i]);*/
	if(TargetType & SPELL_TARGET_OBJECT_CURPET && p_caster != NULL)
		AddTarget(i, TargetType, p_caster->GetSummon());
	if(TargetType & SPELL_TARGET_OBJECT_PETOWNER)
	{
		uint64 guid = m_targets.m_unitTarget;
		if(GET_TYPE_FROM_GUID(guid) == HIGHGUID_TYPE_PET)
		{
			Pet* p = m_caster->GetMapMgr()->GetPet(GET_LOWGUID_PART(guid));

			if(p != NULL)
				AddTarget(i, TargetType, p->GetPetOwner());
		}
	}
	//targets party, not raid
	if((TargetType & SPELL_TARGET_AREA_PARTY) && !(TargetType & SPELL_TARGET_AREA_RAID))
	{
		if(p_caster == NULL && !m_caster->IsPet() && (!m_caster->IsCreature() || !m_caster->IsTotem()))
			AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //npcs
		else
			AddPartyTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //players/pets/totems
	}
	if(TargetType & SPELL_TARGET_AREA_RAID)
	{
		if(p_caster == NULL && !m_caster->IsPet() && (!m_caster->IsCreature() || !m_caster->IsTotem()))
			AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //npcs
		else
			AddRaidTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets, (TargetType & SPELL_TARGET_AREA_PARTY) ? true : false); //players/pets/totems
	}
	if(TargetType & SPELL_TARGET_AREA_CHAIN)
		AddChainTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
	//target cone
	if(TargetType & SPELL_TARGET_AREA_CONE)
		AddConeTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);

	if(TargetType & SPELL_TARGET_OBJECT_SCRIPTED)
		AddScriptedOrSpellFocusTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
}
Beispiel #15
0
bool Texture::LoadFromConfiguration(BufferRef<char> configuration)
{
	rapidjson::Document config;
	config.ParseInsitu(configuration.data);

	assert(config.HasMember("type"));

	using MemberIterator = rapidjson::Value::ConstMemberIterator;
	MemberIterator typeItr = config.FindMember("type");

	assert(typeItr != config.MemberEnd());
	assert(typeItr->value.IsString());

	StringRef typeName;
	typeName.str = typeItr->value.GetString();
	typeName.len = typeItr->value.GetStringLength();

	uint32_t typeHash = Hash::FNV1a_32(typeName.str, typeName.len);

	switch (typeHash)
	{
		case "tex2d"_hash: textureType = TextureType::Texture2D; break;
		case "texCube"_hash: textureType = TextureType::TextureCube; break;
		default: textureType = TextureType::Undefined; break;
	}

	targetType = GetTargetType(textureType);

	MemberIterator textureItr = config.FindMember("texture");
	assert(textureItr != config.MemberEnd());

	const rapidjson::Value& textureValue = textureItr->value;

	if (textureType == TextureType::Texture2D)
	{
		assert(textureValue.IsString());

		const char* texturePath = textureValue.GetString();
		Buffer<unsigned char> textureContent = File::ReadBinary(texturePath);

		if (textureContent.IsValid())
		{
			ImageData image;
			if (image.LoadGlraw(textureContent.GetRef()))
			{
				this->Upload_2D(image);

				return true;
			}
		}
	}
	else if (textureType == TextureType::TextureCube)
	{
		assert(textureValue.IsArray());
		assert(textureValue.Size() == 6);

		bool allTextureLoadsSucceeded = true;
		Buffer<unsigned char> fileContents[6];
		ImageData cubeFaceImages[6];

		for (unsigned int i = 0, count = textureValue.Size(); i < count; ++i)
		{
			assert(textureValue[i].IsString());

			const char* texturePath = textureValue[i].GetString();
			fileContents[i] = File::ReadBinary(texturePath);

			if (fileContents[i].IsValid())
			{
				ImageData& image = cubeFaceImages[i];

				if (image.LoadGlraw(fileContents[i].GetRef()) == false)
				{
					allTextureLoadsSucceeded = false;
				}
			}
			else
			{
				allTextureLoadsSucceeded = false;
			}
		}

		if (allTextureLoadsSucceeded)
		{
			this->Upload_Cube(cubeFaceImages);

			return true;
		}
	}

	return false;
}
Beispiel #16
0
bool Spell::GenerateTargets(SpellCastTargets* t)
{
	if(u_caster == NULL || u_caster->GetAIInterface() == NULL || !u_caster->IsInWorld())
		return false;

	bool result = false;

	for(uint32 i = 0; i < 3; ++i)
	{
		if(m_spellInfo->Effect[i] == 0)
			continue;
		uint32 TargetType = 0;
		TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetA[i], i);

		//never get info from B if it is 0 :P
		if(m_spellInfo->EffectImplicitTargetB[i] != 0)
			TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetB[i], i);

		if(TargetType & (SPELL_TARGET_OBJECT_SELF | SPELL_TARGET_AREA_PARTY | SPELL_TARGET_AREA_RAID))
		{
			t->m_targetMask |= TARGET_FLAG_UNIT;
			t->m_unitTarget = u_caster->GetGUID();
			result = true;
		}

		if(TargetType & SPELL_TARGET_NO_OBJECT)
		{
			t->m_targetMask = TARGET_FLAG_SELF;
			result = true;
		}

		if(!(TargetType & (SPELL_TARGET_AREA | SPELL_TARGET_AREA_SELF | SPELL_TARGET_AREA_CURTARGET | SPELL_TARGET_AREA_CONE)))
		{

			if(TargetType & SPELL_TARGET_ANY_OBJECT)
			{
				if(u_caster->GetUInt64Value(UNIT_FIELD_TARGET))
				{
					//generate targets for things like arcane missiles trigger, tame pet, etc
					Object* target = u_caster->GetMapMgr()->_GetObject(u_caster->GetUInt64Value(UNIT_FIELD_TARGET));
					if(target != NULL)
					{
						if(target->IsUnit())
						{
							t->m_targetMask |= TARGET_FLAG_UNIT;
							t->m_unitTarget = target->GetGUID();
							result = true;
						}
						else if(target->IsGameObject())
						{
							t->m_targetMask |= TARGET_FLAG_OBJECT;
							t->m_unitTarget = target->GetGUID();
							result = true;
						}
					}
					result = true;
				}
			}

			if(TargetType & SPELL_TARGET_REQUIRE_ATTACKABLE)
			{
				if(u_caster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT))
				{
					//generate targets for things like arcane missiles trigger, tame pet, etc
					Object* target = u_caster->GetMapMgr()->_GetObject(u_caster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT));
					if(target != NULL)
					{
						if(target->IsUnit())
						{
							t->m_targetMask |= TARGET_FLAG_UNIT;
							t->m_unitTarget = target->GetGUID();
							result = true;
						}
						else if(target->IsGameObject())
						{
							t->m_targetMask |= TARGET_FLAG_OBJECT;
							t->m_unitTarget = target->GetGUID();
							result = true;
						}
					}
				}
				else if(u_caster->GetUInt64Value(UNIT_FIELD_TARGET))
				{
					//generate targets for things like arcane missiles trigger, tame pet, etc
					Object* target = u_caster->GetMapMgr()->_GetObject(u_caster->GetUInt64Value(UNIT_FIELD_TARGET));
					if(target != NULL)
					{
						if(target->IsUnit())
						{
							t->m_targetMask |= TARGET_FLAG_UNIT;
							t->m_unitTarget = target->GetGUID();
							result = true;
						}
						else if(target->IsGameObject())
						{
							t->m_targetMask |= TARGET_FLAG_OBJECT;
							t->m_unitTarget = target->GetGUID();
							result = true;
						}
					}
					result = true;
				}
				else if(u_caster->IsCreature() && u_caster->IsTotem())
				{
					Unit* target = u_caster->GetMapMgr()->GetUnit(GetSinglePossibleEnemy(i));
					if(target != NULL)
					{
						t->m_targetMask |= TARGET_FLAG_UNIT;
						t->m_unitTarget = target->GetGUID();
					}
				}
			}

			if(TargetType & SPELL_TARGET_REQUIRE_FRIENDLY)
			{
				Unit* target = u_caster->GetMapMgr()->GetUnit(GetSinglePossibleFriend(i));
				if(target != NULL)
				{
					t->m_targetMask |= TARGET_FLAG_UNIT;
					t->m_unitTarget = target->GetGUID();
					result = true;
				}
				else
				{
					t->m_targetMask |= TARGET_FLAG_UNIT;
					t->m_unitTarget = u_caster->GetGUID();
					result = true;
				}
			}
		}

		if(TargetType & SPELL_TARGET_AREA_RANDOM)
		{
			//we always use radius(0) for some reason
			uint8 attempts = 0;
			do
			{
				//prevent deadlock
				++attempts;
				if(attempts > 10)
					return false;

				float r = RandomFloat(GetRadius(0));
				float ang = RandomFloat(M_PI_FLOAT * 2);
				t->m_destX = m_caster->GetPositionX() + (cosf(ang) * r);
				t->m_destY = m_caster->GetPositionY() + (sinf(ang) * r);
				t->m_destZ = m_caster->GetMapMgr()->GetLandHeight(t->m_destX, t->m_destY, m_caster->GetPositionZ() + 2.0f);
				t->m_targetMask = TARGET_FLAG_DEST_LOCATION;
			}
			while(sWorld.Collision && !CollideInterface.CheckLOS(m_caster->GetMapId(), m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ(), t->m_destX, t->m_destY, t->m_destZ));
			result = true;
		}
		else if(TargetType & SPELL_TARGET_AREA)  //targetted aoe
		{
			//spells like blizzard, rain of fire
			if(u_caster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT))
			{
				Object* target = u_caster->GetMapMgr()->_GetObject(u_caster->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT));
				if(target != NULL)
				{
					t->m_targetMask |= TARGET_FLAG_DEST_LOCATION | TARGET_FLAG_UNIT;
					t->m_destX = target->GetPositionX();
					t->m_destY = target->GetPositionY();
					t->m_destZ = target->GetPositionZ();
				}
				result = true;
			}
			else
			{
				if(u_caster->GetAIInterface()->getNextTarget() != NULL && TargetType & SPELL_TARGET_REQUIRE_ATTACKABLE)
				{
					t->m_targetMask |= TARGET_FLAG_DEST_LOCATION | TARGET_FLAG_UNIT;
					t->m_destX = u_caster->GetAIInterface()->getNextTarget()->GetPositionX();
					t->m_destY = u_caster->GetAIInterface()->getNextTarget()->GetPositionY();
					t->m_destZ = u_caster->GetAIInterface()->getNextTarget()->GetPositionZ();
					result = true;
				}
				else if(TargetType & SPELL_TARGET_REQUIRE_FRIENDLY)
				{
					t->m_targetMask |= TARGET_FLAG_DEST_LOCATION | TARGET_FLAG_UNIT;
					t->m_destX = u_caster->GetPositionX();
					t->m_destY = u_caster->GetPositionY();
					t->m_destZ = u_caster->GetPositionZ();
					result = true;
				}
			}
		}
		else if(TargetType & SPELL_TARGET_AREA_SELF)
		{
			t->m_targetMask |= TARGET_FLAG_SOURCE_LOCATION | TARGET_FLAG_UNIT;
			t->m_unitTarget = u_caster->GetGUID();
			t->m_srcX = u_caster->GetPositionX();
			t->m_srcY = u_caster->GetPositionY();
			t->m_srcZ = u_caster->GetPositionZ();
			t->m_destX = u_caster->GetPositionX();
			t->m_destY = u_caster->GetPositionY();
			t->m_destZ = u_caster->GetPositionZ();
			result = true;
		}

		if(TargetType & SPELL_TARGET_AREA_CHAIN)
		{
			if(TargetType & SPELL_TARGET_REQUIRE_ATTACKABLE)
			{
				if(u_caster->GetAIInterface()->getNextTarget() != NULL)
				{
					t->m_targetMask |= TARGET_FLAG_UNIT;
					t->m_unitTarget = u_caster->GetAIInterface()->getNextTarget()->GetGUID();
					result = true;
				}
			}
			else
			{
				t->m_targetMask |= TARGET_FLAG_UNIT;
				t->m_unitTarget = u_caster->GetGUID();
				result = true;
			}
		}
		//target cone
		if(TargetType & SPELL_TARGET_AREA_CONE)
		{
			if(u_caster->GetAIInterface()->getNextTarget() != NULL)
			{
				t->m_targetMask |= TARGET_FLAG_DEST_LOCATION;
				t->m_destX = u_caster->GetAIInterface()->getNextTarget()->GetPositionX();
				t->m_destY = u_caster->GetAIInterface()->getNextTarget()->GetPositionY();
				t->m_destZ = u_caster->GetAIInterface()->getNextTarget()->GetPositionZ();
				result = true;
			}
		}
	}
	return result;
}
Beispiel #17
0
/// Fill the target map with the targets
/// the targets are specified with numbers and handled accordingly
void Spell::FillTargetMap(uint32 i)
{
    if(!m_caster->IsInWorld())
        return;

    uint32 TargetType = SPELL_TARGET_NONE;

    // Get our info from A regardless of nullity
    TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetA[i], i);

    //never get info from B if it is 0 :P
    if(m_spellInfo->EffectImplicitTargetB[i] != 0)
        TargetType |= GetTargetType(m_spellInfo->EffectImplicitTargetB[i], i);
    if(TargetType & SPELL_TARGET_NOT_IMPLEMENTED)
        return;
    if(TargetType & SPELL_TARGET_NO_OBJECT)  //summon spells that appear infront of caster
    {
        HandleTargetNoObject();
        return;
    }

    //always add this guy :P
    if(!(TargetType & (SPELL_TARGET_AREA | SPELL_TARGET_AREA_SELF | SPELL_TARGET_AREA_CURTARGET | SPELL_TARGET_AREA_CONE | SPELL_TARGET_OBJECT_SELF | SPELL_TARGET_OBJECT_PETOWNER)))
    {
        Object* target = m_caster->GetMapMgr()->_GetObject(m_targets.m_unitTarget);
        AddTarget(i, TargetType, target);
    }

    if(TargetType & SPELL_TARGET_OBJECT_SELF)
        AddTarget(i, TargetType, m_caster);

    if(TargetType & (SPELL_TARGET_AREA | SPELL_TARGET_AREA_SELF))  //targetted aoe
        AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
    if (TargetType & SPELL_TARGET_OBJECT_CURTOTEMS && u_caster != NULL)
    {
        std::vector<Creature*> m_totemList;
        u_caster->FillSummonList(m_totemList, SUMMON_TYPE_TOTEM);
        for(std::vector<Creature*>::iterator itr = m_totemList.begin(); itr != m_totemList.end(); itr++)
            AddTarget(i, TargetType, *itr);
    }

    if(TargetType & SPELL_TARGET_OBJECT_CURPET && p_caster != NULL)
        AddTarget(i, TargetType, p_caster->GetSummon());

    if(TargetType & SPELL_TARGET_OBJECT_PETOWNER)
    {
        uint64 guid = m_targets.m_unitTarget;
        if(GUID_HIPART(guid) == HIGHGUID_TYPE_PET)
        {
            Pet* p = m_caster->GetMapMgr()->GetPet(GUID_LOPART(guid));

            if(p != NULL)
                AddTarget(i, TargetType, p->GetPetOwner());
        }
    }

    //targets party, not raid
    if((TargetType & SPELL_TARGET_AREA_PARTY) && !(TargetType & SPELL_TARGET_AREA_RAID))
    {
        if(p_caster == NULL && !m_caster->IsPet() && (!m_caster->IsCreature() || !m_caster->IsTotem()))
            AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //npcs
        else
            AddPartyTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //players/pets/totems
    }

    if(TargetType & SPELL_TARGET_AREA_RAID)
    {
        if(p_caster == NULL && !m_caster->IsPet() && (!m_caster->IsCreature() || !m_caster->IsTotem()))
            AddAOETargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets); //npcs
        else
            AddRaidTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets, (TargetType & SPELL_TARGET_AREA_PARTY) ? true : false); //players/pets/totems
    }

    if(TargetType & SPELL_TARGET_AREA_CHAIN)
        AddChainTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);

    //target cone
    if(TargetType & SPELL_TARGET_AREA_CONE)
        AddConeTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);

    if(TargetType & SPELL_TARGET_OBJECT_SCRIPTED)
        AddScriptedOrSpellFocusTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);
}