Ir para conteúdo

Featured Replies

Postado

Ok, troque o enchanting.lua por:

local config = {
	manaCost = 300,
	soulCost = 2,
}

local spheres = {
	[7759] = {3, 7},
	[7760] = {1, 5},
	[7761] = {2, 6},
	[7762] = {4, 8}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local iex = Item(itemEx.uid)
	local iuid = Item(item.uid)
	local p = Player(cid)
	if(item.itemid == 2147 and itemEx.itemid == 2342) then
		iex:transform(2343)
		iex:decay()
		iuid:remove(1)
		toPosition:sendMagicEffect(CONST_ME_MAGIC_RED)
		return true
	end

	if(item.itemid == 7760 and isInArray({9934, 10022}, itemEx.itemid)) then
		iex:transform(9933)
		iuid:remove(1)
		toPosition:sendMagicEffect(CONST_ME_MAGIC_RED)
		return true
	end

	if(isInArray(enchantableGems, item.itemid)) then
		local subtype = item.type
		if(subtype == 0) then
			subtype = 1
		end

		local mana = config.manaCost * subtype
		if(p:getMana() < mana) then
			p:sendCancelMessage(RETURNVALUE_NOTENOUGHMANA)
			return true
		end

		local soul = config.soulCost * subtype
		if(p:getSoul() < soul) then
			p:sendCancelMessage(RETURNVALUE_NOTENOUGHSOUL)
			return true
		end

		local a = table.find(enchantableGems, item.itemid)
		if(a == nil or not(isInArray(enchantingAltars[a], itemEx.itemid))) then
			return false
		end

		p:addMana(-mana)
		p:addSoul(-soul)
		iuid:transform(enchantedGems[a])
		p:addManaSpent(mana * configManager.getNumber(configKeys.RATE_MAGIC))
		fromPosition:sendMagicEffect(CONST_ME_MAGIC_RED)
		return true
	end
 
	if(isInArray(enchantedGems, item.itemid)) then
		if(not(isInArray(enchantableItems, itemEx.itemid))) then
			fromPosition:sendMagicEffect(CONST_ME_POFF)
			return false
		end

		local b = table.find(enchantedGems, item.itemid)
		if(b == nil) then
			return false
		end

		local subtype = itemEx.type
		if(not(isInArray({2544, 8905}, itemEx.itemid))) then
			subtype = 1000
		end

		iex:transform(enchantedItems[itemEx.itemid][b], subtype)
		getThingPos(itemEx.uid):sendMagicEffect(CONST_ME_MAGIC_RED)
		iuid:remove(1)
		return true
	end
return false
end

  • Respostas 14
  • Visualizações 695
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

Postado
  • Autor

consegui resolver aqui, obrigado Absolut por me ajudar, sem vc não iria conseguir mesmo haha

 

para quem tiver esse problema aqui esta a enchanting.lua

--by Keraxel  
function onUse(cid, item, fromPosition, itemEx, toPosition)  

--CONFIG  
local config = {  
mana = 300,  
soul = 2,  
messNotEnoughSoul = "You don't have enough soul points.",  
messNotEnoughMana = "You don't have enough mana points.",  
effect = 39 --you can test effects with !z command (ex. !z 23)  
}  
--/CONFIG  

local array = { [7759] = 8907, [7760] = 8906, [7761] = 8909, [7762] = 8908 }  
local altars = {{7516, 7517, 7518, 7519}, {7504, 7505, 7506, 7507}, {7512, 7513, 7514, 7515}, {7508, 7509, 7510, 7511}}  
local gems = {2149, 2147, 2150, 2146}  
local enchantedGems = {7761, 7760, 7762, 7759}  
local weapons = {  
    -- {earth, fire, energy, ice}  
    [2430] = {7860, 7750, 7875, 7769},  
    [2423] = {7864, 7754, 7879, 7773},  
    [7406] = {7857, 7747, 7872, 7766},  
    [7383] = {7855, 7745, 7870, 7764},  
    [7384] = {7856, 7746, 7871, 7765},  
    [7415] = {7866, 7756, 7881, 7775},  
    [7380] = {7862, 7752, 7877, 7771},  
    [7402] = {7858, 7784, 7873, 7767},  
    [2391] = {7868, 7758, 7883, 7777},  
    [7389] = {7861, 7751, 7876, 7770},  
    [2383] = {7854, 7744, 7869, 7763},  
    [7392] = {7867, 7757, 7882, 7776},  
    [2429] = {7859, 7749, 7874, 7768},  
    [2445] = {7865, 7755, 7880, 7774},  
    [2454] = {7863, 7753, 7878, 7772}  
}  
      
          
        if itemEx.itemid == 8905 and isInArray(enchantedGems, item.itemid) then  
            for k, v in pairs(array) do  
                if item.itemid == k then  
                    doTransformItem(itemEx.uid, v)  
                    doRemoveItem(item.uid, 1)  
                    doSendMagicEffect(fromPosition, config.effect)  
                    return TRUE  
                end  
            end  
        elseif isInArray(gems, item.itemid) == TRUE then  
            for i=1, #gems do  
                if isInArray(altars[i], itemEx.itemid) == TRUE and item.itemid == gems[i] then  
                    if getPlayerMana(cid) >= config.mana then  
                        if getPlayerSoul(cid) >= config.soul then 
                            doRemoveItem(item.uid, 1)  
                            doPlayerAddItem(cid, enchantedGems[i], 1)  
                            doPlayerAddSoul(cid,-config.soul)  
                            doPlayerAddMana(cid,-config.mana)  
                        else  
                            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, config.messNotEnoughSoul)  
                            doSendMagicEffect(fromPosition, 2)  
                            return FALSE  
                        end  
                    else  
                        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, config.messNotEnoughMana)  
                        doSendMagicEffect(fromPosition, 2)  
                        return FALSE  
                    end  
                    doSendMagicEffect(toPosition, config.effect)  
                    return TRUE  
                end  
            end  
                  
        else  
            for k, v in pairs(weapons) do  
                if itemEx.itemid == k then  
                    for i=1, #enchantedGems do  
                        if item.itemid == enchantedGems[i] then  
                            doTransformItem(itemEx.uid, v[i], 1000)  
                            doRemoveItem(item.uid, 1)  
                            doSendMagicEffect(fromPosition, config.effect)  
                            return TRUE  
                        end  
                    end  
                end  
            end      
        end  
    return TRUE  
end

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo