Jump to content
fotostocker

Заточка шанс и максимальный уровень!!!!!

Recommended Posts

Давно не создавал сервер но тут решил вспомнить как это было. И сразу же появилась проблема. Не нашел ни где функцию про заточку аппарелей и поднятия %%%%. Побегал по форумам и везде видно что многие ищут данную функцию. Так вот вам пользуйтесь все ковыряйтесь делайте как вам нравиться.

 

 

Нашел!!!!!!!!! Поковырялся но добился свое кому ни то может пригодиться 

 

файл forge.lua

 

function can_beuplv_item_main ( Table )

local role = 0

local ItemBag = {}

local ItemCount = {}

local ItemBagCount = {}

local Get_Count = 4

local ItemReadCount = 0

local ItemReadNow = 1

local ItemReadNext = 0

local ItemBag_Now = 0

local ItemCount_Now = 0

local ItemBagCount_Num = 0

role , ItemBag , ItemCount , ItemBagCount , ItemBag_Now , ItemCount_Now , ItemBagCount_Num = Read_Table ( Table )

local ItemBagCount_beuplv = ItemBagCount [1]

local ItemBag_beuplv = ItemBag [1]

local ItemNum_beuplv = ItemCount [1]

local Item_beuplv = GetChaItem ( role , 2 , ItemBag_beuplv ) 

local Item_beuplv_Type = GetItemType ( Item_beuplv )

local Item_beuplv_ID = GetItemID ( Item_beuplv )

local Item_ScItem = GetChaItem ( role , 2 , ItemBag [0] )

local Item_YxItem = GetChaItem ( role , 2 , ItemBag [2] )

local Item_ScItem_ID = GetItemID ( Item_ScItem )

local Item_YxItem_ID = GetItemID ( Item_YxItem )

local Item_ScItem_Type = GetItemType ( Item_ScItem )

local Item_YxItem_Type = GetItemType ( Item_YxItem )

local Item_beuplv_Lv =  Get_Itembeuplv_Lv ( Item_beuplv )

local ItemAttr_Val_Fusionid = GetItemAttr ( Item_beuplv , ITEMATTR_VAL_FUSIONID ) 

if Item_beuplv_ID < 5001 or Item_beuplv_ID > 6000 then

SystemNotice( role ,"Этот предмет нельзя плавить ")

return 0

end

if  ItemAttr_Val_Fusionid == 0 then

SystemNotice( role , "Предмет невозможно улучшить ")

return 0

end

if Item_beuplv_Lv >= 50 then -- Максимальный уровень улучшения --( расчет идет +4 то есть 50*4=200 заточка получаеться 200%) 

SystemNotice( role ,"Вы достигли максимального уровня заточки ")

return 0

end

if ItemBagCount_beuplv ~= 1 then

SystemNotice( role , "Недопустимый уровень улучшения ")

return 0

end

if Item_ScItem_Type ~= 62 then

SystemNotice( role , "У вас нет Улучшающего свитка ")

return 0

end

if Item_YxItem_Type ~= 63 then

SystemNotice( role , "У вас нет Усиливающего кристалла ")

return 0

end

if ItemNum_beuplv ~= 1 then

SystemNotice( role , "Неверный номер улучшения ")

return 0

end

if ItemCount [0] ~= 1 or ItemCount [2] ~= 1 or ItemBagCount [0] ~= 1 or ItemBagCount [2] ~= 1 then  

SystemNotice ( role ,"Ошибка предмета из ИМ или игрового материала ")

return 0

end

local Money_Need = getupgrade_money_main ( Table )

local Money_Have = GetChaAttr ( role , ATTR_GD )

if Money_Need > Money_Have then

SystemNotice( role ,"У вас не хватает золота. Невозможно провести улучшение ")

return 0

end

return 1

end

 

function begin_upgrade_item (...)

local Check_Canbeuplv = 0

Check_Canbeuplv = can_beuplv_item_main ( arg )

if Check_Canbeuplv == 0 then

return 0

end

local role = 0

local ItemBag = {}

local ItemCount = {}

local ItemBagCount = {}

local Get_Count = 4

local ItemReadCount = 0

local ItemReadNow = 1

local ItemReadNext = 0

local ItemBag_Num = 0

local ItemCount_Num = 0

local ItemBagCount_Num = 0

role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( arg )

local ItemBag_beuplv = ItemBag [1]

local Item_beuplv = GetChaItem ( role , 2 , ItemBag_beuplv )    

local Item_ScItem = GetChaItem ( role , 2 , ItemBag [0] )

local Item_YxItem = GetChaItem ( role , 2 , ItemBag [2] )

local Item_ScItem_ID = GetItemID ( Item_ScItem )

local Item_YxItem_ID = GetItemID ( Item_YxItem )

local Item_beuplv_Lv =  Get_Itembeuplv_Lv ( Item_beuplv )

local R1 = 0

local R2 = 0

 

R1 = RemoveChaItem ( role , Item_ScItem_ID , 1 , 2 , ItemBag [0] , 2 , 1 , 0 )

R2 = RemoveChaItem ( role , Item_YxItem_ID , 1 , 2 , ItemBag [2] , 2 , 1 , 0 )

if R1 == 0 or R2 == 0 then

LG( "beuplv" , "Удалить предмет не удалось " )

end

local Money_Need = getupgrade_money_main ( arg )

local Money_Have = GetChaAttr ( role , ATTR_GD )

Money_Have = Money_Have - Money_Need

SetCharaAttr ( Money_Have , role , ATTR_GD )

ALLExAttrSet( role )

local a = Check_CG_beuplv ( Item_beuplv_Lv )

if a == 0 then

R1 = RemoveChaItem ( role , Item_ScItem_ID , 1 , 2 , ItemBag [0] , 2 , 1 , 0 )

R2 = RemoveChaItem ( role , Item_YxItem_ID , 1 , 2 , ItemBag [2] , 2 , 1 , 0 )

if R1 == 0 or R2 == 0 then

LG( "beuplv" , "Удалить предмет не удалось " )

end

local cha_name = GetChaDefaultName ( role )

LG( "JingLian_ShiBai" , "Игрок "..cha_name.." не смог улучшить предмет " )

SystemNotice( role , "Извините, заточить аппарель неудалось ")

return 

end

Item_beuplv_Lv = Item_beuplv_Lv + 50 ------(это сколько уровней сразу поднимется тоесть 1 уровень это 2% а 50 уровенй это 100% сразу )

SetChaKitbagChange( role , 1 )

Set_Itembeuplv_Lv ( Item_beuplv , Item_beuplv_Lv )

SynChaKitbag( role, 4 )

local LvD = GetItemAttr( Item_beuplv , ITEMATTR_VAL_LEVEL )

SynChaKitbag(role,13)

SystemNotice( role , "Вы заточили шмотку ")

local cha_name = GetChaDefaultName ( role )

LG( "JingLian_ShiBai" , "Игрок "..cha_name.." успешно провел усиление " )

return 1

end

 

function Get_Itembeuplv_Lv ( Item )

local Lv = GetItemAttr ( Item , ITEMATTR_VAL_LEVEL )

return Lv

end

 

function Set_Itembeuplv_Lv ( Item , Item_Lv )

local i = 0

i = SetItemAttr ( Item , ITEMATTR_VAL_LEVEL , Item_Lv )

if i == 0 then

LG( "Hecheng_BS","Failed to set gem level" )

end

end

 

------------------

-- Шанс Заточки --

------------------

 

function Check_CG_beuplv ( Item_Lv )

local ran = math.random ( 1, 100 )

if Item_Lv <= 10 then

return 1 -- 100%

end

if Item_Lv>10 and Item_Lv <= 15 then

if ran <= 50 then -- 50%

return 1

else

return 0

end

end

if Item_Lv>15 and Item_Lv <= 20 then

if ran <= 10 then --10%

return 1

else

return 0

end

end

end

 

 

Спасибо за такой отличный форум

  • Thanks 1

Share this post


Link to post
Share on other sites

Привет, @fotostocker!

 

Благодарю за то, что поделился с нами решением проблемы, думаю кому-то это может пригодиться  в будущем. Если будет время и желание, то можешь оформить проблему и её решение в виде небольшого гайда в разделе "Пиратия: Документация".

 

On 12/30/2021 at 10:08 AM, fotostocker said:

Спасибо за такой отличный форум

Всегда пожалуйста!


Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...