Quest [Quest]Energy System

  • Autore discussione Autore discussione Named
  • Data d'inizio Data d'inizio
Stato
Discussione chiusa ad ulteriori risposte.

Named

Utente Jade
15 Febbraio 2010
2,036
57
459
735
Ultima modifica da un moderatore:
Ok, posso anche non mettere la mia frase introduttiva di ogni dannatissima sera.

Codice:
[/I][/B]quest energySystem begin
state start begin
    
    function getBonusTable()
        bonusList = {}
        --BONUS / BONUS MIN VALUE / BONUS MAX VALUE / BONUS MIN VALUE 1 / BONUS MAX VALUE 1 / BONUS MIN DURATION / BONUS MEDIUM DURATION / BONUS MAX DURATION
        --              1  2  3   4   5     6    7     8
        bonusList[1] = {3, 1, 20, 10, 15, 1800, 3600, 7200}
        bonusList[2] = {4, 1, 20, 10, 15, 1800, 3600, 7200}
        bonusList[3] = {5, 1, 20, 10, 15, 1800, 3600, 7200}
        bonusList[4] = {6, 1, 20, 10, 15, 1800, 3600, 7200}
        bonusList[5] = {15, 1, 20, 15, 20, 1800, 3600, 7200}
        bonusList[6] = {1, 500, 3000, 2500, 3000, 1800, 3600, 7200}
        bonusList[7] = {2, 500, 3000, 2500, 3000, 1800, 3600, 7200}
        bonusList[8] = {10, 1, 30, 25, 30, 1800, 3600, 7200}
        bonusList[9] = {11, 1, 30, 25, 30, 1800, 3600, 7200}
        bonusList[10] = {24, 1, 30, 25, 30, 1800, 3600, 7200}
        bonusList[11] = {23, 1, 30, 25, 30, 1800, 3600, 7200}
        return bonusList
    end
    
    when 123010.use or 123020.use or 123030.use begin
        local itemSocket0 = item.get_socket(0)
        local itemSocket1 = item.get_socket(1)
        local itemSocket2 = (item.get_socket(2)*60)
        if itemSocket0 == 0 then
            local bonusTable = energySystem.getBonusTable()
            local bonusNumber = number(1, table.getn(bonusTable))
            local selectedBonus = bonusList[bonusNumber][1]
            local selectedBonusValue = 0
            local selectedBonusDuration = 0
            if item.get_vnum() == 123010 then
                selectedBonusValue = number(bonusList[bonusNumber][2], bonusList[bonusNumber][3])
                selectedBonusDuration = number(bonusList[bonusNumber][6], bonusList[bonusNumber][8])
            elseif item.get_vnum() == 123020 then
                selectedBonusValue = number(bonusList[bonusNumber][4], bonusList[bonusNumber][5])
                selectedBonusDuration = bonusList[bonusNumber][7]
            elseif item.get_vnum() == 123030 then
                selectedBonusValue = bonusList[bonusNumber][3]
                selectedBonusDuration = bonusList[bonusNumber][8]
            end
            item.set_socket(0, selectedBonus)
            item.set_socket(1, selectedBonusValue)
            item.set_socket(2, (selectedBonusDuration/60))
            syschat("Hai trasferito la tua energia sul Cristallo.")
        else
            if pc.getqf("energyEndTime") > get_global_time() then
                syschat("Non puoi ancora usarlo.")
            else
                syschat("Ti sono stati applicati i bonus del Cristallo di Energia.")
                local command = string.format("Energy %d %d %d", itemSocket0, itemSocket1, itemSocket2)
                affect.add_collect(itemSocket0, itemSocket1, itemSocket2)
                pc.setqf("energyEndTime", get_global_time() + itemSocket2)
                pc.setqf("energyBonus", itemSocket0)
                pc.setqf("energyPoint", itemSocket1)
                cmdchat(command)
                item.remove()
            end
        end
    end    
    when login or enter begin
        local remainTime = pc.getqf("remainEnergyTime")
        if remainTime > 0 then
            local bonus = pc.getqf("energyBonus")
            local point = pc.getqf("energyPoint")
            local command = string.format("Energy %d %d %d", bonus, point, remainTime)
            cmdchat(command)
            pc.setqf("energyEndTime", (get_global_time() + remainTime))
        end
    end

    when logout begin
        pc.setqf("remainEnergyTime", (pc.getqf("energyEndTime") - get_global_time()))
    end

end
end[B][I]
 
Grazie ice, ma chiedevo soltanto info.. Mi sono allontanato da metin per un' pò ed ora cerco di informarmi sulle novita :)
 
Stato
Discussione chiusa ad ulteriori risposte.
Indietro
Top Bottom