Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
forge.lua
Package: 4fcom-20090616-13.rar [view]
Upload User: bjtaixing
Upload Date: 2021-01-15
Package Size: 24749k
Code Size: 338k
Category:
E-Books
Development Platform:
DOS
- ----宝石合成
- ---检测是否能够合成
- function can_unite_item (...)
- -- Notice("开始判断")
- if arg.n ~= 12 then
- -- Notice("参数个数非法"..arg.n)
- return 0
- end
- local kkk = 0
- -- for kkk = 2 , arg.n ,1 do
- -- SystemNotice ( arg[1] , arg[kkk])
- -- end
- local Check = 0
- -- SystemNotice( arg[1] , "调用合成检测主函数")
- Check = can_unite_item_main ( arg )
- if Check == 1 then
- -- SystemNotice (arg[1] , "返回1 ")
- return 1
- else
- -- SystemNotice (arg[1] , "返回0 ")
- return 0
- end
- end
- --检测是否可以合成主函数
- function can_unite_item_main ( Table )
- -- SystemNotice ( Table[1] , "进入合成主函数")
- 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
- -- SystemNotice( arg[1] , "开始调用参数解析")
- role , ItemBag , ItemCount , ItemBagCount , ItemBag_Now , ItemCount_Now , ItemBagCount_Num = Read_Table ( Table )
- -- for kkk = 0 , 2 , 1 do
- -- SystemNotice ( role , ItemBagCount[kkk])
- -- SystemNotice ( role , ItemBag[kkk])
- -- SystemNotice ( role , ItemCount[kkk])
- -- end
- -- Notice(role , "11111")
- local i = 0
- for i = 0 , 2 , 1 do --判断道具对象个数和道具个数是否和法
- if ItemBagCount[i] ~= 1 or ItemCount[i] ~= 1 then
- -- SystemNotice( role , "ItemBagCount[i] = "..ItemBagCount[i])
- -- SystemNotice( role , "ItemCount[i] = "..ItemCount[i])
- SystemNotice( role , "道具对象个数和道具个数非法")
- return 0
- end
- end
- local BagItem1 = ItemBag [0]
- local BagItem2 = ItemBag [1]
- local BagItem3 = ItemBag [2]
- local Item1 = GetChaItem ( role , 2 , BagItem1 ) --取道具指针
- local Item2 = GetChaItem ( role , 2 , BagItem2 )
- local Item3 = GetChaItem ( role , 2 , BagItem3 )
- local ItemID1 = GetItemID ( Item1 ) --取道具编号
- local ItemID2 = GetItemID ( Item2 )
- local ItemID3 = GetItemID ( Item3 )
- local ItemType1 = GetItemType ( Item1 )
- local ItemType2 = GetItemType ( Item2 )
- local ItemType3 = GetItemType ( Item3 )
- if ItemType1 ~= 47 then --判断卷轴是否正确
- SystemNotice( role ,"不是合成卷轴")
- return 0
- end
- if ItemType2 ~= 49 or ItemType3 ~= 49 then --判断是否是宝石
- if ItemType2 ~= 50 or ItemType3 ~= 50 then
- SystemNotice( role , "不是宝石")
- return 0
- end
- end
- if ItemID2 ~= ItemID3 then --判断两个宝石是否同类
- SystemNotice(role ,"宝石不一样")
- return 0
- end
- local Item2_Lv = Get_StoneLv ( Item2 ) --取宝石等级
- local Item3_Lv = Get_StoneLv ( Item3 )
- if ItemID2 == 6718 or ItemID2 == 6717 then
- if Item2_Lv>=2 or Item3_Lv >= 2 then
- SystemNotice ( role , "试炼宝石只能合成到2级。")
- return 0
- end
- end
- if ItemType2 == 49 and ItemType3 == 49 then
- if Item2_Lv >= 9 or Item3_Lv >= 9 then
- SystemNotice ( role , "宝石级别到达上限")
- return 0
- end
- end
- if Item2_Lv ~= Item3_Lv then
- SystemNotice(role ,"宝石等级不一致")
- return 0
- end
- -- SystemNotice ( role , "判断成功")
- local Money_Need = getunite_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_unite_item (...)
- -- Notice("开始合成")
- local Check_CanUnite = 0
- -- SystemNotice ( arg[1] , "调用检测能否合成主函数")
- Check_CanUnite = can_unite_item_main ( arg )
- if Check_CanUnite == 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_Now = 0
- local ItemCount_Now = 0
- local ItemBagCount_Num = 0
- role , ItemBag , ItemCount , ItemBagCount , ItemBag_Now , ItemCount_Now , ItemBagCount_Num = Read_Table ( arg )
- local BagItem1 = ItemBag [0]
- local BagItem2 = ItemBag [1]
- local BagItem3 = ItemBag [2]
- local BagItem1 = arg [3] --取道具背包位置
- local BagItem2 = arg [6]
- local BagItem3 = arg [9]
- local Item1 = GetChaItem ( role , 2 , BagItem1 ) --取道具指针
- local Item2 = GetChaItem ( role , 2 , BagItem2 )
- local Item3 = GetChaItem ( role , 2 , BagItem3 )
- local ItemID1 = GetItemID ( Item1 ) --取道具编号
- local ItemID2 = GetItemID ( Item2 )
- local ItemID3 = GetItemID ( Item3 )
- local ItemType2 = GetItemType ( Item2 )
- local Item2_Lv = Get_StoneLv ( Item2 ) --取宝石等级
- local Item3_Lv = Get_StoneLv ( Item3 )
- local i = 0
- local j = 0
- i = RemoveChaItem ( role , ItemID1 , 1 , 2 , BagItem1 , 2 , 1 , 0) --移除卷轴
- j = RemoveChaItem ( role , ItemID3 , 1 , 2 , BagItem3 , 2 , 1 , 0) --移除一颗宝石
- if i == 0 or j == 0 then
- LG( "Hecheng_BS" , "移除物品失败" )
- end
- Item2_Lv =Item2_Lv + 1
- Set_StoneLv ( Item2 , Item2_Lv )
- local Money_Need = getunite_money_main ( arg )
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- -- Notice ("目前有"..Money_Have.."这么多的钱")
- -- Notice ("要扣除"..Money_Need.."这么多的钱")
- Money_Have = Money_Have - Money_Need
- SetCharaAttr ( Money_Have , role , ATTR_GD )
- ALLExAttrSet( role )
- local Sklv = 1
- local StateLv = GetChaStateLv ( role , STATE_HCGLJB )
- local State100 = GetChaStateLv ( role , STATE_HCBYS ) ------取药水状态
- Sklv = Sklv + StateLv
- local b = Check_CG_HechengBS ( Item2_Lv , ItemType2 , Sklv )
- if Item2_Lv < 8 and Item3_Lv < 8 then
- if State100 == 11 then
- b = 1
- SystemNotice( role , "你喝了药水,宝石合成几率到100%")
- end
- end
- if b == 0 then
- i = RemoveChaItem ( role , ItemID2 , 1 , 2 , BagItem2 , 2 , 1 , 0) --移除宝石
- if i == 0 then
- LG( "Hecheng_BS" , "移除物品失败" )
- end
- local cha_name = GetChaDefaultName ( role )
- LG( "JingLian_ShiBai" , "玩家"..cha_name.."合成宝石失败" )
- SystemNotice( role , "很遗憾,合成失败了,宝石消失了........")
- return 2
- end
- local cha_name = GetChaDefaultName ( role )
- LG( "JingLian_ShiBai" , "玩家"..cha_name.."合成宝石成功" )
- return 1
- end
- --计算需要金钱
- function get_item_unite_money (...)
- -- SystemNotice ( arg[1] , "开始计算钱" )
- local Money = getunite_money_main ( arg )
- -- SystemNotice ( arg[1] , "计算结束"..Money )
- return 0
- end
- --计算需要金钱主函数
- function getunite_money_main ( Table )
- -- SystemNotice ( Table[1] , "真的开始计算钱了" )
- return 5000
- end
- --精炼
- --判断是否能够精炼
- function can_forge_item(...)
- -- Notice ( "判断是否可以精炼")
- if arg.n ~= 12 then
- SystemNotice ( arg[1] , "参数个数非法"..arg.n )
- return 0
- end
- -- local kkk = 0
- -- for kkk = 2 , arg.n ,1 do
- -- SystemNotice ( arg[1] , arg[kkk])
- -- end
- local Check = 0
- Check = can_forge_item_main ( arg )
- if Check == 1 then
- return 1
- else
- return 0
- end
- end
- --检测是否可以精炼主函数
- function can_forge_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_Jinglian = ItemBagCount [0]
- local ItemBag_Jinglian = ItemBag [0]
- local ItemNum_Jinglian = ItemCount [0]
- local Item_Jinglian = GetChaItem ( role , 2 , ItemBag_Jinglian )
- local Check = 0
- if ItemBagCount_Jinglian ~= 1 then
- SystemNotice( role , "精炼道具对应格数非法")
- return 0
- end
- if ItemNum_Jinglian ~= 1 then
- SystemNotice( role , "精炼道具数量非法")
- return 0
- end
- Check = CheckItem_CanJinglian ( Item_Jinglian )
- if Check == 0 then
- SystemNotice( role ,"道具不可精炼")
- return 0
- end
- if ItemCount [1] ~= 1 or ItemCount [2] ~= 1 or ItemBagCount [1] ~= 1 or ItemBagCount [2] ~= 1 then
- SystemNotice ( role ,"宝石数量非法")
- return 0
- end
- local Item_Stone1 = GetChaItem ( role , 2 , ItemBag [1] )
- local Item_Stone2 = GetChaItem ( role , 2 , ItemBag [2] )
- local Check_Hole = 0
- Check_Hole = CheckItem_HaveHole ( Item_Jinglian , Item_Stone1 , Item_Stone2)
- if Check_Hole == 0 then
- SystemNotice( role ,"没有足够的孔用来精炼" )
- return 0
- end
- local Check_Stone = 0
- Check_Stone = Check_StoneLv ( Item_Jinglian , Item_Stone1 , Item_Stone2 )
- if Check_Stone == 0 then
- SystemNotice ( role , "宝石或精炼石等级不足" )
- return 0
- end
- if Check_Stone == -1 then
- SystemNotice ( role , "试炼精炼石只能和试炼宝石一起精炼" )
- return 0
- end
- local Check_StoneItem = 0
- Check_StoneItem = Check_StoneItemType ( Item_Jinglian , Item_Stone1 , Item_Stone2 )
- if Check_StoneItem == 0 then
- SystemNotice ( role , "宝石与精炼道具不符合" )
- return 0
- end
- if Check_StoneItem==-1 then
- SystemNotice ( role , "试炼宝石只能精炼40级以下的装备" )
- return 0
- end
- local Money_Need = getforge_money_main ( Table )
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- if Money_Need > Money_Have then
- SystemNotice( role ,"金钱不足,不能精炼")
- return 0
- end
- --SystemNotice(role ,"判断结束 ")
- return 1
- end
- function ZBforge(role )
- local ZBMain= GetChaAttr(role,ATTR_EXTEND0)
- local ZBNType= math.floor(ZBMain/10) ---第几次占卜
- local ZBNMain= math.mod(ZBMain,10 ) ---BUFF OR DEBUFF
- local ZBday = GetChaAttr(role,ATTR_EXTEND2) --占卜天数
- local ZBstate=GetChaAttr(role, ATTR_EXTEND1) --
- local ZBstate1=math.floor(ZBstate/10) --占卜效果注册
- local ZBstate2=math.mod(ZBstate,10) --占卜类型
- local now_day=os.date("%d")
- now_day=tonumber(now_day)
- local ZBforgeXG=0
- local ZBStateLV={}
- ZBStateLV[1] = {}
- ZBStateLV[1][1] = 10
- ZBStateLV[1][2] = 8
- ZBStateLV[1][3] = 6
- ZBStateLV[1][4] = 4
- ZBStateLV[1][5] = 2
- if now_day==ZBday and ZBstate2==2 and ZBstate1>= 1 and ZBstate1<=5 then
- ZBforgeXG=ZBStateLV[1][ZBstate1]/100
- end
- return ZBforgeXG
- end
- --开始精炼
- function begin_forge_item(...)
- -- Notice("进入精炼")
- local Check_CanForge = 0
- Check_CanForge = can_forge_item_main ( arg )
- if Check_CanForge == 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_Jinglian = ItemBag [0]
- local Item_Jinglian = GetChaItem ( role , 2 , ItemBag_Jinglian )
- local Item_Stone1 = GetChaItem ( role , 2 , ItemBag [1] )
- local Item_Stone2 = GetChaItem ( role , 2 , ItemBag [2] )
- local Check_Jinglian_Item = 0
- local Money_Need = getforge_money_main ( arg )
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- -- Notice ("目前有"..Money_Have.."这么多的钱")
- -- Notice ("要扣除"..Money_Need.."这么多的钱")
- Money_Have = Money_Have - Money_Need
- SetCharaAttr ( Money_Have , role , ATTR_GD )
- ALLExAttrSet( role )
- local ItemID_Jinglian = GetItemID ( Item_Jinglian )
- ----------------
- local Jinglian_Lv_Now = GetItem_JinglianLv ( Item_Jinglian )
- ----------------
- local Num = GetItemForgeParam ( Item_Jinglian , 1 )
- Num = TansferNum ( Num )
- local Stone1Type = GetItemType ( Item_Stone1 )
- local Stone2Type = GetItemType ( Item_Stone2 )
- local Baoshi = 0
- if Stone1Type == 49 then
- Baoshi = Item_Stone1
- elseif Stone2Type == 49 then
- Baoshi = Item_Stone2
- end
- local Item_Stone = {}
- local Item_StoneLv = {}
- local Baoshi_NeedLv = 1
- Item_Stone[0] = GetNum_Part2 ( Num )
- Item_Stone[1] = GetNum_Part4 ( Num )
- Item_Stone[2] = GetNum_Part6 ( Num )
- Item_StoneLv[0] = GetNum_Part3 ( Num )
- Item_StoneLv[1] = GetNum_Part5 ( Num )
- Item_StoneLv[2] = GetNum_Part7 ( Num )
- BaoshiType = GetStone_TypeID ( Baoshi )
- for i = 0 , 2 ,1 do
- if BaoshiType == Item_Stone[i] then
- Baoshi_NeedLv = Item_StoneLv[i] + 1
- end
- end
- ----------------
- local Sklv = 1
- local StateLv = GetChaStateLv ( role , STATE_JLGLJB )
- local State100 = GetChaStateLv ( role , STATE_JLBYS )
- Sklv = Sklv + StateLv
- local ZBforgeXG=ZBforge(role )
- local Check_A = math.max ( 0.02 , math.min ( 1 , ( 1 - Baoshi_NeedLv * 0.1 + Sklv * 0.15 - 0.3+ZBforgeXG ) ) )
- local CheckFaild = Percentage_Random ( Check_A )
- if State100 == 10 then
- if Baoshi_NeedLv < 10 then
- CheckFaild = 1
- SystemNotice( role , "你喝了药水,装备精炼几率到100%")
- end
- end
- if Baoshi_NeedLv < 7 then
- CheckFaild = 1
- end
- if CheckFaild == 1 then
- Check_Jinglian_Item = Jinglian_Item ( Item_Jinglian , Item_Stone1 , Item_Stone2 )
- else
- local cha_name = GetChaDefaultName ( role )
- local Item_Jinglian_name = GetItemName ( ItemID_Jinglian )
- LG( "JingLian_ShiBai" , "玩家"..cha_name.."精炼装备失败,装备未损坏"..Item_Jinglian_name )
- SystemNotice ( role , "很遗憾,精炼失败了,还好装备没有损坏" )
- end
- ------------------
- local ItemID_Stone1 = GetItemID ( Item_Stone1 )
- local ItemID_Stone2 = GetItemID ( Item_Stone2 )
- local Stone1_Lv = Get_StoneLv ( Item_Stone1 )
- local Stone2_Lv = Get_StoneLv ( Item_Stone2 )
- local Jinglianshi_Lv = 0
- if Stone1_Lv > Stone2_Lv then
- Jinglianshi_Lv = Stone1_Lv
- else
- Jinglianshi_Lv = Stone2_Lv
- end
- local Jinglian_Lv = GetItem_JinglianLv ( Item_Jinglian )
- local R1 = 0
- local R2 = 0
- R1 = RemoveChaItem ( role , ItemID_Stone1 , 1 , 2 , ItemBag [1] , 2 , 1 , 0 ) --移除宝石1
- R2 = RemoveChaItem ( role , ItemID_Stone2 , 1 , 2 , ItemBag [2] , 2 , 1 , 0 ) --移除宝石2
- if R1 == 0 or R2 == 0 then
- LG( "Jinglian" , "移除宝石失败" )
- end
- if CheckFaild == 0 then
- return 2
- end
- check_item_final_data ( Item_Jinglian )
- -- SystemNotice(role , "返回失败")
- -- local a = 0.75
- local b = Check_CG_Jinglian ( Jinglian_Lv , Jinglianshi_Lv , Sklv )
- if b == 0 then
- i = RemoveChaItem ( role , ItemID_Jinglian , 1 , 2 , ItemBag [0] , 2 , 1 , 0) --移除宝石
- if i == 0 then
- LG( "Hecheng_BS" , "移除物品失败" )
- end
- local cha_name = GetChaDefaultName ( role )
- local Item_Jinglian_name = GetItemName ( ItemID_Jinglian )
- LG( "JingLian_ShiBai" , "玩家"..cha_name.."精炼装备失败"..Item_Jinglian_name )
- SystemNotice( role , "很遗憾,精炼失败了,装备完全坏掉了........")
- return 2
- end
- -- Notice("精炼结束")
- local cha_name = GetChaDefaultName ( role )
- local Item_Jinglian_name = GetItemName ( ItemID_Jinglian )
- LG( "JingLian_ShiBai" , "玩家"..cha_name.."精炼成功"..Item_Jinglian_name )
- return 1
- end
- --计算精炼费用
- function get_item_forge_money(...)
- -- Notice("计算费用")
- local Money = getforge_money_main ( arg )
- return Money
- end
- --计算精练费用主函数
- function getforge_money_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_Num = 0
- local ItemCount_Num = 0
- local ItemBagCount_Num = 0
- role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
- local ItemBag_Jinglian = ItemBag [0]
- local Item_Jinglian = GetChaItem ( role , 2 , ItemBag_Jinglian )
- local Jinglian_Lv = 0
- Jinglian_Lv = GetItem_JinglianLv ( Item_Jinglian )
- Jinglian_Lv = Jinglian_Lv + 1
- local Money_Need
- if Jinglian_Lv == 1 then
- Money_Need = 10000
- end
- if Jinglian_Lv > 1 then
- Money_Need = Jinglian_Lv * 10000
- end
- --local Money_Need = Jinglian_Lv * 100000
- -- Notice("计算结束")
- return Money_Need
- end
- ----相关函数--------------------------------------------------------------------------------------------------------
- function Get_StoneLv ( Item ) --读取宝石等级
- local Lv = GetItemAttr ( Item , ITEMATTR_VAL_BaoshiLV )
- return Lv
- end
- function Set_StoneLv ( Item , Item_Lv ) --设置宝石等级
- local i = 0
- i = SetItemAttr ( Item , ITEMATTR_VAL_BaoshiLV , Item_Lv )
- if i == 0 then
- LG( "Hecheng_BS","宝石等级设置失败" )
- end
- end
- --检查装备是否可被精炼
- function CheckItem_CanJinglian ( Item )
- -- Notice ("CheckItem_CanJinglian ")
- local Item_Type = GetItemType ( Item )
- local i = 0
- for i = 0 , Item_CanJinglian_Num , 1 do
- if Item_Type == Item_CanJinglian_ID [i] then
- return 1
- end
- end
- return 0
- end
- ---检查是否有足够的洞精炼
- function CheckItem_HaveHole ( Item , Stone1 , Stone2)
- -- Notice ("CheckItem_HaveHole")
- local Num = GetItemForgeParam ( Item , 1 )
- Num = TansferNum ( Num )
- local Hole = GetNum_Part1 ( Num )
- local Item_Stone = {}
- local Stone1TypeID = 0
- local Stone2TypeID = 0
- Item_Stone[0] = GetNum_Part2 ( Num )
- Item_Stone[1] = GetNum_Part4 ( Num )
- Item_Stone[2] = GetNum_Part6 ( Num )
- local i = 0
- local Hole_empty = 0
- for i = 0 , 2 , 1 do
- if Item_Stone[i] == 0 then
- Hole_empty = Hole_empty + 1
- end
- Stone1TypeID = GetStone_TypeID ( Stone1 )
- Stone2TypeID = GetStone_TypeID ( Stone2 )
- if Item_Stone[i] == Stone1TypeID or Item_Stone[i] == Stone2TypeID then
- return 1
- end
- end
- local Hole_Used = 3 - Hole_empty
- if Hole_Used >= Hole then
- return 0
- else
- return 1
- end
- end
- --检查宝石等级是否足够
- function Check_StoneLv ( Item , Stone1 , Stone2 )
- -- Notice ("Check_StoneLv")
- local Num = GetItemForgeParam ( Item , 1 )
- Num = TansferNum ( Num )
- -- Notice ( Num )
- local Jinglian_Lv = GetItem_JinglianLv ( Item )
- -- Notice ( Jinglian_Lv )
- local Stone1Type = GetItemType ( Stone1 )
- local Stone2Type = GetItemType ( Stone2 )
- -- Notice (Stone1Type)
- -- Notice (Stone2Type)
- local Jinglianshi = 0
- local Jinglianshi_Lv = 0
- local Baoshi = 0
- local Baoshi_Lv = 0
- local Baoshi_NeedLv = 0
- if Stone1Type == 50 then
- Jinglianshi = Stone1
- elseif Stone2Type == 50 then
- Jinglianshi = Stone2
- end
- if Stone1Type == 49 then
- Baoshi = Stone1
- elseif Stone2Type == 49 then
- Baoshi = Stone2
- end
- Jinglianshi_Lv = Get_StoneLv ( Jinglianshi )
- Baoshi_Lv = Get_StoneLv ( Baoshi )
- local baoShiID = GetItemID(Baoshi)
- local jingLianShiID = GetItemID(Jinglianshi)
- if jingLianShiID== 6717 and baoShiID~=6718 then
- return -1
- end
- -- Notice("Jinglianshi_Lv= "..Jinglianshi_Lv)
- -- Notice("Baoshi_Lv= "..Baoshi_Lv)
- local Item_Stone = {}
- local Item_StoneLv = {}
- Item_Stone[0] = GetNum_Part2 ( Num )
- Item_Stone[1] = GetNum_Part4 ( Num )
- Item_Stone[2] = GetNum_Part6 ( Num )
- Item_StoneLv[0] = GetNum_Part3 ( Num )
- Item_StoneLv[1] = GetNum_Part5 ( Num )
- Item_StoneLv[2] = GetNum_Part7 ( Num )
- BaoshiType = GetStone_TypeID ( Baoshi )
- -- Notice("BaoshiType= "..BaoshiType)
- local i = 0
- for i = 0 , 2 ,1 do
- if BaoshiType == Item_Stone[i] then
- Baoshi_NeedLv = Item_StoneLv[i] + 1
- end
- end
- local Jinglianshi_NeedLv = Baoshi_NeedLv
- if Baoshi_Lv < Baoshi_NeedLv then
- -- Notice("宝石等级不够")
- return 0
- end
- if Jinglianshi_Lv < Jinglianshi_NeedLv then
- -- Notice("精炼石等级不够")
- return 0
- end
- -- Notice("返回成功")
- return 1
- end
- ---开始精炼
- function Jinglian_Item ( Item , Stone1 , Stone2 )
- -- Notice("Jinglian_Item")
- local Num = GetItemForgeParam ( Item , 1 )
- Num = TansferNum ( Num )
- local Jinglian_Lv = GetItem_JinglianLv ( Item )
- local Stone1Type = GetItemType ( Stone1 )
- local Stone2Type = GetItemType ( Stone2 )
- local Baoshi = 0
- local Num_New = Num
- if Stone1Type == 49 then
- Baoshi = Stone1
- elseif Stone2Type == 49 then
- Baoshi = Stone2
- end
- Num_New = SetJinglian_Lv ( Baoshi , Baoshi_Lv , Num )
- -- Notice(Num_New)
- local i = 0
- i = SetItemForgeParam ( Item , 1 , Num_New )
- if i == 0 then
- LG( "Jinglian" , "设置精炼内容失败" )
- end
- local Item_URE_Add = 0
- local Item_MAXURE = GetItemAttr ( Item , ITEMATTR_MAXURE )
- if Item_MAXURE < 600 then
- Item_MAXURE = math.min ( ( Item_MAXURE + Item_URE_Add ) , 600 )
- end
- local j = 0
- j = SetItemAttr ( Item , ITEMATTR_MAXURE , Item_MAXURE )
- if j == 0 then
- LG( "Jinglian" , "精炼设置最大耐久失败")
- end
- if Num_New == Num then
- -- Notice("设置内容未改变")
- end
- return 1
- end
- --设置武器上宝石的属性
- function SetJinglian_Lv ( Baoshi , Baoshi_Lv , Num )
- -- Notice ("SetJinglian_Lv")
- -- Notice (Num)
- local Baoshi_Lv = 0
- Baoshi_Lv = Get_StoneLv ( Baoshi )
- local Item_Stone = {}
- local Item_StoneLv = {}
- Item_Stone[0] = GetNum_Part2 ( Num )
- Item_Stone[1] = GetNum_Part4 ( Num )
- Item_Stone[2] = GetNum_Part6 ( Num )
- Item_StoneLv[0] = GetNum_Part3 ( Num )
- Item_StoneLv[1] = GetNum_Part5 ( Num )
- Item_StoneLv[2] = GetNum_Part7 ( Num )
- BaoshiType = GetStone_TypeID ( Baoshi )
- -- Notice("BaoshiType= "..BaoshiType)
- local i = 0
- local Stone_Check = 0
- for i = 0 , 2 , 1 do
- if BaoshiType == Item_Stone [i] then
- Item_StoneLv [i] = Item_StoneLv [i] + 1
- Stone_Check = i + 1
- end
- end
- if Stone_Check == 1 then
- Num = SetNum_Part3 ( Num , Item_StoneLv[0] )
- elseif Stone_Check == 2 then
- Num = SetNum_Part5 ( Num , Item_StoneLv[1] )
- elseif Stone_Check == 3 then
- Num = SetNum_Part7 ( Num , Item_StoneLv[2] )
- elseif Stone_Check == 0 then
- local Check_empty = 0
- for i = 2 , 0 , -1 do
- if Item_Stone[i] == 0 then
- Check_empty = i + 1
- end
- end
- if Check_empty == 1 then
- Num = SetNum_Part2 ( Num , BaoshiType )
- Num = SetNum_Part3 ( Num , 1 )
- elseif Check_empty == 2 then
- Num = SetNum_Part4 ( Num , BaoshiType )
- Num = SetNum_Part5 ( Num , 1 )
- elseif Check_empty == 3 then
- Num = SetNum_Part6 ( Num , BaoshiType )
- Num = SetNum_Part7 ( Num , 1 )
- end
- end
- -- Notice("SetJinglian_Lv结束")
- return Num
- end
- --取宝石类型ID
- function GetStone_TypeID ( Stone )
- -- Notice ("GetStone_TypeID")
- local StoneID = GetItemID ( Stone )
- local i = 0
- for i = 1 , StoneTpye_ID_Num , 1 do
- -- Notice ( StoneTpye_ID[i] )
- if StoneTpye_ID[i] == StoneID then
- return i
- end
- end
- return -1
- end
- ----变参内容解析
- function Read_Table ( Table )
- -- Notice("Read_Table")
- local role = Table [1] --角色
- -- Notice(role)
- -- Notice(Table.n)
- local ItemBag = {} --道具背包位置
- local ItemCount = {} --道具数量
- local ItemBagCount = {} --道具对象数量
- local Get_Count = 4
- local ItemReadCount = 0
- local ItemReadNow = 2
- local ItemReadNext = 0
- local ItemBag_Now = 0
- local ItemCount_Now = 0
- local ItemBagCount_New = 0
- local i = 0
- local j = 0
- for i = 0 , Get_Count , 1 do
- if ItemReadNow <= Table.n then
- ItemBagCount [i] = Table [ItemReadNow]
- -- SystemNotice ( role , "aaa "..ItemBagCount [i] )
- ItemBagCount_New = ItemBagCount_New + 1
- -- Notice("ItemBagCount= "..ItemBagCount [i])
- ItemReadNow = ItemReadNow + 1
- ItemReadNext = ItemReadNow + 2 * ( ItemBagCount [i] - 1 )
- ItemReadCount = ItemReadNow
- if ItemBagCount [i] ~= 0 then
- for j = ItemReadCount , ItemReadNext , 2 do
- ItemBag [ItemBag_Now] = Table [j]
- -- SystemNotice(role , "aaa "..ItemBag [ItemBag_Now])
- -- Notice("ItemBag= "..ItemBag [ItemBag_Now])
- ItemBag_Now = ItemBag_Now + 1
- ItemCount [ItemCount_Now] = Table [ j+1 ]
- -- SystemNotice(role , "aaa "..ItemCount[ItemCount_Now])
- -- Notice("ItemCount= "..ItemCount [ItemCount_Now])
- ItemCount_Now = ItemCount_Now + 1
- ItemReadNow = ItemReadNow + 2
- end
- end
- else
- ItemBagCount [i] = 0
- -- SystemNotice ( role , "aaa "..ItemBagCount [i] )
- -- Notice(ItemBagCount [i])
- end
- end
- -- Notice("1111")
- return role , ItemBag , ItemCount , ItemBagCount , ItemBag_Now , ItemCount_Now , ItemBagCount_New
- end
- --道具精炼属性重算
- function check_item_final_data ( Item )
- local Item_TypeCheck = GetItemType ( Item )
- if Item_TypeCheck == 59 then
- return
- end
- -- Notice ("check_item_final_data")
- local Num = GetItemForgeParam ( Item , 1 )
- Num = TansferNum ( Num )
- -- Notice(Num)
- local StoneInfo = {}
- local StoneLv = {}
- local ResetCheck = 0
- ResetCheck = ResetItemFinalAttr( Item )
- if ResetCheck == 0 then
- -- Notice("ResetCheck失败")
- LG("check_item_final","ResetCheck失败")
- return
- end
- StoneInfo[0]=0
- StoneInfo[1]=0
- StoneInfo[2]=0
- StoneLv[0]=0
- StoneLv[1]=0
- StoneLv[2]=0
- StoneInfo[0],StoneInfo[1],StoneInfo[2],StoneLv[0],StoneLv[1],StoneLv[2] = CheckStoneInfo ( Num )
- local AddCheck = 0
- local i = 0
- local j = 0
- for i = 0 , 2 , 1 do
- if StoneInfo [i] ~= nil and StoneInfo [i] ~=0 then
- -- Notice("StoneInfo"..i.."= "..StoneInfo [i])
- if StoneAttrType[StoneInfo [i]] == ITEMATTR_VAL_MNATK then
- -- Notice("加攻击力")
- local Itemattr_Type1 = StoneAttrType[StoneInfo [i]]
- local Itemattr_Type2 = Itemattr_Type1 + 1
- local ItemAttrEff = 0
- local num_stone=0
- local lv_stone=0
- if StoneLv[i]>0 and StoneLv[i]<=9 then
- lv_stone=StoneLv[i]
- end
- if StoneInfo [i]>=0 and StoneInfo [i]<=StoneEff_Num then
- num_stone=StoneInfo [i]
- ItemAttrEff =StoneEff [num_stone] * lv_stone
- end
- -- local Item_attr1 = GetItemAttr ( Item , Itemattr_Type1 )
- -- local Item_attr2 = GetItemAttr ( Item , Itemattr_Type2 )
- -- local Item_Newattr1 = Item_attr1 + ItemAttrEff
- -- local Item_Newattr2 = Item_attr2 + ItemAttrEff
- -- Notice ( "Itemattr_Type1= "..Itemattr_Type1.." Itemattr_Type2= "..Itemattr_Type2)
- -- Notice ( "ItemAttrEff= "..ItemAttrEff)
- AddCheck = AddItemFinalAttr ( Item , Itemattr_Type1 , ItemAttrEff )
- if AddCheck == 0 then
- LG("check_item_final","AddCheck失败")
- end
- AddCheck = AddItemFinalAttr ( Item , Itemattr_Type2 , ItemAttrEff )
- if AddCheck == 0 then
- LG("check_item_final","AddCheck失败")
- end
- else
- local Itemattr_Type = StoneAttrType[StoneInfo [i]]
- local ItemAttrEff = 0
- local num_stone=0
- local lv_stone=0
- if StoneLv[i]>0 and StoneLv[i]<=9 then
- lv_stone=StoneLv[i]
- end
- if StoneInfo [i]>=0 and StoneInfo [i]<=StoneEff_Num then
- num_stone=StoneInfo [i]
- ItemAttrEff =StoneEff [num_stone] * lv_stone
- end
- --local ItemAttrEff = StoneEff[StoneInfo [i]] * StoneLv[i]
- -- local Item_attr = GetItemAttr ( Item , Itemattr_Type )
- -- local Item_Newattr = Item_attr + ItemAttrEff
- AddCheck = AddItemFinalAttr ( Item , Itemattr_Type , ItemAttrEff )
- if AddCheck == 0 then
- LG("check_item_final","AddCheck失败")
- end
- end
- end
- end
- end
- --检查宝石可精炼道具类型
- function Check_StoneItemType ( Item , Stone1 , Stone2 )
- -- Notice ("Check_StoneItemType")
- local Stone1Type = GetItemType ( Stone1 )
- local Stone2Type = GetItemType ( Stone2 )
- local Baoshi = 0
- local ItemType = GetItemType ( Item )
- if Stone1Type == 49 then
- Baoshi = Stone1
- elseif Stone2Type == 49 then
- Baoshi = Stone2
- end
- local Baoshi_ID = GetItemID ( Baoshi )
- local i = 0
- local Baoshi_TypeID = 0
- for i = 1 , StoneAttrType_Num , 1 do
- if Baoshi_ID == StoneTpye_ID[i] then
- Baoshi_TypeID = i
- end
- end
- if Baoshi_ID == 6718 then
- local itemLV=GetItemLv(Item)
- if itemLV>40 then
- return -1
- end
- end
- for i = 0 , 15 , 1 do
- if ItemType == StoneItemType[Baoshi_TypeID][i] then
- return 1
- end
- if StoneItemType[Baoshi_TypeID][i] == 0 then
- -- Notice ("返回失败")
- return 0
- end
- end
- -- Notice ("返回失败")
- return 0
- end
- --取精炼等级
- function GetItem_JinglianLv ( Item )
- -- Notice ("GetItem_JinglianLv")
- local Num = GetItemForgeParam ( Item , 1 )
- Num = TansferNum ( Num )
- local Item_StoneLv = {}
- local JinglianLv = 0
- Item_StoneLv[0] = GetNum_Part3 ( Num )
- Item_StoneLv[1] = GetNum_Part5 ( Num )
- Item_StoneLv[2] = GetNum_Part7 ( Num )
- JinglianLv = Item_StoneLv[0] + Item_StoneLv[1] + Item_StoneLv[2]
- return JinglianLv
- end
- --读取武器上宝石信息
- function CheckStoneInfo( Num )
- local Item_Stone = {}
- local Item_StoneLv = {}
- Item_Stone[0] = GetNum_Part2 ( Num )
- Item_Stone[1] = GetNum_Part4 ( Num )
- Item_Stone[2] = GetNum_Part6 ( Num )
- Item_StoneLv[0] = GetNum_Part3 ( Num )
- Item_StoneLv[1] = GetNum_Part5 ( Num )
- Item_StoneLv[2] = GetNum_Part7 ( Num )
- return Item_Stone[0],Item_Stone[1],Item_Stone[2],Item_StoneLv[0],Item_StoneLv[1],Item_StoneLv[2]
- end
- function Check_CG_HechengBS ( Item_Lv , Item_Type , Sklv )
- local a = 0
- local b = 0
- Item_Lv = Item_Lv - 1
- if Item_Type == 49 then
- a = math.max ( 0 , math.min ( 1 , ( 1 - Item_Lv * 0.10 + Sklv * 0.10 ) ) )
- b = Percentage_Random ( a )
- if Item_Lv < 3 then
- b = 1
- end
- return b
- elseif Item_Type == 50 then
- a = math.max ( 0 , math.min ( 1 , ( 1 - Item_Lv * 0.05 + Sklv * 0.15 ) ) )
- b = Percentage_Random ( a )
- return b
- else
- LG( "Hecheng_BS","概率检查时道具类型不是宝石" )
- return 0
- end
- end
- ------------------------by Chaos
- function Check_CG_Jinglian ( Jinglian_Lv , Stone_Lv , Sklv )
- -- local a = 0
- local b = 0
- -- a = math.max ( 0.02 , math.min ( 1 , ( 1 - Jinglian_Lv * 0.05 + Sklv * 0.15 - 0.3 ) ) )
- -- b = Percentage_Random ( a )
- -- if Jinglian_Lv <= 8 then
- b = 1
- -- end
- return b
- end
- --随机宝石种类——————————————————————————————————————
- function Roll_DiamondId ( cha )
- local a = math.random ( 1 , 8 )
- local DiamondId = StoneTpye_ID [ a ]
- return DiamondId
- end
- --1级宝石兑换卷————————————————————————————————————————————————————
- function Transfer_DiamondScript_Lv1 ( role )
- local cha = TurnToCha ( role )
- local x_give = 0
- local y_give = 0
- local script_count = CheckBagItem ( cha , 3877 ) --检查背包中兑换券数量
- local DiamondId = Roll_DiamondId ( cha ) --随机兑换宝石的种类
- if script_count >= 1 then
- x_del = DelBagItem ( cha , 3877 , 1 )
- if x_del == 1 then
- x_give = GiveItem ( cha , 0 , DiamondId , 1 , 101 ) --兑换宝石
- y_give = GiveItem ( cha , 0 , 885 , 1 , 101 ) --兑换精炼石
- else
- SystemNotice ( cha , "无法正确扣除宝石兑换券" )
- end
- else
- SystemNotice ( cha , "背包内需要一级宝石兑换券才可兑换" )
- end
- if x_give == 1 and y_give ==1 then
- return 1
- else
- return 0
- end
- end
- --2级宝石兑换卷————————————————————————————————————————————————————
- function Transfer_DiamondScript_Lv2 ( role )
- local cha = TurnToCha ( role )
- local x_give = 0
- local y_give = 0
- local script_count = CheckBagItem ( cha , 3878 ) --检查背包中兑换券数量
- local DiamondId = Roll_DiamondId ( cha ) --随机兑换宝石的种类
- if script_count >= 1 then
- x_del = DelBagItem ( cha , 3878 , 1 )
- if x_del == 1 then
- x_give = GiveItem ( cha , 0 , DiamondId , 1 , 102 ) --兑换宝石
- y_give = GiveItem ( cha , 0 , 885 , 1 , 102 ) --兑换精炼石
- else
- SystemNotice ( cha , "无法正确扣除宝石兑换券" )
- end
- else
- SystemNotice ( cha , "背包内需要二级精炼兑换券才可兑换" )
- end
- if x_give == 1 and y_give ==1 then
- return 1
- else
- return 0
- end
- end
- -------------------------------圣诞祝福
- function GetChaName_0 ( role,npc )
- local cha_name = GetChaDefaultName ( role )
- local Money_Need = 1000
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- local item_num = CheckBagItem( role, 2887 )
- if Money_Need > Money_Have or item_num <=0 then
- SystemNotice( role ,"身上没有圣诞卡或金钱不足")
- else
- end
- if Money_Have >= Money_Need and item_num >0 then
- TakeMoney(role,nil,Money_Need)
- TakeItem( role, 0,2887, 1 )
- PlayEffect( npc, 361 )
- ScrollNotice(" 来自 "..cha_name.." 的圣诞祝福:白雪飘飘,鹿铃霄霄,甜蜜的平安夜又来到,小手摆摆,舞姿曼曼,快乐的圣诞节日多美好.",1)
- else
- end
- end
- -------------------------------------------
- function GetChaName_1 ( role,npc )
- local cha_name = GetChaDefaultName ( role )
- local Money_Need = 1000
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- local item_num = CheckBagItem( role, 2887 )
- if Money_Need > Money_Have or item_num <=0 then
- SystemNotice( role ,"身上没有圣诞卡或金钱不足")
- else
- end
- if Money_Have >= Money_Need and item_num >0 then
- TakeMoney(role,nil,Money_Need)
- TakeItem( role, 0,2887, 1 )
- PlayEffect( npc, 361 )
- ScrollNotice(" 来自 "..cha_name.." 的圣诞祝福:每一朵雪花飘下,每一个烟火燃起,每一秒时间流动,每一份思念传送,都代表着我想要送你的每一个祝福,圣诞快乐!",1)
- else
- end
- end
- ---------------------------------------
- function GetChaName_2 ( role,npc )
- local cha_name = GetChaDefaultName ( role )
- local Money_Need = 1000
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- local item_num = CheckBagItem( role, 2887 )
- if Money_Need > Money_Have or item_num <=0 then
- SystemNotice( role ,"身上没有圣诞卡或金钱不足")
- else
- end
- if Money_Have >= Money_Need and item_num >0 then
- TakeMoney(role,nil,Money_Need)
- TakeItem( role, 0,2887, 1 )
- PlayEffect( npc, 361 )
- ScrollNotice(" 来自 "..cha_name.." 的美丽愿望:以前的圣诞节,总是认为圣诞老人不会将最好的礼物降临给我,但今年的圣诞节不同,有你的到来,让我永远记住今天.",1)
- else
- end
- end
- -----------------------------------------
- function GetChaName_3 ( role,npc )
- local cha_name = GetChaDefaultName ( role )
- local Money_Need = 1000
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- local item_num = CheckBagItem( role, 2887 )
- if Money_Need > Money_Have or item_num <=0 then
- SystemNotice( role ,"身上没有圣诞卡或金钱不足")
- else
- end
- if Money_Have >= Money_Need and item_num >0 then
- TakeMoney(role,nil,Money_Need)
- TakeItem( role, 0,2887, 1 )
- PlayEffect( npc, 361 )
- ScrollNotice(" 来自 "..cha_name.." 的圣诞祝福:圣诞节到了,向支持我的朋友和我所爱的朋友说声感谢,感谢你走进我的生活,我会尽我最大的努力给你无限的快乐!",1)
- else
- end
- end
- -----------------------------------------
- function GetChaName_26 ( role,npc )
- local cha_name = GetChaDefaultName ( role )
- local Money_Need = 1000
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- local item_num = CheckBagItem( role, 2887 )
- if Money_Need > Money_Have or item_num <=0 then
- SystemNotice( role ,"身上没有圣诞卡或金钱不足")
- else
- end
- if Money_Have >= Money_Need and item_num >0 then
- TakeMoney(role,nil,Money_Need)
- TakeItem( role, 0,2887, 1 )
- PlayEffect( npc, 361 )
- ScrollNotice(""..cha_name.." 仰天长叹:能不能在下个圣诞节之前别再让我当乱斗之王,工会战不要次次都赢,上天,赐予我一个强劲的对手吧,阿门……",1)
- else
- end
- end
- -----------------------------------------
- function GetChaName_27 ( role,npc )
- local cha_name = GetChaDefaultName ( role )
- local Money_Need = 1000
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- local item_num = CheckBagItem( role, 2887 )
- if Money_Need > Money_Have or item_num <=0 then
- SystemNotice( role ,"身上没有圣诞卡或金钱不足")
- else
- end
- if Money_Have >= Money_Need and item_num >0 then
- TakeMoney(role,nil,Money_Need)
- TakeItem( role, 0,2887, 1 )
- PlayEffect( npc, 361 )
- ScrollNotice(""..cha_name.." 仰天狂叫:哈里路亚,妈妈咪呀,主啊……赐我一个妞吧",1)
- else
- end
- end
- -----------------------------------------
- function GetChaName_28 ( role,npc )
- local cha_name = GetChaDefaultName ( role )
- local Money_Need = 1000
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- local item_num = CheckBagItem( role, 2887 )
- if Money_Need > Money_Have or item_num <=0 then
- SystemNotice( role ,"身上没有圣诞卡或金钱不足")
- else
- end
- if Money_Have >= Money_Need and item_num >0 then
- TakeMoney(role,nil,Money_Need)
- TakeItem( role, 0,2887, 1 )
- PlayEffect( npc, 361 )
- ScrollNotice(""..cha_name.." 祝福自己好运天天交,生活步步高,彩票期期中,打牌次次赢,口味顿顿好,若敢把我忘,小心挨棍棒",1)
- else
- end
- end
- ---------------------------------Leo的团队之星兑换
- function Transfer_TeamStar( role , level )
- local cha = TurnToCha ( role )
- local script_count = CheckBagItem ( cha , 1034 )--取背包数量
- local chaLV = GetChaAttr( cha , ATTR_LV)--取等级
- local job = GetChaAttr( role, ATTR_JOB) --取职业
- if script_count >= 1 then
- if chaLV < 41 then
- SystemNotice(role,"您的团队之星暂时还没老旧,请你41级以后再来吧")
- else
- if job ~= 12 and job ~= 9 and job ~= 16 and job ~= 8 and job ~= 13 and job ~=14 then
- SystemNotice(role,"必须是二转职业才能使用哦,请去各大城市找职业NPC完成二转职业任务再来兑换吧~")
- else
- local x_del = DelBagItem ( cha , 1034 , 1 )
- if x_del == 1 then
- if job == 12 then --狙击
- GiveItem( role , 0 , 1409 , 1 , 22 )
- elseif job == 9 then --双剑
- GiveItem( role , 0 , 1392 , 1 , 22 )
- elseif job == 16 then --航海
- GiveItem( role , 0 , 1419 , 1 , 22 )
- elseif job == 8 then --巨剑
- GiveItem( role , 0 , 1382 , 1 , 22 )
- elseif job == 13 then --圣职
- GiveItem( role , 0 ,1433 , 1 , 22 )
- elseif job == 14 then --封印
- GiveItem( role , 0 , 1467 , 1 , 22 )
- end
- else
- SystemNotice ( cha , "无法正确扣除团队之星" )
- end
- end
- end
- else
- SystemNotice ( cha , "背包内需要团队之星才可以换领" )
- end
- end
- --宝石兑换卷
- --Lv1 一级宝石兑换券
- --Lv2 二级宝石兑换券
- --Lv3 精炼石兑换券
- --Lv4 宝石兑换券
- function TransferDiamond( role , level )
- local ret = KitbagLock(role,0)
- if ret ~= LUA_TRUE then
- SystemNotice(role,"背包被锁定无法兑换")
- return
- end
- local retbag
- if level == 1 then
- retbag = HasLeaveBagGrid( role, 2)
- if retbag ~= LUA_TRUE then
- SystemNotice(role,"背包空格少于2个无法兑换")
- return
- end
- Transfer_DiamondScript_Lv1 ( role )
- elseif level == 2 then
- retbag = HasLeaveBagGrid( role, 2)
- if retbag ~= LUA_TRUE then
- SystemNotice(role,"背包空格少于2个无法兑换")
- return
- end
- Transfer_DiamondScript_Lv2 ( role )
- elseif level == 3 then
- retbag = HasLeaveBagGrid( role, 1)
- if retbag ~= LUA_TRUE then
- SystemNotice(role,"背包空格少于1个无法兑换")
- return
- end
- Transfer_OneStoneScript ( role )
- elseif level == 4 then
- retbag = HasLeaveBagGrid( role, 1)
- if retbag ~= LUA_TRUE then
- SystemNotice(role,"背包空格少于1个无法兑换")
- return
- end
- Transfer_OneDiamondScript ( role )
- else
- LG( "BSduihuan","兑换卷等级非法" )
- end
- end
- --精炼石兑换卷
- function Transfer_OneStoneScript ( role )
- local cha = TurnToCha ( role )
- local y_give = 0
- local script_count = CheckBagItem ( cha , 3885 ) --检查背包中兑换券数量
- if script_count >= 1 then
- x_del = DelBagItem ( cha , 3885 , 1 )
- if x_del == 1 then
- y_give = GiveItem ( cha , 0 , 885 , 1 , 101 ) --兑换精炼石
- else
- SystemNotice ( cha , "无法正确扣除宝石兑换券" )
- end
- else
- SystemNotice ( cha , "背包内需要精炼石兑换券才可兑换" )
- end
- if y_give ==1 then
- return 1
- else
- return 0
- end
- end
- --一个宝石兑换券
- function Transfer_OneDiamondScript ( role )
- local cha = TurnToCha ( role )
- local x_give = 0
- local y_give = 0
- local script_count = CheckBagItem ( cha , 3886 ) --检查背包中兑换券数量
- local DiamondId = Roll_DiamondId ( cha ) --随机兑换宝石的种类
- if script_count >= 1 then
- x_del = DelBagItem ( cha , 3886 , 1 )
- if x_del == 1 then
- x_give = GiveItem ( cha , 0 , DiamondId , 1 , 101 ) --兑换宝石
- else
- SystemNotice ( cha , "无法正确扣除宝石兑换券" )
- end
- else
- SystemNotice ( cha , "背包内需要宝石兑奖券才可兑换" )
- end
- if x_give == 1 then
- return 1
- else
- return 0
- end
- end
- --精炼内容负值转换
- function TansferNum ( Num )
- if Num < 0 then
- Num = Num + 4294967296
- end
- return Num
- end
- --打磨内容相关脚本
- --是否可以打磨
- function can_milling_item (...)
- -- Notice("开始判断")
- if arg.n ~= 12 then
- -- Notice("参数个数非法"..arg.n)
- return 0
- end
- local kkk = 0
- -- for kkk = 2 , arg.n ,1 do
- -- SystemNotice ( arg[1] , arg[kkk])
- -- end
- local Check = 0
- -- SystemNotice( arg[1] , "调用合成检测主函数")
- Check = can_milling_item_main ( arg )
- if Check == 1 then
- -- SystemNotice (arg[1] , "返回1 ")
- return 1
- else
- -- SystemNotice (arg[1] , "返回0 ")
- return 0
- end
- end
- --是否可以打磨主函数
- function can_milling_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
- -- SystemNotice( arg[1] , "开始调用参数解析")
- role , ItemBag , ItemCount , ItemBagCount , ItemBag_Now , ItemCount_Now , ItemBagCount_Num = Read_Table ( Table )
- local ItemBag_damo = ItemBag [0]
- local Item_damo = GetChaItem ( role , 2 , ItemBag_damo ) --读取打磨道具的指针
- local Item_Cailiao1 = GetChaItem ( role , 2 , ItemBag [1] ) --读取打磨材料1的指针
- local Item_Cailiao2 = GetChaItem ( role , 2 , ItemBag [2] ) --读取打磨材料2的指针
- local Check_Cailiao1 = 0
- local Check_Cailiao2 = 0
- Check_Cailiao1 = Check_Jiaguji ( Item_Cailiao1 , Item_Cailiao2 )
- Check_Cailiao2 = Check_Cuihuafen ( Item_Cailiao1 , Item_Cailiao2 )
- if Check_Cailiao1 == 0 then
- SystemNotice ( role , "打磨过程需要装备加固剂" )
- return 0
- end
- if Check_Cailiao2 == 0 then
- SystemNotice ( role , "打磨过程需要装备催化粉" )
- return 0
- end
- local MJdamo_ItemID = GetItemID (Item_damo)--------检测打洞装备是否是魔剑
- if MJdamo_ItemID == 6347 then
- SystemNotice( role ,"无法给魔剑打磨!")
- return 0
- end
- local BB95_qiecaidaoId = GetItemID (Item_damo)--------检测打洞装备是否是切菜刀
- if BB95_qiecaidaoId == 6473 then
- SystemNotice( role ,"无法给切菜刀打磨!")
- return 0
- end
- local BB95_sheriId = GetItemID (Item_damo)--------检测打洞装备是否是射日专用
- if BB95_sheriId == 6474 then
- SystemNotice( role ,"无法给射日专用打磨!")
- return 0
- end
- local BB95_ak47Id = GetItemID (Item_damo)--------检测打洞装备是否是AK47
- if BB95_ak47Id == 6475 then
- SystemNotice( role ,"无法给AK47打磨!")
- return 0
- end
- local BB95_shoushudaoId = GetItemID (Item_damo)--------检测打洞装备是否是手术刀
- if BB95_shoushudaoId == 6476 then
- SystemNotice( role ,"无法给手术刀打磨!")
- return 0
- end
- local BB95_dakandaoId = GetItemID (Item_damo)--------检测打洞装备是否是大砍刀
- if BB95_dakandaoId == 6477 then
- SystemNotice( role ,"无法给大砍刀打磨!")
- return 0
- end
- local BB95_laonainaiId = GetItemID (Item_damo)--------检测打洞装备是否是老奶奶的拐杖
- if BB95_laonainaiId == 6478 then
- SystemNotice( role ,"无法给老奶奶的拐杖打磨!")
- return 0
- end
- local BB95_yadiannaId = GetItemID (Item_damo)--------检测打洞装备是否是雅典娜的杖
- if BB95_yadiannaId == 6479 then
- SystemNotice( role ,"无法给雅典娜的神杖打磨!")
- return 0
- end
- local MianJu = GetItemID (Item_damo)--------检测打洞装备是否是魔剑
- if MianJu == 1122 or MianJu==1121 then
- SystemNotice( role ,"无法给万圣节面具打磨!")
- return 0
- end
- local Check_Hole = 0
- Check_Hole = Check_HasHole ( Item_damo )
- if Check_Hole >= 3 then
- SystemNotice ( role , "孔数已达上限,无法继续打磨" )
- return 0
- end
- local Money_Need = get_milling_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 get_item_milling_money(...)
- -- Notice("计算费用")
- local Money = get_milling_money_main ( arg )
- return Money
- end
- --计算打磨费用主函数
- function get_milling_money_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_Num = 0
- local ItemCount_Num = 0
- local ItemBagCount_Num = 0
- role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
- local ItemBag_damo = ItemBag [0]
- local Item_damo = GetChaItem ( role , 2 , ItemBag_damo )
- local Hole_Num = 0
- local Num = GetItemForgeParam ( Item_damo , 1 )
- Num = TansferNum ( Num )
- Hole_Num = GetNum_Part1 ( Num )
- local Money_Need = ( Hole_Num + 1 ) * 50000
- -- Notice("计算结束")
- return Money_Need
- end
- --开始打磨
- function begin_milling_item (...)
- -- Notice("进入精炼")
- local Check_CanMilling = 0
- Check_CanMilling = can_milling_item_main ( arg )
- if Check_CanMilling == 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_damo = ItemBag [0]
- local Item_damo = GetChaItem ( role , 2 , ItemBag_damo )
- local Item_cailiao1 = GetChaItem ( role , 2 , ItemBag [1] )
- local Item_cailiao2 = GetChaItem ( role , 2 , ItemBag [2] )
- local Money_Need = get_milling_money_main ( arg )
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- -- Notice ("目前有"..Money_Have.."这么多的钱")
- -- Notice ("要扣除"..Money_Need.."这么多的钱")
- Money_Have = Money_Have - Money_Need
- SetCharaAttr ( Money_Have , role , ATTR_GD )
- ALLExAttrSet( role )
- local ItemID_Cailiao1 = GetItemID ( Item_cailiao1 )
- local ItemID_Cailiao2 = GetItemID ( Item_cailiao2 )
- local R1 = 0
- local R2 = 0
- R1 = RemoveChaItem ( role , ItemID_Cailiao1 , 1 , 2 , ItemBag [1] , 2 , 1 , 0 ) --移除材料1
- R2 = RemoveChaItem ( role , ItemID_Cailiao2 , 1 , 2 , ItemBag [2] , 2 , 1 , 0 ) --移除材料2
- if R1 == 0 or R2 == 0 then
- LG( "Damo" , "移除材料失败" )
- end
- local Sklv = 1
- local b = Check_CG_damo ( Item_damo , Sklv )
- if b == 0 then
- Damo_Shibai ( role , Item_damo )
- return 2
- end
- -- Notice("精炼结束")
- Damo_ChengGong ( role , Item_damo )
- local cha_name = GetChaDefaultName ( role )
- LG( "JingLian_ShiBai" , "玩家"..cha_name.."打磨成功" )
- return 1
- end
- --打磨相关函数
- --检查是否有加固剂
- function Check_Jiaguji ( Item_Cailiao1 , Item_Cailiao2 )
- local ItemID_Cailiao1 = GetItemID ( Item_Cailiao1 )
- local ItemID_Cailiao2 = GetItemID ( Item_Cailiao2 )
- if ItemID_Cailiao1 == 890 then
- return 1
- elseif ItemID_Cailiao2 == 890 then
- return 1
- end
- return 0
- end
- --检查是否有催化粉
- function Check_Cuihuafen ( Item_Cailiao1 , Item_Cailiao2 )
- local ItemID_Cailiao1 = GetItemID ( Item_Cailiao1 )
- local ItemID_Cailiao2 = GetItemID ( Item_Cailiao2 )
- if ItemID_Cailiao1 == 891 then
- return 1
- elseif ItemID_Cailiao2 == 891 then
- return 1
- end
- return 0
- end
- --检查孔数
- function Check_HasHole ( Item_damo )
- local Num = GetItemForgeParam ( Item_damo , 1 )
- Num = TansferNum ( Num )
- local Hole_Num = GetNum_Part1 ( Num )
- return Hole_Num
- end
- --判断打磨是否成功
- function Check_CG_damo ( Item_damo , Sklv )
- local a = 0
- local Hole_Num = Check_HasHole ( Item_damo )
- if Hole_Num == 0 then
- a = 1
- end
- if Hole_Num == 1 then
- a = 1
- end
- if Hole_Num == 2 then
- a = 1
- end
- local b = Percentage_Random ( a )
- return b
- end
- --打磨失败
- function Damo_Shibai ( role , Item_damo )
- -- local Num = GetItemForgeParam ( Item_damo , 1 )
- -- local i = 0
- -- Num = TansferNum ( Num )
- -- local Hole_Num = GetNum_Part1 ( Num )
- -- if Hole_Num >= 1 then
- -- local a = 0.7
- -- local b = Percentage_Random ( a )
- -- if b == 0 then
- -- SystemNotice ( role , "打磨失败了,装备上原有的一个孔消失了" )
- -- Hole_Num = Hole_Num - 1
- -- Delete_Forge_Eff ( role , Item_damo )
- -- else
- -- SystemNotice ( role , "打磨失败了,还好装备没有损坏" )
- -- end
- -- else
- local cha_name = GetChaDefaultName ( role )
- LG( "JingLian_ShiBai" , "玩家"..cha_name.."打磨失败" )
- SystemNotice ( role , "打磨失败了,还好装备没有损坏" )
- -- end
- -- Num = SetNum_Part1 ( Num , Hole_Num )
- -- i = SetItemForgeParam ( Item_damo , 1 , Num )
- -- if i == 0 then
- -- LG( "Damo" , "设置精炼内容失败" )
- -- end
- end
- --打磨成功
- function Damo_ChengGong ( role , Item_damo )
- local Num = GetItemForgeParam ( Item_damo , 1 )
- local i = 0
- Num = TansferNum ( Num )
- local Hole_Num = GetNum_Part1 ( Num )
- if Hole_Num <= 3 then
- SystemNotice ( role , "打磨成功了,装备上获得了一个新的孔" )
- Hole_Num = Hole_Num + 1
- else
- SystemNotice ( role , "装备孔数已达上限,无法再获得新的孔" )
- end
- Num = SetNum_Part1 ( Num , Hole_Num )
- i = SetItemForgeParam ( Item_damo , 1 , Num )
- if i == 0 then
- LG( "Damo" , "设置精炼内容失败" )
- end
- end
- --去处装备上一个精炼效果
- function Delete_Forge_Eff ( role , Item_damo )
- local Jinglian_Lv = GetItem_JinglianLv ( Item_damo )
- if Jinglian_Lv == 0 then
- return
- end
- local Num = GetItemForgeParam ( Item_damo , 1 )
- local Item_Stone = {}
- local Item_StoneLv = {}
- Item_Stone[0] = GetNum_Part2 ( Num )
- Item_Stone[1] = GetNum_Part4 ( Num )
- Item_Stone[2] = GetNum_Part6 ( Num )
- Item_StoneLv[0] = GetNum_Part3 ( Num )
- Item_StoneLv[1] = GetNum_Part5 ( Num )
- Item_StoneLv[2] = GetNum_Part7 ( Num )
- local j = 0
- local Del = 0
- for j = 2 , 0 , -1 do
- if Del == 0 then
- if Item_Stone [j] ~= 0 or Item_StoneLv[j] ~= 0 then
- Item_Stone[j] = 0
- Item_StoneLv[j] = 0
- Del = 1
- end
- end
- end
- Num = SetNum_Part2( Num , Item_Stone[0] )
- Num = SetNum_Part4( Num , Item_Stone[1] )
- Num = SetNum_Part6( Num , Item_Stone[2] )
- Num = SetNum_Part3( Num , Item_StoneLv[0] )
- Num = SetNum_Part5( Num , Item_StoneLv[1] )
- Num = SetNum_Part7( Num , Item_StoneLv[2] )
- local i = 0
- i = SetItemForgeParam ( Item_damo , 1 , Num )
- if i == 0 then
- LG( "Damo" , "设置精炼内容失败" )
- end
- SystemNotice ( role , "消失了一个精炼效果" )
- end
- --熔合
- --判断是否能够熔合,熔合函数入口
- function can_fusion_item(...)
- -- Notice ( "判断是否可以熔合")
- if arg.n ~= 12 and arg.n ~= 14 then
- SystemNotice ( arg[1] , "参数个数非法"..arg.n )
- return 0
- end
- -- local kkk = 0
- -- for kkk = 2 , arg.n ,1 do
- -- SystemNotice ( arg[1] , arg[kkk])
- -- end
- local Check = 0
- Check = can_fusion_item_main ( arg )
- if Check == 1 then
- return 1
- else
- return 0
- end
- end
- --检测是否可以熔合主函数
- function can_fusion_item_main ( Table )
- local role = 0
- local ItemBag = {} --道具背包位置
- local ItemCount = {} --道具数量
- local ItemBagCount = {} --道具对象数量
- 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 )
- --------道具数量判断
- if ItemCount [1] ~= 1 or ItemCount [2] ~= 1 or ItemBagCount [1] ~= 1 or ItemBagCount [2] ~= 1 then
- SystemNotice ( role ,"装备数量非法")
- return 0
- end
- --------取出道具指针
- local Item_Juanzhou = GetChaItem ( role , 2 , ItemBag [0] ) --卷轴指针
- local Item_Waiguan = GetChaItem ( role , 2 , ItemBag [1] ) --外观道具指针
- local Item_Shuxing = GetChaItem ( role , 2 , ItemBag [2] ) --属性道具指针
- --------卷轴类型判断
- local ItemType_Juanzhou = GetItemType ( Item_Juanzhou )
- if ItemType_Juanzhou ~= 60 then
- SystemNotice( role ,"卷轴使用错误")
- return 0
- end
- --------外观道具ID判断
- local ItemID_Waiguan = GetItemAttr ( Item_Waiguan , ITEMATTR_MAXURE )
- if ItemID_Waiguan ~= 25000 then
- SystemNotice( role ,"该装备不可被赋予属性")
- return 0
- end
- --------外观道具耐久判断
- local Item_URE = GetItemAttr ( Item_Waiguan , ITEMATTR_URE )
- local Item_MAXENERGY = GetItemAttr ( Item_Waiguan , ITEMATTR_MAXURE )
- if Item_URE < Item_MAXENERGY then
- SystemNotice( role ,"装备耐久未达最大,不可被赋予属性")
- return 0
- end
- --------最初外观道具判断
- local Item_FUSIONID_star = GetItemAttr ( Item_Shuxing , ITEMATTR_VAL_FUSIONID )
- local ItemID_shuxing_star = GetItemAttr ( Item_Shuxing ,ITEMATTR_MAXURE )
- if Item_FUSIONID_star ==0 and ItemID_shuxing_star == 25000 then
- SystemNotice( role ,"右侧装备无属性,不能融合!")
- return 0
- end
- --------属性道具ID判断
- local ShuXing_ItemID = GetItemID (Item_Shuxing)
- if ShuXing_ItemID >= 6165 and ShuXing_ItemID <= 6196 then
- SystemNotice( role ,"该装备为封印状态,不能溶合!")
- return 0
- elseif ShuXing_ItemID >= 6270 and ShuXing_ItemID <= 6293 then
- SystemNotice( role ,"该装备不能溶合!")
- return 0
- elseif ShuXing_ItemID == 6347 then
- SystemNotice( role ,"魔剑无法被熔合!")
- return 0
- elseif ShuXing_ItemID == 1122 or ShuXing_ItemID == 1121 then
- SystemNotice( role ,"节日面具不能被融合")
- return 0
- elseif ShuXing_ItemID == 6473 then
- SystemNotice( role ,"切菜刀无法被熔合!")
- return 0
- elseif ShuXing_ItemID == 6474 then
- SystemNotice( role ,"射日专用无法被熔合!")
- return 0
- elseif ShuXing_ItemID == 6475 then
- SystemNotice( role ,"AK47无法被熔合!")
- return 0
- elseif ShuXing_ItemID == 6476 then
- SystemNotice( role ,"手术刀无法被熔合!")
- return 0
- elseif ShuXing_ItemID == 6477 then
- SystemNotice( role ,"大砍刀无法被熔合!")
- return 0
- elseif ShuXing_ItemID == 6478 then
- SystemNotice( role ,"老奶奶的拐杖无法被熔合!")
- return 0
- elseif ShuXing_ItemID == 6479 then
- SystemNotice( role ,"雅典娜的杖无法被熔合!")
- return 0
- end
- --------属性道具类型判断
- local ItemType_Shuxing = GetItemType (Item_Shuxing)
- if ItemType_Shuxing < 1 then
- SystemNotice( role ,"该装备不具有可以转移给其他装备的属性")
- return 0
- elseif ItemType_Shuxing > 11 and ItemType_Shuxing < 20 then
- SystemNotice( role ,"该装备不具有可以转移给其他装备的属性")
- return 0
- elseif ItemType_Shuxing > 24 and ItemType_Shuxing ~= 27 then
- SystemNotice( role ,"该装备不具有可以转移给其他装备的属性")
- return 0
- end
- --------外观和属性道具是否为同一类型
- local ItemType_Shuxing = GetItemType ( Item_Shuxing )
- local ItemType_Waiguan = GetItemType ( Item_Waiguan )
- local star=0
- if ItemType_Shuxing ~= 22 and ItemType_Shuxing ~=27 then ----既不是纹身也不是衣服
- star = 1
- end
- if ItemType_Waiguan~=27 then
- if ItemType_Shuxing ~= ItemType_Waiguan then
- SystemNotice( role ,"两件装备类型不同" )
- return 0
- end
- elseif ItemType_Waiguan==27 and star == 1 then
- SystemNotice( role ,"两件装备类型不同" )
- return 0
- end
- --------外观和属性道具是否为同一体型和职业限制
- local Check_RongHe = 0
- Check_RongHe = CheckFusionItem( Item_Waiguan , Item_Shuxing )
- if Check_RongHe == LUA_FALSE then
- SystemNotice( role ,"两个装备的体型或者职业限制不相同" )
- return 0
- end
- --------是否放的是催化剂
- if ItemBagCount[3] == 0 then
- local Item_Waiguan_name = GetItemName ( ItemID_Waiguan )
- LG("Ronghe_CuiHuaJi","在未放入催化剂的情况下融合装备",Item_Waiguan_name,"无精炼效果")
- end
- if ItemBagCount[3] ~= 0 then
- local Item_Cuihuaji = GetChaItem ( role , 2 , ItemBag [3] )
- local ItemType_Cuihuaji = GetItemType ( Item_Cuihuaji )
- if ItemType_Cuihuaji ~= 61 then
- SystemNotice( role ,"催化剂好像有问题,无法熔合" )
- return 0
- end
- end
- --------身上金钱判断
- local Money_Need = getfusion_money_main ( Table )
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- if Money_Need > Money_Have then
- SystemNotice( role ,"金钱不足,不能熔合")
- return 0
- end
- --SystemNotice(role ,"判断结束 ")
- return 1
- end
- --开始熔合,熔合主程序入口
- function begin_fusion_item(...)
- -- Notice("进入熔合")
- --------是否可以融合检测
- local Check_Canfusion = 0
- Check_Canfusion = can_fusion_item_main ( arg )
- if Check_Canfusion == 0 then
- return 0
- end
- --------取出数据
- local role = 0
- local ItemBag = {} --道具背包位置
- local ItemCount = {} --道具数量
- local ItemBagCount = {} --道具对象数量
- 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 Item_Juanzhou = GetChaItem ( role , 2 , ItemBag [0] )
- local Item_Waiguan = GetChaItem ( role , 2 , ItemBag [1] )
- local Item_Shuxing = GetChaItem ( role , 2 , ItemBag [2] )
- local ItemID_Waiguan = GetItemID ( Item_Waiguan )
- --------扣除金钱
- local Money_Need = getfusion_money_main ( arg )
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- -- Notice ("目前有"..Money_Have.."这么多的钱")
- -- Notice ("要扣除"..Money_Need.."这么多的钱")
- Money_Have = Money_Have - Money_Need
- SetCharaAttr ( Money_Have , role , ATTR_GD )
- ALLExAttrSet( role )
- --------熔合过程
- Check_Ronghe_Item = ronghe_item ( arg )
- if Check_Ronghe_Item == 0 then
- SystemNotice ( role ,"熔合失败,请检查程序")
- end
- --check_item_final_data ( Item_Waiguan )
- SynChaKitbag(role,13)
- --------Notice("熔合结束")
- local cha_name = GetChaDefaultName ( role )
- SystemNotice ( role ,"熔合成功")
- local Item_Waiguan_name = GetItemName ( ItemID_Waiguan )
- LG( "Ronghe_ShiBai" , "玩家"..cha_name.."熔合成功"..Item_Waiguan_name )
- return 1
- end
- --计算熔合费用
- function get_item_fusion_money(...)
- -- Notice("计算费用")
- local Money = getfusion_money_main ( arg )
- return Money
- end
- --计算精练费用主函数
- function getfusion_money_main ( Table )
- local role = 0
- local ItemBag = {} --道具背包位置数组
- local ItemCount = {} --道具数量数组
- local ItemBagCount = {} --道具对象数量数组
- local ItemBag_Num = 0 --背包位置数组长度
- local ItemCount_Num = 0 --道具数量数组长度
- local ItemBagCount_Num = 0 --道具对象数量数组长度
- role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
- local ItemBag_Shuxing = ItemBag [2]
- local Item_Shuxing = GetChaItem ( role , 2 , ItemBag_Shuxing )
- local Shuxing_Lv = 0
- local Shuxing_Lv = GetItemLv ( Item_Shuxing )
- local Money_Need = Shuxing_Lv * 1000
- -- Notice("计算结束")
- return Money_Need
- end
- ----相关函数--------------------------------------------------------------------------------------------------------
- ---开始熔合
- function ronghe_item ( Table )
- -- Notice("Ronghe_Item")
- local role = 0
- local ItemBag = {} --道具背包位置
- local ItemCount = {} --道具数量
- local ItemBagCount = {} --道具对象数量
- local ItemBag_Num = 0
- local ItemCount_Num = 0
- local ItemBagCount_Num = 0
- local ItemID_Cuihuaji = 0
- role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
- local Item_Juanzhou = GetChaItem ( role , 2 , ItemBag [0] )
- local Item_Waiguan = GetChaItem ( role , 2 , ItemBag [1] )
- local Item_Shuxing = GetChaItem ( role , 2 , ItemBag [2] )
- local ItemID_Juanzhou = GetItemID ( Item_Juanzhou )
- local ItemID_Waiguan = GetItemID ( Item_Waiguan )
- local ItemID_Shuxing = GetItemID ( Item_Shuxing )
- ----------------==============
- local ItemID_shuxing_maxure = GetItemAttr ( Item_Shuxing ,ITEMATTR_MAXURE )
- local ItemID_star = ItemID_Shuxing
- local ItemID_star_maxure = ItemID_shuxing_maxure
- local flg=0
- if ItemBagCount[3] ~= 0 then
- local Item_Cuihuaji = GetChaItem ( role , 2 , ItemBag [3] )
- ItemID_Cuihuaji = GetItemID ( Item_Cuihuaji )
- flg=1
- end
- local Jinglianxinxi = GetItemForgeParam ( Item_Shuxing , 1 )
- --------赋予熔合道具记录ID
- ----------------==============
- if ItemID_shuxing_maxure == 25000 then
- ItemID_Shuxing = GetItemAttr( Item_Shuxing , ITEMATTR_VAL_FUSIONID )
- SetItemAttr( Item_Waiguan , ITEMATTR_VAL_FUSIONID , ItemID_Shuxing )
- else
- SetItemAttr( Item_Waiguan , ITEMATTR_VAL_FUSIONID , ItemID_Shuxing )
- end
- --------熔合道具
- local Check_FusionItem = FusionItem ( Item_Waiguan, Item_Shuxing )
- --------赋予熔合道具等级
- local star_lv=0
- if flg==1 then
- if ItemID_shuxing_maxure < 25000 then
- star_lv=10
- else
- star_lv=GetItemAttr ( Item_Shuxing , ITEMATTR_VAL_LEVEL ) -- 设置熔合道具等级
- end
- else
- star_lv=10
- end
- --SystemNotice( role , "star_lv="..star_lv )
- SetItemAttr ( Item_Waiguan , ITEMATTR_VAL_LEVEL , star_lv ) -- 设置熔合道具等级
- --local i = GetItemAttr ( Item_Waiguan , ITEMATTR_VAL_LEVEL )
- --SystemNotice( role , "装备等级="..i )
- local hole_num = Check_HasHole ( Item_Shuxing )
- if Check_FusionItem == 0 then
- SystemNotice( role , "熔合失败")
- return
- -- else
- -- for Check_FusionItem = 1 , 49 , 1 do
- -- RO = GetItemAttr ( Item_Waiguan , Check_FusionItem )
- -- SystemNotice( role , "属性"..Check_FusionItem.."="..RO )
- -- end
- end
- --------移出道具
- ----------------------------------
- ----------------------------------此处打LG
- local Item_Shuxing_ENERGY = GetItemAttr ( Item_Shuxing , ITEMATTR_ENERGY )
- local Item_Shuxing_MAXURE = GetItemAttr ( Item_Shuxing , ITEMATTR_MAXURE )
- local cha_name = GetChaDefaultName ( role )
- local num={}
- local numAttr={}
- local b = 0
- local a = {}
- for b=1,5,1 do
- num [b]=0
- numAttr [b]=0
- end
- b = 0
- for i=1,47,1 do
- a [i]=GetItemAttr ( Item_Shuxing , i )
- if a [i]~=0 then
- -- SystemNotice( role , a [i] )
- b = b + 1
- num [b]=i
- numAttr [b]=a[i]
- end
- end
- --LG( "ZhuangBeiRH_XinXi" , cha_name , ItemID_Waiguan , ItemID_Shuxing , Item_Shuxing_ENERGY , Item_Shuxing_MAXURE , num[1],numAttr[1],num[2],numAttr[2],num[3],numAttr[3],num[4],numAttr[4],num[5],numAttr[5],Jinglianxinxi,flg)
- LG( "ZhuangBeiRH_XinXi" , cha_name , ItemID_Waiguan , ItemID_Shuxing , Item_Shuxing_ENERGY , Item_Shuxing_MAXURE , STAR_ATTR[num[1]],numAttr[1],STAR_ATTR[num[2]],numAttr[2],STAR_ATTR[num[3]],numAttr[3],STAR_ATTR[num[4]],numAttr[4],STAR_ATTR[num[5]],numAttr[5],Jinglianxinxi,flg)
- -----------取融合后道具的属性
- local attr1=GetItemAttr ( Item_Waiguan , num[1] )
- local attr2=GetItemAttr ( Item_Waiguan , num[2] )
- local attr3=GetItemAttr ( Item_Waiguan , num[3] )
- local attr4=GetItemAttr ( Item_Waiguan , num[4] )
- local attr5=GetItemAttr ( Item_Waiguan , num[5] )
- LG( "RHWaiguan_XinXi" , cha_name , ItemID_Waiguan , STAR_ATTR[num[1]],attr1,STAR_ATTR[num[2]],attr2,STAR_ATTR[num[3]],attr3,STAR_ATTR[num[4]],attr4,STAR_ATTR[num[5]],attr5)
- --------------------重新设置融合装备耐久
- SetItemAttr ( Item_Waiguan , ITEMATTR_MAXURE , 25000 )
- SetItemAttr ( Item_Waiguan , ITEMATTR_URE , 25000 )
- local R1 = 0
- local R2 = 0
- local R3 = 1
- R1 = RemoveChaItem ( role , ItemID_Juanzhou , 1 , 2 , ItemBag [0] , 2 , 1 , 0 ) --移除卷轴道具
- R2 = RemoveChaItem ( role , ItemID_Shuxing , 1 , 2 , ItemBag [2] , 2 , 1 , 0 ) --移除属性道具
- if ItemID_Cuihuaji ~= 0 then
- R3 = RemoveChaItem ( role , ItemID_Cuihuaji , 1 , 2 , ItemBag [3] , 2 , 1 , 0 ) --移出催化剂道具
- end
- if R1 == 0 or R2 == 0 or R3 == 0 then
- SystemNotice( role , "移出道具失败")
- return
- end
- --------赋予熔合道具精炼属性
- if ItemID_Cuihuaji ~= 0 then
- local Check_SetItemForgeParam = SetItemForgeParam( Item_Waiguan , 1 , Jinglianxinxi )
- if Check_SetItemForgeParam == 0 then
- SystemNotice( role , "设置精炼属性失败")
- return
- end
- else
- local Part1_Jinglianxinxi = GetNum_Part1 ( Jinglianxinxi ) --Get Num Part 1 到 Part 7
- local Part2_Jinglianxinxi = GetNum_Part2 ( Jinglianxinxi )
- local Part3_Jinglianxinxi = GetNum_Part3 ( Jinglianxinxi )
- local Part4_Jinglianxinxi = GetNum_Part4 ( Jinglianxinxi )
- local Part5_Jinglianxinxi = GetNum_Part5 ( Jinglianxinxi )
- local Part6_Jinglianxinxi = GetNum_Part6 ( Jinglianxinxi )
- local Part7_Jinglianxinxi = GetNum_Part7 ( Jinglianxinxi )
- Jinglianxinxi = SetNum_Part1 ( Jinglianxinxi , hole_num ) ----------二转标记
- Jinglianxinxi = SetNum_Part2 ( Jinglianxinxi , 0 )
- Jinglianxinxi = SetNum_Part3 ( Jinglianxinxi , 0 )
- Jinglianxinxi = SetNum_Part4 ( Jinglianxinxi , 0 )
- Jinglianxinxi = SetNum_Part5 ( Jinglianxinxi , 0 )
- Jinglianxinxi = SetNum_Part6 ( Jinglianxinxi , 0 )
- Jinglianxinxi = SetNum_Part7 ( Jinglianxinxi , 0 )
- local Check_SetItemForgeParam = SetItemForgeParam( Item_Waiguan , 1 , Jinglianxinxi )
- if Check_SetItemForgeParam == 0 then
- SystemNotice( role , "设置精炼属性失败")
- return
- end
- end
- end
- -------------装备升级之强化升级部分
- ----装备升级之强化升级
- ---检测是否能够强化升级
- function can_upgrade_item (...)
- -- Notice ( "判断是否可以强化升级")
- if arg.n ~= 12 then
- SystemNotice ( arg[1] , "参数个数非法"..arg.n )
- return 0
- end
- local Check = 0
- Check = can_beuplv_item_main ( arg )
- if Check == 1 then
- return 1
- else
- return 0
- end
- end
- --检测是否可以强化升级主函数
- 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 ) ----取融合道具ID
- local Item_ScItem = GetChaItem ( role , 2 , ItemBag [0] ) ----强化卷轴道具指针
- local Item_YxItem = GetChaItem ( role , 2 , ItemBag [2] ) ----强化晶石道具指针
- local Item_ScItem_ID = GetItemID ( Item_ScItem ) ----商城道具ID
- local Item_YxItem_ID = GetItemID ( Item_YxItem ) ----游戏道具ID
- 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 ) -- 取道具装备熔合信息ID
- 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 >= 15 then --判断融合道具是否为最大等级
- 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
- --SystemNotice(role ,"判断结束 ")
- 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 ) ----商城道具ID
- local Item_YxItem_ID = GetItemID ( Item_YxItem ) ----游戏道具ID
- local Item_beuplv_Lv = Get_Itembeuplv_Lv ( Item_beuplv ) ---取融合住装备等级
- --SystemNotice( role , "LVA"..Item_beuplv_Lv)
- 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 + 1
- SetChaKitbagChange( role , 1 )
- --SystemNotice( role , "LVB"..Item_beuplv_Lv)
- Set_Itembeuplv_Lv ( Item_beuplv , Item_beuplv_Lv ) -------设融合住装备等级
- --SystemNotice( role , "LVC"..Item_beuplv_Lv)
- SynChaKitbag( role, 4 )
- local LvD = GetItemAttr( Item_beuplv , ITEMATTR_VAL_LEVEL )
- --SystemNotice( role , "LVD"..LvD)
- --check_item_final_data ( Item_beuplv ) -----属性重算
- SynChaKitbag(role,13)
- SystemNotice( role , "升级成功")
- local cha_name = GetChaDefaultName ( role )
- LG( "JingLian_ShiBai" , "玩家"..cha_name.."强化升级成功" )
- return 1
- end
- -------------------------------
- --function beuplv ( item ) ----------融合装备升级效果
- -- local can_beuplv = 0
- -- can_beuplv = can_beuplv_item(...)
- -- if can_beuplv == 0 then
- -- return 0
- -- end
- --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","宝石等级设置失败" )
- end
- end
- ----------------------------
- function Check_CG_beuplv ( Item_Lv ) -------不同等级的成功概率
- local ran = math.random ( 1, 100 )
- if Item_Lv <= 15 then -------10级以下100%成功
- return 1
- end
- if Item_Lv>10 and Item_Lv <= 15 then -------10到15级以下50%成功
- if ran <= 100 then
- return 1
- else
- return 0
- end
- end
- if Item_Lv>15 and Item_Lv <= 20 then -------15到20级以下10%成功
- if ran <= 100 then
- return 1
- else
- return 0
- end
- end
- end
- function get_item_upgrade_money(...)
- -- Notice("计算费用")
- local Money = getupgrade_money_main ( arg )
- return Money
- end
- --计算精练费用主函数
- function getupgrade_money_main ( Table )
- local role = 0
- local ItemBag = {} --道具背包位置数组
- local ItemCount = {} --道具数量数组
- local ItemBagCount = {} --道具对象数量数组
- local ItemBag_Num = 0 --背包位置数组长度
- local ItemCount_Num = 0 --道具数量数组长度
- local ItemBagCount_Num = 0 --道具对象数量数组长度
- role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
- local ItemBag_Waiguan = ItemBag [1]
- local Item_Waiguan = GetChaItem ( role , 2 , ItemBag_Waiguan )
- local Waiguan_Lv = 0
- local Waiguan_Lv = Get_Itembeuplv_Lv ( Item_Waiguan )
- local Money_Need = ( Waiguan_Lv + 1 )*( Waiguan_Lv + 1 )*10000
- -- Notice("计算结束")
- return Money_Need
- end
- --精灵二转
- --判断是否能够转生,转生函数入口
- function can_jlborn_item(...)
- if arg.n ~= 12 then
- SystemNotice ( arg[1] , "参数个数非法"..arg.n )
- return 0
- end
- local Check = 0
- Check = can_jlborn_item_main ( arg )
- if Check == 1 then
- return 1
- else
- return 0
- end
- end
- --检测是否可以转生主函数
- function can_jlborn_item_main ( Table )
- local role = 0
- local ItemBag = {} --道具背包位置
- local ItemCount = {} --道具数量
- local ItemBagCount = {} --道具对象数量
- 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 )
- ---道具数量判断
- if ItemCount [1] ~= 1 or ItemCount [2] ~= 1 or ItemBagCount [1] ~= 1 or ItemBagCount [2] ~= 1 then
- SystemNotice ( role ,"装备数量非法")
- return 0
- end
- ----取出道具指针
- local Item_EMstone = GetChaItem ( role , 2 , ItemBag [0] ) --恶魔宝石指针
- local Item_JLone = GetChaItem ( role , 2 , ItemBag [1] ) --一个精灵道具的指针
- local Item_JLother = GetChaItem ( role , 2 , ItemBag [2] ) --另一个精灵道具的指针
- local Item_JLone_ID = GetItemID ( Item_JLone ) --一个精灵道具ID
- local Item_JLother_ID = GetItemID ( Item_JLother ) --一个精灵道具ID
- ---取一个精灵的五个属性
- local str_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_STR ) --力量
- local con_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_CON ) --体质
- local agi_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_AGI ) --专注
- local dex_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_DEX ) --敏捷
- local sta_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_STA ) --精神
- local URE_JLone = GetItemAttr( Item_JLone ,ITEMATTR_URE ) --体力
- local MAXURE_JLone = GetItemAttr( Item_JLone ,ITEMATTR_MAXURE ) --最大体力
- local lv_JLone = str_JLone + con_JLone + agi_JLone + dex_JLone + sta_JLone ----一个精灵的等级
- ---取另一个精灵的五个属性
- local str_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_STR ) --力量
- local con_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_CON ) --体质
- local agi_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_AGI ) --专注
- local dex_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_DEX ) --敏捷
- local sta_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_STA ) --精神
- local URE_JLother = GetItemAttr( Item_JLother ,ITEMATTR_URE ) --体力
- local MAXURE_JLother = GetItemAttr( Item_JLother ,ITEMATTR_MAXURE ) --最大体力
- local lv_JLother = str_JLother + con_JLother + agi_JLother + dex_JLother + sta_JLother ----另一个精灵的等级
- ----取一个精灵的7位数值
- local Num_JLone = GetItemForgeParam ( Item_JLone , 1 )
- local Part1_JLone = GetNum_Part1 ( Num_JLone ) --Get Num Part 1 到 Part 7
- local Part2_JLone = GetNum_Part2 ( Num_JLone )
- local Part3_JLone = GetNum_Part3 ( Num_JLone )
- local Part4_JLone = GetNum_Part4 ( Num_JLone )
- local Part5_JLone = GetNum_Part5 ( Num_JLone )
- local Part6_JLone = GetNum_Part6 ( Num_JLone )
- local Part7_JLone= GetNum_Part7 ( Num_JLone )
- ----取另一个精灵的7位数值
- local Num_JLother = GetItemForgeParam ( Item_JLother , 1 )
- local Part1_JLother = GetNum_Part1 ( Num_JLother ) --Get Num Part 1 到 Part 7
- local Part2_JLother = GetNum_Part2 ( Num_JLother )
- local Part3_JLother = GetNum_Part3 ( Num_JLother )
- local Part4_JLother = GetNum_Part4 ( Num_JLother )
- local Part5_JLother = GetNum_Part5 ( Num_JLother )
- local Part6_JLother = GetNum_Part6 ( Num_JLother )
- local Part7_JLother= GetNum_Part7 ( Num_JLother )
- local Item_CanGet = GetChaFreeBagGridNum ( role )
- if Item_CanGet < 2 then
- SystemNotice(role ,"精灵结婚至少需要背包中有两个空位")
- return 0
- end
- ----恶魔果实判断
- local Item_EMstone_ID = GetItemID ( Item_EMstone )
- if Item_EMstone_ID ~= 3918 and Item_EMstone_ID ~= 3919 and Item_EMstone_ID ~= 3920 and Item_EMstone_ID ~= 3921 and Item_EMstone_ID ~= 3922 and Item_EMstone_ID ~= 3924 and Item_EMstone_ID ~= 3925 then
- SystemNotice( role ,"恶魔果实使用错误")
- return 0
- end
- -----普通掉料检测
- if Item_EMstone_ID == 3918 then
- local i1 = CheckBagItem( role, 4530 ) ---美味乌贼肉
- local i2 = CheckBagItem( role,3434 ) ----废灵武士骸骨
- if i1 < 10 or i2 < 10 then
- SystemNotice( role ,"精灵结婚缺少一些必备原料")
- return 0
- end
- end
- if Item_EMstone_ID == 3919 then
- local i1 = CheckBagItem( role, 4531 ) ---破碎的阿拉伯珍珠
- local i2 = CheckBagItem( role, 3435 ) ----废灵弓箭手骸骨
- if i1 < 10 or i2 < 10 then
- SystemNotice( role ,"精灵结婚缺少一些必备原料")
- return 0
- end
- end
- if Item_EMstone_ID == 3920 then
- local i1 = CheckBagItem( role,1196 ) ---阿拉伯珍珠碎片
- local i2 = CheckBagItem( role,3436 ) ----泣灵武士骸骨
- if i1 < 10 or i2 < 10 then
- SystemNotice( role ,"精灵结婚缺少一些必备原料")
- return 0
- end
- end
- if Item_EMstone_ID == 3921 then
- local i1 = CheckBagItem( role, 4533 ) ---蝌蚪尾巴
- local i2 = CheckBagItem( role, 3437 ) ----泣灵弓箭手骸骨
- if i1 < 10 or i2 < 10 then
- SystemNotice( role ,"精灵结婚缺少一些必备原料")
- return 0
- end
- end
- if Item_EMstone_ID == 3922 then
- local i1 = CheckBagItem( role,4537 ) ---鱼刺
- local i2 = CheckBagItem( role,3444 ) ----泥浆块
- if i1 < 10 or i2 < 10 then
- SystemNotice( role ,"精灵结婚缺少一些必备原料")
- return 0
- end
- end
- if Item_EMstone_ID == 3924 then
- local i1 = CheckBagItem( role, 4540 ) ---鲨鱼背鳍
- local i2 = CheckBagItem( role, 3443 ) ----沼泽枯木
- if i1 < 10 or i2 < 10 then
- SystemNotice( role ,"精灵结婚缺少一些必备原料")
- return 0
- end
- end
- if Item_EMstone_ID == 3925 then
- local i1 = CheckBagItem( role, 1253 ) ---闪光的阿拉伯珍珠碎片
- local i2 = CheckBagItem( role, 3442 ) ----污泥块
- if i1 < 10 or i2 < 10 then
- SystemNotice( role ,"精灵结婚缺少一些必备原料")
- return 0
- end
- end
- ----精灵类型判断
- local ItemType_JLone = GetItemType (Item_JLone)
- local ItemType_JLother = GetItemType (Item_JLother)
- if ItemType_JLone ~=59 or ItemType_JLother ~=59 then
- SystemNotice( role ,"放入的不是精灵")
- return 0
- end
- ------放入的是否是同一精灵
- if ItemBag [1]==ItemBag [2] then
- SystemNotice( role ,"傻孩子,你见过自己和自己结婚的吗")
- return 0
- end
- ----是否为普通精灵的判断
- if Part1_JLone ~=0 or Part1_JLother ~=0 then
- SystemNotice( role ,"目前只有普通精灵才能结婚")
- return 0
- end
- -----精灵等级判断
- if lv_JLone < 20 or lv_JLother < 20 then
- SystemNotice( role ," 精灵级别不足20级不能结婚")
- return 0
- end
- -----精灵是否满体力判断
- if URE_JLone < MAXURE_JLone or URE_JLone < MAXURE_JLone then
- SystemNotice( role ," 结婚是件很耗费体力的事,请保持满体力")
- return 0
- end
- ----身上金钱判断
- local Money_Need = getjlborn_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_jlborn_item(...)
- -----是否可以融合检测
- local Check_Canjlborn = 0
- Check_Canjlborn = can_jlborn_item_main ( arg )
- if Check_Canjlborn == 0 then
- return 0
- end
- ------取出数据
- local role = 0
- local ItemBag = {} --道具背包位置
- local ItemCount = {} --道具数量
- local ItemBagCount = {} --道具对象数量
- 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 Item_EMstone = GetChaItem ( role , 2 , ItemBag [0] ) --恶魔宝石指针
- local Item_JLone = GetChaItem ( role , 2 , ItemBag [1] ) --一个精灵道具的指针
- local Item_JLother = GetChaItem ( role , 2 , ItemBag [2] ) --另一个精灵道具的指针
- -----扣除金钱
- local Money_Need = getjlborn_money_main ( arg )
- local Money_Have = GetChaAttr ( role , ATTR_GD )
- Money_Have = Money_Have - Money_Need
- SetCharaAttr ( Money_Have , role , ATTR_GD )
- ALLExAttrSet( role )
- -----转生过程
- Check_JLBorn_Item = jlborn_item ( arg )
- if Check_JLBorn_Item == 0 then
- SystemNotice ( role ,"结婚失败,请检查程序")
- end
- local cha_name = GetChaDefaultName ( role )
- SystemNotice ( role ,"结婚成功")
- LG( "JLBorn_ShiBai" , "玩家"..cha_name.."的精灵结婚成功" )
- return 1
- end
- --计算转生费用
- function get_item_jlborn_money(...)
- local Money = getjlborn_money_main ( arg )
- return Money
- end
- --计算转生费用主函数
- function getjlborn_money_main ( Table )
- local role = 0
- local ItemBag = {} --道具背包位置数组
- local ItemCount = {} --道具数量数组
- local ItemBagCount = {} --道具对象数量数组
- local ItemBag_Num = 0 --背包位置数组长度
- local ItemCount_Num = 0 --道具数量数组长度
- local ItemBagCount_Num = 0 --道具对象数量数组长度
- role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
- ---取出道具指针
- local Item_JLone = GetChaItem ( role , 2 , ItemBag [1] ) --一个精灵道具的指针
- local Item_JLother = GetChaItem ( role , 2 , ItemBag [2] ) --另一个精灵道具的指针
- ---取一个精灵的五个属性
- local str_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_STR ) --力量
- local con_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_CON ) --体质
- local agi_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_AGI ) --专注
- local dex_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_DEX ) --敏捷
- local sta_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_STA ) --精神
- local lv_JLone = str_JLone + con_JLone + agi_JLone + dex_JLone + sta_JLone ----一个精灵的等级
- ---取另一个精灵的五个属性
- local str_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_STR ) --力量
- local con_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_CON ) --体质
- local agi_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_AGI ) --专注
- local dex_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_DEX ) --敏捷
- local sta_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_STA ) --精神
- local lv_JLother = str_JLother + con_JLother + agi_JLother + dex_JLother + sta_JLother ----另一个精灵的等级
- local Money_Need = ( 60 - lv_JLone )*(60 - lv_JLother )*100
- if lv_JLone>60 or lv_JLother>60 then
- Money_Need = 0
- end
- return Money_Need
- end
- ----相关函数--------------------------------------------------------------------------------------------------------
- ---开始转生
- function jlborn_item ( Table )
- local role = 0
- local ItemBag = {} --道具背包位置
- local ItemCount = {} --道具数量
- local ItemBagCount = {} --道具对象数量
- local ItemBag_Num = 0
- local ItemCount_Num = 0
- local ItemBagCount_Num = 0
- local ItemID_Cuihuaji = 0
- role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
- ---取出道具指针
- local Item_EMstone = GetChaItem ( role , 2 , ItemBag [0] ) --恶魔宝石指针
- local Item_JLone = GetChaItem ( role , 2 , ItemBag [1] ) --一个精灵道具的指针
- local Item_JLother = GetChaItem ( role , 2 , ItemBag [2] ) --另一个精灵道具的指针
- local Item_EMstone_ID = GetItemID ( Item_EMstone ) --恶魔果实ID
- local Item_JLone_ID = GetItemID ( Item_JLone ) --一个精灵道具ID
- local Item_JLother_ID = GetItemID ( Item_JLother ) --一个精灵道具ID
- ---取一个精灵的五个属性
- local str_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_STR ) --力量
- local con_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_CON ) ---体质
- local agi_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_AGI ) --敏捷
- local dex_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_DEX ) --专注
- local sta_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_STA ) --精神
- local URE_JLone = GetItemAttr( Item_JLone ,ITEMATTR_URE ) --体力
- local MAXURE_JLone = GetItemAttr( Item_JLone ,ITEMATTR_MAXURE ) --最大体力
- local lv_JLone = str_JLone + con_JLone + agi_JLone + dex_JLone + sta_JLone ----一个精灵的等级
- ---取另一个精灵的五个属性
- local str_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_STR ) --力量
- local con_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_CON ) --体质
- local agi_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_AGI ) --敏捷
- local dex_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_DEX ) --专注
- local sta_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_STA ) --精神
- local URE_JLother = GetItemAttr( Item_JLother ,ITEMATTR_URE ) --体力
- local MAXURE_JLother = GetItemAttr( Item_JLother ,ITEMATTR_MAXURE ) --最大体力
- local lv_JLother = str_JLother + con_JLother + agi_JLother + dex_JLother + sta_JLother ----另一个精灵的等级
- ----取一个精灵的7位数值
- local Num_JLone = GetItemForgeParam ( Item_JLone , 1 )
- local Part1_JLone = GetNum_Part1 ( Num_JLone ) --Get Num Part 1 到 Part 7
- local Part2_JLone = GetNum_Part2 ( Num_JLone )
- local Part3_JLone = GetNum_Part3 ( Num_JLone )
- local Part4_JLone = GetNum_Part4 ( Num_JLone )
- local Part5_JLone = GetNum_Part5 ( Num_JLone )
- local Part6_JLone = GetNum_Part6 ( Num_JLone )
- local Part7_JLone= GetNum_Part7 ( Num_JLone )
- ----取另一个精灵的7位数值
- local Num_JLother = GetItemForgeParam ( Item_JLother , 1 )
- local Part1_JLother = GetNum_Part1 ( Num_JLother ) --Get Num Part 1 到 Part 7
- local Part2_JLother = GetNum_Part2 ( Num_JLother )
- local Part3_JLother = GetNum_Part3 ( Num_JLother )
- local Part4_JLother = GetNum_Part4 ( Num_JLother )
- local Part5_JLother = GetNum_Part5 ( Num_JLother )
- local Part6_JLother = GetNum_Part6 ( Num_JLother )
- local Part7_JLother= GetNum_Part7 ( Num_JLother )
- -----赋予新精灵等级记录在新精灵上
- local new_str = math.floor ((str_JLone+str_JLother)*0.125 )
- local new_con = math.floor ((con_JLone+con_JLother)*0.125 )
- local new_agi = math.floor ((agi_JLone+agi_JLother)*0.125 )
- local new_dex = math.floor ((dex_JLone+dex_JLother)*0.125 )
- local new_sta = math.floor ((sta_JLone+sta_JLother)*0.125 )
- local new_lv = new_str + new_con + new_agi + new_dex + new_sta
- local new_MAXENERGY = 240 * ( new_lv + 1 )
- if new_MAXENERGY > 6480 then
- new_MAXENERGY = 6480
- end
- local new_MAXURE = 5000 + 1000*new_lv
- if new_MAXURE > 32000 then
- new_MAXURE = 32000
- end
- if new_MAXURE ==25000 then
- new_MAXURE = 25000+1
- end
- --------恶魔果实判断
- if Item_EMstone_ID ==3918 then ---青涩恶魔果实
- local j1 =TakeItem( role, 0, 4530, 10 ) ---美味乌贼肉
- local j2 = TakeItem( role, 0,3434, 10 ) ----废灵武士骸骨
- if j1==0 or j2==0 then
- SystemNotice ( role ,"删除精灵转生道具失败")
- return
- end
- local rad = math.random ( 1, 100 )
- local r1 = 0
- local r2 = 0
- if Item_JLone_ID ==680 or Item_JLother_ID ==680 then
- if Item_JLone_ID==Item_JLother_ID then
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- elseif lv_JLone>=20 and lv_JLone<25 and lv_JLother >=20 and lv_JLother<25 and rad>=88 then---12%为摩豆二世
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- elseif lv_JLone>=25 and lv_JLone<35 and lv_JLother >=25 and lv_JLother<35 and rad>=50 then ---50%为摩豆二世
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- elseif lv_JLone>=35 and lv_JLother >=35 and rad>=10 then---90%
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- else
- r1,r2 =MakeItem ( role , 231 , 1 , 4 )
- end
- else
- r1,r2 =MakeItem ( role , 231 , 1 , 4 )
- end
- local Item_newJL = GetChaItem ( role , 2 , r2 ) --取新精灵道具指针
- local Item_newJL_ID = GetItemID ( Item_newJL )
- local Num_newJL = GetItemForgeParam ( Item_newJL , 1 )
- local Part1_newJL = GetNum_Part1 ( Num_newJL ) --Get Num Part 1 到 Part 7
- local Part2_newJL = GetNum_Part2 ( Num_newJL )
- local Part3_newJL = GetNum_Part3 ( Num_newJL )
- local Part4_newJL = GetNum_Part4 ( Num_newJL )
- local Part5_newJL = GetNum_Part5 ( Num_newJL )
- local Part6_newJL = GetNum_Part6 ( Num_newJL )
- local Part7_newJL= GetNum_Part7 ( Num_newJL )
- if lv_JLone>=20 and lv_JLother >=20 then
- Part2_newJL = 6 ---------运之精灵技能编号
- Part3_newJL = 1 ---------初级阶段
- end
- if lv_JLone>=25 and lv_JLother >=25 then
- Part2_newJL = 6 ---------运之精灵技能编号
- Part3_newJL = 2 ---------中级阶段
- end
- if lv_JLone>=35 and lv_JLother >=35 then
- Part2_newJL = 6 ---------运之精灵技能编号
- Part3_newJL = 3 ---------高级阶段
- end
- local rad1 = math.random ( 1, 100 )
- if Part3_newJL==3 then
- GiveItem ( role , 0 , 609 , 1 , 4 )
- end
- if Part3_newJL==2 then
- if rad1 <=95 then
- GiveItem ( role , 0 , 608 , 1 , 4 )
- elseif rad1 > 95 and rad1 <=100 then
- GiveItem ( role , 0 , 609 , 1 , 4 )
- end
- end
- if Part3_newJL==1 then
- if rad1 <=90 then
- GiveItem ( role , 0 , 239 , 1 , 4 )
- elseif rad1 > 90 and rad1 <=98 then
- GiveItem ( role , 0 , 608 , 1 , 4 )
- elseif rad1 > 98 and rad1 <=100 then
- GiveItem ( role , 0 , 609 , 1 , 4 )
- end
- end
- Num_newJL = SetNum_Part1 ( Num_newJL , 1 ) ----------二转标记
- Num_newJL = SetNum_Part2 ( Num_newJL , Part2_newJL )
- Num_newJL = SetNum_Part3 ( Num_newJL , Part3_newJL )
- Num_newJL = SetNum_Part4 ( Num_newJL , Part4_newJL )
- Num_newJL = SetNum_Part5 ( Num_newJL , Part5_newJL )
- Num_newJL = SetNum_Part6 ( Num_newJL , Part6_newJL )
- Num_newJL = SetNum_Part7 ( Num_newJL , Part7_newJL )
- SetItemForgeParam ( Item_newJL , 1 , Num_newJL )
- SetItemAttr ( Item_newJL , ITEMATTR_VAL_STR , new_str )
- SetItemAttr( Item_newJL , ITEMATTR_VAL_DEX , new_dex )
- SetItemAttr ( Item_newJL , ITEMATTR_VAL_STA , new_sta )
- SetItemAttr( Item_newJL , ITEMATTR_VAL_AGI , new_agi )
- SetItemAttr ( Item_newJL , ITEMATTR_VAL_CON , new_con )
- SetItemAttr ( Item_newJL , ITEMATTR_MAXENERGY , new_MAXENERGY )
- SetItemAttr ( Item_newJL , ITEMATTR_MAXURE , new_MAXURE )
- end
- if Item_EMstone_ID ==3919 then ---勇者恶魔果实 体之精灵----体质加防御
- local j1 = TakeItem( role, 0, 4531, 10 ) ---破碎的阿拉伯珍珠
- local j2 = TakeItem( role, 0,3435, 10 ) ----废灵弓箭手骸骨
- if j1==0 or j2==0 then
- SystemNotice ( role ,"删除精灵转生道具失败")
- return
- end
- local rad = math.random ( 1, 100 )
- local r1 = 0
- local r2 = 0
- if Item_JLone_ID ==680 or Item_JLother_ID ==680 then
- if Item_JLone_ID==Item_JLother_ID then
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- elseif lv_JLone>=20 and lv_JLone<25 and lv_JLother >=20 and lv_JLother<25 and rad>=88 then---12%为摩豆二世
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- elseif lv_JLone>=25 and lv_JLone<35 and lv_JLother >=25 and lv_JLother<35 and rad>=50 then ---50%为摩豆二世
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- elseif lv_JLone>=35 and lv_JLother >=35 and rad>=10 then---90%
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- else
- r1,r2 =MakeItem ( role , 233 , 1 , 4 )
- end
- else
- r1,r2 =MakeItem ( role , 233 , 1 , 4 )
- end
- local Item_newJL = GetChaItem ( role , 2 , r2 ) --取新精灵道具指针
- local Num_newJL = GetItemForgeParam ( Item_newJL , 1 )
- local Part1_newJL = GetNum_Part1 ( Num_newJL ) --Get Num Part 1 到 Part 7
- local Part2_newJL = GetNum_Part2 ( Num_newJL )
- local Part3_newJL = GetNum_Part3 ( Num_newJL )
- local Part4_newJL = GetNum_Part4 ( Num_newJL )
- local Part5_newJL = GetNum_Part5 ( Num_newJL )
- local Part6_newJL = GetNum_Part6 ( Num_newJL )
- local Part7_newJL= GetNum_Part7 ( Num_newJL )
- if lv_JLone>=20 and lv_JLother >=20 then
- Part2_newJL = 7 ---------体之精灵技能编号
- Part3_newJL = 1 ---------初级阶段
- end
- if lv_JLone>=25 and lv_JLother >=25 then
- Part2_newJL = 7 ---------体之精灵技能编号
- Part3_newJL = 2 ---------中级阶段
- end
- if lv_JLone>=35 and lv_JLother >=35 then
- Part2_newJL = 7 ---------体之精灵技能编号
- Part3_newJL = 3 ---------高级阶段
- end
- local rad1 = math.random ( 1, 100 )
- if Part3_newJL==3 then
- GiveItem ( role , 0 , 609 , 1 , 4 )
- end
- if Part3_newJL==2 then
- if rad1 <=95 then
- GiveItem ( role , 0 , 608 , 1 , 4 )
- elseif rad1 > 95 and rad1 <=100 then
- GiveItem ( role , 0 , 609 , 1 , 4 )
- end
- end
- if Part3_newJL==1 then
- if rad1 <=90 then
- GiveItem ( role , 0 , 239 , 1 , 4 )
- elseif rad1 > 90 and rad1 <=98 then
- GiveItem ( role , 0 , 608 , 1 , 4 )
- elseif rad1 > 98 and rad1 <=100 then
- GiveItem ( role , 0 , 609 , 1 , 4 )
- end
- end
- Num_newJL = SetNum_Part1 ( Num_newJL , 1 ) ----------二转标记
- Num_newJL = SetNum_Part2 ( Num_newJL , Part2_newJL )
- Num_newJL = SetNum_Part3 ( Num_newJL , Part3_newJL )
- Num_newJL = SetNum_Part4 ( Num_newJL , Part4_newJL )
- Num_newJL = SetNum_Part5 ( Num_newJL , Part5_newJL )
- Num_newJL = SetNum_Part6 ( Num_newJL , Part6_newJL )
- Num_newJL = SetNum_Part7 ( Num_newJL , Part7_newJL )
- SetItemForgeParam ( Item_newJL , 1 , Num_newJL )
- SetItemAttr ( Item_newJL , ITEMATTR_VAL_STR , new_str )
- SetItemAttr( Item_newJL , ITEMATTR_VAL_DEX , new_dex )
- SetItemAttr ( Item_newJL , ITEMATTR_VAL_STA , new_sta )
- SetItemAttr( Item_newJL , ITEMATTR_VAL_AGI , new_agi )
- SetItemAttr ( Item_newJL , ITEMATTR_VAL_CON , new_con )
- SetItemAttr ( Item_newJL , ITEMATTR_MAXENERGY , new_MAXENERGY )
- SetItemAttr ( Item_newJL , ITEMATTR_MAXURE , new_MAXURE )
- end
- if Item_EMstone_ID ==3920 then ---力量恶魔果实 力之精灵----力量加攻击
- local j1 =TakeItem( role, 0, 1196, 10 ) ---阿拉伯珍珠碎片
- local j2 = TakeItem( role, 0,3436, 10 ) ----泣灵武士骸骨
- if j1==0 or j2==0 then
- SystemNotice ( role ,"删除精灵转生道具失败")
- return
- end
- local rad = math.random ( 1, 100 )
- local r1 = 0
- local r2 = 0
- if Item_JLone_ID ==680 or Item_JLother_ID ==680 then
- if Item_JLone_ID==Item_JLother_ID then
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- elseif lv_JLone>=20 and lv_JLone<25 and lv_JLother >=20 and lv_JLother<25 and rad>=88 then---12%为摩豆二世
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- elseif lv_JLone>=25 and lv_JLone<35 and lv_JLother >=25 and lv_JLother<35 and rad>=50 then ---50%为摩豆二世
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- elseif lv_JLone>=35 and lv_JLother >=35 and rad>=10 then---90%
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- else
- r1,r2 =MakeItem ( role , 232 , 1 , 4 )
- end
- else
- r1,r2 =MakeItem ( role , 232 , 1 , 4 )
- end
- local Item_newJL = GetChaItem ( role , 2 , r2 ) --取新精灵道具指针
- local Num_newJL = GetItemForgeParam ( Item_newJL , 1 )
- local Part1_newJL = GetNum_Part1 ( Num_newJL ) --Get Num Part 1 到 Part 7
- local Part2_newJL = GetNum_Part2 ( Num_newJL )
- local Part3_newJL = GetNum_Part3 ( Num_newJL )
- local Part4_newJL = GetNum_Part4 ( Num_newJL )
- local Part5_newJL = GetNum_Part5 ( Num_newJL )
- local Part6_newJL = GetNum_Part6 ( Num_newJL )
- local Part7_newJL= GetNum_Part7 ( Num_newJL )
- if lv_JLone>=20 and lv_JLother >=20 then
- Part2_newJL = 8 ---------力之精灵技能编号
- Part3_newJL = 1 ---------初级阶段
- end
- if lv_JLone>=25 and lv_JLother >=25 then
- Part2_newJL = 8 ---------力之精灵技能编号
- Part3_newJL = 2 ---------中级阶段
- end
- if lv_JLone>=35 and lv_JLother >=35 then
- Part2_newJL = 8 ---------力之精灵技能编号
- Part3_newJL = 3 ---------高级阶段
- end
- local rad1 = math.random ( 1, 100 )
- if Part3_newJL==3 then
- GiveItem ( role , 0 , 609 , 1 , 4 )
- end
- if Part3_newJL==2 then
- if rad1 <=95 then
- GiveItem ( role , 0 , 608 , 1 , 4 )
- elseif rad1 > 95 and rad1 <=100 then
- GiveItem ( role , 0 , 609 , 1 , 4 )
- end
- end
- if Part3_newJL==1 then
- if rad1 <=90 then
- GiveItem ( role , 0 , 239 , 1 , 4 )
- elseif rad1 > 90 and rad1 <=98 then
- GiveItem ( role , 0 , 608 , 1 , 4 )
- elseif rad1 > 98 and rad1 <=100 then
- GiveItem ( role , 0 , 609 , 1 , 4 )
- end
- end
- Num_newJL = SetNum_Part1 ( Num_newJL , 1 ) ----------二转标记
- Num_newJL = SetNum_Part2 ( Num_newJL , Part2_newJL )
- Num_newJL = SetNum_Part3 ( Num_newJL , Part3_newJL )
- Num_newJL = SetNum_Part4 ( Num_newJL , Part4_newJL )
- Num_newJL = SetNum_Part5 ( Num_newJL , Part5_newJL )
- Num_newJL = SetNum_Part6 ( Num_newJL , Part6_newJL )
- Num_newJL = SetNum_Part7 ( Num_newJL , Part7_newJL )
- SetItemForgeParam ( Item_newJL , 1 , Num_newJL )
- SetItemAttr ( Item_newJL , ITEMATTR_VAL_STR , new_str )
- SetItemAttr( Item_newJL , ITEMATTR_VAL_DEX , new_dex )
- SetItemAttr ( Item_newJL , ITEMATTR_VAL_STA , new_sta )
- SetItemAttr( Item_newJL , ITEMATTR_VAL_AGI , new_agi )
- SetItemAttr ( Item_newJL , ITEMATTR_VAL_CON , new_con )
- SetItemAttr ( Item_newJL , ITEMATTR_MAXENERGY , new_MAXENERGY )
- SetItemAttr ( Item_newJL , ITEMATTR_MAXURE , new_MAXURE )
- end
- if Item_EMstone_ID ==3921 then ---智慧恶魔果实 神之精灵 精神加防御
- local j1 =TakeItem( role, 0, 4533, 10 ) ---蝌蚪尾巴
- local j2 = TakeItem( role, 0,3437, 10 ) ----泣灵弓箭手骸骨
- if j1==0 or j2==0 then
- SystemNotice ( role ,"删除精灵转生道具失败")
- return
- end
- local rad = math.random ( 1, 100 )
- local r1 = 0
- local r2 = 0
- if Item_JLone_ID ==680 or Item_JLother_ID ==680 then
- if Item_JLone_ID==Item_JLother_ID then
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- elseif lv_JLone>=20 and lv_JLone<25 and lv_JLother >=20 and lv_JLother<25 and rad>=88 then---12%为摩豆二世
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- elseif lv_JLone>=25 and lv_JLone<35 and lv_JLother >=25 and lv_JLother<35 and rad>=50 then ---50%为摩豆二世
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- elseif lv_JLone>=35 and lv_JLother >=35 and rad>=10 then---90%
- r1,r2 =MakeItem ( role , 681 , 1 , 4 )
- else
- r1,r2 =MakeItem ( role , 234 , 1 , 4 )
- end
- else
- r1,r2 =MakeItem ( role , 234 , 1 , 4 )
- end
- local Item_newJL = GetChaItem ( role , 2 , r2 ) --取新精灵道具指针
- local Num_newJL = GetItemForgeParam ( Item_newJL , 1 )
- local Part1_newJL = GetNum_Part1 ( Num_newJL ) --Get Num Part 1 到 Part 7
- local Part2_newJL = GetNum_Part2 ( Num_newJL )
- local Part3_newJL = GetNum_Part3 ( Num_newJL )
- local Part4_newJL = GetNum_Part4 ( Num_newJL )
- local Part5_newJL = GetNum_Part5 ( Num_newJL )
- local Part6_newJL = GetNum_Part6 ( Num_newJL )
- local Part7_newJL= GetNum_Part7 ( Num_newJL )
- if lv_JLone>=20 and lv_JLother >=20 then
- Part2_newJL = 9 ---------神之精灵技能编号
- Part3_newJL = 1 ---------初级阶段
- end
- if lv_JLone>=25 and lv_JLother >=25 then
- Part2_newJL = 9 ---------神之精灵技能编号
- Part3_newJL = 2 ---------中级阶段
- end
- if lv_JLone>=35 and lv_JLother >=35 then
- Part2_newJL = 9 ---------神之精灵技能编号
- Part3_newJL = 3 ---------高级阶段
- end
- local rad1 = math.random ( 1, 100 )
- if Part3_newJL==3 then
- GiveItem ( role , 0 , 609 , 1 , 4 )
- end
- if Part3_newJL==2 then
- if rad1 <=95 then
- GiveItem ( role , 0 , 608 , 1 , 4 )
- elseif rad1 > 95 and rad1 <=100 then
- GiveItem ( role , 0 , 609 , 1 , 4 )
- end
- end
- if Part3_newJL==1 then
- if rad1 <=90 then