TNET
English French German Spain Italian Dutch Russian Portuguese Japanese Korean Arabic Chinese Simplified

Wróć   Tibia.net.pl > OpenTibia > Skrypty Lua & XML > Actions

Odpowiedz


 
02-07-10, 09:52  
Shadok
Delegat
 
Użytkownik Shadok na Tibia.net.pl

[8.4+] Perfect items upgrade v2.0


Author: Mock
Org temat:


Update:
Cytat:
Wolno ulepszac od +1 do +999 !
Mozesz ulepszac luki!
Mozesz ulepszac z systemem slot
W actions/actions.xml wklej to:
Kod:
<action itemid="8306" event="script" value="upgrade.lua"/>
<action itemid="8305" event="script" value="upgrade.lua"/>
8306 - Normalnie upgrejduje xD
8305 - Ma 100% szans ze zubgrejduje xD ;p

Teraz w actions/scripts/ stworz plik upgrade.lua i wklej to:
Kod:
--- Perfect refine system by Mock the bear (MTB).
--- Email: 
-- &a = weapon attack
-- &d = weapon defense
-- &s = shield defense
-- &p = armor defense
-- # = nivel do item
-- @ = max level
local gain = {
gainArmor='&p+(1)',loseArmor='&p-(1)',
gainShield='&s+#',loseShield='&s-(#+1)',
gainAttack='&a+(1*(#))',loseAttack='&a-(1*(#+1))',
gainDefense='&d+(1*(#))',loseDefense='&d-(1*(#+1))',
chance='(100/math.sqrt((((@/4)+(#*2))/@)*#))',
maxlvl = 17,
blocked_ids = {8881}
}
local it = {
--[itemid] = [percent]
[8306] = 0, -- 0% additional
[8305] = 100, -- 50%
}
if not setItemName then
    function setItemName(uid,name)
                return doItemSetAttribute(uid,'name',name)
    end
    function setItemArmor(uid,name)
                return doItemSetAttribute(uid,'armor',name)
    end
        function setItemDefense(uid,name)
                return doItemSetAttribute(uid,'defense',name)
        end
        function setItemAttack(uid,name)
                return doItemSetAttribute(uid,'attack',name)
        end
        function getItemAttack(uid)
                return getItemAttribute(uid,'attack')
        end
        function getItemDefense(uid)
                return getItemAttribute(uid,'defense')
        end
function getItemArmor(uid)
   if type(uid) == 'number' then
      return getItemAttribute(uid,'armor')
   else
      return getItemInfo(uid.itemid).armor
   end
end
end
local function isArmor(uid) -- Function by Mock the bear.
    if (getItemInfo(uid.itemid).armor ~= 0) and (getItemWeaponType(uid.uid) == 0) then
                return true
        end
        return false
end
local function isWeapon(uid) -- Function by Mock the bear.
        uid = uid or 0
        local f = getItemWeaponType(uid)
        if f == 1 or f == 2 or f == 3 then
                return true
        end
        return false
end
local function isShield(uid) -- Function by Mock the bear.
        uid = uid or 0
        if getItemWeaponType(uid) == 4 then
                return true
        end
        return false
end
local function isBow(uid) -- Function by Mock the bear.
        uid = uid or 0
        if getItemWeaponType(uid) == 5 then
                return true
        end
        return false
end
local function getWeaponLevel(uid) -- Function by Mock the bear.
   uid = uid or 0
   local name = getItemName(uid.uid) or getItemInfo(uid.itemid).name or ''
   local lvl = string.match(name,'%s%+(%d+)%s*')
   return tonumber(lvl) or 0
end
local function doTransform(s,i) -- Function by Mock the bear.
    local c = string.gsub(s,'@',gain.maxlvl)
    local c = string.gsub(c,'&a',(getItemAttack(i.uid) ~= 0 and getItemAttack(i.uid) or getItemInfo(i.itemid).attack))
    local c = string.gsub(c,'&d',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense))
    local c = string.gsub(c,'&s',(getItemDefense(i.uid) ~= 0 and getItemDefense(i.uid) or getItemInfo(i.itemid).defense))
    local c = string.gsub(c,'&p',(getItemArmor(i.uid) ~= 0 and getItemArmor(i.uid) or getItemInfo(i.itemid).armor))
    local c = string.gsub(c,'#',getWeaponLevel(i))
    local q =  assert(loadstring('return '..c))
    return math.floor(assert(q()))
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
         if item.uid == 0 or item.itemid == 0 then return false end
                 toPosition.stackpos = 255
         if isInArray(gain.blocked_ids, itemEx.itemid)
          or (not getItemWeaponType(itemEx.uid) or getItemWeaponType(itemEx.uid) > 5)
           or (getItemWeaponType(itemEx.uid) == 0 and not isArmor(itemEx))
             or itemEx.itemid == 0 or itemEx.type > 1 or isItemStackable(itemEx.uid) then
                doPlayerSendTextMessage(cid, 24,"You cant refine this item.")
                return TRUE
         end
         if isCreature(itemEx.uid) == TRUE then
            return FALSE
         end
        local level = getWeaponLevel(itemEx)
        local chance = doTransform(gain.chance,itemEx)
                if level == gain.maxlvl then
                        doSendMagicEffect(toPosition, 2)
            return doPlayerSendTextMessage(cid, 24,"Your item is on max level, you can't upgrade it.")
                end
                doPlayerSendTextMessage(cid, 24,"Trying refine with "..(chance+it[item.itemid] > 100 and 100 or chance+it[item.itemid]).."% of sucess!")
        if chance+it[item.itemid] >= math.random(0,100) then
                        local nm = getItemName(itemEx.uid)
                        local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it ^^
                        slot = slot~='' and ' '..slot or slot
            setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level+1)..slot)
            addEvent(doPlayerSendTextMessage,500,cid, 24,"Your item has been upgrated to +"..(level+1)..slot..".")
            doSendMagicEffect(toPosition, 12)
            if isArmor(itemEx) then
                                local get = doTransform(gain.gainArmor,itemEx)
                                setItemArmor(itemEx.uid,get)
                        elseif isBow(itemEx.uid) then
                                setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
                        elseif isWeapon(itemEx.uid) then
                                setItemAttack(itemEx.uid, doTransform(gain.gainAttack,itemEx))
                                setItemDefense(itemEx.uid, doTransform(gain.gainDefense,itemEx))
            elseif isShield(itemEx.uid) then
                                setItemDefense(itemEx.uid, doTransform(gain.gainShield,itemEx))
                        end
        else
                        if level == 0 then
                                addEvent(doPlayerSendTextMessage,500,cid, 24,"No effect.")
                                doSendMagicEffect(toPosition, 2)
                        elseif level > 0 then
                        local nm = getItemName(itemEx.uid)
                        local slot = nm:match('(%[.+%])') or '' ---If you server use slot system dont change it ^^
                                slot = slot~='' and ' '..slot or slot
                                if level == 1 then
                                        setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..slot)
                                        addEvent(doPlayerSendTextMessage,500,cid, 24,"Your item back to normal.")
                                else
                                        setItemName(itemEx.uid, getItemNameById(itemEx.itemid)..' +'..(level-1)..slot)
                                        addEvent(doPlayerSendTextMessage,500,cid, 24,"Your item back to +"..(level-1)..slot..".")
                                end
                                if isArmor(itemEx) then
                                        setItemArmor(itemEx.uid,doTransform(gain.loseArmor  ,itemEx))
                                elseif isWeapon(itemEx.uid) then
                                        setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
                                        setItemDefense(itemEx.uid, doTransform(gain.loseDefense,itemEx))
                                elseif isBow(itemEx.uid) then
                                        setItemAttack(itemEx.uid, doTransform(gain.loseAttack,itemEx))
                                elseif isShield(itemEx.uid) then
                                        setItemDefense(itemEx.uid, doTransform(gain.loseShield,itemEx))
                                end
                        end
                        doSendMagicEffect(toPosition, 9)
        end
        doRemoveItem(item.uid,1)
        return true
end


Mozesz tego systemu uzywac z slot system i bedzie to wygladac tak:
Cytat:
12:02 You see a knife +1 [hp.+7%] (Atk:8, Def:6).
Regards,
Shadok ;]
 
Linki sponsorowane
Adwert
Informator
Grasz?

20-07-10, 09:22  
krawczyk31
Przybysz

Odp: [8.4+] Perfect items upgrade v2.0


a czy to zadziała na tfs pod tibie 8.54
 
21-07-10, 14:11  
Aragornkk
Przewodniczący
 
Użytkownik Aragornkk na Tibia.net.pl

Odp: [8.4+] Perfect items upgrade v2.0


Shadok źle zrobiłeś tag. To działa tylko od 8.54 w górę.
#topic
Skrypt jest naprawdę godny uwagi i dodania do naszego serwera zadziała we wszystkich Tfsach od 0.3.6 w górę.


#krawczyk31
Tak zadziała.

#quas
A kto tym się przejmuje?
 
21-07-10, 14:21  
quas
Przybysz

Odp: [8.4+] Perfect items upgrade v2.0


Mock wie ze to tutaj umieszczasz?
 
30-07-10, 12:43  
Folgowsky
Rzemieślnik
 
Użytkownik Folgowsky na Tibia.net.pl

Odp: [8.4+] Perfect items upgrade v2.0


Kurcze gdy chce enchantowac dany przedmiot nic się nie dzieje , mam tfs 0.3.6 .
 
01-09-10, 12:05  
Thular
Rzemieślnik
 
Użytkownik Thular na Tibia.net.pl

Odp: [8.4+] Perfect items upgrade v2.0


mozesz ktos go zmenic zeby kazde uprage to 100% ciagle i +100 ataku i defa?
 
05-09-10, 13:08  
Tormo
Przybysz

Odp: [8.4+] Perfect items upgrade v2.0


Jak zrobic by to miało więcej użyć ??
 


7 do setki

Odpowiedz

Narzędzia tematu
Wygląd


Podobne wątki
Wątek Autor wątku Forum Odpowiedzi Ostatni post / autor
Tibia 7.60 Perfect Amulet
Kod jest mój, Masterpall na otsoft to ja;). Skorzystałem z paru kodów i połączyłem je w jedno i powstał Perfect Amulet. Wygląda on tak:...
korzonek93 C++ 6 10-08-10 16:55
Tibia 8.40 Genezis- Hamachi Perfect OTS.
Witam chciałbym was zaprosić na nasze Serwer pod hamachi, PS! Pierwszy gracz! Tamax! Pozdro! Nasz Serwer nazywa się Genezis , jest to pierwszy...
Scarlet Robe Serwery Hamachi 0 12-03-09 16:04

Tibia.net.pl: Actions ()
Temat: [8.4+] Perfect items upgrade v2.0 Author: Mock Org temat: Update: Cytat: Wolno ulepszac od +1 [...]


8.54 Vip system na konto i dni. - Sassin (18) Dzisiaj 21:15 [8.1-8.6]Sprawdzanie wszytkich funckji silnika - Aragornkk (1) 08-08-10 23:06 [8.10] GM Medal. - PrO GrAcZ (16) 30-08-10 13:29 [8.4+] Perfect items upgrade v2.0 - Shadok (6) 05-09-10 13:08 [8.5+]Snake System - Vvex (1) 07-07-10 14:51


Czas w strefie GMT +2. Teraz jest 21:47.




Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.3.0 © 2009, Crawlability, Inc.
Tibia.net.pl 2007-2010