Ir para conteúdo
  • Cadastre-se

Posts Recomendados

The Open-Tibia BR Server Global - Version: (Based on TFS 1.3.10)
Compiled with: Microsoft Visual C++ version 14.1
Compiled on Jun 18 2019 03:54:04 for platform x64

 

Estou com problema de não aparecer as opções de imbuing nos itens, "qualquer item".

A parte de entregar 5 heavy old tomes, estão corretos, mas deveria pelo menos aparecer os dois primeiro nível de imbuir.

Mesmo com os itens na backpack de mana leech, não aparecem nada!

Testei isso nos client 10.00 11.00 12.00(login.php)

E item.xml e moviments.xml, estão ok!

 

image.thumb.png.f1bb106364e8ca5ea414624784540aaf.png


 

Citar

--[[
    1~3 => Element Type
    4~6 => Total Time (segundos - 20 h)
    7~9 => Time Passed (seconds)
]]

--[[ Icon List --
    0 = NONE
    1 ~ 3   = Critical
    4 ~ 6   = Death
    7 ~ 9   = Earth
    10 ~ 12 = Energy
    13 ~ 15 = Fire
    16 ~ 18 = Holy
    19 ~ 21 = Ice
    22 ~ 24 = Fire (grey | not used)
    25 ~ 27 = Shielding (grey | not used)
    28 ~ 30 = Reduction Earth
    31 ~ 33 = Reduction Energy
    34 ~ 36 = Reduction Fire
    37 ~ 39 = Reduction Holy
    40 ~ 42 = Reduction Ice
    43 ~ 45 = Shielding (white | not used)
    46 ~ 48 = Life Leech
    49 ~ 51 = Mana Leech
    52 ~ 54 = Axe Fighting
    55 ~ 57 = Club Fighting
    58 ~ 60 = Distance Fighting
    61 ~ 63 = Fist Fighting
    64 ~ 66 = Magic Level
    67 ~ 69 = Shielding Fighting
    70 ~ 72 = Sword Fighting
    73 ~ 75 = Speed
]]

ImbuingSystem = {
    Developer = "Charles (Cjaker)",
    Version = "1.0",
    LastUpdate = "24/05/2017 - 03:50 (AM)"
}

local Imbuements = {
    {
        Name = "Scorch",
        Category = "Elemental Damage (Fire)",
        Type = "firedamage",
        IconID = 13,
        Description = "Converts % of the physical damage to fire damage.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {10, 25, 50},
        Weapons = {"axe", "club", "sword"},
        Items = {{10553, 25}, {5920, 5}, {5954, 5}}
    },
    {
        Name = "Venom",
        Category = "Elemental Damage (Earth)",
        Type = "earthdamage",
        IconID = 7,
        Description = "Converts % of the physical damage to earth damage.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {10, 25, 50},
        Weapons = {"axe", "club", "sword"},
        Items = {{10603, 25}, {10557, 5}, {23565, 5}}
    },
    {
        Name = "Frost",
        Category = "Elemental Damage (Ice)",
        Type = "icedamage",
        IconID = 19,
        Description = "Converts % of the physical damage to ice damage.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {10, 25, 50},
        Weapons = {"axe", "club", "sword"},
        Items = {{10567, 25}, {10578, 20}, {24170, 1}}
    },
    {
        Name = "Electrify",
        Category = "Elemental Damage (Energy)",
        Type = "energydamage",
        IconID = 10,
        Description = "Converts % of the physical damage to energy damage.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {10, 25, 50},
        Weapons = {"axe", "club", "sword"},
        Items = {{21310, 25}, {24631, 5}, {26164, 1}}
    },
    {
        Name = "Reap",
        Category = "Elemental Damage (Death)",
        Type = "deathdamage",
        IconID = 4,
        Description = "Converts % of the physical damage to death damage.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {10, 25, 50},
        Weapons = {"axe", "club", "sword"},
        Items = {{12440, 25}, {10564, 20}, {11337, 5}}
    },
    {
        Name = "Vampirism",
        Category = "Life Leech",
        Type = "hitpointsleech",
        IconID = 46,
        Description = "converts % of damage to HP with a chance of 100%.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {5, 10, 25},
        Weapons = {"axe", "club", "sword", "wand", "rod", "especial", "bow", "crossbow", "armor"},
        Items = {{10602, 25}, {10550, 15}, {10580, 5}}
    },
    {
        Name = "Void",
        Category = "Mana Leech",
        Type = "manapointsleech",
        IconID = 49,
        Description = "converts % of damage to MP with a chance of 100%.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {3, 5, 8},
        Weapons = {"axe", "club", "sword", "wand", "rod", "especial", "bow", "crossbow", "helmet"},
        Items = {{12448, 25}, {22534, 25}, {25386, 5}}
    },
    {
        Name = "Strike",
        Category = "Critical Hit",
        Type = "criticaldamage",
        IconID = 1,
        Description = "raises crit hit damage by % and crit hit chance by 10%.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {15, 25, 50},
        Weapons = {"axe", "club", "sword", "bow", "crossbow", "especial"},
        Items = {{12400, 20}, {11228, 25}, {25384, 5}}
    },
    {
        Name = "Lich Shroud",
        Category = "Death Damage",
        Type = "absorbPercentDeath",
        IconID = 25,
        Description = "reduces death damage by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {3, 8, 15},
        Weapons = {"armor", "spellbooks"},
        Items = {{12422, 25}, {24663, 20}, {10577, 5}}
    },
    {
        Name = "Snake Skin",
        Category = "Eart Damage",
        Type = "absorbPercentEarth",
        IconID = 28,
        Description = "reduces earth damage by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {3, 8, 15},
        Weapons = {"armor", "spellbooks"},
        Items = {{20103, 25}, {10611, 20}, {12658, 10}}
    },
    {
        Name = "Hide Dragon",
        Category = "Fire Damage",
        Type = "absorbPercentFire",
        IconID = 34,
        Description = "reduces fire damage by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {3, 8, 15},
        Weapons = {"armor", "spellbooks"},
        Items = {{5877, 25}, {18425, 10}, {12614, 5}}
    },
    {
        Name = "Quara Scale",
        Category = "Ice Damage",
        Type = "absorbPercentIce",
        IconID = 40,
        Description = "reduces ice damage by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {3, 8, 15},
        Weapons = {"armor", "spellbooks"},
        Items = {{11212, 25}, {11224, 15}, {15425, 10}}
    },
    {
        Name = "Cloud Fabric",
        Category = "Energy Damage",
        Type = "absorbPercentEnergy",
        IconID = 31,
        Description = "reduces energy damage by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {3, 8, 15},
        Weapons = {"armor", "spellbooks"},
        Items = {{10561, 25}, {15482, 15}, {10582, 10}}
    },
    {
        Name = "Demon Presence",
        Category = "Holy Damage",
        Type = "absorbPercentHoly",
        IconID = 37,
        Description = "reduces holy damage by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {3, 8, 15},
        Weapons = {"armor", "spellbooks"},
        Items = {{10556, 25}, {10555, 25}, {11221, 20}}
    },
    {
        Name = "Swiftness",
        Category = "Increase Speed",
        Type = "speed",
        IconID = 73,
        Description = "raises walking speed by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {10, 15, 20},
        Weapons = {"boots"},
        Items = {{19738, 15}, {11219, 25}, {15484, 20}}
    },
    {
        Name = "Chop",
        Category = "Increase Axe Fighting",
        Type = "skillAxe",
        IconID = 52,
        Description = "raises axe fighting skill by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {1, 2, 4},
        Weapons = {"axe", "helmet"},
        Items = {{11113, 20}, {12403, 25}, {23571, 20}}
    },
    {
        Name = "Slash",
        Category = "Increase Sword Fighting",
        Type = "skillSword",
        IconID = 70,
        Description = "raises sword fighting skill by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {1, 2, 4},
        Weapons = {"sword", "helmet"},
        Items = {{10608, 25}, {23573, 25}, {10571, 5}}
    },
    {
        Name = "Bash",
        Category = "Increase Club Fighting",
        Type = "skillClub",
        IconID = 52,
        Description = "raises club fighting skill by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {1, 2, 4},
        Weapons = {"club", "helmet"},
        Items = {{10574, 20}, {24845, 15}, {11322, 10}}
    },
    {
        Name = "Precision",
        Category = "Increase Distance Fighting",
        Type = "skillDist",
        IconID = 58,
        Description = "raises distance fighting skill by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {1, 2, 4},
        Weapons = {"bow", "crossbow", "helmet"},
        Items = {{12420, 25}, {21311, 20}, {11215, 10}}
    },
    {
        Name = "Blockade",
        Category = "Increase Shielding",
        Type = "skillShield",
        IconID = 67,
        Description = "raises shielding skill by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {1, 2, 4},
        Weapons = {"shield", "helmet", "spellbooks"},
        Items = {{10558, 20}, {12659, 25}, {22533, 25}}
    },
    {
        Name = "Epiphany",
        Category = "Increase Magic Level",
        Type = "magiclevelpoints",
        IconID = 64,
        Description = "raises magic level by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {1, 2, 4},
        Weapons = {"wand", "rod", "helmetmage", "especial"},
        Items = {{10552, 25}, {12408, 15}, {11226, 15}}
    },
    {
        Name = "Featherweight",
        Category = "Increase Capacity",
        Type = "capacity",
        IconID = 64,
        Description = "raises capacity by %.",
        Levels = {"Basic", "Intricate", "Powerful"},
        LevelsPercent = {3, 8, 15},
        Weapons = {"backpack"},
        Items = {{28998, 25}, {29006, 10}, {22539, 5}}
    }
}

local Weapons = {
    ["armor"] = {21692, 2500, 2656, 2464, 2487, 2494, 15407, 2492, 2503, 12607, 2505, 32419, 30883, 2466, 23538, 10296, 2476, 3968, 2472, 7463, 8888, 23537, 2486, 15406, 8891, 18404}, -- ok
    ["shield"] = {2537, 2518, 15491, 2535, 2519, 25414, 2520, 15411, 2516, 32422, 32421, 30885, 2522, 2533, 21707, 2514, 10289, 2536, 6433, 6391, 7460, 2524, 15413, 2539, 25382, 21697, 3974, 10297, 12644, 10294, 2509, 2542, 2528, 2534, 2531, 15453}, -- ok
    ["boots"] = {24742, 2195, 2644, 9931, 3982, 11117, 15410, 11118, 12646, 7457, 7892, 2646, 11240, 2643, 7893, 7891, 23540, 24637, 2641, 5462, 18406, 2642, 2645, 7886, 25412, 21708, 11303}, --ok
    ["helmet"] = {2499, 2139, 3972, 2458, 2491, 2497, 2493, 2502, 12645, 32414, 32415, 7458, 30882, 2471, 10299, 20132, 10298, 2662, 10291, 2498, 24848, 5741, 25410, 2475, 11302}, --ok
    ["helmetmage"] = {10016, 2323, 11368, 8820, 10570, 9778}, -- ok
    ["bow"] = {25946, 30690, 8855, 7438, 32418, 15643, 21696, 10295, 18454, 25522, 8857, 22417, 22418, 8854}, -- ok
    ["crossbow"] = {25950, 8850, 2455, 30691, 8849, 25523, 8851, 8852, 8853, 16111, 21690, 22420, 22421}, -- ok
    ["backpack"] = {1988, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2365, 3940, 3960, 5801, 5926, 5949, 7342, 9774, 10518, 10519, 10521, 10522, 11119, 11241, 11243, 11244, 11263, 15645, 15646, 16007, 18393, 18394, 21475, 22696, 23666, 23816, 24740, 26181, 27061, 27063, 35056, 33318},
    ["wand"] = {2191, 8920, 8921, 8922}, --ok
    ["rod"] = {8910, 8911, 24839}, --ok
    ["axe"] = {30686, 2429, 3962, 7412, 30687, 18451, 8926, 2414, 11305, 7419, 2435, 7453, 32424, 2415, 2427, 7380, 8924, 7389, 15492, 7435, 2430, 7455, 7456, 2443, 25383, 7434, 6553, 8925, 2431, 2447, 22405, 22408, 22406, 22409, 2454, 15451, 11323}, --ok
    ["club"] = {7414, 7426, 2453, 7429, 2423, 7415, 2445, 15647, 7431, 7430, 32425, 23543, 30689, 2444, 2452, 20093, 7424, 30688, 25418, 18452, 8928, 7421, 7392, 15414, 7410, 7437, 7451, 2424, 2436, 7423, 12648, 7452, 8929, 22414, 22411, 22415, 22412, 2421, 2391}, --ok
    ["sword"] = {7404, 7403, 7406, 12649, 30684, 7416, 2407, 2413, 7385, 7382, 2451, 7402, 8930, 2438, 32423, 2393, 30886, 7407, 7405, 2400, 7384, 7418, 7383, 7417, 18465, 30685, 2383, 2376, 7391, 6528, 8931, 12613, 11309, 22399, 22403, 22400, 22402, 7408, 11307}, --ok
    ["spellbooks"] = {25411, 2175, 8900, 8901, 22423, 22424, 29004}, -- ok
    ["especial"] = {32417, 32416, 30693, 30692} --ok falcon and destruction rod/wand crit

}

local ImbuingInfo = {
    [1] = {Price = 5000, Protection = 10000, Percent = 90},
    [2] = {Price = 25000, Protection = 30000, Percent = 70},
    [3] = {Price = 100000, Protection = 50000, Percent = 50}
}

local imbuingShrineIds = {
    27728, 27729, 27850, 27851
}

local ImbuementElements = {
    "firedamage", "earthdamage", "energydamage", "deathdamage", "icedamage"
}

local ErrorMessages = {
    MESSAGEDIALOG_IMBUEMENT_ERROR = 1,
    MESSAGEDIALOG_IMBUEMENT_ROLL_FAILED = 2,
    MESSAGEDIALOG_IMBUING_STATION_NOT_FOUND = 3,
    MESSAGEDIALOG_CLEARING_CHARM_SUCCESS = 10,
    MESSAGEDIALOG_CLEARING_CHARM_ERROR = 11
}

local ClientPackets = {
    ApplyImbuement = 0xD5,
    ClearImbuement = 0xD6
}

local enablingStorages = {
    ["shroud"] = Storage.ForgottenKnowledge.LadyTenebrisKilled,
    ["reap"] = Storage.ForgottenKnowledge.LadyTenebrisKilled,
    ["vampirism"] = Storage.ForgottenKnowledge.LadyTenebrisKilled,
    ["cloud fabric"] = Storage.ForgottenKnowledge.LloydKilled,
    ["electrify"] = Storage.ForgottenKnowledge.LloydKilled,
    ["swiftness"] = Storage.ForgottenKnowledge.LloydKilled,
    ["snake skin"] = Storage.ForgottenKnowledge.ThornKnightKilled,
    ["venom"] = Storage.ForgottenKnowledge.ThornKnightKilled,
    ["slash"] = Storage.ForgottenKnowledge.ThornKnightKilled,
    ["chop"] = Storage.ForgottenKnowledge.ThornKnightKilled,
    ["bash"] = Storage.ForgottenKnowledge.ThornKnightKilled,
    ["dragon hide"] = Storage.ForgottenKnowledge.DragonkingKilled,
    ["scorch"] = Storage.ForgottenKnowledge.DragonkingKilled,
    ["void"] = Storage.ForgottenKnowledge.DragonkingKilled,
    ["quara scale"] = Storage.ForgottenKnowledge.HorrorKilled,
    ["frost"] = Storage.ForgottenKnowledge.HorrorKilled,
    ["blockade"] = Storage.ForgottenKnowledge.HorrorKilled,
    ["demon presence"] = Storage.ForgottenKnowledge.TimeGuardianKilled,
    ["precision"] = Storage.ForgottenKnowledge.TimeGuardianKilled,
    ["strike"] = Storage.ForgottenKnowledge.LastLoreKilled,
    ["epiphany"] = Storage.ForgottenKnowledge.LastLoreKilled,
}


function onRecvbyte(player, msg, byte)
    if (byte == ClientPackets.ApplyImbuement) then
        -- Apply Imbuement
        player:applyImbuement(msg)
    elseif (byte == ClientPackets.ClearImbuement) then
        -- Clear Imbuement
        player:clearImbuement(msg)
    end
end

local function tableContains(table, value)
    for i = 1, #table do
        if (table == value) then
            return true
        end
    end

    return false
end

local function haveImbuingShrine(player)
    for x = -1, 1 do
        for y = -1, 1 do
            local posX, posY, posZ = player:getPosition().x+x, player:getPosition().y+y, player:getPosition().z
            local tile = Tile(posX, posY, posZ)
            if (tile) then
                for index, id in pairs(imbuingShrineIds) do
                    if tile:getItemById(id) then
                        return true
                    end
                end
            end
        end
    end

    return false
end

local function getEquipById(id)
    for i, v in pairs(Weapons) do
        if (tableContains(v, id)) then
            return i
        end
    end

    return nil
end

local function getImbuementEquip(equip, pid)
    local tableReturn = {}
    local player = Player(pid)

    for i = 1, #Imbuements do
        if (tableContains(Imbuements.Weapons, equip)) then
            local storageNeeded = enablingStorages[Imbuements.Name:lower()]
            if player:getStorageValue(storageNeeded) > 0 then
                tableReturn[#tableReturn+1] = Imbuements
            end
        end
    end

    return tableReturn
end

local function getActiveImbuement(item, slot)
    for i = 1, #Imbuements do
        for j = 1, 3 do
            local level = Imbuements.Levels[j]
            local enchant = item:getSpecialAttribute(slot)
            if (enchant and type(enchant) ~= 'number' and enchant:find(level) and enchant:find(Imbuements.Name)) then
                return Imbuements, j
            end
        end
    end

    return nil
end

local function getImbuementByIndex(index, id)
    local equip = getEquipById(id)
    local myImbuements = getImbuementEquip(equip)
    local tmpIndex = 0
    for i = 1, #myImbuements do
        for k = 1, 3 do
            tmpIndex = tmpIndex + 1
            if (index == tmpIndex) then
                return myImbuements, k
            end
        end
    end

    return nil
end

local function sendImbuementError(self, message, errorType)
    local msg = NetworkMessage()
    msg:addByte(0xED)
    msg:addByte(errorType or 0x01)
    msg:addString(message)
    msg:sendToPlayer(self)
end

local function mergeImbuementList(table1, table2)
    local newTable = {}
    for i, v in pairs(table1) do
        if (v.Name ~= table2.Name and not (tableContains(ImbuementElements, v.Type) and tableContains(ImbuementElements, table2.Type))) then
            newTable[#newTable+1] = v
        end
    end

    return newTable
end

function Player.applyImbuement(self, msg)
    if (not haveImbuingShrine(self)) then
        sendImbuementError(self, "An error ocurred, please reopen imbuement window.", ErrorMessages.MESSAGEDIALOG_IMBUEMENT_ERROR)
        return false
    end

    local item = lastItemImbuing[self:getGuid()]
    if not item then
        sendImbuementError(self, "Cannot find item, please contact an Administrator.", ErrorMessages.MESSAGEDIALOG_IMBUEMENT_ERROR)
        return false
    end

    local slot, choiceId, useProtection = msg:getByte(), msg:getU32(), msg:getByte()
    local myImbuements = getImbuementEquip(getEquipById(item:getId()),self:getId())
    local imbuingLevel = 0
    local imbuementNow, index = nil, 0

    for i = 1, item:getType():getImbuingSlots() do
        existsImbuement, enchantLevel = getActiveImbuement(item, i)
        if existsImbuement then
            myImbuements = mergeImbuementList(myImbuements, existsImbuement)
        end
    end

    for k = 1, #myImbuements do
        for i = 1, 3 do
            index = index + 1
            if not imbuementNow and index == choiceId then
                imbuementNow = myImbuements[k]
            end
        end
    end

    for i = 3, index, 3 do
        if choiceId >= i-2 and choiceId <= i then
            imbuingLevel = math.abs((i - 2) - choiceId) + 1
            break
        end
    end

    if (not imbuementNow) then
        sendImbuementError(self, "Cannot find imbuement data, please contact an Administrator.", ErrorMessages.MESSAGEDIALOG_IMBUEMENT_ERROR)
        return false
    end

    local imbuingPrice = ImbuingInfo[imbuingLevel].Price
    if (useProtection == 1) then
        imbuingPrice = imbuingPrice + ImbuingInfo[imbuingLevel].Protection
    end

    if (not self:removeMoneyNpc(imbuingPrice)) then
        sendImbuementError(self, "You don't have enough money " ..imbuingPrice.. " gps.", ErrorMessages.MESSAGEDIALOG_IMBUEMENT_ROLL_FAILED)
        return false
    end

    slot = slot + 1
    if self:getAccountType() < 5 then
        for j = 1, imbuingLevel do
            local itemID, itemCount = imbuementNow.Items[j][1], imbuementNow.Items[j][2]
            if (self:getItemCount(itemID) < itemCount) then
                sendImbuementError(self, "You don't have all necessary items.", ErrorMessages.MESSAGEDIALOG_IMBUEMENT_ROLL_FAILED)
                return false
            end

            self:removeItem(itemID, itemCount)
        end
    end

    if (item:isActiveImbuement(slot+3)) then
        sendImbuementError(self, "An error ocurred, please reopen imbuement window.", ErrorMessages.MESSAGEDIALOG_IMBUEMENT_ERROR)
        return false
    end

    local applyChance = math.random(100)
    if (ImbuingInfo[imbuingLevel].Percent < applyChance and useProtection == 0) then
        sendImbuementError(self, "Item failed to apply imbuement.", ErrorMessages.MESSAGEDIALOG_IMBUEMENT_ROLL_FAILED)
        return false
    end

    item:setSpecialAttribute(slot, imbuementNow.Levels[imbuingLevel].. " " ..imbuementNow.Name, slot+3, 72000, slot+6, 0)
    self:openImbuementWindow(item)
end

function Player.clearImbuement(self, msg)
    if (not haveImbuingShrine(self)) then
        sendImbuementError(self, "Sorry, not possible.", ErrorMessages.MESSAGEDIALOG_CLEARING_CHARM_ERROR)
        return false
    end

    local item = lastItemImbuing[self:getGuid()]
    if (item == nil) then
        sendImbuementError(self, "Cannot find item, please send this message to a Administrator.", ErrorMessages.MESSAGEDIALOG_CLEARING_CHARM_ERROR)
        return false
    end

    local weaponSlot = msg:getByte()
    if (not weaponSlot) then
        sendImbuementError(self, "Sorry, not possible.", ErrorMessages.MESSAGEDIALOG_CLEARING_CHARM_ERROR)
        return false
    end

    weaponSlot = weaponSlot + 1
    if (not item:isActiveImbuement(weaponSlot + 3)) then
        sendImbuementError(self, "Sorry, not possible.", ErrorMessages.MESSAGEDIALOG_CLEARING_CHARM_ERROR)
        return false
    end

    if (not self:removeMoneyNpc(15000)) then
        sendImbuementError(self, "You don't have enough money 15000 gps.", ErrorMessages.MESSAGEDIALOG_CLEARING_CHARM_ERROR)
        return false
    end

    item:setSpecialAttribute(weaponSlot, 0, weaponSlot+3, 0, weaponSlot+6, 0)
    self:openImbuementWindow(item)
    sendImbuementError(self, "Item clean success!", ErrorMessages.MESSAGEDIALOG_CLEARING_CHARM_SUCCESS)
end

function Player.closeImbuementWindow(self)
    local msg = NetworkMessage()
    msg:addByte(0xEC)
    msg:sendToPlayer(self)
end

function Player.openImbuementWindow(self, item)
    if (not item or not item:isItem() or not item:isImbuementEquip()) then
        self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "This item is not imbuable.")
        return false
    end

    local msg = NetworkMessage()
    local itemID = item:getId()
    local equip = getEquipById(item:getId())
    local myImbuements = getImbuementEquip(equip,self:getId())
    local imbuingSlots = item:getType():getImbuingSlots()
    lastItemImbuing[self:getGuid()] = item

    msg:addByte(0xEB)
    msg:addItemId(itemID) -- Item to put slots imbuement
    msg:addByte(imbuingSlots) -- Loop Exists Imbuement and slot (soon)

    for i = 1, imbuingSlots do
        if (item:isActiveImbuement(i+3)) then
            local existsImbuement, enchantLevel = getActiveImbuement(item, i)
            myImbuements = mergeImbuementList(myImbuements, existsImbuement)
            msg:addByte(0x01) -- No have imbuement (byte 1 need more packets)
            msg:addU32(900) -- Start Read Imbuement Data
            msg:addString(existsImbuement.Levels[enchantLevel].. " " ..existsImbuement.Name) -- Name Element

            local newDescription = existsImbuement.Description:gsub(" %%", " " ..existsImbuement.LevelsPercent[enchantLevel].."%%")
            msg:addString(newDescription.. "\nLasts for 20h 0min while fighting.") -- Description
            msg:addString(existsImbuement.Category) -- Type Imbuement
            msg:addU16(existsImbuement.IconID+(enchantLevel-1)) -- Icon ID (wtf?)
            msg:addU32(72000) -- duration in seconds (20hrs)
            msg:addByte(0x01) -- premium true
            msg:addByte(enchantLevel) -- Loop Length astral sources
            for j = 1, enchantLevel do
                local itemID, itemName = existsImbuement.Items[j][1], ItemType(existsImbuement.Items[j][1]):getName()
                msg:addItemId(itemID or 2160) -- Astral ID
                msg:addString(itemName or "") -- Astral Name
                msg:addU16(existsImbuement.Items[j][2]) -- Astral Necessary count
            end

            msg:addU32(ImbuingInfo[enchantLevel].Price)
            msg:addByte(ImbuingInfo[enchantLevel].Percent)
            msg:addU32(ImbuingInfo[enchantLevel].Protection) -- End Read Imbuement Data
            msg:addU32(item:getTimeImbuement(i+3)) -- Remaining Seconds
            msg:addU32(15000) -- Clear Cost Gold
        else
            msg:addByte(0x00)
        end
    end

    msg:addU16(#myImbuements*3) -- Loop Read Imbuement data
    local index = 0
    for k = 1, #myImbuements do
        for i = 1, 3 do
            index = index + 1
            msg:addU32(index) -- Start Read Imbuement Data
            msg:addString(myImbuements[k].Levels.. " " ..myImbuements[k].Name) -- Name Element

            local newDescription = myImbuements[k].Description:gsub(" %%", " " ..myImbuements[k].LevelsPercent.."%%")
            msg:addString(newDescription.. "\nLasts for 20h 0min while fighting.") -- Description
            msg:addString(myImbuements[k].Category) -- Type Imbuement
            msg:addU16(1) -- Icon ID (wtf?)
            msg:addU32(72000) -- duration in seconds (20hrs)
            if (i > 1) then
                msg:addByte(0x01) -- premium true
            else
                msg:addByte(0x00) -- premium false
            end

            msg:addByte(i) -- Loop Length astral sources
            for j = 1, i do
                local itemID, itemName = myImbuements[k].Items[j][1], ItemType(myImbuements[k].Items[j][1]):getName()
                msg:addItemId(itemID or 2160) -- Astral ID
                msg:addString(itemName or "") -- Astral Name
                msg:addU16(myImbuements[k].Items[j][2]) -- Astral Necessary count
            end

            msg:addU32(ImbuingInfo.Price)
            msg:addByte(ImbuingInfo.Percent)
            msg:addU32(ImbuingInfo.Protection) -- End Read Imbuement Data
        end
    end

    msg:addU32(#myImbuements*3)
    for k = 1, #myImbuements do
        for j = 1, 3 do
            msg:addItemId(myImbuements[k].Items[j][1])
            if self:getAccountType() < 5 then
                msg:addU16(self:getItemCount(myImbuements[k].Items[j][1]))
            else
                msg:addU16(999)
            end
        end
    end

    self:sendResource("bank", self:getBankBalance())
    self:sendResource("inventory", self:getMoney())
    msg:sendToPlayer(self)
end

function Item:isActiveImbuement(index)
    local time = self:getSpecialAttribute(index)
    if (time and time > 0) then
        return true
    end

    return false
end

function Item:getTimeImbuement(index)
    local time = self:getSpecialAttribute(index)
    if (time and time > 0) then
        return time
    end

    return false
end

function Item:isImbuementEquip()
    if (not self) then
        return false
    end

    if (self:getType() and self:getType():getImbuingSlots() > 0) then
        return true
    end

    return false
end

function Item:getImbuementType(slot)
    local enchant = self:getSpecialAttribute(slot)
    if (enchant == 0) then
        return false
    end

    for i, v in pairs(Imbuements) do
        for j = 1, 3 do
            if (enchant:find(v.Name) and enchant:find(v.Levels[j])) then
                return v.Type
            end
        end
    end

    return nil
end

function Item:getImbuementPercent(name)
    for i, v in pairs(Imbuements) do
        for j = 1, 3 do
            if (name:find(v.Name) and name:find(v.Levels[j]) and name ~= 0) then
                return v.LevelsPercent[j]
            end
        end
    end

    return nil
end

 

 

 

 

Agradeço ajuda, já tou quase desistindo! :(

 

Editado por Preguica (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Este tópico foi movido para a área correta. Esta é uma mensagem automática!
Pedimos que leia as regras do fórum!

Spoiler

This topic has been moved to the correct area. This is an automated message!
Please read the forum rules.

 

Link para o post
Compartilhar em outros sites
  • 6 months later...

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por cloudrun2023
      CloudRun - Sua Melhor Escolha para Hospedagem de OTServer!
      Você está procurando a solução definitiva para hospedar seu OTServer com desempenho imbatível e segurança inigualável? Não procure mais! Apresentamos a CloudRun, sua parceira confiável em serviços de hospedagem na nuvem.
       
      Recursos Exclusivos - Proteção DDoS Avançada:
      Mantenha seu OTServer online e seguro com nossa robusta proteção DDoS, garantindo uma experiência de jogo ininterrupta para seus jogadores.
       
      Servidores Ryzen 7 Poderosos: Desfrute do poder de processamento superior dos servidores Ryzen 7 para garantir um desempenho excepcional do seu OTServer. Velocidade e estabilidade garantidas!
       
      Armazenamento NVMe de Alta Velocidade:
      Reduza o tempo de carregamento do jogo com nosso armazenamento NVMe ultrarrápido. Seus jogadores vão adorar a rapidez com que podem explorar o mundo do seu OTServer.
       
      Uplink de até 1GB:
      Oferecemos uma conexão de alta velocidade com até 1GB de largura de banda, garantindo uma experiência de jogo suave e livre de lag para todos os seus jogadores, mesmo nos momentos de pico.
       
      Suporte 24 Horas:
      Estamos sempre aqui para você! Nossa equipe de suporte está disponível 24 horas por dia, 7 dias por semana, para resolver qualquer problema ou responder a qualquer pergunta que você possa ter. Sua satisfação é a nossa prioridade.
       
      Fácil e Rápido de Começar:
      Configurar seu OTServer na CloudRun é simples e rápido. Concentre-se no desenvolvimento do seu jogo enquanto cuidamos da hospedagem.
       
      Entre em Contato Agora!
      Website: https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
      Email: [email protected]
      Telefone: (47) 99902-5147

      Não comprometa a qualidade da hospedagem do seu OTServer. Escolha a CloudRun e ofereça aos seus jogadores a melhor experiência de jogo possível. Visite nosso site hoje mesmo para conhecer nossos planos e começar!
       
      https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
       
      CloudRun - Onde a Velocidade Encontra a Confiabilidade!
       

    • Por FeeTads
      SALVE rapaziada do TK, esses dias vim pensando em novos scripts pro meu OT, e em um deles eu precisava que determinada area não contasse frag pro player que matasse outros, PORÉM eu precisava que os players que morressem nessa area ainda assim tivessem as penalidades da sua morte, procurei por ai, achei alguns scripts que apenas tiravam o SKULL e não realmente o FRAG do player.

      **script atualizado 22/10/2023** - melhorado e otimizado, levei o script pra puxar as infos por .lua / creatureScripts

      vou disponibilizar o code aqui, e o que fazer pra determinada area não contar frag.

      SOURCE OTX 2 / TFS 0.x, Funciona em TFS 1.x mudando as tags e ajeitando as sintaxes.

      vá em creatureevent.cpp

      procure por:
      else if(type == "preparedeath") _type = CREATURE_EVENT_PREPAREDEATH;
      Adiciona abaixo:
      else if(type == "nocountfrag") _type = CREATURE_EVENT_NOCOUNTFRAG;

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "onPrepareDeath";  
      Adicione abaixo: 
      case CREATURE_EVENT_NOCOUNTFRAG: return "noCountFragArea";

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "cid, deathList";
      Adicione abaixo:
      case CREATURE_EVENT_NOCOUNTFRAG: return "cid, target";

      agora no mesmo arquivo, vá até o final do arquivo e adicione essa função:
      uint32_t CreatureEvent::executeNoCountFragArea(Creature* creature, Creature* target) { //noCountFragArea(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::ostringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; if(m_scriptData) scriptstream << *m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::ostringstream desc; desc << creature->getName(); env->setEvent(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::noCountFragArea] Call stack overflow." << std::endl; return 0; } }

      agora vá em creatureevent.h

      procure por:
      CREATURE_EVENT_PREPAREDEATH
      adicione abaixo:
      CREATURE_EVENT_NOCOUNTFRAG

      procure por:
      uint32_t executePrepareDeath(Creature* creature, DeathList deathList);
      Adicione abaixo:
      uint32_t executeNoCountFragArea(Creature* creature, Creature* target);

      agora vá em player.cpp

      procure por:
      bool Player::onKilledCreature(Creature* target, DeathEntry& entry)
      abaixo de:
      War_t enemy; if(targetPlayer->getEnemy(this, enemy)) { if(entry.isLast()) IOGuild::getInstance()->updateWar(enemy); entry.setWar(enemy); }
      Adicione o seguinte código:
      if (targetPlayer){ CreatureEventList killEvents = getCreatureEvents(CREATURE_EVENT_NOCOUNTFRAG); for (const auto &event : killEvents) { if (!event->executeNoCountFragArea(this, target)) { return true; } } }

      //

      Feito isso, tudo completo na sua source, agora é necessário adicionar o creaturescript dentro do servidor

      vá até creaturescripts/scripts
      crie um arquivo chamado, "noCountFragInArea.lua"
      e dentro dele cole o código:
       
      --[[ script feito por feetads / TibiaKing ]]-- --[[ discord: feetads / FeeTads#0246 ]]-- -- Add positions here for which you do not want to count frags local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, -- from = area superior esquerda / to = area inferior direita (formando um quadrado) } local onlyKillerInArea = false -- only killer need to be in area? function noCountFragArea(cid, target) if not isCreature(cid) or not isCreature(target) then return true end local posKiller = getPlayerPosition(cid) local posTarget = getPlayerPosition(target) for i = 1, #areas do local area = areas[i] if isInArea(posKiller, area.from, area.to) then if onlyKillerInArea then return false elseif isInArea(posTarget, area.from, area.to) then return false end end end return true end
      agora em creaturescripts.xml
      <event type="nocountfrag" name="fragarea" event="script" value="noCountFragInArea.lua"/>
      agora em creaturescripts/scripts/login.lua
       procure por OU semelhante a esse:
      registerCreatureEvent(cid, "AdvanceSave")
      e abaixo adicione:
      registerCreatureEvent(cid, "fragarea")

      //


      Agora tudo certo, quando quiser adiciona uma area que não pega frag, vá até o script e apenas coloque a area, igual o demonstrado no script

      Exemplo:
      local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, [2] = {from = {x = 1000, y = 1000, z = 7}, to = {x = 1100, y = 1100, z = 7}}, }
      assim somente colocando a area no script e abrindo o server ou dando /reload, já funcionará a area como não pegar frag.
      Esse sistema pode ser bom pra areas de pvp ativo, onde você ainda quer que o player que morrer perca os atributos, como se fosse uma morte normal, porém não conta frag pra quem matar.
      Bom pra sistemas tipo castle 48h (guild war), onde há diversas mortes e risco de pegar red, atrapalhando a war.

      Façam bom proveito dos scripts, e deixem os créditos no script rsrs

      **Eu fiz as alterações e o simples código por isso vim disponibilizar, créditos meus**
    • Por Muvuka
      Abri canal a força creaturescript acho que funcione no creaturescript cria script creaturescript
       
      <channel id="9" name="HELP" logged="yes"/>
      <channel id="12" name="Report Bugs" logged="yes"/>
      <channel id="13" name="Loot" logged="yes"/>
      <channel id="14" name="Report Character Rules Tibia Rules" logged="yes"/>
      <channel id="15" name="Death Channel"/>
      <channel id="6548" name="DexSoft" level="1"/>
      <channel id="7" name="Reports" logged="yes"/>
       
      antes de 
              if(lastLogin > 0) then adicione isso:
                      doPlayerOpenChannel(cid, CHANNEL_HELP) doPlayerOpenChannel(cid, 1,  2, 3) = 1,2 ,3 Channels, entendeu? NÃO FUNCIONA EU QUERO UM MEIO DE ABRI SEM USA A SOURCE
       
      EU NÃO CONSEGUI ABRI EU NÃO TENHO SOURCE
       
       
    • Por bolachapancao
      Rapaziada seguinte preciso de um script que ao utilizar uma alavanca para até 4 jogadores.
      Os jogadores serão teleportados para hunt durante uma hora e depois de uma hora os jogadores serão teleportados de volta para o templo.
       
      Observação: caso o jogador morra ou saia da hunt o evento hunt é cancelado.

      Estou a base canary
      GitHub - opentibiabr/canary: Canary Server 13.x for OpenTibia community.
       
    • Por RAJADAO
      .Qual servidor ou website você utiliza como base? 
      Sabrehaven 8.0
      Qual o motivo deste tópico? 
      Ajuda com novos efeitos
       
      Olá amigos, gostaria de ajuda para introduzir os seguintes efeitos no meu servidor (usando o Sabrehaven 8.0 como base), adicionei algumas runas novas (avalanche, icicle, míssil sagrado, stoneshower & Thunderstorm) e alguns novos feitiços (exevo mas san, exori san, exori tera, exori frigo, exevo gran mas frigo, exevo gran mas tera, exevo tera hur, exevo frigo hur) mas nenhum dos efeitos dessas magias parece existir no servidor, alguém tem um link para um tutorial ou algo assim para que eu possa fazer isso funcionar?
      Desculpe pelo mau inglês, sou brasileiro.

      Obrigado!


      AVALANCHE RUNE id:3161 \/
      (COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

      STONESHOWER RUNE id:3175 \/
      (COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_STONES)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)

      THUNDERSTORM RUNE id:3202 \/
      (COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_E NERGYHIT)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)

      ICICLE RUNE id:3158 \/
      COMBAT_ICEDAMAGE
      CONST_ME_ICEAREA
      CONST_ANI_ICE

      SANTO MÍSSIL RUNA id:3182 \/
      (COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

      CONST_ME_PLANTATTACK (exevo gran mas tera)
      CONST_ME_ICETORNADO (exevo gran mas frigo)
      CONST_ME_SMALLPLANTS (exevo tera hur)
      CONST_ME_ICEAREA (exevo frigo hur)
      CONST_ME_ICEATTACK (exori frigo)
      CONST_ME_CARNIPHILA (exori tera)

      EXORI SAN \/
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
      CONST_ME_HOLYDAM IDADE

      EXEVO MAS SAN \/
      CONST_ME_HOLYAREA
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo