Ir para conteúdo

[Encerrado] EXP HIT TFS 0.4


higorroque

Posts Recomendados

Gente, estou com um problema! Eu coloquei um EXP HIT no meu otserver, mudei meu config.lua para FALSE/TRUE E EXP 0, adicionei em cima de return true do "login.lua" > registerCreatureEvent(cid, "exphit"), porém o exp hit ainda não está funcionando! Alguem me ajuda?

 

Código:

Citar

-- CONFIGURACOES DE EXPERIENCIA --

useStages = true
premiumMultipliqueExp = 2 


local stages = { -- ["DELEVEL-ATELEVEL"]
    ["1-50"] = 100,
    ["51-100"] = 70,
    ["101-150"] = 50,
    ["151-200"] = 10,
    ["201-250"] = 7,
    ["251-300"] = 5,
    ["351-400"] = 3,
}
ultimateExp = 1

-- CONFIGURAÇÕES DA PARTY

partyPorcent = 40
levelBlockParty = 1000
expShareRadiusX = 30
expShareRadiusY = 30
expShareRadiusZ = 1

-- CONFIGURACOES DE RINGS --

local rings = { -- [ID DO ANEL]
    [3048] = 2,
    [3049] = 4,
    [3050] = 6,
}

-- FIM DAS CONFIGURACOES --


function CalculeExp(monsterhp, exptotal, hit)
    hit = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0
    return hit < 0 and 0 or hit
end

function isSummon(uid)
    return uid ~= getCreatureMaster(uid) or false
end

function onStatsChange(cid, attacker, type, combat, value)
    if getCreatureStorage(cid, 50001) ~= 1 then
        doCreatureSetStorage(cid, 50002, getMonsterInfo(getCreatureName(cid)).experience * rateExp)
        doCreatureSetStorage(cid, 50001, 1)
    end
    if type == STATSCHANGE_HEALTHLOSS then
        if isMonster(cid) then
            if isCreature(attacker) then
                local _cid = isSummon(attacker) and getCreatureMaster(attacker) or attacker
                if isPlayer(_cid) then
                    if useStages then
                        for strstage, experience in pairs(stages) do
                            tabstage = string.explode(strstage, "-")
                            if getPlayerLevel(_cid) >= tonumber(tabstage[1]) and getPlayerLevel(_cid) <= tonumber(tabstage[2]) then
                                ultimateExp = experience
                            end
                        end
                        experienceRate = ultimateExp
                    else
                        experienceRate = rateExp
                    end
                    local expgain = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * experienceRate, value)
                    if getCreatureStorage(cid, 50002) > 0 then
                        if getCreatureStorage(cid, 50002) - expgain < 0 then
                            expgain = getCreatureStorage(cid, 50002)
                        end
                        doCreatureSetStorage(cid, 50002, getCreatureStorage(cid, 50002) - expgain)
                        local ringexp = 1
                        for idring, expring in pairs(rings) do
                            if getPlayerSlotItem(_cid, 9).itemid == idring then
                                ringexp = expring
                                break
                            end
                        end
                        local premiumMultipliqueExp = isPremium(_cid) and premiumMultipliqueExp or 1
                        expgain = expgain * ringexp * premiumMultipliqueExp
                        local party = false
                        if isInParty(_cid) then
                            local partyMembers, expParty = getPartyMembers(getPartyLeader(_cid)), expgain / 100 * partyPorcent
                            for indice, partyMember in pairs(partyMembers) do
                                attackerLevel, partyLevel = getPlayerLevel(_cid), getPlayerLevel(partyMember)
                                attackerPos, partyPos = getThingPos(_cid), getThingPos(partyMember)
                                x = false
                                if math.abs(attackerLevel - partyLevel) > levelBlockParty then
                                    x = true
                                elseif math.abs(attackerPos.x - partyPos.x) > expShareRadiusX then
                                    x = true
                                elseif math.abs(attackerPos.y - partyPos.y) > expShareRadiusY then
                                    x = true
                                elseif attackerPos.z ~= partyPos.z then
                                    x = true
                                elseif _cid == partyMember then
                                    x = true
                                end
                                if x then
                                    partyMembers[indice] = nil
                                end
                            end
                            if #partyMembers ~= 0 then
                                expParty = math.ceil(expgain / 100 * partyPorcent)
                                expmember = math.ceil(expParty / #partyMembers)
                                for _, member in pairs(partyMembers) do
                                    if member ~= _cid then
                                        doPlayerSendTextMessage(member, 12, "You received "..expmember.." party exp.")
                                        doPlayerAddExp(member, expmember)
                                    end
                                end
                                doPlayerSendTextMessage(_cid, 12, "You gain "..expgain.." exp. (" ..partyPorcent.."% send to party)")
                                doPlayerAddExp(_cid, expgain - expParty)
                                party = true
                            else
                                party = false
                            end
                        end
                        if not party then
                            doPlayerSendTextMessage(_cid, 12, "You gain "..expgain.." exp.")
                            doPlayerAddExp(_cid, expgain)
                        end
                    end
                end
            end
        end
    end
    return true
end

function onCombat(cid, target)
    if isMonster(target) and not isSummon(target) and not isPlayer(target) then
        registerCreatureEvent(target, "ExpGain")
    end
    return true
end

 

Link para o comentário
Compartilhar em outros sites

  • 2 months later...
A questão neste suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...