Advertisement
Guest User

Simple Hat Enchant

a guest
Oct 17th, 2016
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.13 KB | None | 0 0
  1. --[[
  2.  
  3.                                                 *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*
  4.                                                 %      - Simple Hat Upgrade System -         %
  5.                                                 %                By: Satan                   %
  6.                                                 *%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*
  7.                                                
  8.  
  9. ###########################################################
  10. * ItemInfo.txt: Hat and Source upgrade lines              *
  11. * - You can change hat name, texture, attributes as well. *
  12. * - Texture used: White Death Crown                       *
  13. * - Change "XXXX" to your line id                         *
  14. ###########################################################
  15.                        
  16. XXXX    Lv1 Demonic Argent Hat  n1661   10110001    00000ZKyl1  00000ZKyl2  00000ZKyl3  00000ZKyl4  0   0   20  0   0   0   0   1   0   1   0   1   1   1   20000   -1,-2,-2,-2 100 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2    0   0   0,-2,-2,-2,-2,-2,-2,-2,-2,-2    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2   0   0   0   0   0   0   0   0   0   0   0   0   10  10  0   0   0   0   0   0   10  0   1,1 1,1 1,1 1,1 1,1 0,0 0,0 0,0 0,0 0,0 50,50   0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0   7000,7000   20000,20000 3   0   0   0   0   0   0   0   0   0   0   0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0 0   0   Demonic Argent equipments   0
  17. XXXX    Lv2 Demonic Argent Hat  n1661   10110001    00000ZKyl1  00000ZKyl2  00000ZKyl3  00000ZKyl4  0   0   20  0   0   0   0   1   0   1   0   1   1   1   20000   -1,-2,-2,-2 100 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2    0   0   0,-2,-2,-2,-2,-2,-2,-2,-2,-2    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2   0   0   0   0   0   0   0   0   0   0   0   0   20  20  0   0   0   0   0   0   20  0   1,1 1,1 1,1 1,1 1,1 0,0 0,0 0,0 0,0 0,0 50,50   0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0   7000,7000   20000,20000 3   0   0   0   0   0   0   0   0   0   0   0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0 0   0   Demonic Argent equipments   0
  18. XXXX    Lv3 Demonic Argent Hat  n1661   10110001    00000ZKyl1  00000ZKyl2  00000ZKyl3  00000ZKyl4  0   0   20  0   0   0   0   1   0   1   0   1   1   1   20000   -1,-2,-2,-2 100 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2    0   0   0,-2,-2,-2,-2,-2,-2,-2,-2,-2    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2   0   0   0   0   0   0   0   0   0   0   0   0   30  30  0   0   0   0   0   0   30  0   2,2 2,2 2,2 2,2 2,2 0,0 0,0 0,0 0,0 0,0 50,50   0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0   7000,7000   20000,20000 3   0   0   0   0   0   0   0   0   0   0   0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0 0   0   Demonic Argent equipments   0
  19. XXXX    Lv4 Demonic Argent Hat  n1661   10110001    00000ZKyl1  00000ZKyl2  00000ZKyl3  00000ZKyl4  0   0   20  0   0   0   0   1   0   1   0   1   1   1   20000   -1,-2,-2,-2 100 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2    0   0   0,-2,-2,-2,-2,-2,-2,-2,-2,-2    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2   0   0   0   0   0   0   0   0   0   0   0   0   40  40  0   0   0   0   0   0   40  0   2,2 2,2 2,2 2,2 2,2 0,0 0,0 0,0 0,0 0,0 50,50   0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0   7000,7000   20000,20000 3   0   0   0   0   0   0   0   0   0   0   0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0 0   0   Demonic Argent equipments   0
  20. XXXX    Lv5 Demonic Argent Hat  n1661   10110001    00000ZKyl1  00000ZKyl2  00000ZKyl3  00000ZKyl4  0   0   20  0   0   0   0   1   0   1   0   1   1   1   20000   -1,-2,-2,-2 100 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2    0   0   0,-2,-2,-2,-2,-2,-2,-2,-2,-2    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2   0   0   0   0   0   0   0   0   0   0   0   0   50  50  0   0   0   0   0   0   50  0   2,2 2,2 2,2 2,2 2,2 0,0 0,0 0,0 0,0 0,0 50,50   0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0   7000,7000   20000,20000 3   0   0   0   0   0   0   0   0   0   0   0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0 0   0   Demonic Argent equipments   0
  21. XXXX    Lv6 Demonic Argent Hat  n1661   10110001    00000ZKyl1  00000ZKyl2  00000ZKyl3  00000ZKyl4  0   0   20  0   0   0   0   1   0   1   0   1   1   1   20000   -1,-2,-2,-2 100 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2    0   0   0,-2,-2,-2,-2,-2,-2,-2,-2,-2    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2   0   0   0   0   0   0   0   0   0   0   0   0   60  60  0   0   0   0   0   0   60  0   3,3 3,3 3,3 3,3 3,3 0,0 0,0 0,0 0,0 0,0 50,50   0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0   7000,7000   20000,20000 3   0   0   0   0   0   0   0   0   0   0   0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0 0   0   Demonic Argent equipments   0
  22. XXXX    Lv7 Demonic Argent Hat  n1661   10110001    00000ZKyl1  00000ZKyl2  00000ZKyl3  00000ZKyl4  0   0   20  0   0   0   0   1   0   1   0   1   1   1   20000   -1,-2,-2,-2 100 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2    0   0   0,-2,-2,-2,-2,-2,-2,-2,-2,-2    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2   0   0   0   0   0   0   0   0   0   0   0   0   70  70  0   0   0   0   0   0   70  0   3,3 3,3 3,3 3,3 3,3 0,0 0,0 0,0 0,0 0,0 50,50   0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0   7000,7000   20000,20000 3   0   0   0   0   0   0   0   0   0   0   0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0 0   0   Demonic Argent equipments   0
  23. XXXX    Lv8 Demonic Argent Hat  n1661   10110001    00000ZKyl1  00000ZKyl2  00000ZKyl3  00000ZKyl4  0   0   20  0   0   0   0   1   0   1   0   1   1   1   20000   -1,-2,-2,-2 100 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2    0   0   0,-2,-2,-2,-2,-2,-2,-2,-2,-2    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2   0   0   0   0   0   0   0   0   0   0   0   0   80  80  0   0   0   0   0   0   80  0   3,3 3,3 3,3 3,3 3,3 0,0 0,0 0,0 0,0 0,0 50,50   0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 1,1 0   7000,7000   20000,20000 3   0   0   0   0   0   0   0   0   0   0   0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0 0   0   Demonic Argent equipments   0
  24. XXXX    Lv9 Demonic Argent Hat  n1661   10110001    00000ZKyl1  00000ZKyl2  00000ZKyl3  00000ZKyl4  0   0   20  0   0   0   0   1   0   1   0   1   1   1   20000   -1,-2,-2,-2 100 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2    0   0   0,-2,-2,-2,-2,-2,-2,-2,-2,-2    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2   0   0   0   0   0   0   0   0   0   0   0   0   90  90  0   0   0   0   0   0   90  0   4,4 4,4 4,4 4,4 4,4 0,0 0,0 0,0 0,0 0,0 50,50   0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 2,2 0   7000,7000   20000,20000 3   0   0   0   0   0   0   0   0   0   0   0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0 0   0   Demonic Argent equipments   0
  25. XXXX    Lv10 Demonic Argent Hat n1661   10110001    00000ZKyl1  00000ZKyl2  00000ZKyl3  00000ZKyl4  0   0   20  0   0   0   0   1   0   1   0   1   1   1   20000   -1,-2,-2,-2 100 -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2    0   0   0,-2,-2,-2,-2,-2,-2,-2,-2,-2    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2   0   0   0   0   0   0   0   0   0   0   0   0   100 100 0   0   0   0   0   0   100 0   5,5 5,5 5,5 5,5 5,5 0,0 0,0 0,0 0,0 0,0 50,50   0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 3,3 0   7000,7000   20000,20000 3   0   0   0   0   0   0   0   0   0   0   0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0 0   0   Demonic Argent equipments   0
  26. XXXX    Evil Crystal Source n2140   10130005    0   0   0   0   0   0   86  0   0   0   0   0   1   1   1   1   99  0   2   -1,-2,-2,-2 0   -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2    0   0   -1,-2,-2,-2,-2,-2,-2,-2,-2,-2   -1,-2,-2,-2,-2,-2,-2,-2,-2,-2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0   0,0 0,0 0   0   0   0   0   0   0   0   0   DemonicUpgrade  0   0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0 0,0 0   0   An energy source for all Demons. A necessity for Enchanting Demonic Argent Hat. 0
  27.  
  28. --]]
  29.  
  30. -- Functions.lua: That check if whole item on slot used for upgrade is Demonic Hat.
  31. -- Change "XXXX" to your hat ID in sequence. From low attributes to higher.
  32. CheckIsDemonic = function(role)
  33.     local Hat       = GetChaItem ( role , 2, 0 )
  34.     local hatID     = GetItemID (Hat)
  35.         if hatID == XXXX or hatID == XXXX or hatID == XXXX or hatID == XXXX or hatID == XXXX or hatID == XXXX or hatID == XXXX or hatID == XXXX or hatID == XXXX or hatID == XXXX then
  36.             return 1
  37.         end
  38.     return 0
  39. end
  40.  
  41. -- That check if any determined item is gemmed.
  42. VerifyIsGemmed = function(item)
  43.     local EQ        = {}
  44.     local param     = GetItemForgeParam(item, 1)
  45.         param   = TansferNum(param)
  46.         EQ[1] = GetNum_Part1(param)
  47.         EQ[2] = GetNum_Part2(param)
  48.         EQ[3] = GetNum_Part3(param)
  49.         EQ[4] = GetNum_Part4(param)
  50.         EQ[5] = GetNum_Part5(param)
  51.         EQ[6] = GetNum_Part6(param)
  52.         EQ[7] = GetNum_Part7(param)
  53.     return EQ
  54. end
  55.  
  56. -- That transfer gems from equipment which you did check to new one.
  57. KeepGems = function(role, item, EQ)
  58.     local param = GetItemForgeParam(item, 1)
  59.         param = TansferNum(param)
  60.         param = SetNum_Part1(param, EQ[1])
  61.         param = SetNum_Part2(param, EQ[2])
  62.         param = SetNum_Part3(param, EQ[3])
  63.         param = SetNum_Part4(param, EQ[4])
  64.         param = SetNum_Part5(param, EQ[5])
  65.         param = SetNum_Part6(param, EQ[6])
  66.         param = SetNum_Part7(param, EQ[7])
  67.         SetItemForgeParam(item, 1, param)
  68.     RefreshCha(role)
  69. end
  70.  
  71. -- It's used to upgrade hat to a new one with better attributes, keeping gems.
  72. -- On "if" put your hat id starting with lower attributes
  73. -- In "local r1,r2" put hat id of hat which player will get after sucesfully upgrade.
  74. EvilSourceBegin = function(role)
  75.     local Hat               = GetChaItem ( role , 2, 0 )
  76.     local hatID             = GetItemID (Hat)
  77.     local CheckGems         = VerifyIsGemmed(Hat)  
  78.     local chanceLv2         = Percentage_Random ( 0.5 )
  79.     local chanceLv3         = Percentage_Random ( 0.4 )
  80.     local chanceLv4         = Percentage_Random ( 0.3 )
  81.     local chanceLv5         = Percentage_Random ( 0.2 )
  82.     local chanceLv6         = Percentage_Random ( 0.15 )
  83.     local chanceLv7         = Percentage_Random ( 0.10 )
  84.     local chanceLv8         = Percentage_Random ( 0.09 )
  85.     local chanceLv9         = Percentage_Random ( 0.07 )
  86.     local chanceLv10        = Percentage_Random ( 0.05 )
  87.         if hatID == XXXX and chanceLv2 == 1 then
  88.             TakeItem(role, 0, hatID, 1)    
  89.         local r1,r2         = MakeItem ( role , XXXX  , 1 , 4 )
  90.         local itemNew       = GetChaItem(role, 2, r2)  
  91.             KeepGems(role, itemNew, CheckGems)         
  92.             SystemNotice(role,"Congratulation! You have sucesfully enchanted Demonic Hat to Lv2")
  93.             PlayEffect(role, 345)
  94.         elseif hatID == XXXX and chanceLv3 == 1 then
  95.             TakeItem(role, 0, hatID, 1)
  96.         local r1,r2         = MakeItem ( role , XXXX  , 1 , 4 )
  97.         local itemNew = GetChaItem(role, 2, r2)
  98.             KeepGems(role, itemNew, CheckGems)             
  99.             SystemNotice(role,"Congratulation! You have sucesfully enchanted Demonic Hat to Lv3")
  100.             PlayEffect(role, 345)
  101.         elseif hatID == XXXX and chanceLv4 == 1 then
  102.             TakeItem(role, 0, hatID, 1)
  103.         local r1,r2         = MakeItem ( role , XXXX  , 1 , 4 )
  104.         local itemNew = GetChaItem(role, 2, r2)
  105.             KeepGems(role, itemNew, CheckGems) 
  106.             SystemNotice(role,"Congratulation! You have sucesfully enchanted Demonic Hat to Lv4")
  107.             PlayEffect(role, 345)
  108.         elseif hatID == XXXX and chanceLv5 == 1 then
  109.             TakeItem(role, 0, hatID, 1)
  110.         local r1,r2         = MakeItem ( role , XXXX  , 1 , 4 )
  111.         local itemNew       = GetChaItem(role, 2, r2)  
  112.             KeepGems(role, itemNew, CheckGems) 
  113.             SystemNotice(role,"Congratulation! You have sucesfully enchanted Demonic Hat to Lv5")
  114.             PlayEffect(role, 345)
  115.         elseif hatID == XXXX and chanceLv6 == 1 then
  116.             TakeItem(role, 0, hatID, 1)
  117.         local r1,r2         = MakeItem ( role , XXXX  , 1 , 4 )
  118.         local itemNew       = GetChaItem(role, 2, r2)  
  119.             KeepGems(role, itemNew, CheckGems) 
  120.             SystemNotice(role,"Congratulation! You have sucesfully enchanted Demonic Hat to Lv6")
  121.             PlayEffect(role, 345)
  122.         elseif hatID == XXXX and chanceLv7 == 1 then
  123.             TakeItem(role, 0, hatID, 1)
  124.         local r1,r2         = MakeItem ( role , XXXX  , 1 , 4 )
  125.         local itemNew = GetChaItem(role, 2, r2)
  126.             KeepGems(role, itemNew, CheckGems) 
  127.             SystemNotice(role,"Congratulation! You have sucesfully enchanted Demonic Hat to Lv7")
  128.             PlayEffect(role, 345)
  129.         elseif hatID == XXXX and chanceLv8 == 1 then
  130.             TakeItem(role, 0, hatID, 1)
  131.         local r1,r2         = MakeItem ( role , XXXX  , 1 , 4 )
  132.         local itemNew       = GetChaItem(role, 2, r2)  
  133.             KeepGems(role, itemNew, CheckGems) 
  134.             SystemNotice(role,"Congratulation! You have sucesfully enchanted Demonic Hat to Lv8")
  135.             PlayEffect(role, 345)
  136.         elseif hatID == XXXX and chanceLv9 == 1 then
  137.             TakeItem(role, 0, hatID, 1)
  138.         local r1,r2         = MakeItem ( role , XXXX  , 1 , 4 )
  139.         local itemNew       = GetChaItem(role, 2, r2)  
  140.             KeepGems(role, itemNew, CheckGems) 
  141.             SystemNotice(role,"Congratulation! You have sucesfully enchanted Demonic Hat to Lv9")
  142.             PlayEffect(role, 345)
  143.         elseif hatID == XXXX and chanceLv10 == 1 then
  144.             TakeItem(role, 0, hatID, 1)
  145.         local r1,r2         = MakeItem ( role , XXXX  , 1 , 4 )
  146.         local itemNew       = GetChaItem(role, 2, r2)  
  147.             KeepGems(role, itemNew, CheckGems) 
  148.             SystemNotice(role,"Congratulation! You have sucesfully enchanted Demonic Hat to Lv10")
  149.             PlayEffect(role, 345)
  150.         elseif hatID == XXXX then
  151.             BickerNotice(role,"Demonic Hat arealdy enchated!")
  152.             return
  153.     else
  154.         SystemNotice(role,"Enchanting failed..")
  155.         PlayEffect(role, 346)
  156.     end
  157. end
  158.  
  159. -- Itemeffect.lua: Source function, used to upgrade hat.
  160. DemonicUpgrade = function(role, Item)
  161.     local Item_CanGet   = GetChaFreeBagGridNum ( role )
  162.         if Item_CanGet < 2 then
  163.             SystemNotice(role ,"You need to have at least 2 empty inventory slot")
  164.             UseItemFailed ( role )
  165.             return
  166.         end
  167.  
  168.     local Cha_Boat  = 0
  169.         Cha_Boat = GetCtrlBoat ( role )
  170.             if Cha_Boat ~= nil then
  171.                 SystemNotice( role , "Cannot use while sailing" )
  172.                 UseItemFailed ( role )
  173.             return
  174.         end
  175.  
  176.     local CanUpgradeHat = CheckIsDemonic(role)
  177.         if CanUpgradeHat == 0 then
  178.             BickerNotice(role,"Please put Demonic Hat on <1st> slot.")
  179.             UseItemFailed ( role )
  180.             return
  181.     else
  182.         EvilSourceBegin(role)          
  183.     end
  184. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement