• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

When will TFS 1.4 be released?

Status
Not open for further replies.
some guys has explained why but can't remember the words that they used it's something related to add untested code lines and some other things
Untested lua comments 😎
 
At this pace the release will come in 2030.

The pace is determined by the time the community spends.
If no one approves / tests PRs (no matter if it's a tutorial (is the tutorial correct?), a tutorial / information text (is it correct?), a script (does it work, could it cause memory problems)) etc there won't be any approvals.
We who can approve PRs still want people to approve / test them, we need time to check if everything is OK instead of rushing and approving code like this (opentibiabr/otservbr-global (https://github.com/opentibiabr/otservbr-global/blob/dee06ecd2117681d314cee166b1258fefae34a7d/data/scripts/actions/other/jean_pierre_food.lua))

Unless you want to be paid to help the open community feel free to help out by adding your comments to the PRs that are created or even better fix the open issues we have at the moment instead of being negative.
 
tbh I planned to apply for a tfs developer discord channel but I lost interest for reasons unrelated to the repo itself. It isn't about money either @WibbenZ
 
Last edited:
I really wish I knew how to use github haha
 
You can literally just merge it yourself on your own pc and you will be at the same place as they would do it


bing it bro
I tried looking stuff up but I can't seem to find anything, at least what im looking for. Probably because I dont really know how to phrase what I need to know. I know there is a way to pull the repo, modify the files with the github desktop app and add a pull request easy. I can't seem to figure out though.
 
I tried looking stuff up but I can't seem to find anything, at least what im looking for. Probably because I dont really know how to phrase what I need to know. I know there is a way to pull the repo, modify the files with the github desktop app and add a pull request easy. I can't seem to figure out though.
Don't use desktop app. Use git bash. Github as the name suggests is a hub for git so search how to do things in git instead of github. You can also read about version control in general.
 
I tried looking stuff up but I can't seem to find anything, at least what im looking for. Probably because I dont really know how to phrase what I need to know. I know there is a way to pull the repo, modify the files with the github desktop app and add a pull request easy. I can't seem to figure out though.
Idk about github app but you can just download the pr branch and merge it.
 
tbh I planned to apply for a tfs developer discord channel but I lost interest for reasons unrelated to the repo itself. It isn't about money either @WibbenZ
Well you were offerd a position as an ST where you could become a TFS dev or global mod, but you're first question was how much you were gonna be paid?

The sad part for me is that I was one of the mods who recommended you for a promotion.

Either help or complain and do nothing, up to you.
The community and us 2 might not agree on everything but I bet most of us want the community to move forwards.

If you want to continue this send me a PM 👍
 
We who can approve PRs still want people to approve / test them, we need time to check if everything is OK instead of rushing and approving code like this (opentibiabr/otservbr-global (https://github.com/opentibiabr/otservbr-global/blob/dee06ecd2117681d314cee166b1258fefae34a7d/data/scripts/actions/other/jean_pierre_food.lua))
and what is wrong with that code? Of course using metatables along with 0.x compatibility functions looks weird but who decided that it is wrong? Using elseif's are okay too because they are often faster than using hashtable for that small amount of variables.
I find it funny because I can see much worse code on the actual TFS repository that got approved and merged that should never be accepted so I wonder where is this "quality" test.
 
and what is wrong with that code? Of course using metatables along with 0.x compatibility functions looks weird but who decided that it is wrong? Using elseif's are okay too because they are often faster than using hashtable for that small amount of variables.
I find it funny because I can see much worse code on the actual TFS repository that got approved and merged that should never be accepted so I wonder where is this "quality" test.
@fabian766
I admire you and admire your work with your tfs.
why don't you write in the official tfs or because your tfs doesn't become the official?
 
and what is wrong with that code?
1. Pretty sure the conditions could be written in a more elegant way (some loop very likely).
2. enter key not used enough, everything is just clumped together
3. adding condition, sending a message and sending magic effect could be moved to some configurable table
4. things from point 3 and item:remove(1) could be moved outside of if/elseif chain because it's a single instruction that runs in every case so the code could be a few lines shorter. Cases in which the food can't be used could be handled by return statement before reaching item removing instruction.
5. Creature(cid):addHealth(getCreatureMaxHealth(cid) - getCreatureHealth(cid)) Why are they even using cid to add health to player when player variable is available and proper methods to do that without using cid were introduced?

If I were to code it, I would do consumableFoods[itemId] instead of ifs chain and do if/elseif only for things that aren't convenient in configs

example:
Code:
local consumableFoods = {
    [9992] = {sound = "gulp", message = "Your health has been refilled.", effect = CONST_ME_MAGIC_RED}
}

having this kind of structure, an optional field "condition" could be added to apply a condition or a field "callback" could be added to avoid ifs chain
example callback:
Code:
consumableFoods[9992].callback = function(player)
    player:addHealth(player:getMaxHealth() - player:getHealth())
end
 
Last edited:
1. Pretty sure the conditions could be written in a more elegant way.
2. enter key not used enough, everything is just clumped together
3. adding condition, sending a message and sending magic effect could be moved to some configurable table
4. things from point 3 and item:remove(1) could be moved outside of if/elseif chain because it's a single instruction that runs in every case so the code could be a few lines shorter. Cases in which the food can't be used could be handled by return statement before reaching item removing instruction.
I don't know much about programming, but what this person says is very correct.

It is not a complaint that the code work bad, just that someone else should have taught him to design the code correctly and then be merged, and please do not come out and insult me, I already know that I am not good with codes UwU

Note: nobody is perfect

@fabian766 I would like to see an example of a badly designed or cumbersome-looking code in the official TFS, just out of curiosity, I like gossip 🙈
 
I fixed some of it :p

Lua:
local conditions = {
    CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY,
    CONDITION_PARALYZE, CONDITION_DRUNK, CONDITION_DROWN,
    CONDITION_FREEZING, CONDITION_DAZZLED, CONDITION_CURSED,
    CONDITION_BLEEDING
}
local condition_shield = createConditionObject(CONDITION_ATTRIBUTES)
    setConditionParam(condition_shield, CONDITION_PARAM_SUBID, 3)
    setConditionParam(condition_shield, CONDITION_PARAM_BUFF_SPELL, 1)
    setConditionParam(condition_shield, CONDITION_PARAM_TICKS, 60 * 60 * 1000)
    setConditionParam(condition_shield, CONDITION_PARAM_SKILL_SHIELD, 10)
    setConditionParam(condition_shield, CONDITION_PARAM_FORCEUPDATE, true)
local condition_ml = createConditionObject(CONDITION_ATTRIBUTES)
    setConditionParam(condition_ml, CONDITION_PARAM_SUBID, 4)
    setConditionParam(condition_ml, CONDITION_PARAM_BUFF_SPELL, 1)
    setConditionParam(condition_ml, CONDITION_PARAM_TICKS, 60 * 60 * 1000)
    setConditionParam(condition_ml, CONDITION_PARAM_STAT_MAGICPOINTS, 5)
    setConditionParam(condition_ml, CONDITION_PARAM_FORCEUPDATE, true)
local condition_melee = createConditionObject(CONDITION_ATTRIBUTES)
    setConditionParam(condition_melee, CONDITION_PARAM_SUBID, 5)
    setConditionParam(condition_melee, CONDITION_PARAM_BUFF_SPELL, 1)
    setConditionParam(condition_melee, CONDITION_PARAM_TICKS, 60 * 60 * 1000)
    setConditionParam(condition_melee, CONDITION_PARAM_SKILL_MELEE, 10)
    setConditionParam(condition_melee, CONDITION_PARAM_FORCEUPDATE, true)
local condition_dist = createConditionObject(CONDITION_ATTRIBUTES)
    setConditionParam(condition_dist, CONDITION_PARAM_SUBID, 6)
    setConditionParam(condition_dist, CONDITION_PARAM_BUFF_SPELL, 1)
    setConditionParam(condition_dist, CONDITION_PARAM_TICKS, 60 * 60 * 1000)
    setConditionParam(condition_dist, CONDITION_PARAM_SKILL_DISTANCE, 10)
    setConditionParam(condition_dist, CONDITION_PARAM_FORCEUPDATE, true)
local condition_f = createConditionObject(CONDITION_ATTRIBUTES)
    setConditionParam(condition_f, CONDITION_PARAM_SUBID, 6)
    setConditionParam(condition_f, CONDITION_PARAM_BUFF_SPELL, 1)
    setConditionParam(condition_f, CONDITION_PARAM_TICKS, 60 * 60 * 1000)
    setConditionParam(condition_f, CONDITION_PARAM_SKILL_FISHING, 50)
    setConditionParam(condition_f, CONDITION_PARAM_FORCEUPDATE, true)
local condition_speed = createConditionObject(CONDITION_HASTE)
    setConditionParam(condition_speed, CONDITION_PARAM_TICKS, 60 * 60 * 1000)
    setConditionParam(condition_speed, CONDITION_PARAM_SPEED, 600)
local combat_i = createCombatObject()
    setCombatParam(combat_i, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
    setCombatParam(combat_i, COMBAT_PARAM_AGGRESSIVE, 0)
local condition_i = createConditionObject(CONDITION_INVISIBLE)
    setConditionParam(condition_i, CONDITION_PARAM_TICKS, 600000)
    addCombatCondition(combat_i, condition_i)

local iid = {[9992] = 0, [9993] = 1, [9994] = 2, [9995] = 3, [9996] = 4, [9997] = 5, [9998] = 6, [9999] = 7, [10000] = 8, [10001] = 9, [12540] = 10, [12542] = 11, [12543] = 12, [12544] = 13}

local food = {
    [9992] = {say = "Gulp.", talkType = TALKTYPE_MONSTER_SAY, textMsg = "Your health has been refilled.", magicEffect = CONST_ME_MAGIC_RED, health = true},
    [9993] = {say = "Chomp.", talkType = TALKTYPE_MONSTER_SAY, textMsg = "You feel better body condition.", magicEffect = CONST_ME_MAGIC_RED, removeConditions = true},
    [9994] = {say = "Chomp.", talkType = TALKTYPE_MONSTER_SAY, textMsg = "You feel less vulnerable.", magicEffect = CONST_ME_MAGIC_RED, conditions = {condition_shield}},
    [9995] = {say = "Chomp.", talkType = TALKTYPE_MONSTER_SAY, textMsg = "You feel smarter.", magicEffect = CONST_ME_MAGIC_RED, conditions = {condition_ml}},
    [9996] = {say = "Slurp.", talkType = TALKTYPE_MONSTER_SAY, textMsg = "You don't really know what this did to you, but suddenly you feel very happy.", magicEffect = CONST_ME_HEARTS},
    [9997] = {say = "Yum.", talkType = TALKTYPE_MONSTER_SAY, textMsg = "You feel stronger.", magicEffect = CONST_ME_MAGIC_RED, conditions = {condition_melee}},
    [9998] = {say = "Yum.", talkType = TALKTYPE_MONSTER_SAY, textMsg = "Your speed has been increased.", magicEffect = CONST_ME_MAGIC_RED, conditions = {condition_speed}},
    [9999] = {say = "Chomp.", talkType = TALKTYPE_MONSTER_SAY, textMsg = "Your mana has been refilled.", magicEffect = CONST_ME_MAGIC_RED, mana = true},
    [10000] = {say = "Mmmm.", talkType = TALKTYPE_MONSTER_SAY, textMsg = "You feel more focused.", magicEffect = CONST_ME_MAGIC_RED, conditions = {condition_dist}},
    [10001] = {say = "Smack.", talkType = TALKTYPE_MONSTER_SAY, textMsg = "You felt fishing inspiration.", magicEffect = CONST_ME_MAGIC_RED, conditions = {condition_f}},
    [12540] = {say = "Yum.", talkType = TALKTYPE_MONSTER_SAY, textMsg = "Underwater walking speed increased.", magicEffect = CONST_ME_MAGIC_RED, storage = 17100, sTime = 86400},
}

local jeanPierreFood = Action()

function jeanPierreFood.onUse(player, item, frompos, item2, topos)
    if player:getStorageValue(17110 + iid[item.itemid]) > os.time() then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need to wait before using it again.")
        return true
    end
    
    player:setStorageValue(17110 + iid[item.itemid],os.time() + (15 * 60))
    
    local ITEM = food[item.itemid]
    
    if ITEM then
    
        if ITEM.health then
            player:addHealth(player:getMaxHealth() - player:getHealth())
        end
        
        if ITEM.say then
            player:say(ITEM.say, ITEM.talkType)
        end
        
        if ITEM.textMsg then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, ITEM.textMsg)
        end
        
        if ITEM.magicEffect then
            player:getPosition():sendMagicEffect(ITEM.magicEffect)
        end
        
        if ITEM.removeConditions then
            for i = 1, #conditions do
                player:removeCondition(conditions[i])
            end
        end
        
        if ITEM.conditions then
            for i = 1, #ITEM.conditions do
                player:addCondition(ITEM.conditions[i])
            end
        end
        
        if ITEM.mana then
            player:addMana(player:getMaxMana() - player:getMana())
        end
        
        if ITEM.storage then
            if ITEM.sTime then
                player:setStorageValue(ITEM.storage, ITEM.stime + os.time())
            end
        end
    
    item:remove(1)
    return true
    end
    

    if item.itemid == 12542 then
        if math.random(1,5) == 5 then
            item:remove(1)
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "You take the last gulp from the large bowl. No leftovers!")
        else
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "You take a gulp from the large bowl, but there's still some blackjack in it.")
        end
        Creature(cid):addHealth(getCreatureMaxHealth(cid) - getCreatureHealth(cid))
        player:say("Gulp.", TALKTYPE_MONSTER_SAY)
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        return true
    elseif item.itemid == 12543 then
        item:remove(1)
        local c = {condition_shield,condition_ml,condition_melee,condition_dist,condition_speed}
        local r = math.random(1,4)
        if r == 1 then
            Creature(cid):addCondition(c[math.random(1, #c)])
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "You feel stronger, but you have no idea what was increased.")
        elseif r == 2 then
            doSetCreatureLight(cid, 15, 154, 60*60*1000)
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "You feel enlightened.")
        elseif r == 3 then
            Creature(cid):addCondition(condition_i)
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "You became invisible.")
        elseif r == 4 then
            Creature(cid):addHealth(getCreatureMaxHealth(cid) - getCreatureHealth(cid))
            Creature(cid):addMana(Creature(cid):getMaxMana() - Creature(cid):getMana())
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "Your vitality has been restored.")
        end
         player:say("Smack.", TALKTYPE_MONSTER_SAY)
         player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
    return true
    elseif item.itemid == 12544 then
    local ring = getPlayerSlotItem(cid, CONST_SLOT_RING)
    local r_t = {
        [2211] = 2208,
        [2212] = 2209,
        [6301] = 6300,
        [2215] = 2213,
        [2204] = 2167,
        [2205] = 2168,
        [2164] = 2164,
        [2203] = 2166,
        [18528] = 18408,
        [2216] = 2214,
        [13826] = 13825,
        [2202] = 2165,
        [2210] = 2207,
        [2206] = 2169}
        if(ring.itemid == 0) then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "No ring equipped.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
        end

    if r_t[ring.itemid] ~= nil then
        item:remove(1)
        if ring.itemid == r_t[ring.itemid] then
            r_m_am = 20
        else
            r_m_am = 1
        end
        
        for i = 1, 10 do
            doPlayerAddItem(cid, r_t[ring.itemid], r_m_am)
        end
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "Your ring has been multiplied.")
        player:say("Slurp!", TALKTYPE_MONSTER_SAY)
        return true
    else
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "This ring cannot be multiplied.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)     
        return true
        end
    end
end

for index, value in pairs(iid) do
    jeanPierreFood:id(index)
end

jeanPierreFood:register()
 
Status
Not open for further replies.
Back
Top