示例#1
0
//this is wrong, alternative script needed
bool ItemUse_item_tainted_core(Player* pPlayer, Item* pItem, SpellCastTargets const& sctTargets)
{
    ScriptedInstance* pInstance = ((ScriptedInstance*)pPlayer->GetInstanceData());

    if (!pInstance)
    {
        error_log("DS: Lady Vashj Tainted Core: Instance Script Not Initialized");
        return true;
    }

    Creature* pVashj = (Creature*)(Unit::GetUnit((*pPlayer), pInstance->GetData64(DATA_LADYVASHJ)));
    if (pVashj && ((boss_lady_vashjAI*)pVashj->AI())->m_uiPhase == 2)
    {
        if (sctTargets.getGOTarget() && sctTargets.getGOTarget()->GetTypeId()==TYPEID_GAMEOBJECT)
        {
            uint32 uiIdentifier;
            uint8 uiChannelIdentifier;
            switch(sctTargets.getGOTarget()->GetEntry())
            {
            case 185052:
                uiIdentifier = TYPE_SHIELDGENERATOR1;
                uiChannelIdentifier = 0;
                break;
            case 185053:
                uiIdentifier = TYPE_SHIELDGENERATOR2;
                uiChannelIdentifier = 1;
                break;
            case 185051:
                uiIdentifier = TYPE_SHIELDGENERATOR3;
                uiChannelIdentifier = 2;
                break;
            case 185054:
                uiIdentifier = TYPE_SHIELDGENERATOR4;
                uiChannelIdentifier = 3;
                break;
            default:
                return true;
                break;
            }

            if (pInstance->GetData(uiIdentifier) == DONE)
                return true;

            //get and remove channel
            if (Unit* pChannel = Unit::GetUnit((*pVashj), ((boss_lady_vashjAI*)pVashj->AI())->m_auiShieldGeneratorChannel[uiChannelIdentifier]))
                pChannel->setDeathState(JUST_DIED);         //calls Unsummon()

            pInstance->SetData(uiIdentifier, DONE);

            //remove this item
            pPlayer->DestroyItemCount(31088, 1, true);
        }
    }
    return true;
}
示例#2
0
文件: deadmines.cpp 项目: Bootz/SF1
bool ItemUse_item_defias_gunpowder(Player* player, Item* pItem, SpellCastTargets const& targets)
{
    ScriptedInstance *pInstance = player->GetInstanceData();

    if (!pInstance)
    {
        player->GetSession()->SendNotification("Instance script not initialized");
        return true;
    }
    if (pInstance->GetData(EVENT_CANNON) != CANNON_NOT_USED)
        return false;
    if (targets.getGOTarget() && targets.getGOTarget()->GetTypeId() == TYPEID_GAMEOBJECT && targets.getGOTarget()->GetEntry() == GO_DEFIAS_CANNON)
        pInstance->SetData(EVENT_CANNON, CANNON_GUNPOWDER_USED);

    player->DestroyItemCount(pItem->GetEntry(), 1, true);
    return true;
}
示例#3
0
	bool OnUse(Player* player, Item* item, SpellCastTargets const& targets) {
		InstanceScript *pInstance = player->GetInstanceScript();

		if (!pInstance) {
			player->GetSession()->SendNotification(
					"Instance script not initialized");
			return true;
		}
		if (pInstance->GetData(EVENT_STATE) != CANNON_NOT_USED)
			return false;
		if (targets.getGOTarget()
				&& targets.getGOTarget()->GetTypeId() == TYPEID_GAMEOBJECT
				&& targets.getGOTarget()->GetEntry() == GO_DEFIAS_CANNON) {
			pInstance->SetData(EVENT_STATE, CANNON_GUNPOWDER_USED);
		}

		player->DestroyItemCount(item->GetEntry(), 1, true);
		return true;
	}
示例#4
0
bool ItemUse_item_tainted_core(Player* pPlayer, Item* _Item, SpellCastTargets const& targets)
{
    ScriptedInstance *pInstance = pPlayer->GetInstanceData();

    if (!pInstance)
    {
        pPlayer->GetSession()->SendNotification(TEXT_NOT_INITIALIZED);
        return true;
    }

    Creature *Vashj = NULL;
    Vashj = (Unit::GetCreature((*pPlayer), pInstance->GetData64(DATA_LADYVASHJ)));
    if (Vashj && CAST_AI(boss_lady_vashjAI, Vashj->AI())->Phase == 2)
    {
        if (targets.getGOTarget() && targets.getGOTarget()->GetTypeId()==TYPEID_GAMEOBJECT)
        {
            uint32 identifier;
            uint8 channel_identifier;
            switch (targets.getGOTarget()->GetEntry())
            {
                case 185052:
                    identifier = DATA_SHIELDGENERATOR1;
                    channel_identifier = 0;
                    break;
                case 185053:
                    identifier = DATA_SHIELDGENERATOR2;
                    channel_identifier = 1;
                    break;
                case 185051:
                    identifier = DATA_SHIELDGENERATOR3;
                    channel_identifier = 2;
                    break;
                case 185054:
                    identifier = DATA_SHIELDGENERATOR4;
                    channel_identifier = 3;
                    break;
                default:
                    return true;
            }

            if (pInstance->GetData(identifier))
            {
                pPlayer->GetSession()->SendNotification(TEXT_ALREADY_DEACTIVATED);
                return true;
            }

            //get and remove channel
            Unit *Channel = NULL;
            Channel = Unit::GetCreature(*Vashj, CAST_AI(boss_lady_vashjAI, Vashj->AI())->ShieldGeneratorChannel[channel_identifier]);
            if (Channel)
            {
                //call Unsummon()
                Channel->setDeathState(JUST_DIED);
            }

            pInstance->SetData(identifier, 1);

            //remove this item
            pPlayer->DestroyItemCount(31088, 1, true);
            return true;
        }
        else if (targets.getUnitTarget()->GetTypeId() == TYPEID_UNIT)
            return false;
        else if (targets.getUnitTarget()->GetTypeId() == TYPEID_PLAYER)
        {
            pPlayer->DestroyItemCount(31088, 1, true);
            pPlayer->CastSpell(targets.getUnitTarget(), 38134, true);
            return true;
        }
    }
    return true;
}