forge.lua
Upload User: bjtaixing
Upload Date: 2021-01-15
Package Size: 24749k
Code Size: 338k
Category:

E-Books

Development Platform:

DOS

  1. ----宝石合成
  2. ---检测是否能够合成
  3. function can_unite_item (...)
  4. -- Notice("开始判断")
  5. if arg.n ~= 12 then
  6. -- Notice("参数个数非法"..arg.n)
  7. return 0
  8. end
  9. local kkk = 0
  10. -- for kkk = 2 , arg.n ,1 do
  11. -- SystemNotice ( arg[1] , arg[kkk])
  12. -- end
  13. local Check = 0
  14. -- SystemNotice( arg[1] , "调用合成检测主函数")
  15. Check = can_unite_item_main ( arg )
  16. if Check == 1 then
  17. -- SystemNotice (arg[1] , "返回1 ")
  18. return 1
  19. else
  20. -- SystemNotice (arg[1] , "返回0 ")
  21. return 0
  22. end
  23. end
  24. --检测是否可以合成主函数
  25. function can_unite_item_main ( Table )
  26. -- SystemNotice ( Table[1] , "进入合成主函数")
  27. local role = 0
  28. local ItemBag = {} --道具背包位置
  29. local ItemCount = {} --道具数量
  30. local ItemBagCount = {} --道具对象数量
  31. local Get_Count = 4
  32. local ItemReadCount = 0
  33. local ItemReadNow = 1
  34. local ItemReadNext = 0
  35. local ItemBag_Now = 0
  36. local ItemCount_Now = 0
  37. local ItemBagCount_Num = 0
  38. -- SystemNotice( arg[1] , "开始调用参数解析")
  39. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Now , ItemCount_Now , ItemBagCount_Num = Read_Table ( Table )
  40. -- for kkk = 0 , 2 , 1 do
  41. -- SystemNotice ( role , ItemBagCount[kkk])
  42. -- SystemNotice ( role , ItemBag[kkk])
  43. -- SystemNotice ( role , ItemCount[kkk])
  44. -- end
  45. -- Notice(role , "11111")
  46. local i = 0
  47. for i = 0 , 2 , 1 do --判断道具对象个数和道具个数是否和法
  48. if ItemBagCount[i] ~= 1 or ItemCount[i] ~= 1 then
  49. -- SystemNotice( role , "ItemBagCount[i] = "..ItemBagCount[i])
  50. -- SystemNotice( role , "ItemCount[i] = "..ItemCount[i])
  51. SystemNotice( role , "道具对象个数和道具个数非法")
  52. return 0
  53. end
  54. end
  55. local BagItem1 = ItemBag [0]
  56. local BagItem2 = ItemBag [1]
  57. local BagItem3 = ItemBag [2]
  58. local Item1 = GetChaItem ( role , 2 , BagItem1 ) --取道具指针
  59. local Item2 = GetChaItem ( role , 2 , BagItem2 )
  60. local Item3 = GetChaItem ( role , 2 , BagItem3 )
  61. local ItemID1 = GetItemID ( Item1 ) --取道具编号
  62. local ItemID2 = GetItemID ( Item2 )
  63. local ItemID3 = GetItemID ( Item3 )
  64. local ItemType1 = GetItemType ( Item1 )
  65. local ItemType2 = GetItemType ( Item2 )
  66. local ItemType3 = GetItemType ( Item3 )
  67. if ItemType1 ~= 47 then --判断卷轴是否正确
  68. SystemNotice( role ,"不是合成卷轴")
  69. return 0
  70. end
  71. if ItemType2 ~= 49 or ItemType3 ~= 49 then --判断是否是宝石
  72. if ItemType2 ~= 50 or ItemType3 ~= 50 then
  73. SystemNotice( role , "不是宝石")
  74. return 0
  75. end
  76. end
  77. if ItemID2 ~= ItemID3 then --判断两个宝石是否同类
  78. SystemNotice(role ,"宝石不一样")
  79. return 0
  80. end
  81. local Item2_Lv = Get_StoneLv ( Item2 ) --取宝石等级
  82. local Item3_Lv = Get_StoneLv ( Item3 )
  83. if ItemID2 == 6718 or ItemID2 == 6717 then 
  84. if Item2_Lv>=2 or Item3_Lv >= 2 then 
  85. SystemNotice ( role , "试炼宝石只能合成到2级。")
  86. return 0
  87. end
  88. end
  89. if ItemType2 == 49 and ItemType3 == 49 then
  90. if Item2_Lv >= 9 or Item3_Lv >= 9 then
  91. SystemNotice ( role , "宝石级别到达上限")
  92. return 0
  93. end
  94. end
  95. if Item2_Lv ~= Item3_Lv then 
  96. SystemNotice(role ,"宝石等级不一致")
  97. return 0
  98. end
  99. -- SystemNotice ( role , "判断成功")
  100. local Money_Need = getunite_money_main ( Table )
  101. local Money_Have = GetChaAttr ( role , ATTR_GD )
  102. if Money_Need > Money_Have then
  103. SystemNotice( role ,"金钱不足,不能合成")
  104. return 0
  105. end
  106. return 1
  107. end
  108. --开始合成
  109. function begin_unite_item (...)
  110. -- Notice("开始合成")
  111. local Check_CanUnite = 0
  112. -- SystemNotice ( arg[1] , "调用检测能否合成主函数")
  113. Check_CanUnite = can_unite_item_main ( arg )
  114. if Check_CanUnite == 0 then
  115. return 0
  116. end
  117. local role = 0
  118. local ItemBag = {} --道具背包位置
  119. local ItemCount = {} --道具数量
  120. local ItemBagCount = {} --道具对象数量
  121. local Get_Count = 4
  122. local ItemReadCount = 0
  123. local ItemReadNow = 1
  124. local ItemReadNext = 0
  125. local ItemBag_Now = 0
  126. local ItemCount_Now = 0
  127. local ItemBagCount_Num = 0
  128. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Now , ItemCount_Now , ItemBagCount_Num = Read_Table ( arg )
  129. local BagItem1 = ItemBag [0]
  130. local BagItem2 = ItemBag [1]
  131. local BagItem3 = ItemBag [2]
  132. local BagItem1 = arg [3] --取道具背包位置
  133. local BagItem2 = arg [6]
  134. local BagItem3 = arg [9]
  135. local Item1 = GetChaItem ( role , 2 , BagItem1 ) --取道具指针
  136. local Item2 = GetChaItem ( role , 2 , BagItem2 )
  137. local Item3 = GetChaItem ( role , 2 , BagItem3 )
  138. local ItemID1 = GetItemID ( Item1 ) --取道具编号
  139. local ItemID2 = GetItemID ( Item2 )
  140. local ItemID3 = GetItemID ( Item3 )
  141. local ItemType2 = GetItemType ( Item2 )
  142. local Item2_Lv = Get_StoneLv ( Item2 ) --取宝石等级
  143. local Item3_Lv = Get_StoneLv ( Item3 )
  144. local i = 0
  145. local j = 0
  146. i = RemoveChaItem ( role , ItemID1 , 1 , 2 , BagItem1 , 2 , 1 , 0) --移除卷轴
  147. j = RemoveChaItem ( role , ItemID3 , 1 , 2 , BagItem3 , 2 , 1 , 0) --移除一颗宝石
  148. if i == 0 or j == 0 then
  149. LG( "Hecheng_BS" , "移除物品失败" )
  150. end
  151. Item2_Lv =Item2_Lv + 1
  152. Set_StoneLv ( Item2 , Item2_Lv )
  153. local Money_Need = getunite_money_main ( arg )
  154. local Money_Have = GetChaAttr ( role , ATTR_GD )
  155. -- Notice ("目前有"..Money_Have.."这么多的钱")
  156. -- Notice ("要扣除"..Money_Need.."这么多的钱")
  157. Money_Have = Money_Have - Money_Need
  158. SetCharaAttr ( Money_Have , role , ATTR_GD )
  159. ALLExAttrSet( role )
  160. local Sklv = 1
  161. local StateLv = GetChaStateLv ( role , STATE_HCGLJB )
  162. local State100 = GetChaStateLv ( role , STATE_HCBYS ) ------取药水状态
  163. Sklv = Sklv + StateLv
  164. local b = Check_CG_HechengBS ( Item2_Lv , ItemType2 , Sklv )
  165. if Item2_Lv < 8 and Item3_Lv < 8 then 
  166. if State100 == 11 then
  167. b = 1
  168. SystemNotice( role , "你喝了药水,宝石合成几率到100%")    
  169. end
  170. end
  171. if b == 0 then
  172. i = RemoveChaItem ( role , ItemID2 , 1 , 2 , BagItem2 , 2 , 1 , 0) --移除宝石
  173. if i == 0 then
  174. LG( "Hecheng_BS" , "移除物品失败" )
  175. end
  176. local cha_name = GetChaDefaultName ( role )
  177. LG( "JingLian_ShiBai" , "玩家"..cha_name.."合成宝石失败" )
  178. SystemNotice( role , "很遗憾,合成失败了,宝石消失了........")
  179. return 2
  180. end
  181. local cha_name = GetChaDefaultName ( role )
  182. LG( "JingLian_ShiBai" , "玩家"..cha_name.."合成宝石成功" )
  183. return 1
  184. end
  185. --计算需要金钱
  186. function get_item_unite_money (...)
  187. -- SystemNotice ( arg[1] , "开始计算钱" )
  188. local Money = getunite_money_main ( arg )
  189. -- SystemNotice ( arg[1] , "计算结束"..Money )
  190. return 0
  191. end
  192. --计算需要金钱主函数
  193. function getunite_money_main ( Table )
  194. -- SystemNotice ( Table[1] , "真的开始计算钱了" )
  195. return 5000
  196. end
  197. --精炼
  198. --判断是否能够精炼
  199. function can_forge_item(...)
  200. -- Notice ( "判断是否可以精炼")
  201. if arg.n ~= 12 then
  202. SystemNotice ( arg[1] , "参数个数非法"..arg.n )
  203. return 0
  204. end
  205. -- local kkk = 0
  206. -- for kkk = 2 , arg.n ,1 do
  207. -- SystemNotice ( arg[1] , arg[kkk])
  208. -- end
  209. local Check = 0
  210. Check = can_forge_item_main ( arg )
  211. if Check == 1 then
  212. return 1
  213. else
  214. return 0
  215. end
  216. end
  217. --检测是否可以精炼主函数
  218. function can_forge_item_main ( Table )
  219. local role = 0
  220. local ItemBag = {} --道具背包位置
  221. local ItemCount = {} --道具数量
  222. local ItemBagCount = {} --道具对象数量
  223. local Get_Count = 4
  224. local ItemReadCount = 0
  225. local ItemReadNow = 1
  226. local ItemReadNext = 0
  227. local ItemBag_Now = 0
  228. local ItemCount_Now = 0
  229. local ItemBagCount_Num = 0
  230. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Now , ItemCount_Now , ItemBagCount_Num = Read_Table ( Table )
  231. local ItemBagCount_Jinglian = ItemBagCount [0]
  232. local ItemBag_Jinglian = ItemBag [0]
  233. local ItemNum_Jinglian = ItemCount [0]
  234. local Item_Jinglian = GetChaItem ( role , 2 , ItemBag_Jinglian )
  235. local Check = 0
  236. if ItemBagCount_Jinglian ~= 1 then
  237. SystemNotice( role , "精炼道具对应格数非法")
  238. return 0
  239. end
  240. if ItemNum_Jinglian ~= 1 then
  241. SystemNotice( role , "精炼道具数量非法")
  242. return 0
  243. end
  244. Check = CheckItem_CanJinglian ( Item_Jinglian )
  245. if Check == 0 then
  246. SystemNotice( role ,"道具不可精炼")
  247. return 0
  248. end
  249. if ItemCount [1] ~= 1 or ItemCount [2] ~= 1 or ItemBagCount [1] ~= 1 or ItemBagCount [2] ~= 1 then
  250. SystemNotice ( role ,"宝石数量非法")
  251. return 0
  252. end
  253. local Item_Stone1 = GetChaItem ( role , 2 , ItemBag [1] )
  254. local Item_Stone2 = GetChaItem ( role , 2 , ItemBag [2] )
  255. local Check_Hole = 0
  256. Check_Hole = CheckItem_HaveHole ( Item_Jinglian , Item_Stone1 , Item_Stone2)
  257. if Check_Hole == 0 then
  258. SystemNotice( role ,"没有足够的孔用来精炼" )
  259. return 0
  260. end
  261. local Check_Stone = 0
  262. Check_Stone = Check_StoneLv ( Item_Jinglian , Item_Stone1 , Item_Stone2 )
  263. if Check_Stone == 0 then
  264. SystemNotice ( role , "宝石或精炼石等级不足" )
  265. return 0
  266. end
  267. if Check_Stone == -1 then
  268. SystemNotice ( role , "试炼精炼石只能和试炼宝石一起精炼" )
  269. return 0
  270. end
  271. local Check_StoneItem = 0
  272. Check_StoneItem = Check_StoneItemType ( Item_Jinglian , Item_Stone1 , Item_Stone2 )
  273. if Check_StoneItem == 0 then
  274. SystemNotice ( role , "宝石与精炼道具不符合" )
  275. return 0
  276. end
  277. if Check_StoneItem==-1 then 
  278. SystemNotice ( role , "试炼宝石只能精炼40级以下的装备" )
  279. return 0
  280. end
  281. local Money_Need = getforge_money_main ( Table )
  282. local Money_Have = GetChaAttr ( role , ATTR_GD )
  283. if Money_Need > Money_Have then
  284. SystemNotice( role ,"金钱不足,不能精炼")
  285. return 0
  286. end
  287. --SystemNotice(role ,"判断结束 ")
  288. return 1
  289. end
  290. function ZBforge(role )
  291. local ZBMain= GetChaAttr(role,ATTR_EXTEND0)
  292. local ZBNType= math.floor(ZBMain/10)      ---第几次占卜
  293. local ZBNMain= math.mod(ZBMain,10 ) ---BUFF OR DEBUFF
  294. local ZBday = GetChaAttr(role,ATTR_EXTEND2) --占卜天数
  295. local ZBstate=GetChaAttr(role, ATTR_EXTEND1) --
  296. local ZBstate1=math.floor(ZBstate/10) --占卜效果注册
  297. local ZBstate2=math.mod(ZBstate,10) --占卜类型
  298. local now_day=os.date("%d")
  299. now_day=tonumber(now_day)
  300. local ZBforgeXG=0
  301. local ZBStateLV={}
  302. ZBStateLV[1] = {}
  303. ZBStateLV[1][1] = 10
  304. ZBStateLV[1][2] = 8
  305. ZBStateLV[1][3] = 6
  306. ZBStateLV[1][4] = 4
  307. ZBStateLV[1][5] = 2
  308. if now_day==ZBday and ZBstate2==2 and ZBstate1>= 1 and ZBstate1<=5 then
  309. ZBforgeXG=ZBStateLV[1][ZBstate1]/100
  310. end
  311. return ZBforgeXG
  312. end
  313. --开始精炼
  314. function begin_forge_item(...)
  315. -- Notice("进入精炼")
  316. local Check_CanForge = 0
  317. Check_CanForge = can_forge_item_main ( arg )
  318. if Check_CanForge == 0 then
  319. return 0
  320. end
  321. local role = 0
  322. local ItemBag = {} --道具背包位置
  323. local ItemCount = {} --道具数量
  324. local ItemBagCount = {} --道具对象数量
  325. local Get_Count = 4
  326. local ItemReadCount = 0
  327. local ItemReadNow = 1
  328. local ItemReadNext = 0
  329. local ItemBag_Num = 0
  330. local ItemCount_Num = 0
  331. local ItemBagCount_Num = 0
  332. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( arg )
  333. local ItemBag_Jinglian = ItemBag [0]
  334. local Item_Jinglian = GetChaItem ( role , 2 , ItemBag_Jinglian )
  335. local Item_Stone1 = GetChaItem ( role , 2 , ItemBag [1] )
  336. local Item_Stone2 = GetChaItem ( role , 2 , ItemBag [2] )
  337. local Check_Jinglian_Item = 0
  338. local Money_Need = getforge_money_main ( arg )
  339. local Money_Have = GetChaAttr ( role , ATTR_GD )
  340. -- Notice ("目前有"..Money_Have.."这么多的钱")
  341. -- Notice ("要扣除"..Money_Need.."这么多的钱")
  342. Money_Have = Money_Have - Money_Need
  343. SetCharaAttr ( Money_Have , role , ATTR_GD )
  344. ALLExAttrSet( role )
  345. local ItemID_Jinglian = GetItemID ( Item_Jinglian )
  346. ----------------
  347. local Jinglian_Lv_Now = GetItem_JinglianLv ( Item_Jinglian )
  348. ----------------
  349. local Num = GetItemForgeParam ( Item_Jinglian , 1 )
  350. Num = TansferNum ( Num )
  351. local Stone1Type = GetItemType ( Item_Stone1 )
  352. local Stone2Type = GetItemType ( Item_Stone2 )
  353. local Baoshi = 0
  354. if Stone1Type == 49 then
  355. Baoshi = Item_Stone1
  356. elseif Stone2Type == 49 then
  357. Baoshi = Item_Stone2
  358. end
  359. local Item_Stone = {}
  360. local Item_StoneLv = {}
  361. local Baoshi_NeedLv = 1
  362. Item_Stone[0] = GetNum_Part2 ( Num )
  363. Item_Stone[1] = GetNum_Part4 ( Num )
  364. Item_Stone[2] = GetNum_Part6 ( Num )
  365. Item_StoneLv[0] = GetNum_Part3 ( Num )
  366. Item_StoneLv[1] = GetNum_Part5 ( Num )
  367. Item_StoneLv[2] = GetNum_Part7 ( Num )
  368. BaoshiType = GetStone_TypeID ( Baoshi )
  369. for i = 0 , 2 ,1 do
  370. if BaoshiType == Item_Stone[i] then
  371. Baoshi_NeedLv = Item_StoneLv[i] + 1
  372. end
  373. end
  374. ----------------
  375. local Sklv = 1
  376. local StateLv = GetChaStateLv ( role , STATE_JLGLJB )
  377. local State100 = GetChaStateLv ( role , STATE_JLBYS )
  378. Sklv = Sklv + StateLv
  379. local ZBforgeXG=ZBforge(role )
  380. local Check_A = math.max ( 0.02 , math.min ( 1 , ( 1 - Baoshi_NeedLv * 0.1 + Sklv * 0.15 - 0.3+ZBforgeXG ) ) )
  381. local CheckFaild = Percentage_Random ( Check_A )
  382. if State100 == 10 then 
  383. if Baoshi_NeedLv < 10 then
  384. CheckFaild = 1
  385. SystemNotice( role , "你喝了药水,装备精炼几率到100%")
  386. end
  387. end
  388. if Baoshi_NeedLv < 7 then
  389. CheckFaild = 1
  390. end
  391. if CheckFaild == 1 then
  392. Check_Jinglian_Item = Jinglian_Item ( Item_Jinglian , Item_Stone1 , Item_Stone2 )
  393. else
  394. local cha_name = GetChaDefaultName ( role )
  395. local Item_Jinglian_name = GetItemName ( ItemID_Jinglian )
  396. LG( "JingLian_ShiBai" , "玩家"..cha_name.."精炼装备失败,装备未损坏"..Item_Jinglian_name )
  397. SystemNotice ( role , "很遗憾,精炼失败了,还好装备没有损坏" )
  398. end
  399. ------------------
  400. local ItemID_Stone1 = GetItemID ( Item_Stone1 )
  401. local ItemID_Stone2 = GetItemID ( Item_Stone2 )
  402. local Stone1_Lv = Get_StoneLv ( Item_Stone1 )
  403. local Stone2_Lv = Get_StoneLv ( Item_Stone2 )
  404. local Jinglianshi_Lv = 0
  405. if Stone1_Lv > Stone2_Lv then
  406. Jinglianshi_Lv = Stone1_Lv
  407. else
  408. Jinglianshi_Lv = Stone2_Lv
  409. end
  410. local Jinglian_Lv = GetItem_JinglianLv ( Item_Jinglian )
  411. local R1 = 0
  412. local R2 = 0
  413. R1 = RemoveChaItem ( role , ItemID_Stone1 , 1 , 2 , ItemBag [1] , 2 , 1 , 0 ) --移除宝石1
  414. R2 = RemoveChaItem ( role , ItemID_Stone2 , 1 , 2 , ItemBag [2] , 2 , 1 , 0 ) --移除宝石2
  415. if R1 == 0 or R2 == 0 then
  416. LG( "Jinglian" , "移除宝石失败" )
  417. end
  418. if CheckFaild == 0 then
  419. return 2
  420. end
  421. check_item_final_data ( Item_Jinglian )
  422. -- SystemNotice(role , "返回失败")
  423. -- local a = 0.75
  424. local b = Check_CG_Jinglian ( Jinglian_Lv , Jinglianshi_Lv , Sklv )
  425. if b == 0 then
  426. i = RemoveChaItem ( role , ItemID_Jinglian , 1 , 2 , ItemBag [0] , 2 , 1 , 0) --移除宝石
  427. if i == 0 then
  428. LG( "Hecheng_BS" , "移除物品失败" )
  429. end
  430. local cha_name = GetChaDefaultName ( role )
  431. local Item_Jinglian_name = GetItemName ( ItemID_Jinglian )
  432. LG( "JingLian_ShiBai" , "玩家"..cha_name.."精炼装备失败"..Item_Jinglian_name )
  433. SystemNotice( role , "很遗憾,精炼失败了,装备完全坏掉了........")
  434. return 2
  435. end
  436. -- Notice("精炼结束")
  437. local cha_name = GetChaDefaultName ( role )
  438. local Item_Jinglian_name = GetItemName ( ItemID_Jinglian )
  439. LG( "JingLian_ShiBai" , "玩家"..cha_name.."精炼成功"..Item_Jinglian_name )
  440. return 1
  441. end
  442. --计算精炼费用
  443. function get_item_forge_money(...)
  444. -- Notice("计算费用")
  445. local Money = getforge_money_main ( arg )
  446. return Money
  447. end
  448. --计算精练费用主函数
  449. function getforge_money_main ( Table )
  450. local role = 0
  451. local ItemBag = {} --道具背包位置
  452. local ItemCount = {} --道具数量
  453. local ItemBagCount = {} --道具对象数量
  454. local Get_Count = 4
  455. local ItemReadCount = 0
  456. local ItemReadNow = 1
  457. local ItemReadNext = 0
  458. local ItemBag_Num = 0
  459. local ItemCount_Num = 0
  460. local ItemBagCount_Num = 0
  461. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
  462. local ItemBag_Jinglian = ItemBag [0]
  463. local Item_Jinglian = GetChaItem ( role , 2 , ItemBag_Jinglian )
  464. local Jinglian_Lv = 0
  465. Jinglian_Lv =  GetItem_JinglianLv ( Item_Jinglian )
  466. Jinglian_Lv = Jinglian_Lv + 1
  467. local Money_Need
  468. if Jinglian_Lv == 1 then
  469. Money_Need = 10000
  470. end
  471. if Jinglian_Lv > 1 then
  472. Money_Need = Jinglian_Lv * 10000
  473. end
  474. --local Money_Need = Jinglian_Lv * 100000
  475. -- Notice("计算结束")
  476. return Money_Need
  477. end
  478. ----相关函数--------------------------------------------------------------------------------------------------------
  479. function Get_StoneLv ( Item ) --读取宝石等级
  480. local Lv = GetItemAttr ( Item , ITEMATTR_VAL_BaoshiLV )
  481. return Lv
  482. end
  483. function Set_StoneLv ( Item , Item_Lv ) --设置宝石等级
  484. local i = 0
  485. i = SetItemAttr ( Item , ITEMATTR_VAL_BaoshiLV , Item_Lv )
  486. if i == 0 then
  487. LG( "Hecheng_BS","宝石等级设置失败" )
  488. end
  489. end
  490. --检查装备是否可被精炼
  491. function CheckItem_CanJinglian ( Item )
  492. -- Notice ("CheckItem_CanJinglian ")
  493. local Item_Type = GetItemType ( Item )
  494. local i = 0
  495. for i = 0 , Item_CanJinglian_Num  , 1 do
  496. if Item_Type == Item_CanJinglian_ID [i] then
  497. return 1
  498. end
  499. end
  500. return 0
  501. end
  502. ---检查是否有足够的洞精炼
  503. function CheckItem_HaveHole ( Item , Stone1 , Stone2)
  504. -- Notice ("CheckItem_HaveHole")
  505. local Num = GetItemForgeParam ( Item , 1 )
  506. Num = TansferNum ( Num )
  507. local Hole = GetNum_Part1 ( Num )
  508. local Item_Stone = {} 
  509. local Stone1TypeID = 0
  510. local Stone2TypeID = 0
  511. Item_Stone[0] = GetNum_Part2 ( Num )
  512. Item_Stone[1] = GetNum_Part4 ( Num )
  513. Item_Stone[2] = GetNum_Part6 ( Num )
  514. local i = 0
  515. local Hole_empty = 0
  516. for i = 0 , 2 , 1 do
  517. if Item_Stone[i] == 0 then
  518. Hole_empty = Hole_empty + 1
  519. end
  520. Stone1TypeID = GetStone_TypeID ( Stone1 )
  521. Stone2TypeID = GetStone_TypeID ( Stone2 )
  522. if Item_Stone[i] == Stone1TypeID or Item_Stone[i] == Stone2TypeID then
  523. return 1
  524. end
  525. end
  526. local Hole_Used = 3 - Hole_empty
  527. if Hole_Used >= Hole then
  528. return 0
  529. else
  530. return 1
  531. end
  532. end
  533. --检查宝石等级是否足够
  534. function Check_StoneLv ( Item , Stone1 , Stone2 )
  535. -- Notice ("Check_StoneLv")
  536. local Num = GetItemForgeParam ( Item , 1 )
  537. Num = TansferNum ( Num )
  538. -- Notice ( Num )
  539. local Jinglian_Lv =  GetItem_JinglianLv ( Item )
  540. -- Notice ( Jinglian_Lv )
  541. local Stone1Type = GetItemType ( Stone1 )
  542. local Stone2Type = GetItemType ( Stone2 )
  543. -- Notice (Stone1Type)
  544. -- Notice (Stone2Type)
  545. local Jinglianshi = 0
  546. local Jinglianshi_Lv = 0
  547. local Baoshi = 0
  548. local Baoshi_Lv = 0
  549. local Baoshi_NeedLv = 0
  550. if Stone1Type == 50 then
  551. Jinglianshi = Stone1
  552. elseif  Stone2Type == 50 then
  553. Jinglianshi = Stone2
  554. end
  555. if Stone1Type == 49 then
  556. Baoshi = Stone1
  557. elseif Stone2Type == 49 then
  558. Baoshi = Stone2
  559. end
  560. Jinglianshi_Lv = Get_StoneLv ( Jinglianshi )
  561. Baoshi_Lv = Get_StoneLv ( Baoshi )
  562. local baoShiID = GetItemID(Baoshi)
  563. local jingLianShiID = GetItemID(Jinglianshi)
  564. if jingLianShiID== 6717 and baoShiID~=6718 then 
  565. return -1 
  566. end
  567. -- Notice("Jinglianshi_Lv= "..Jinglianshi_Lv)
  568. -- Notice("Baoshi_Lv= "..Baoshi_Lv)
  569. local Item_Stone = {}
  570. local Item_StoneLv = {}
  571. Item_Stone[0] = GetNum_Part2 ( Num )
  572. Item_Stone[1] = GetNum_Part4 ( Num )
  573. Item_Stone[2] = GetNum_Part6 ( Num )
  574. Item_StoneLv[0] = GetNum_Part3 ( Num )
  575. Item_StoneLv[1] = GetNum_Part5 ( Num )
  576. Item_StoneLv[2] = GetNum_Part7 ( Num )
  577. BaoshiType = GetStone_TypeID ( Baoshi )
  578. -- Notice("BaoshiType= "..BaoshiType)
  579. local i = 0
  580. for i = 0 , 2 ,1 do
  581. if BaoshiType == Item_Stone[i] then
  582. Baoshi_NeedLv = Item_StoneLv[i] + 1
  583. end
  584. end
  585. local Jinglianshi_NeedLv = Baoshi_NeedLv
  586. if Baoshi_Lv < Baoshi_NeedLv then
  587. -- Notice("宝石等级不够")
  588. return 0
  589. end
  590. if Jinglianshi_Lv < Jinglianshi_NeedLv then
  591. -- Notice("精炼石等级不够")
  592. return 0
  593. end
  594. -- Notice("返回成功")
  595. return 1
  596. end
  597. ---开始精炼
  598. function Jinglian_Item ( Item , Stone1 , Stone2 )
  599. -- Notice("Jinglian_Item")
  600. local Num = GetItemForgeParam ( Item , 1 )
  601. Num = TansferNum ( Num )
  602. local Jinglian_Lv =  GetItem_JinglianLv ( Item )
  603. local Stone1Type = GetItemType ( Stone1 )
  604. local Stone2Type = GetItemType ( Stone2 )
  605. local Baoshi = 0
  606. local Num_New = Num
  607. if Stone1Type == 49 then
  608. Baoshi = Stone1
  609. elseif Stone2Type == 49 then
  610. Baoshi = Stone2
  611. end
  612. Num_New = SetJinglian_Lv ( Baoshi , Baoshi_Lv , Num )
  613. -- Notice(Num_New)
  614. local i = 0
  615. i = SetItemForgeParam ( Item , 1 , Num_New )
  616. if i == 0 then
  617. LG( "Jinglian" , "设置精炼内容失败" )
  618. end
  619. local Item_URE_Add = 0
  620. local Item_MAXURE = GetItemAttr ( Item , ITEMATTR_MAXURE )
  621. if Item_MAXURE < 600 then
  622. Item_MAXURE = math.min ( ( Item_MAXURE + Item_URE_Add ) , 600 )
  623. end
  624. local j = 0
  625. j = SetItemAttr ( Item , ITEMATTR_MAXURE , Item_MAXURE )
  626. if j == 0 then
  627. LG( "Jinglian" , "精炼设置最大耐久失败")
  628. end
  629. if Num_New == Num then
  630. -- Notice("设置内容未改变")
  631. end
  632. return 1
  633. end
  634. --设置武器上宝石的属性
  635. function SetJinglian_Lv ( Baoshi , Baoshi_Lv , Num )
  636. -- Notice ("SetJinglian_Lv")
  637. -- Notice (Num)
  638. local Baoshi_Lv = 0
  639. Baoshi_Lv = Get_StoneLv ( Baoshi )
  640. local Item_Stone = {}
  641. local Item_StoneLv = {}
  642. Item_Stone[0] = GetNum_Part2 ( Num )
  643. Item_Stone[1] = GetNum_Part4 ( Num )
  644. Item_Stone[2] = GetNum_Part6 ( Num )
  645. Item_StoneLv[0] = GetNum_Part3 ( Num )
  646. Item_StoneLv[1] = GetNum_Part5 ( Num )
  647. Item_StoneLv[2] = GetNum_Part7 ( Num )
  648. BaoshiType = GetStone_TypeID ( Baoshi )
  649. -- Notice("BaoshiType= "..BaoshiType)
  650. local i = 0
  651. local Stone_Check = 0
  652. for i = 0 , 2 , 1 do
  653. if BaoshiType == Item_Stone [i] then
  654. Item_StoneLv [i] = Item_StoneLv [i] + 1
  655. Stone_Check = i + 1
  656. end
  657. end
  658. if Stone_Check == 1 then
  659. Num = SetNum_Part3 ( Num , Item_StoneLv[0] )
  660. elseif Stone_Check == 2 then
  661. Num = SetNum_Part5 ( Num , Item_StoneLv[1] )
  662. elseif Stone_Check == 3 then
  663. Num = SetNum_Part7 ( Num , Item_StoneLv[2] )
  664. elseif Stone_Check == 0 then
  665. local Check_empty = 0
  666. for i = 2 , 0 , -1 do
  667. if Item_Stone[i] == 0 then
  668. Check_empty = i + 1
  669. end
  670. end
  671. if Check_empty == 1 then
  672. Num = SetNum_Part2 ( Num , BaoshiType )
  673. Num = SetNum_Part3 ( Num , 1 )
  674. elseif Check_empty == 2 then
  675. Num = SetNum_Part4 ( Num , BaoshiType )
  676. Num = SetNum_Part5 ( Num , 1 )
  677. elseif Check_empty == 3 then
  678. Num = SetNum_Part6 ( Num , BaoshiType )
  679. Num = SetNum_Part7 ( Num , 1 )
  680. end
  681. end
  682. -- Notice("SetJinglian_Lv结束")
  683. return Num
  684. end
  685. --取宝石类型ID
  686. function GetStone_TypeID ( Stone )
  687. -- Notice ("GetStone_TypeID")
  688. local StoneID = GetItemID ( Stone )
  689. local i = 0
  690. for i = 1 , StoneTpye_ID_Num , 1 do
  691. -- Notice ( StoneTpye_ID[i] )
  692. if StoneTpye_ID[i] == StoneID then
  693. return i
  694. end
  695. end
  696. return -1
  697. end
  698. ----变参内容解析
  699. function Read_Table ( Table )
  700. -- Notice("Read_Table")
  701. local role = Table [1] --角色
  702. -- Notice(role)
  703. -- Notice(Table.n)
  704. local ItemBag = {} --道具背包位置
  705. local ItemCount = {} --道具数量
  706. local ItemBagCount = {} --道具对象数量
  707. local Get_Count = 4
  708. local ItemReadCount = 0
  709. local ItemReadNow = 2
  710. local ItemReadNext = 0
  711. local ItemBag_Now = 0
  712. local ItemCount_Now = 0
  713. local ItemBagCount_New = 0
  714. local i = 0
  715. local j = 0
  716. for i = 0 , Get_Count , 1 do
  717. if ItemReadNow <= Table.n then
  718. ItemBagCount [i] = Table [ItemReadNow]
  719. -- SystemNotice ( role , "aaa  "..ItemBagCount [i] )
  720. ItemBagCount_New = ItemBagCount_New + 1
  721. -- Notice("ItemBagCount= "..ItemBagCount [i])
  722. ItemReadNow = ItemReadNow + 1
  723. ItemReadNext = ItemReadNow + 2 * ( ItemBagCount [i] - 1 )
  724. ItemReadCount = ItemReadNow
  725. if ItemBagCount [i] ~= 0  then
  726. for j = ItemReadCount , ItemReadNext , 2 do
  727. ItemBag [ItemBag_Now] = Table [j]
  728. -- SystemNotice(role , "aaa  "..ItemBag [ItemBag_Now])
  729. -- Notice("ItemBag= "..ItemBag [ItemBag_Now])
  730. ItemBag_Now = ItemBag_Now + 1
  731. ItemCount [ItemCount_Now] = Table [ j+1 ]
  732. -- SystemNotice(role , "aaa  "..ItemCount[ItemCount_Now])
  733. -- Notice("ItemCount= "..ItemCount [ItemCount_Now])
  734. ItemCount_Now = ItemCount_Now + 1
  735. ItemReadNow = ItemReadNow + 2
  736. end
  737. end
  738. else
  739. ItemBagCount [i] = 0
  740. -- SystemNotice ( role , "aaa  "..ItemBagCount [i] )
  741. -- Notice(ItemBagCount [i])
  742. end
  743. end
  744. -- Notice("1111")
  745. return role , ItemBag , ItemCount , ItemBagCount , ItemBag_Now , ItemCount_Now , ItemBagCount_New
  746. end
  747. --道具精炼属性重算
  748. function check_item_final_data ( Item )
  749. local Item_TypeCheck = GetItemType ( Item )
  750. if Item_TypeCheck == 59 then
  751. return
  752. end
  753. -- Notice ("check_item_final_data")
  754. local Num = GetItemForgeParam ( Item , 1 )
  755. Num = TansferNum ( Num )
  756. -- Notice(Num)
  757. local StoneInfo = {}
  758. local StoneLv = {}
  759. local ResetCheck = 0
  760. ResetCheck = ResetItemFinalAttr( Item )
  761. if ResetCheck == 0 then
  762. -- Notice("ResetCheck失败")
  763. LG("check_item_final","ResetCheck失败")
  764. return
  765. end
  766. StoneInfo[0]=0
  767. StoneInfo[1]=0
  768. StoneInfo[2]=0
  769. StoneLv[0]=0
  770. StoneLv[1]=0
  771. StoneLv[2]=0
  772. StoneInfo[0],StoneInfo[1],StoneInfo[2],StoneLv[0],StoneLv[1],StoneLv[2] = CheckStoneInfo ( Num )
  773. local AddCheck = 0
  774. local i = 0
  775. local j = 0
  776. for i = 0 , 2 , 1 do
  777. if StoneInfo [i] ~= nil and StoneInfo [i] ~=0  then
  778. -- Notice("StoneInfo"..i.."= "..StoneInfo [i])
  779. if StoneAttrType[StoneInfo [i]] == ITEMATTR_VAL_MNATK then
  780. -- Notice("加攻击力")
  781. local Itemattr_Type1 = StoneAttrType[StoneInfo [i]]
  782. local Itemattr_Type2 = Itemattr_Type1 + 1
  783. local ItemAttrEff = 0
  784. local num_stone=0
  785. local lv_stone=0
  786. if StoneLv[i]>0 and StoneLv[i]<=9 then
  787. lv_stone=StoneLv[i]
  788. end
  789. if StoneInfo [i]>=0 and StoneInfo [i]<=StoneEff_Num then
  790. num_stone=StoneInfo [i]
  791. ItemAttrEff =StoneEff [num_stone] * lv_stone
  792. end
  793. -- local Item_attr1 = GetItemAttr ( Item , Itemattr_Type1 )
  794. -- local Item_attr2 = GetItemAttr ( Item , Itemattr_Type2 )
  795. -- local Item_Newattr1 = Item_attr1 + ItemAttrEff
  796. -- local Item_Newattr2 = Item_attr2 + ItemAttrEff
  797. -- Notice ( "Itemattr_Type1= "..Itemattr_Type1.." Itemattr_Type2= "..Itemattr_Type2)
  798. -- Notice ( "ItemAttrEff= "..ItemAttrEff)
  799. AddCheck = AddItemFinalAttr ( Item , Itemattr_Type1 , ItemAttrEff )
  800. if AddCheck == 0 then
  801. LG("check_item_final","AddCheck失败")
  802. end
  803. AddCheck = AddItemFinalAttr ( Item , Itemattr_Type2 , ItemAttrEff )
  804. if AddCheck == 0 then
  805. LG("check_item_final","AddCheck失败")
  806. end
  807. else
  808. local Itemattr_Type = StoneAttrType[StoneInfo [i]]
  809. local ItemAttrEff = 0
  810. local num_stone=0
  811. local lv_stone=0
  812. if StoneLv[i]>0 and StoneLv[i]<=9 then
  813. lv_stone=StoneLv[i]
  814. end
  815. if StoneInfo [i]>=0 and StoneInfo [i]<=StoneEff_Num then
  816. num_stone=StoneInfo [i]
  817. ItemAttrEff =StoneEff [num_stone] * lv_stone
  818. end
  819. --local ItemAttrEff = StoneEff[StoneInfo [i]] * StoneLv[i]
  820. -- local Item_attr = GetItemAttr ( Item , Itemattr_Type )
  821. -- local Item_Newattr = Item_attr + ItemAttrEff
  822. AddCheck = AddItemFinalAttr ( Item , Itemattr_Type , ItemAttrEff )
  823. if AddCheck == 0 then
  824. LG("check_item_final","AddCheck失败")
  825. end
  826. end
  827. end
  828. end
  829. end
  830. --检查宝石可精炼道具类型
  831. function Check_StoneItemType ( Item , Stone1 , Stone2 )
  832. -- Notice ("Check_StoneItemType")
  833. local Stone1Type = GetItemType ( Stone1 )
  834. local Stone2Type = GetItemType ( Stone2 )
  835. local Baoshi = 0
  836. local ItemType = GetItemType ( Item )
  837. if Stone1Type == 49 then
  838. Baoshi = Stone1
  839. elseif Stone2Type == 49 then
  840. Baoshi = Stone2
  841. end
  842. local Baoshi_ID = GetItemID ( Baoshi )
  843. local i = 0
  844. local Baoshi_TypeID = 0
  845. for i = 1 , StoneAttrType_Num , 1 do
  846. if Baoshi_ID == StoneTpye_ID[i] then
  847. Baoshi_TypeID = i
  848. end
  849. end
  850. if Baoshi_ID == 6718 then
  851. local itemLV=GetItemLv(Item)
  852. if itemLV>40 then 
  853. return -1
  854. end
  855. end
  856. for i = 0 , 15 , 1 do
  857. if ItemType == StoneItemType[Baoshi_TypeID][i] then
  858. return 1
  859. end
  860. if StoneItemType[Baoshi_TypeID][i] == 0 then
  861. -- Notice ("返回失败")
  862. return 0
  863. end
  864. end
  865. -- Notice ("返回失败")
  866. return 0
  867. end
  868. --取精炼等级
  869. function GetItem_JinglianLv ( Item )
  870. -- Notice ("GetItem_JinglianLv")
  871. local Num = GetItemForgeParam ( Item , 1 )
  872. Num = TansferNum ( Num )
  873. local Item_StoneLv = {}
  874. local JinglianLv = 0
  875. Item_StoneLv[0] = GetNum_Part3 ( Num )
  876. Item_StoneLv[1] = GetNum_Part5 ( Num )
  877. Item_StoneLv[2] = GetNum_Part7 ( Num )
  878. JinglianLv = Item_StoneLv[0] + Item_StoneLv[1] + Item_StoneLv[2]
  879. return JinglianLv
  880. end
  881. --读取武器上宝石信息
  882. function CheckStoneInfo( Num )
  883. local Item_Stone = {}
  884. local Item_StoneLv = {}
  885. Item_Stone[0] = GetNum_Part2 ( Num )
  886. Item_Stone[1] = GetNum_Part4 ( Num )
  887. Item_Stone[2] = GetNum_Part6 ( Num )
  888. Item_StoneLv[0] = GetNum_Part3 ( Num )
  889. Item_StoneLv[1] = GetNum_Part5 ( Num )
  890. Item_StoneLv[2] = GetNum_Part7 ( Num )
  891. return Item_Stone[0],Item_Stone[1],Item_Stone[2],Item_StoneLv[0],Item_StoneLv[1],Item_StoneLv[2]
  892. end
  893. function Check_CG_HechengBS ( Item_Lv , Item_Type , Sklv )
  894. local a = 0
  895. local b = 0
  896. Item_Lv = Item_Lv - 1
  897. if Item_Type == 49 then
  898. a = math.max ( 0 , math.min ( 1 , ( 1 - Item_Lv * 0.10 + Sklv * 0.10 ) ) )
  899. b = Percentage_Random ( a )
  900. if Item_Lv < 3 then
  901. b = 1
  902. end
  903. return b
  904. elseif Item_Type == 50 then
  905. a = math.max ( 0 , math.min ( 1 , ( 1 - Item_Lv * 0.05 + Sklv * 0.15 ) ) )
  906. b = Percentage_Random ( a )
  907. return b
  908. else
  909. LG( "Hecheng_BS","概率检查时道具类型不是宝石" )
  910. return 0
  911. end
  912. end
  913. ------------------------by Chaos
  914. function Check_CG_Jinglian ( Jinglian_Lv , Stone_Lv , Sklv )
  915. -- local a = 0
  916. local b = 0
  917. -- a = math.max ( 0.02 , math.min ( 1 , ( 1 - Jinglian_Lv  * 0.05 + Sklv * 0.15 - 0.3 ) ) )
  918. -- b = Percentage_Random ( a )
  919. -- if Jinglian_Lv <= 8 then
  920. b = 1
  921. -- end
  922. return b
  923. end
  924. --随机宝石种类——————————————————————————————————————
  925. function Roll_DiamondId ( cha ) 
  926. local a = math.random ( 1 , 8 ) 
  927. local DiamondId = StoneTpye_ID [ a ] 
  928. return DiamondId  
  929. end 
  930. --1级宝石兑换卷————————————————————————————————————————————————————
  931. function Transfer_DiamondScript_Lv1 ( role )
  932. local cha = TurnToCha ( role ) 
  933. local x_give = 0 
  934. local y_give = 0 
  935. local script_count = CheckBagItem ( cha , 3877 ) --检查背包中兑换券数量
  936. local DiamondId = Roll_DiamondId ( cha ) --随机兑换宝石的种类
  937. if script_count >= 1  then 
  938. x_del = DelBagItem ( cha , 3877 , 1 ) 
  939. if x_del == 1 then 
  940. x_give = GiveItem ( cha , 0 , DiamondId , 1 , 101 ) --兑换宝石
  941. y_give = GiveItem ( cha , 0 , 885 , 1 , 101 ) --兑换精炼石
  942. else 
  943. SystemNotice ( cha , "无法正确扣除宝石兑换券" ) 
  944. end 
  945. else 
  946. SystemNotice ( cha , "背包内需要一级宝石兑换券才可兑换"  ) 
  947. end 
  948. if x_give == 1 and y_give ==1 then 
  949. return 1 
  950. else 
  951. return 0 
  952. end 
  953. end 
  954. --2级宝石兑换卷————————————————————————————————————————————————————
  955. function Transfer_DiamondScript_Lv2 ( role )
  956. local cha = TurnToCha ( role ) 
  957. local x_give = 0 
  958. local y_give = 0 
  959. local script_count = CheckBagItem ( cha , 3878 ) --检查背包中兑换券数量
  960. local DiamondId = Roll_DiamondId ( cha ) --随机兑换宝石的种类
  961. if script_count >= 1 then 
  962. x_del = DelBagItem ( cha , 3878 , 1 ) 
  963. if x_del == 1 then 
  964. x_give = GiveItem ( cha , 0 , DiamondId , 1 , 102 ) --兑换宝石
  965. y_give = GiveItem ( cha , 0 , 885 , 1 , 102 ) --兑换精炼石
  966. else 
  967. SystemNotice ( cha , "无法正确扣除宝石兑换券" ) 
  968. end 
  969. else 
  970. SystemNotice ( cha , "背包内需要二级精炼兑换券才可兑换"  ) 
  971. end 
  972. if x_give == 1 and y_give ==1 then 
  973. return 1 
  974. else 
  975. return 0 
  976. end 
  977. end 
  978. -------------------------------圣诞祝福
  979. function GetChaName_0 ( role,npc  )
  980. local cha_name = GetChaDefaultName ( role )
  981. local Money_Need = 1000
  982. local Money_Have = GetChaAttr ( role , ATTR_GD )
  983. local item_num = CheckBagItem( role, 2887 )
  984. if Money_Need > Money_Have or item_num <=0 then
  985. SystemNotice( role ,"身上没有圣诞卡或金钱不足")
  986. else
  987. end
  988. if Money_Have >= Money_Need and item_num >0 then
  989. TakeMoney(role,nil,Money_Need)
  990. TakeItem( role, 0,2887, 1 )
  991. PlayEffect( npc, 361 )
  992. ScrollNotice(" 来自 "..cha_name.." 的圣诞祝福:白雪飘飘,鹿铃霄霄,甜蜜的平安夜又来到,小手摆摆,舞姿曼曼,快乐的圣诞节日多美好.",1)
  993. else
  994. end
  995. end
  996. -------------------------------------------
  997. function GetChaName_1 ( role,npc )
  998. local cha_name = GetChaDefaultName ( role )
  999. local Money_Need = 1000
  1000. local Money_Have = GetChaAttr ( role , ATTR_GD )
  1001. local item_num = CheckBagItem( role, 2887 )
  1002. if Money_Need > Money_Have or item_num <=0 then
  1003. SystemNotice( role ,"身上没有圣诞卡或金钱不足")
  1004. else
  1005. end
  1006. if Money_Have >= Money_Need and item_num >0 then
  1007. TakeMoney(role,nil,Money_Need)
  1008. TakeItem( role, 0,2887, 1 )
  1009. PlayEffect( npc, 361 )
  1010. ScrollNotice(" 来自 "..cha_name.." 的圣诞祝福:每一朵雪花飘下,每一个烟火燃起,每一秒时间流动,每一份思念传送,都代表着我想要送你的每一个祝福,圣诞快乐!",1)
  1011. else
  1012. end
  1013. end
  1014. ---------------------------------------
  1015. function GetChaName_2 ( role,npc )
  1016. local cha_name = GetChaDefaultName ( role )
  1017. local Money_Need = 1000
  1018. local Money_Have = GetChaAttr ( role , ATTR_GD )
  1019. local item_num = CheckBagItem( role, 2887 )
  1020. if Money_Need > Money_Have or item_num <=0 then
  1021. SystemNotice( role ,"身上没有圣诞卡或金钱不足")
  1022. else
  1023. end
  1024. if Money_Have >= Money_Need and item_num >0 then
  1025. TakeMoney(role,nil,Money_Need)
  1026. TakeItem( role, 0,2887, 1 )
  1027. PlayEffect( npc, 361 )
  1028. ScrollNotice(" 来自 "..cha_name.." 的美丽愿望:以前的圣诞节,总是认为圣诞老人不会将最好的礼物降临给我,但今年的圣诞节不同,有你的到来,让我永远记住今天.",1)
  1029. else
  1030. end
  1031. end
  1032. -----------------------------------------
  1033. function GetChaName_3 ( role,npc )
  1034. local cha_name = GetChaDefaultName ( role )
  1035. local Money_Need = 1000
  1036. local Money_Have = GetChaAttr ( role , ATTR_GD )
  1037. local item_num = CheckBagItem( role, 2887 )
  1038. if Money_Need > Money_Have or item_num <=0 then
  1039. SystemNotice( role ,"身上没有圣诞卡或金钱不足")
  1040. else
  1041. end
  1042. if Money_Have >= Money_Need and item_num >0 then
  1043. TakeMoney(role,nil,Money_Need)
  1044. TakeItem( role, 0,2887, 1 )
  1045. PlayEffect( npc, 361 )
  1046. ScrollNotice(" 来自 "..cha_name.." 的圣诞祝福:圣诞节到了,向支持我的朋友和我所爱的朋友说声感谢,感谢你走进我的生活,我会尽我最大的努力给你无限的快乐!",1)
  1047. else
  1048. end
  1049. end
  1050. -----------------------------------------
  1051. function GetChaName_26 ( role,npc )
  1052. local cha_name = GetChaDefaultName ( role )
  1053. local Money_Need = 1000
  1054. local Money_Have = GetChaAttr ( role , ATTR_GD )
  1055. local item_num = CheckBagItem( role, 2887 )
  1056. if Money_Need > Money_Have or item_num <=0 then
  1057. SystemNotice( role ,"身上没有圣诞卡或金钱不足")
  1058. else
  1059. end
  1060. if Money_Have >= Money_Need and item_num >0 then
  1061. TakeMoney(role,nil,Money_Need)
  1062. TakeItem( role, 0,2887, 1 )
  1063. PlayEffect( npc, 361 )
  1064. ScrollNotice(""..cha_name.." 仰天长叹:能不能在下个圣诞节之前别再让我当乱斗之王,工会战不要次次都赢,上天,赐予我一个强劲的对手吧,阿门……",1)
  1065. else
  1066. end
  1067. end
  1068. -----------------------------------------
  1069. function GetChaName_27 ( role,npc )
  1070. local cha_name = GetChaDefaultName ( role )
  1071. local Money_Need = 1000
  1072. local Money_Have = GetChaAttr ( role , ATTR_GD )
  1073. local item_num = CheckBagItem( role, 2887 )
  1074. if Money_Need > Money_Have or item_num <=0 then
  1075. SystemNotice( role ,"身上没有圣诞卡或金钱不足")
  1076. else
  1077. end
  1078. if Money_Have >= Money_Need and item_num >0 then
  1079. TakeMoney(role,nil,Money_Need)
  1080. TakeItem( role, 0,2887, 1 )
  1081. PlayEffect( npc, 361 )
  1082. ScrollNotice(""..cha_name.." 仰天狂叫:哈里路亚,妈妈咪呀,主啊……赐我一个妞吧",1)
  1083. else
  1084. end
  1085. end
  1086. -----------------------------------------
  1087. function GetChaName_28 ( role,npc )
  1088. local cha_name = GetChaDefaultName ( role )
  1089. local Money_Need = 1000
  1090. local Money_Have = GetChaAttr ( role , ATTR_GD )
  1091. local item_num = CheckBagItem( role, 2887 )
  1092. if Money_Need > Money_Have or item_num <=0 then
  1093. SystemNotice( role ,"身上没有圣诞卡或金钱不足")
  1094. else
  1095. end
  1096. if Money_Have >= Money_Need and item_num >0 then
  1097. TakeMoney(role,nil,Money_Need)
  1098. TakeItem( role, 0,2887, 1 )
  1099. PlayEffect( npc, 361 )
  1100. ScrollNotice(""..cha_name.." 祝福自己好运天天交,生活步步高,彩票期期中,打牌次次赢,口味顿顿好,若敢把我忘,小心挨棍棒",1)
  1101. else
  1102. end
  1103. end
  1104. ---------------------------------Leo的团队之星兑换
  1105. function Transfer_TeamStar( role , level )
  1106. local cha = TurnToCha ( role )  
  1107. local script_count = CheckBagItem ( cha , 1034 )--取背包数量
  1108. local chaLV =  GetChaAttr( cha , ATTR_LV)--取等级
  1109. local job = GetChaAttr( role, ATTR_JOB) --取职业
  1110. if script_count >= 1 then
  1111. if chaLV < 41 then
  1112. SystemNotice(role,"您的团队之星暂时还没老旧,请你41级以后再来吧")
  1113. else
  1114. if job ~= 12 and job ~= 9 and job ~= 16 and job ~= 8 and job ~= 13 and job ~=14 then
  1115. SystemNotice(role,"必须是二转职业才能使用哦,请去各大城市找职业NPC完成二转职业任务再来兑换吧~")
  1116. else
  1117. local x_del = DelBagItem ( cha , 1034 , 1 ) 
  1118. if x_del == 1 then 
  1119. if job == 12 then --狙击
  1120. GiveItem( role , 0 , 1409  , 1 , 22 )
  1121. elseif job == 9 then --双剑
  1122. GiveItem( role , 0 , 1392  , 1 , 22 )
  1123. elseif job == 16 then --航海
  1124. GiveItem( role , 0 , 1419  , 1 , 22 )
  1125. elseif job == 8 then --巨剑
  1126. GiveItem( role , 0 , 1382  , 1 , 22 )
  1127. elseif job == 13 then --圣职
  1128. GiveItem( role , 0 ,1433  , 1 , 22 )
  1129. elseif job == 14 then --封印
  1130. GiveItem( role , 0 , 1467  , 1 , 22 )
  1131. end
  1132. else 
  1133. SystemNotice ( cha , "无法正确扣除团队之星" ) 
  1134. end 
  1135. end
  1136. end
  1137. else 
  1138. SystemNotice ( cha , "背包内需要团队之星才可以换领"  ) 
  1139. end 
  1140. end
  1141. --宝石兑换卷
  1142. --Lv1 一级宝石兑换券
  1143. --Lv2 二级宝石兑换券
  1144. --Lv3 精炼石兑换券
  1145. --Lv4 宝石兑换券
  1146. function TransferDiamond( role , level )
  1147. local ret = KitbagLock(role,0)
  1148. if ret ~= LUA_TRUE then
  1149. SystemNotice(role,"背包被锁定无法兑换")
  1150. return
  1151. end
  1152. local retbag
  1153. if level == 1 then
  1154. retbag = HasLeaveBagGrid( role, 2)
  1155. if retbag ~= LUA_TRUE then
  1156. SystemNotice(role,"背包空格少于2个无法兑换")
  1157. return 
  1158. end
  1159. Transfer_DiamondScript_Lv1 ( role )
  1160. elseif level == 2 then 
  1161. retbag = HasLeaveBagGrid( role, 2)
  1162. if retbag ~= LUA_TRUE then
  1163. SystemNotice(role,"背包空格少于2个无法兑换")
  1164. return 
  1165. end
  1166. Transfer_DiamondScript_Lv2 ( role )
  1167. elseif level == 3 then
  1168. retbag = HasLeaveBagGrid( role, 1)
  1169. if retbag ~= LUA_TRUE then
  1170. SystemNotice(role,"背包空格少于1个无法兑换")
  1171. return 
  1172. end
  1173. Transfer_OneStoneScript ( role )
  1174. elseif level == 4 then
  1175. retbag = HasLeaveBagGrid( role, 1)
  1176. if retbag ~= LUA_TRUE then
  1177. SystemNotice(role,"背包空格少于1个无法兑换")
  1178. return 
  1179. end
  1180. Transfer_OneDiamondScript ( role )
  1181. else
  1182. LG( "BSduihuan","兑换卷等级非法" )
  1183. end
  1184. end
  1185. --精炼石兑换卷
  1186. function Transfer_OneStoneScript ( role )
  1187. local cha = TurnToCha ( role ) 
  1188. local y_give = 0 
  1189. local script_count = CheckBagItem ( cha , 3885 ) --检查背包中兑换券数量
  1190. if script_count >= 1 then 
  1191. x_del = DelBagItem ( cha , 3885 , 1 ) 
  1192. if x_del == 1 then 
  1193. y_give = GiveItem ( cha , 0 , 885 , 1 , 101 ) --兑换精炼石
  1194. else 
  1195. SystemNotice ( cha , "无法正确扣除宝石兑换券" ) 
  1196. end 
  1197. else 
  1198. SystemNotice ( cha , "背包内需要精炼石兑换券才可兑换"  ) 
  1199. end 
  1200. if y_give ==1 then 
  1201. return 1 
  1202. else 
  1203. return 0 
  1204. end
  1205. end
  1206. --一个宝石兑换券
  1207. function Transfer_OneDiamondScript ( role )
  1208. local cha = TurnToCha ( role ) 
  1209. local x_give = 0 
  1210. local y_give = 0 
  1211. local script_count = CheckBagItem ( cha , 3886 ) --检查背包中兑换券数量
  1212. local DiamondId = Roll_DiamondId ( cha ) --随机兑换宝石的种类
  1213. if script_count >= 1 then 
  1214. x_del = DelBagItem ( cha , 3886 , 1 ) 
  1215. if x_del == 1 then 
  1216. x_give = GiveItem ( cha , 0 , DiamondId , 1 , 101 ) --兑换宝石
  1217. else 
  1218. SystemNotice ( cha , "无法正确扣除宝石兑换券" ) 
  1219. end 
  1220. else 
  1221. SystemNotice ( cha , "背包内需要宝石兑奖券才可兑换"  ) 
  1222. end 
  1223. if x_give == 1 then 
  1224. return 1 
  1225. else 
  1226. return 0 
  1227. end 
  1228. end 
  1229. --精炼内容负值转换
  1230. function TansferNum ( Num )
  1231. if Num < 0 then
  1232. Num = Num + 4294967296
  1233. end
  1234. return Num
  1235. end
  1236. --打磨内容相关脚本
  1237. --是否可以打磨
  1238. function can_milling_item (...)
  1239. -- Notice("开始判断")
  1240. if arg.n ~= 12 then
  1241. -- Notice("参数个数非法"..arg.n)
  1242. return 0
  1243. end
  1244. local kkk = 0
  1245. -- for kkk = 2 , arg.n ,1 do
  1246. -- SystemNotice ( arg[1] , arg[kkk])
  1247. -- end
  1248. local Check = 0
  1249. -- SystemNotice( arg[1] , "调用合成检测主函数")
  1250. Check = can_milling_item_main ( arg )
  1251. if Check == 1 then
  1252. -- SystemNotice (arg[1] , "返回1 ")
  1253. return 1
  1254. else
  1255. -- SystemNotice (arg[1] , "返回0 ")
  1256. return 0
  1257. end
  1258. end
  1259. --是否可以打磨主函数
  1260. function can_milling_item_main ( Table )
  1261. local role = 0
  1262. local ItemBag = {} --道具背包位置
  1263. local ItemCount = {} --道具数量
  1264. local ItemBagCount = {} --道具对象数量
  1265. local Get_Count = 4
  1266. local ItemReadCount = 0
  1267. local ItemReadNow = 1
  1268. local ItemReadNext = 0
  1269. local ItemBag_Now = 0
  1270. local ItemCount_Now = 0
  1271. local ItemBagCount_Num = 0
  1272. -- SystemNotice( arg[1] , "开始调用参数解析")
  1273. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Now , ItemCount_Now , ItemBagCount_Num = Read_Table ( Table )
  1274. local ItemBag_damo = ItemBag [0]
  1275. local Item_damo = GetChaItem ( role , 2 , ItemBag_damo ) --读取打磨道具的指针
  1276. local Item_Cailiao1 = GetChaItem ( role , 2 , ItemBag [1] ) --读取打磨材料1的指针
  1277. local Item_Cailiao2 = GetChaItem ( role , 2 , ItemBag [2] ) --读取打磨材料2的指针
  1278. local Check_Cailiao1 = 0
  1279. local Check_Cailiao2 = 0
  1280. Check_Cailiao1 = Check_Jiaguji ( Item_Cailiao1 , Item_Cailiao2 )
  1281. Check_Cailiao2 = Check_Cuihuafen ( Item_Cailiao1 , Item_Cailiao2 )
  1282. if Check_Cailiao1 == 0 then
  1283. SystemNotice ( role , "打磨过程需要装备加固剂" )
  1284. return 0
  1285. end
  1286. if Check_Cailiao2 == 0 then
  1287. SystemNotice ( role , "打磨过程需要装备催化粉" )
  1288. return 0
  1289. end
  1290. local MJdamo_ItemID = GetItemID (Item_damo)--------检测打洞装备是否是魔剑
  1291. if MJdamo_ItemID == 6347 then
  1292. SystemNotice( role ,"无法给魔剑打磨!")
  1293. return 0
  1294. end
  1295. local BB95_qiecaidaoId = GetItemID (Item_damo)--------检测打洞装备是否是切菜刀
  1296. if BB95_qiecaidaoId == 6473 then
  1297. SystemNotice( role ,"无法给切菜刀打磨!")
  1298. return 0
  1299. end
  1300. local BB95_sheriId = GetItemID (Item_damo)--------检测打洞装备是否是射日专用
  1301. if BB95_sheriId == 6474 then
  1302. SystemNotice( role ,"无法给射日专用打磨!")
  1303. return 0
  1304. end
  1305. local BB95_ak47Id = GetItemID (Item_damo)--------检测打洞装备是否是AK47
  1306. if BB95_ak47Id == 6475 then
  1307. SystemNotice( role ,"无法给AK47打磨!")
  1308. return 0
  1309. end
  1310. local BB95_shoushudaoId = GetItemID (Item_damo)--------检测打洞装备是否是手术刀
  1311. if BB95_shoushudaoId == 6476 then
  1312. SystemNotice( role ,"无法给手术刀打磨!")
  1313. return 0
  1314. end
  1315. local BB95_dakandaoId = GetItemID (Item_damo)--------检测打洞装备是否是大砍刀
  1316. if BB95_dakandaoId == 6477 then
  1317. SystemNotice( role ,"无法给大砍刀打磨!")
  1318. return 0
  1319. end
  1320. local BB95_laonainaiId = GetItemID (Item_damo)--------检测打洞装备是否是老奶奶的拐杖
  1321. if BB95_laonainaiId == 6478 then
  1322. SystemNotice( role ,"无法给老奶奶的拐杖打磨!")
  1323. return 0
  1324. end
  1325. local BB95_yadiannaId = GetItemID (Item_damo)--------检测打洞装备是否是雅典娜的杖
  1326. if BB95_yadiannaId == 6479 then
  1327. SystemNotice( role ,"无法给雅典娜的神杖打磨!")
  1328. return 0
  1329. end
  1330. local MianJu = GetItemID (Item_damo)--------检测打洞装备是否是魔剑
  1331. if MianJu == 1122 or MianJu==1121 then
  1332. SystemNotice( role ,"无法给万圣节面具打磨!")
  1333. return 0
  1334. end
  1335. local Check_Hole = 0
  1336. Check_Hole = Check_HasHole ( Item_damo )
  1337. if Check_Hole >= 3 then
  1338. SystemNotice ( role , "孔数已达上限,无法继续打磨" )
  1339. return 0
  1340. end
  1341. local Money_Need = get_milling_money_main ( Table )
  1342. local Money_Have = GetChaAttr ( role , ATTR_GD )
  1343. if Money_Need > Money_Have then
  1344. SystemNotice( role ,"金钱不足,不能进行打磨")
  1345. return 0
  1346. end
  1347. return 1
  1348. end
  1349. --计算打磨费用
  1350. function get_item_milling_money(...)
  1351. -- Notice("计算费用")
  1352. local Money = get_milling_money_main ( arg )
  1353. return Money
  1354. end
  1355. --计算打磨费用主函数
  1356. function get_milling_money_main ( Table )
  1357. local role = 0
  1358. local ItemBag = {} --道具背包位置
  1359. local ItemCount = {} --道具数量
  1360. local ItemBagCount = {} --道具对象数量
  1361. local Get_Count = 4
  1362. local ItemReadCount = 0
  1363. local ItemReadNow = 1
  1364. local ItemReadNext = 0
  1365. local ItemBag_Num = 0
  1366. local ItemCount_Num = 0
  1367. local ItemBagCount_Num = 0
  1368. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
  1369. local ItemBag_damo = ItemBag [0]
  1370. local Item_damo = GetChaItem ( role , 2 , ItemBag_damo )
  1371. local Hole_Num = 0
  1372. local Num = GetItemForgeParam ( Item_damo , 1 )
  1373. Num = TansferNum ( Num )
  1374. Hole_Num = GetNum_Part1 ( Num )
  1375. local Money_Need = ( Hole_Num + 1 ) * 50000
  1376. -- Notice("计算结束")
  1377. return Money_Need
  1378. end
  1379. --开始打磨
  1380. function begin_milling_item (...)
  1381. -- Notice("进入精炼")
  1382. local Check_CanMilling = 0
  1383. Check_CanMilling = can_milling_item_main ( arg )
  1384. if Check_CanMilling == 0 then
  1385. return 0
  1386. end
  1387. local role = 0
  1388. local ItemBag = {} --道具背包位置
  1389. local ItemCount = {} --道具数量
  1390. local ItemBagCount = {} --道具对象数量
  1391. local Get_Count = 4
  1392. local ItemReadCount = 0
  1393. local ItemReadNow = 1
  1394. local ItemReadNext = 0
  1395. local ItemBag_Num = 0
  1396. local ItemCount_Num = 0
  1397. local ItemBagCount_Num = 0
  1398. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( arg )
  1399. local ItemBag_damo = ItemBag [0]
  1400. local Item_damo = GetChaItem ( role , 2 , ItemBag_damo )
  1401. local Item_cailiao1 = GetChaItem ( role , 2 , ItemBag [1] )
  1402. local Item_cailiao2 = GetChaItem ( role , 2 , ItemBag [2] )
  1403. local Money_Need = get_milling_money_main ( arg )
  1404. local Money_Have = GetChaAttr ( role , ATTR_GD )
  1405. -- Notice ("目前有"..Money_Have.."这么多的钱")
  1406. -- Notice ("要扣除"..Money_Need.."这么多的钱")
  1407. Money_Have = Money_Have - Money_Need
  1408. SetCharaAttr ( Money_Have , role , ATTR_GD )
  1409. ALLExAttrSet( role )
  1410. local ItemID_Cailiao1 = GetItemID ( Item_cailiao1 )
  1411. local ItemID_Cailiao2 = GetItemID ( Item_cailiao2 )
  1412. local R1 = 0
  1413. local R2 = 0
  1414. R1 = RemoveChaItem ( role , ItemID_Cailiao1 , 1 , 2 , ItemBag [1] , 2 , 1 , 0 ) --移除材料1
  1415. R2 = RemoveChaItem ( role , ItemID_Cailiao2 , 1 , 2 , ItemBag [2] , 2 , 1 , 0 ) --移除材料2
  1416. if R1 == 0 or R2 == 0 then
  1417. LG( "Damo" , "移除材料失败" )
  1418. end
  1419. local Sklv = 1
  1420. local b = Check_CG_damo ( Item_damo , Sklv )
  1421. if b == 0 then
  1422. Damo_Shibai ( role , Item_damo )
  1423. return 2
  1424. end
  1425. -- Notice("精炼结束")
  1426. Damo_ChengGong ( role , Item_damo )
  1427. local cha_name = GetChaDefaultName ( role )
  1428. LG( "JingLian_ShiBai" , "玩家"..cha_name.."打磨成功" )
  1429. return 1
  1430. end
  1431. --打磨相关函数
  1432. --检查是否有加固剂
  1433. function Check_Jiaguji ( Item_Cailiao1 , Item_Cailiao2 )
  1434. local ItemID_Cailiao1 = GetItemID ( Item_Cailiao1 )
  1435. local ItemID_Cailiao2 = GetItemID ( Item_Cailiao2 )
  1436. if ItemID_Cailiao1 == 890 then
  1437. return 1
  1438. elseif ItemID_Cailiao2 == 890 then
  1439. return 1
  1440. end
  1441. return 0
  1442. end
  1443. --检查是否有催化粉
  1444. function Check_Cuihuafen ( Item_Cailiao1 , Item_Cailiao2 )
  1445. local ItemID_Cailiao1 = GetItemID ( Item_Cailiao1 )
  1446. local ItemID_Cailiao2 = GetItemID ( Item_Cailiao2 )
  1447. if ItemID_Cailiao1 == 891 then
  1448. return 1
  1449. elseif ItemID_Cailiao2 == 891 then
  1450. return 1
  1451. end
  1452. return 0
  1453. end
  1454. --检查孔数
  1455. function  Check_HasHole ( Item_damo )
  1456. local Num = GetItemForgeParam ( Item_damo , 1 )
  1457. Num = TansferNum ( Num )
  1458. local Hole_Num = GetNum_Part1 ( Num )
  1459. return Hole_Num
  1460. end
  1461. --判断打磨是否成功
  1462. function Check_CG_damo ( Item_damo , Sklv )
  1463. local a = 0
  1464. local Hole_Num = Check_HasHole ( Item_damo )
  1465. if Hole_Num == 0 then
  1466. a = 1
  1467. end
  1468. if Hole_Num == 1 then
  1469. a = 1
  1470. end
  1471. if Hole_Num == 2 then
  1472. a = 1
  1473. end
  1474. local b = Percentage_Random ( a )
  1475. return b
  1476. end
  1477. --打磨失败
  1478. function Damo_Shibai ( role , Item_damo )
  1479. -- local Num = GetItemForgeParam ( Item_damo , 1 )
  1480. -- local i = 0
  1481. -- Num = TansferNum ( Num )
  1482. -- local Hole_Num = GetNum_Part1 ( Num )
  1483. -- if Hole_Num >= 1 then
  1484. -- local a = 0.7
  1485. -- local b = Percentage_Random ( a )
  1486. -- if b == 0 then
  1487. -- SystemNotice ( role , "打磨失败了,装备上原有的一个孔消失了" )
  1488. -- Hole_Num = Hole_Num - 1
  1489. -- Delete_Forge_Eff ( role , Item_damo )
  1490. -- else
  1491. -- SystemNotice ( role , "打磨失败了,还好装备没有损坏" )
  1492. -- end
  1493. -- else
  1494. local cha_name = GetChaDefaultName ( role )
  1495. LG( "JingLian_ShiBai" , "玩家"..cha_name.."打磨失败" )
  1496. SystemNotice ( role , "打磨失败了,还好装备没有损坏" )
  1497. -- end
  1498. -- Num = SetNum_Part1 ( Num , Hole_Num )
  1499. -- i = SetItemForgeParam ( Item_damo , 1 , Num )
  1500. -- if i == 0 then
  1501. -- LG( "Damo" , "设置精炼内容失败" )
  1502. -- end
  1503. end
  1504. --打磨成功
  1505. function Damo_ChengGong ( role , Item_damo )
  1506. local Num = GetItemForgeParam ( Item_damo , 1 )
  1507. local i = 0
  1508. Num = TansferNum ( Num )
  1509. local Hole_Num = GetNum_Part1 ( Num )
  1510. if Hole_Num <= 3 then
  1511. SystemNotice ( role , "打磨成功了,装备上获得了一个新的孔" )
  1512. Hole_Num = Hole_Num + 1
  1513. else
  1514. SystemNotice ( role , "装备孔数已达上限,无法再获得新的孔" )
  1515. end
  1516. Num = SetNum_Part1 ( Num , Hole_Num )
  1517. i = SetItemForgeParam ( Item_damo , 1 , Num )
  1518. if i == 0 then
  1519. LG( "Damo" , "设置精炼内容失败" )
  1520. end
  1521. end
  1522. --去处装备上一个精炼效果
  1523. function Delete_Forge_Eff ( role , Item_damo )
  1524. local Jinglian_Lv = GetItem_JinglianLv ( Item_damo )
  1525. if Jinglian_Lv == 0 then
  1526. return
  1527. end
  1528. local Num = GetItemForgeParam ( Item_damo , 1 )
  1529. local Item_Stone = {}
  1530. local Item_StoneLv = {}
  1531. Item_Stone[0] = GetNum_Part2 ( Num )
  1532. Item_Stone[1] = GetNum_Part4 ( Num )
  1533. Item_Stone[2] = GetNum_Part6 ( Num )
  1534. Item_StoneLv[0] = GetNum_Part3 ( Num )
  1535. Item_StoneLv[1] = GetNum_Part5 ( Num )
  1536. Item_StoneLv[2] = GetNum_Part7 ( Num )
  1537. local j = 0
  1538. local Del = 0
  1539. for j = 2 , 0 , -1 do
  1540. if Del == 0 then
  1541. if Item_Stone [j] ~= 0 or Item_StoneLv[j] ~= 0 then
  1542. Item_Stone[j] = 0
  1543. Item_StoneLv[j] = 0
  1544. Del = 1
  1545. end
  1546. end
  1547. end
  1548. Num = SetNum_Part2( Num , Item_Stone[0] )
  1549. Num = SetNum_Part4( Num , Item_Stone[1] )
  1550. Num = SetNum_Part6( Num , Item_Stone[2] )
  1551. Num = SetNum_Part3( Num , Item_StoneLv[0] )
  1552. Num = SetNum_Part5( Num , Item_StoneLv[1] )
  1553. Num = SetNum_Part7( Num , Item_StoneLv[2] )
  1554. local i = 0
  1555. i = SetItemForgeParam ( Item_damo , 1 , Num )
  1556. if i == 0 then
  1557. LG( "Damo" , "设置精炼内容失败" )
  1558. end
  1559. SystemNotice ( role , "消失了一个精炼效果" )
  1560. end
  1561. --熔合
  1562. --判断是否能够熔合,熔合函数入口
  1563. function can_fusion_item(...)
  1564. -- Notice ( "判断是否可以熔合")
  1565. if arg.n ~= 12 and arg.n ~= 14 then
  1566. SystemNotice ( arg[1] , "参数个数非法"..arg.n )
  1567. return 0
  1568. end
  1569. -- local kkk = 0
  1570. -- for kkk = 2 , arg.n ,1 do
  1571. -- SystemNotice ( arg[1] , arg[kkk])
  1572. -- end
  1573. local Check = 0
  1574. Check = can_fusion_item_main ( arg )
  1575. if Check == 1 then
  1576. return 1
  1577. else
  1578. return 0
  1579. end
  1580. end
  1581. --检测是否可以熔合主函数
  1582. function can_fusion_item_main ( Table )
  1583. local role = 0
  1584. local ItemBag = {} --道具背包位置
  1585. local ItemCount = {} --道具数量
  1586. local ItemBagCount = {} --道具对象数量
  1587. local ItemBag_Now = 0
  1588. local ItemCount_Now = 0
  1589. local ItemBagCount_Num = 0
  1590. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Now , ItemCount_Now , ItemBagCount_Num = Read_Table ( Table )
  1591. --------道具数量判断
  1592. if ItemCount [1] ~= 1 or ItemCount [2] ~= 1 or ItemBagCount [1] ~= 1 or ItemBagCount [2] ~= 1 then
  1593. SystemNotice ( role ,"装备数量非法")
  1594. return 0
  1595. end
  1596. --------取出道具指针
  1597. local Item_Juanzhou = GetChaItem ( role , 2 , ItemBag [0] ) --卷轴指针
  1598. local Item_Waiguan = GetChaItem ( role , 2 , ItemBag [1] ) --外观道具指针
  1599. local Item_Shuxing = GetChaItem ( role , 2 , ItemBag [2] ) --属性道具指针
  1600. --------卷轴类型判断
  1601. local  ItemType_Juanzhou = GetItemType ( Item_Juanzhou )
  1602. if ItemType_Juanzhou ~= 60 then
  1603. SystemNotice( role ,"卷轴使用错误")
  1604. return 0
  1605. end
  1606. --------外观道具ID判断
  1607.     local ItemID_Waiguan = GetItemAttr ( Item_Waiguan , ITEMATTR_MAXURE )
  1608. if ItemID_Waiguan ~= 25000 then
  1609. SystemNotice( role ,"该装备不可被赋予属性")
  1610. return 0
  1611. end
  1612. --------外观道具耐久判断
  1613.    local Item_URE = GetItemAttr ( Item_Waiguan , ITEMATTR_URE )
  1614. local Item_MAXENERGY = GetItemAttr ( Item_Waiguan , ITEMATTR_MAXURE )
  1615. if Item_URE < Item_MAXENERGY then
  1616. SystemNotice( role ,"装备耐久未达最大,不可被赋予属性")
  1617. return 0
  1618. end
  1619. --------最初外观道具判断
  1620.    local Item_FUSIONID_star = GetItemAttr ( Item_Shuxing , ITEMATTR_VAL_FUSIONID )
  1621. local ItemID_shuxing_star =  GetItemAttr ( Item_Shuxing ,ITEMATTR_MAXURE )
  1622. if Item_FUSIONID_star ==0  and ItemID_shuxing_star == 25000 then
  1623. SystemNotice( role ,"右侧装备无属性,不能融合!")
  1624. return 0
  1625. end
  1626. --------属性道具ID判断
  1627. local ShuXing_ItemID = GetItemID (Item_Shuxing)
  1628. if ShuXing_ItemID >= 6165 and ShuXing_ItemID <= 6196 then
  1629. SystemNotice( role ,"该装备为封印状态,不能溶合!")
  1630. return 0
  1631. elseif ShuXing_ItemID >= 6270 and ShuXing_ItemID <= 6293 then
  1632. SystemNotice( role ,"该装备不能溶合!")
  1633. return 0
  1634. elseif ShuXing_ItemID == 6347 then
  1635. SystemNotice( role ,"魔剑无法被熔合!")
  1636. return 0
  1637. elseif ShuXing_ItemID == 1122 or ShuXing_ItemID == 1121 then
  1638. SystemNotice( role ,"节日面具不能被融合")
  1639. return 0
  1640. elseif ShuXing_ItemID == 6473 then
  1641. SystemNotice( role ,"切菜刀无法被熔合!")
  1642. return 0
  1643. elseif ShuXing_ItemID == 6474 then
  1644. SystemNotice( role ,"射日专用无法被熔合!")
  1645. return 0
  1646. elseif ShuXing_ItemID == 6475 then
  1647. SystemNotice( role ,"AK47无法被熔合!")
  1648. return 0
  1649. elseif ShuXing_ItemID == 6476 then
  1650. SystemNotice( role ,"手术刀无法被熔合!")
  1651. return 0
  1652. elseif ShuXing_ItemID == 6477 then
  1653. SystemNotice( role ,"大砍刀无法被熔合!")
  1654. return 0
  1655. elseif ShuXing_ItemID == 6478 then
  1656. SystemNotice( role ,"老奶奶的拐杖无法被熔合!")
  1657. return 0
  1658. elseif ShuXing_ItemID == 6479 then
  1659. SystemNotice( role ,"雅典娜的杖无法被熔合!")
  1660. return 0
  1661. end
  1662. --------属性道具类型判断
  1663. local ItemType_Shuxing = GetItemType (Item_Shuxing)
  1664. if  ItemType_Shuxing < 1  then
  1665. SystemNotice( role ,"该装备不具有可以转移给其他装备的属性")
  1666. return 0
  1667. elseif ItemType_Shuxing > 11 and  ItemType_Shuxing < 20 then
  1668. SystemNotice( role ,"该装备不具有可以转移给其他装备的属性")
  1669. return 0
  1670. elseif ItemType_Shuxing > 24  and ItemType_Shuxing ~= 27 then
  1671. SystemNotice( role ,"该装备不具有可以转移给其他装备的属性")
  1672. return 0
  1673. end
  1674. --------外观和属性道具是否为同一类型
  1675. local ItemType_Shuxing = GetItemType ( Item_Shuxing )
  1676. local ItemType_Waiguan = GetItemType ( Item_Waiguan )
  1677. local star=0
  1678. if ItemType_Shuxing ~= 22 and ItemType_Shuxing ~=27 then ----既不是纹身也不是衣服
  1679. star = 1
  1680. end
  1681. if ItemType_Waiguan~=27  then
  1682. if ItemType_Shuxing ~= ItemType_Waiguan then
  1683. SystemNotice( role ,"两件装备类型不同" )
  1684. return 0
  1685. end 
  1686. elseif ItemType_Waiguan==27 and star == 1 then
  1687. SystemNotice( role ,"两件装备类型不同" )
  1688. return 0
  1689. end
  1690. --------外观和属性道具是否为同一体型和职业限制
  1691. local Check_RongHe = 0
  1692. Check_RongHe = CheckFusionItem( Item_Waiguan , Item_Shuxing )
  1693. if Check_RongHe == LUA_FALSE then
  1694. SystemNotice( role ,"两个装备的体型或者职业限制不相同" )
  1695. return 0
  1696. end
  1697. --------是否放的是催化剂
  1698. if ItemBagCount[3] == 0 then
  1699. local Item_Waiguan_name = GetItemName ( ItemID_Waiguan )
  1700. LG("Ronghe_CuiHuaJi","在未放入催化剂的情况下融合装备",Item_Waiguan_name,"无精炼效果")
  1701. end
  1702. if ItemBagCount[3] ~= 0 then
  1703. local Item_Cuihuaji =  GetChaItem ( role , 2 , ItemBag [3] )
  1704. local ItemType_Cuihuaji =  GetItemType ( Item_Cuihuaji )
  1705. if  ItemType_Cuihuaji ~= 61 then
  1706. SystemNotice( role ,"催化剂好像有问题,无法熔合" )
  1707. return 0
  1708. end
  1709. end
  1710. --------身上金钱判断
  1711. local Money_Need = getfusion_money_main ( Table )
  1712. local Money_Have = GetChaAttr ( role , ATTR_GD )
  1713. if Money_Need > Money_Have then
  1714. SystemNotice( role ,"金钱不足,不能熔合")
  1715. return 0
  1716. end
  1717. --SystemNotice(role ,"判断结束 ")
  1718. return 1
  1719. end
  1720. --开始熔合,熔合主程序入口
  1721. function begin_fusion_item(...)
  1722. -- Notice("进入熔合")
  1723. --------是否可以融合检测
  1724. local Check_Canfusion = 0
  1725. Check_Canfusion = can_fusion_item_main ( arg )
  1726. if Check_Canfusion == 0 then
  1727. return 0
  1728. end
  1729. --------取出数据
  1730. local role = 0
  1731. local ItemBag = {} --道具背包位置
  1732. local ItemCount = {} --道具数量
  1733. local ItemBagCount = {} --道具对象数量
  1734. local ItemBag_Num = 0
  1735. local ItemCount_Num = 0
  1736. local ItemBagCount_Num = 0
  1737. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( arg )
  1738. local Item_Juanzhou = GetChaItem ( role , 2 , ItemBag [0] )
  1739. local Item_Waiguan = GetChaItem ( role , 2 , ItemBag [1] )
  1740. local Item_Shuxing = GetChaItem ( role , 2 , ItemBag [2] )
  1741. local ItemID_Waiguan = GetItemID ( Item_Waiguan )
  1742. --------扣除金钱
  1743. local Money_Need = getfusion_money_main ( arg )
  1744. local Money_Have = GetChaAttr ( role , ATTR_GD )
  1745. -- Notice ("目前有"..Money_Have.."这么多的钱")
  1746. -- Notice ("要扣除"..Money_Need.."这么多的钱")
  1747. Money_Have = Money_Have - Money_Need
  1748. SetCharaAttr ( Money_Have , role , ATTR_GD )
  1749. ALLExAttrSet( role )
  1750. --------熔合过程
  1751. Check_Ronghe_Item = ronghe_item ( arg )
  1752. if Check_Ronghe_Item == 0  then
  1753. SystemNotice ( role ,"熔合失败,请检查程序")
  1754. end
  1755. --check_item_final_data ( Item_Waiguan )
  1756. SynChaKitbag(role,13)
  1757. --------Notice("熔合结束")
  1758. local cha_name = GetChaDefaultName ( role )
  1759. SystemNotice ( role ,"熔合成功")
  1760. local Item_Waiguan_name = GetItemName ( ItemID_Waiguan )
  1761. LG( "Ronghe_ShiBai" , "玩家"..cha_name.."熔合成功"..Item_Waiguan_name )
  1762. return 1
  1763. end
  1764. --计算熔合费用
  1765. function get_item_fusion_money(...)
  1766. -- Notice("计算费用")
  1767. local Money = getfusion_money_main ( arg )
  1768. return Money
  1769. end
  1770. --计算精练费用主函数
  1771. function getfusion_money_main ( Table )
  1772. local role = 0
  1773. local ItemBag = {} --道具背包位置数组
  1774. local ItemCount = {} --道具数量数组
  1775. local ItemBagCount = {} --道具对象数量数组
  1776. local ItemBag_Num = 0 --背包位置数组长度
  1777. local ItemCount_Num = 0 --道具数量数组长度
  1778. local ItemBagCount_Num = 0 --道具对象数量数组长度
  1779. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
  1780. local ItemBag_Shuxing = ItemBag [2]
  1781. local Item_Shuxing = GetChaItem ( role , 2 , ItemBag_Shuxing )
  1782. local Shuxing_Lv = 0
  1783. local Shuxing_Lv =  GetItemLv ( Item_Shuxing )
  1784. local Money_Need = Shuxing_Lv * 1000
  1785. -- Notice("计算结束")
  1786. return Money_Need
  1787. end
  1788. ----相关函数--------------------------------------------------------------------------------------------------------
  1789. ---开始熔合
  1790. function ronghe_item ( Table )
  1791. -- Notice("Ronghe_Item")
  1792. local role = 0
  1793. local ItemBag = {} --道具背包位置
  1794. local ItemCount = {} --道具数量
  1795. local ItemBagCount = {} --道具对象数量
  1796. local ItemBag_Num = 0
  1797. local ItemCount_Num = 0
  1798. local ItemBagCount_Num = 0
  1799. local ItemID_Cuihuaji = 0
  1800. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
  1801. local Item_Juanzhou = GetChaItem ( role , 2 , ItemBag [0] )
  1802. local Item_Waiguan = GetChaItem ( role , 2 , ItemBag [1] )
  1803. local Item_Shuxing = GetChaItem ( role , 2 , ItemBag [2] )
  1804. local ItemID_Juanzhou = GetItemID ( Item_Juanzhou )
  1805. local ItemID_Waiguan = GetItemID ( Item_Waiguan )
  1806. local ItemID_Shuxing = GetItemID ( Item_Shuxing )
  1807. ----------------==============
  1808. local ItemID_shuxing_maxure =  GetItemAttr ( Item_Shuxing ,ITEMATTR_MAXURE )
  1809. local ItemID_star = ItemID_Shuxing
  1810. local ItemID_star_maxure = ItemID_shuxing_maxure
  1811. local flg=0
  1812. if ItemBagCount[3] ~= 0 then
  1813. local Item_Cuihuaji = GetChaItem ( role , 2 , ItemBag [3] )
  1814. ItemID_Cuihuaji = GetItemID ( Item_Cuihuaji )
  1815. flg=1
  1816. end
  1817. local Jinglianxinxi = GetItemForgeParam ( Item_Shuxing , 1 )
  1818. --------赋予熔合道具记录ID
  1819. ----------------==============
  1820. if ItemID_shuxing_maxure == 25000 then
  1821. ItemID_Shuxing = GetItemAttr( Item_Shuxing , ITEMATTR_VAL_FUSIONID )
  1822. SetItemAttr( Item_Waiguan , ITEMATTR_VAL_FUSIONID , ItemID_Shuxing )
  1823. else
  1824. SetItemAttr( Item_Waiguan , ITEMATTR_VAL_FUSIONID , ItemID_Shuxing )
  1825. end
  1826.  --------熔合道具
  1827. local Check_FusionItem = FusionItem ( Item_Waiguan, Item_Shuxing )
  1828. --------赋予熔合道具等级
  1829. local star_lv=0
  1830. if flg==1 then
  1831. if ItemID_shuxing_maxure < 25000 then 
  1832. star_lv=10
  1833. else
  1834. star_lv=GetItemAttr ( Item_Shuxing , ITEMATTR_VAL_LEVEL )                                     -- 设置熔合道具等级
  1835. end
  1836. else 
  1837. star_lv=10
  1838. end
  1839. --SystemNotice( role , "star_lv="..star_lv )
  1840. SetItemAttr ( Item_Waiguan , ITEMATTR_VAL_LEVEL , star_lv )                                     -- 设置熔合道具等级
  1841. --local i = GetItemAttr ( Item_Waiguan , ITEMATTR_VAL_LEVEL )
  1842. --SystemNotice( role , "装备等级="..i )
  1843. local hole_num = Check_HasHole ( Item_Shuxing )
  1844. if Check_FusionItem == 0    then
  1845. SystemNotice( role , "熔合失败")
  1846. return
  1847. -- else 
  1848. -- for Check_FusionItem = 1 , 49 , 1 do
  1849. -- RO = GetItemAttr ( Item_Waiguan , Check_FusionItem )
  1850. -- SystemNotice( role , "属性"..Check_FusionItem.."="..RO )
  1851. -- end
  1852. end
  1853. --------移出道具
  1854. ----------------------------------
  1855. ----------------------------------此处打LG
  1856. local Item_Shuxing_ENERGY  = GetItemAttr ( Item_Shuxing , ITEMATTR_ENERGY )
  1857. local Item_Shuxing_MAXURE  = GetItemAttr ( Item_Shuxing , ITEMATTR_MAXURE )
  1858. local cha_name = GetChaDefaultName ( role )
  1859. local num={}
  1860. local numAttr={}
  1861. local b = 0
  1862. local a = {}
  1863. for b=1,5,1 do
  1864. num [b]=0
  1865. numAttr [b]=0
  1866. end
  1867. b = 0
  1868. for i=1,47,1 do
  1869.     a [i]=GetItemAttr ( Item_Shuxing , i )
  1870. if a [i]~=0 then
  1871. -- SystemNotice( role , a [i] )
  1872. b = b + 1
  1873. num [b]=i
  1874. numAttr [b]=a[i]
  1875. end
  1876. end
  1877. --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)
  1878. 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)
  1879. -----------取融合后道具的属性
  1880. local attr1=GetItemAttr ( Item_Waiguan , num[1] )
  1881. local attr2=GetItemAttr ( Item_Waiguan , num[2] )
  1882. local attr3=GetItemAttr ( Item_Waiguan , num[3] )
  1883. local attr4=GetItemAttr ( Item_Waiguan , num[4] )
  1884. local attr5=GetItemAttr ( Item_Waiguan , num[5] )
  1885. 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)
  1886. --------------------重新设置融合装备耐久
  1887. SetItemAttr ( Item_Waiguan , ITEMATTR_MAXURE , 25000 )
  1888. SetItemAttr ( Item_Waiguan , ITEMATTR_URE , 25000 )
  1889. local R1 = 0
  1890. local R2 = 0
  1891. local R3 = 1
  1892. R1 = RemoveChaItem ( role , ItemID_Juanzhou , 1 , 2 , ItemBag [0] , 2 , 1 , 0 ) --移除卷轴道具
  1893. R2 = RemoveChaItem ( role , ItemID_Shuxing , 1 , 2 , ItemBag [2] , 2 , 1 , 0 ) --移除属性道具
  1894. if ItemID_Cuihuaji ~= 0 then
  1895. R3 = RemoveChaItem ( role , ItemID_Cuihuaji , 1 , 2 , ItemBag [3] , 2 , 1 , 0 ) --移出催化剂道具
  1896. end
  1897. if R1 == 0 or R2 == 0 or R3 == 0 then
  1898. SystemNotice( role , "移出道具失败")
  1899. return
  1900. end
  1901. --------赋予熔合道具精炼属性
  1902. if ItemID_Cuihuaji ~= 0 then
  1903. local Check_SetItemForgeParam = SetItemForgeParam( Item_Waiguan , 1 , Jinglianxinxi )
  1904. if Check_SetItemForgeParam == 0 then
  1905. SystemNotice( role , "设置精炼属性失败")
  1906. return
  1907. end
  1908. else 
  1909. local Part1_Jinglianxinxi = GetNum_Part1 ( Jinglianxinxi ) --Get Num Part 1 到 Part 7
  1910. local Part2_Jinglianxinxi = GetNum_Part2 ( Jinglianxinxi )
  1911. local Part3_Jinglianxinxi = GetNum_Part3 ( Jinglianxinxi )
  1912. local Part4_Jinglianxinxi = GetNum_Part4 ( Jinglianxinxi )
  1913. local Part5_Jinglianxinxi = GetNum_Part5 ( Jinglianxinxi )
  1914. local Part6_Jinglianxinxi = GetNum_Part6 ( Jinglianxinxi )
  1915. local Part7_Jinglianxinxi = GetNum_Part7 ( Jinglianxinxi )
  1916. Jinglianxinxi = SetNum_Part1 ( Jinglianxinxi , hole_num ) ----------二转标记
  1917. Jinglianxinxi = SetNum_Part2 ( Jinglianxinxi , 0 )
  1918. Jinglianxinxi = SetNum_Part3 ( Jinglianxinxi , 0 )
  1919. Jinglianxinxi = SetNum_Part4 ( Jinglianxinxi , 0 )
  1920. Jinglianxinxi = SetNum_Part5 ( Jinglianxinxi , 0 )
  1921. Jinglianxinxi = SetNum_Part6 ( Jinglianxinxi , 0 )
  1922. Jinglianxinxi = SetNum_Part7 ( Jinglianxinxi , 0 )
  1923. local Check_SetItemForgeParam = SetItemForgeParam( Item_Waiguan , 1 , Jinglianxinxi )
  1924. if Check_SetItemForgeParam == 0 then
  1925. SystemNotice( role , "设置精炼属性失败")
  1926. return
  1927. end
  1928. end
  1929. end
  1930. -------------装备升级之强化升级部分
  1931. ----装备升级之强化升级
  1932. ---检测是否能够强化升级
  1933. function can_upgrade_item (...)
  1934. -- Notice ( "判断是否可以强化升级")
  1935. if arg.n ~= 12 then
  1936. SystemNotice ( arg[1] , "参数个数非法"..arg.n )
  1937. return 0
  1938. end
  1939. local Check = 0
  1940. Check = can_beuplv_item_main ( arg )
  1941. if Check == 1 then
  1942. return 1
  1943. else
  1944. return 0
  1945. end
  1946. end
  1947. --检测是否可以强化升级主函数
  1948. function can_beuplv_item_main ( Table )
  1949. local role = 0
  1950. local ItemBag = {} --道具背包位置
  1951. local ItemCount = {} --道具数量
  1952. local ItemBagCount = {} --道具对象数量
  1953. local Get_Count = 4
  1954. local ItemReadCount = 0
  1955. local ItemReadNow = 1
  1956. local ItemReadNext = 0
  1957. local ItemBag_Now = 0
  1958. local ItemCount_Now = 0
  1959. local ItemBagCount_Num = 0
  1960. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Now , ItemCount_Now , ItemBagCount_Num = Read_Table ( Table )
  1961. local ItemBagCount_beuplv = ItemBagCount [1]
  1962. local ItemBag_beuplv = ItemBag [1]
  1963. local ItemNum_beuplv = ItemCount [1]
  1964. local Item_beuplv = GetChaItem ( role , 2 , ItemBag_beuplv ) ----取道具指针
  1965. local Item_beuplv_Type = GetItemType ( Item_beuplv ) ----取融合道具类型
  1966. local Item_beuplv_ID = GetItemID ( Item_beuplv ) ----取融合道具ID
  1967. local Item_ScItem = GetChaItem ( role , 2 , ItemBag [0] ) ----强化卷轴道具指针
  1968. local Item_YxItem = GetChaItem ( role , 2 , ItemBag [2] ) ----强化晶石道具指针
  1969. local Item_ScItem_ID = GetItemID ( Item_ScItem ) ----商城道具ID
  1970. local Item_YxItem_ID = GetItemID ( Item_YxItem ) ----游戏道具ID
  1971. local Item_ScItem_Type = GetItemType ( Item_ScItem ) ----取强化卷轴道具类型
  1972. local Item_YxItem_Type = GetItemType ( Item_YxItem ) ----取强化晶石道具类型
  1973. local Item_beuplv_Lv =  Get_Itembeuplv_Lv ( Item_beuplv ) ---取融合住装备等级
  1974. local ItemAttr_Val_Fusionid = GetItemAttr ( Item_beuplv , ITEMATTR_VAL_FUSIONID ) -- 取道具装备熔合信息ID
  1975. if Item_beuplv_ID < 5001 or Item_beuplv_ID > 6000 then --判断融合道具是否为融合类型
  1976. SystemNotice( role ,"不是融合道具")
  1977. return 0
  1978. end
  1979. -------------------------------------------                             --未融合装备不能升级
  1980. if  ItemAttr_Val_Fusionid == 0 then
  1981. SystemNotice( role , "装备尚未融合不能升级")
  1982. return 0
  1983. end
  1984. -----------------------------------------------
  1985. if Item_beuplv_Lv >= 15 then --判断融合道具是否为最大等级
  1986. SystemNotice( role ,"装备等级已经达到最大不能继续升级")
  1987. return 0
  1988. end
  1989. if ItemBagCount_beuplv ~= 1 then --第二栏放融合道具
  1990. SystemNotice( role , "强化升级道具对应格数非法")
  1991. return 0
  1992. end
  1993. if Item_ScItem_Type ~= 62 then
  1994. SystemNotice( role , "强化卷轴类型非法")
  1995. return 0
  1996. end
  1997. if Item_YxItem_Type ~= 63 then
  1998. SystemNotice( role , "强化晶石类型非法")
  1999. return 0
  2000. end
  2001. if ItemNum_beuplv ~= 1 then
  2002. SystemNotice( role , "强化升级道具数量非法")
  2003. return 0
  2004. end
  2005. if ItemCount [0] ~= 1 or ItemCount [2] ~= 1 or ItemBagCount [0] ~= 1 or ItemBagCount [2] ~= 1 then  ----第一栏和第三栏放商城道具和游戏道具
  2006. SystemNotice ( role ,"商城道具或游戏道具数量非法")
  2007. return 0
  2008. end
  2009. local Money_Need = getupgrade_money_main ( Table )
  2010. local Money_Have = GetChaAttr ( role , ATTR_GD )
  2011. if Money_Need > Money_Have then
  2012. SystemNotice( role ,"金钱不足,装备不能升级")
  2013. return 0
  2014. end
  2015. --SystemNotice(role ,"判断结束 ")
  2016. return 1
  2017. end
  2018. --开始强化升级
  2019. function begin_upgrade_item (...)
  2020. local Check_Canbeuplv = 0
  2021. Check_Canbeuplv = can_beuplv_item_main ( arg )
  2022. if Check_Canbeuplv == 0 then
  2023. return 0
  2024. end
  2025. local role = 0
  2026. local ItemBag = {} --道具背包位置
  2027. local ItemCount = {} --道具数量
  2028. local ItemBagCount = {} --道具对象数量
  2029. local Get_Count = 4
  2030. local ItemReadCount = 0
  2031. local ItemReadNow = 1
  2032. local ItemReadNext = 0
  2033. local ItemBag_Num = 0
  2034. local ItemCount_Num = 0
  2035. local ItemBagCount_Num = 0
  2036. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( arg )
  2037. local ItemBag_beuplv = ItemBag [1]
  2038. local Item_beuplv = GetChaItem ( role , 2 , ItemBag_beuplv )    ----融合装备道具指针
  2039. local Item_ScItem = GetChaItem ( role , 2 , ItemBag [0] ) ----强化卷轴道具指针
  2040. local Item_YxItem = GetChaItem ( role , 2 , ItemBag [2] ) ----强化晶石道具指针
  2041. local Item_ScItem_ID = GetItemID ( Item_ScItem ) ----商城道具ID
  2042. local Item_YxItem_ID = GetItemID ( Item_YxItem ) ----游戏道具ID
  2043. local Item_beuplv_Lv =  Get_Itembeuplv_Lv ( Item_beuplv )  ---取融合住装备等级
  2044. --SystemNotice( role , "LVA"..Item_beuplv_Lv)
  2045. local R1 = 0
  2046. local R2 = 0
  2047. R1 = RemoveChaItem ( role , Item_ScItem_ID , 1 , 2 , ItemBag [0] , 2 , 1 , 0 ) --移除商城道具
  2048. R2 = RemoveChaItem ( role , Item_YxItem_ID , 1 , 2 , ItemBag [2] , 2 , 1 , 0 ) --移除游戏道具
  2049. if R1 == 0 or R2 == 0 then
  2050. LG( "beuplv" , "移除物品失败" )
  2051. end
  2052. local Money_Need = getupgrade_money_main ( arg )
  2053. local Money_Have = GetChaAttr ( role , ATTR_GD )
  2054. Money_Have = Money_Have - Money_Need
  2055. SetCharaAttr ( Money_Have , role , ATTR_GD )
  2056. ALLExAttrSet( role ) --根据角色形态分别刷新当前属性
  2057. local a = Check_CG_beuplv ( Item_beuplv_Lv ) ---不同等级的成功概率
  2058. if a == 0 then
  2059. R1 = RemoveChaItem ( role , Item_ScItem_ID , 1 , 2 , ItemBag [0] , 2 , 1 , 0 ) --移除商城道具
  2060. R2 = RemoveChaItem ( role , Item_YxItem_ID , 1 , 2 , ItemBag [2] , 2 , 1 , 0 ) --移除游戏道具
  2061. if R1 == 0 or R2 == 0 then
  2062. LG( "beuplv" , "移除物品失败" )
  2063. end
  2064. local cha_name = GetChaDefaultName ( role )
  2065. LG( "JingLian_ShiBai" , "玩家"..cha_name.."强化升级失败" )
  2066. SystemNotice( role , "很遗憾,强化升级失败了,某些物品消失了........")
  2067. return 
  2068. end
  2069. Item_beuplv_Lv = Item_beuplv_Lv + 1
  2070. SetChaKitbagChange( role , 1 )
  2071. --SystemNotice( role , "LVB"..Item_beuplv_Lv)
  2072. Set_Itembeuplv_Lv ( Item_beuplv , Item_beuplv_Lv ) -------设融合住装备等级
  2073. --SystemNotice( role , "LVC"..Item_beuplv_Lv)
  2074. SynChaKitbag( role, 4 )
  2075. local LvD = GetItemAttr( Item_beuplv , ITEMATTR_VAL_LEVEL )
  2076. --SystemNotice( role , "LVD"..LvD)
  2077. --check_item_final_data ( Item_beuplv ) -----属性重算
  2078. SynChaKitbag(role,13)
  2079. SystemNotice( role , "升级成功")
  2080. local cha_name = GetChaDefaultName ( role )
  2081. LG( "JingLian_ShiBai" , "玩家"..cha_name.."强化升级成功" )
  2082. return 1
  2083. end
  2084. -------------------------------
  2085. --function beuplv ( item ) ----------融合装备升级效果
  2086. -- local can_beuplv = 0
  2087. -- can_beuplv = can_beuplv_item(...)
  2088. -- if can_beuplv == 0 then
  2089. -- return 0
  2090. -- end
  2091. --end
  2092. -------------------------------
  2093. function Get_Itembeuplv_Lv ( Item ) --读取融合装备等级
  2094. local Lv = GetItemAttr ( Item , ITEMATTR_VAL_LEVEL )
  2095. return Lv
  2096. end
  2097. ---------------------------------
  2098. function Set_Itembeuplv_Lv ( Item , Item_Lv ) --设置装备等级
  2099. local i = 0
  2100. i = SetItemAttr ( Item , ITEMATTR_VAL_LEVEL , Item_Lv )
  2101. if i == 0 then
  2102. LG( "Hecheng_BS","宝石等级设置失败" )
  2103. end
  2104. end
  2105. ----------------------------
  2106. function Check_CG_beuplv ( Item_Lv ) -------不同等级的成功概率
  2107. local ran = math.random ( 1, 100 )
  2108. if Item_Lv <= 15 then -------10级以下100%成功
  2109. return 1
  2110. end
  2111. if Item_Lv>10 and Item_Lv <= 15 then -------10到15级以下50%成功
  2112. if ran <= 100 then
  2113. return 1
  2114. else
  2115. return 0
  2116. end
  2117. end
  2118. if Item_Lv>15 and Item_Lv <= 20 then -------15到20级以下10%成功
  2119. if ran <= 100 then
  2120. return 1
  2121. else
  2122. return 0
  2123. end
  2124. end
  2125. end
  2126. function get_item_upgrade_money(...)
  2127. -- Notice("计算费用")
  2128. local Money = getupgrade_money_main ( arg )
  2129. return Money
  2130. end
  2131. --计算精练费用主函数
  2132. function getupgrade_money_main ( Table )
  2133. local role = 0
  2134. local ItemBag = {} --道具背包位置数组
  2135. local ItemCount = {} --道具数量数组
  2136. local ItemBagCount = {} --道具对象数量数组
  2137. local ItemBag_Num = 0 --背包位置数组长度
  2138. local ItemCount_Num = 0 --道具数量数组长度
  2139. local ItemBagCount_Num = 0 --道具对象数量数组长度
  2140. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
  2141. local ItemBag_Waiguan = ItemBag [1]
  2142. local Item_Waiguan = GetChaItem ( role , 2 , ItemBag_Waiguan )
  2143. local Waiguan_Lv = 0
  2144. local Waiguan_Lv =  Get_Itembeuplv_Lv ( Item_Waiguan )
  2145. local Money_Need = ( Waiguan_Lv + 1 )*( Waiguan_Lv + 1 )*10000
  2146. -- Notice("计算结束")
  2147. return Money_Need
  2148. end
  2149. --精灵二转
  2150. --判断是否能够转生,转生函数入口
  2151. function can_jlborn_item(...)
  2152. if arg.n ~= 12  then
  2153. SystemNotice ( arg[1] , "参数个数非法"..arg.n )
  2154. return 0
  2155. end
  2156. local Check = 0
  2157. Check = can_jlborn_item_main ( arg )
  2158. if Check == 1 then
  2159. return 1
  2160. else
  2161. return 0
  2162. end
  2163. end
  2164. --检测是否可以转生主函数
  2165. function can_jlborn_item_main ( Table )
  2166. local role = 0
  2167. local ItemBag = {} --道具背包位置
  2168. local ItemCount = {} --道具数量
  2169. local ItemBagCount = {} --道具对象数量
  2170. local ItemBag_Now = 0
  2171. local ItemCount_Now = 0
  2172. local ItemBagCount_Num = 0
  2173. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Now , ItemCount_Now , ItemBagCount_Num = Read_Table ( Table )
  2174. ---道具数量判断
  2175. if ItemCount [1] ~= 1 or ItemCount [2] ~= 1 or ItemBagCount [1] ~= 1 or ItemBagCount [2] ~= 1 then
  2176. SystemNotice ( role ,"装备数量非法")
  2177. return 0
  2178. end
  2179. ----取出道具指针
  2180. local Item_EMstone = GetChaItem ( role , 2 , ItemBag [0] ) --恶魔宝石指针
  2181. local Item_JLone = GetChaItem ( role , 2 , ItemBag [1] ) --一个精灵道具的指针
  2182. local Item_JLother = GetChaItem ( role , 2 , ItemBag [2] ) --另一个精灵道具的指针
  2183. local Item_JLone_ID = GetItemID ( Item_JLone )   --一个精灵道具ID
  2184. local Item_JLother_ID = GetItemID ( Item_JLother )   --一个精灵道具ID
  2185. ---取一个精灵的五个属性
  2186. local str_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_STR )  --力量
  2187. local con_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_CON ) --体质
  2188. local agi_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_AGI ) --专注
  2189. local dex_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_DEX ) --敏捷
  2190. local sta_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_STA ) --精神
  2191. local URE_JLone = GetItemAttr( Item_JLone ,ITEMATTR_URE ) --体力
  2192. local MAXURE_JLone = GetItemAttr( Item_JLone ,ITEMATTR_MAXURE )       --最大体力
  2193. local lv_JLone = str_JLone + con_JLone + agi_JLone + dex_JLone + sta_JLone  ----一个精灵的等级
  2194. ---取另一个精灵的五个属性
  2195. local str_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_STR )       --力量
  2196. local con_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_CON )       --体质
  2197. local agi_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_AGI )       --专注
  2198. local dex_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_DEX )       --敏捷
  2199. local sta_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_STA )       --精神
  2200. local URE_JLother = GetItemAttr( Item_JLother ,ITEMATTR_URE )  --体力
  2201. local MAXURE_JLother = GetItemAttr( Item_JLother ,ITEMATTR_MAXURE )       --最大体力
  2202. local lv_JLother = str_JLother + con_JLother + agi_JLother + dex_JLother + sta_JLother ----另一个精灵的等级
  2203. ----取一个精灵的7位数值
  2204. local Num_JLone = GetItemForgeParam ( Item_JLone , 1 )
  2205. local Part1_JLone = GetNum_Part1 ( Num_JLone ) --Get Num Part 1 到 Part 7
  2206. local Part2_JLone = GetNum_Part2 ( Num_JLone )
  2207. local Part3_JLone = GetNum_Part3 ( Num_JLone )
  2208. local Part4_JLone = GetNum_Part4 ( Num_JLone )
  2209. local Part5_JLone = GetNum_Part5 ( Num_JLone )
  2210. local Part6_JLone = GetNum_Part6 ( Num_JLone )
  2211. local Part7_JLone= GetNum_Part7 ( Num_JLone )
  2212. ----取另一个精灵的7位数值
  2213. local Num_JLother = GetItemForgeParam ( Item_JLother , 1 )
  2214. local Part1_JLother = GetNum_Part1 ( Num_JLother ) --Get Num Part 1 到 Part 7
  2215. local Part2_JLother = GetNum_Part2 ( Num_JLother )
  2216. local Part3_JLother = GetNum_Part3 ( Num_JLother )
  2217. local Part4_JLother = GetNum_Part4 ( Num_JLother )
  2218. local Part5_JLother = GetNum_Part5 ( Num_JLother )
  2219. local Part6_JLother = GetNum_Part6 ( Num_JLother )
  2220. local Part7_JLother= GetNum_Part7 ( Num_JLother )
  2221. local Item_CanGet = GetChaFreeBagGridNum ( role )
  2222. if Item_CanGet < 2 then
  2223. SystemNotice(role ,"精灵结婚至少需要背包中有两个空位")
  2224. return 0
  2225. end
  2226. ----恶魔果实判断
  2227. local  Item_EMstone_ID = GetItemID ( Item_EMstone )
  2228. 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
  2229. SystemNotice( role ,"恶魔果实使用错误")
  2230. return 0
  2231. end
  2232. -----普通掉料检测
  2233. if Item_EMstone_ID == 3918 then
  2234. local i1 = CheckBagItem( role, 4530 ) ---美味乌贼肉
  2235. local i2 = CheckBagItem( role,3434 ) ----废灵武士骸骨
  2236. if i1 < 10 or i2 < 10 then
  2237. SystemNotice( role ,"精灵结婚缺少一些必备原料")
  2238. return 0
  2239. end
  2240. end
  2241. if Item_EMstone_ID == 3919 then
  2242. local i1 = CheckBagItem( role, 4531 ) ---破碎的阿拉伯珍珠 
  2243. local i2 = CheckBagItem( role, 3435 ) ----废灵弓箭手骸骨   
  2244. if i1 < 10 or i2 < 10 then
  2245. SystemNotice( role ,"精灵结婚缺少一些必备原料")
  2246. return 0
  2247. end
  2248. end
  2249. if Item_EMstone_ID == 3920 then
  2250. local i1 = CheckBagItem( role,1196 ) ---阿拉伯珍珠碎片
  2251. local i2 = CheckBagItem( role,3436 ) ----泣灵武士骸骨  
  2252. if i1 < 10 or i2 < 10 then
  2253. SystemNotice( role ,"精灵结婚缺少一些必备原料")
  2254. return 0
  2255. end
  2256. end
  2257. if Item_EMstone_ID == 3921 then
  2258. local i1 = CheckBagItem( role, 4533 ) ---蝌蚪尾巴           
  2259. local i2 = CheckBagItem( role, 3437 ) ----泣灵弓箭手骸骨 
  2260. if i1 < 10 or i2 < 10 then
  2261. SystemNotice( role ,"精灵结婚缺少一些必备原料")
  2262. return 0
  2263. end
  2264. end
  2265. if Item_EMstone_ID == 3922 then
  2266. local i1 = CheckBagItem( role,4537 ) ---鱼刺                      
  2267. local i2 = CheckBagItem( role,3444 ) ----泥浆块   
  2268. if i1 < 10 or i2 < 10 then
  2269. SystemNotice( role ,"精灵结婚缺少一些必备原料")
  2270. return 0
  2271. end
  2272. end
  2273. if Item_EMstone_ID == 3924 then
  2274. local i1 = CheckBagItem( role, 4540 ) ---鲨鱼背鳍             
  2275. local i2 = CheckBagItem( role, 3443 ) ----沼泽枯木   
  2276. if i1 < 10 or i2 < 10 then
  2277. SystemNotice( role ,"精灵结婚缺少一些必备原料")
  2278. return 0
  2279. end
  2280. end
  2281. if Item_EMstone_ID == 3925 then
  2282. local i1 = CheckBagItem( role, 1253 ) ---闪光的阿拉伯珍珠碎片
  2283. local i2 = CheckBagItem( role, 3442 ) ----污泥块                    
  2284. if i1 < 10 or i2 < 10 then
  2285. SystemNotice( role ,"精灵结婚缺少一些必备原料")
  2286. return 0
  2287. end
  2288. end
  2289. ----精灵类型判断
  2290. local ItemType_JLone = GetItemType (Item_JLone)
  2291. local ItemType_JLother = GetItemType (Item_JLother)
  2292. if  ItemType_JLone ~=59 or ItemType_JLother ~=59  then
  2293. SystemNotice( role ,"放入的不是精灵")
  2294. return 0
  2295. end
  2296. ------放入的是否是同一精灵
  2297. if ItemBag [1]==ItemBag [2] then
  2298. SystemNotice( role ,"傻孩子,你见过自己和自己结婚的吗")
  2299. return 0
  2300. end
  2301. ----是否为普通精灵的判断
  2302. if  Part1_JLone ~=0 or Part1_JLother ~=0  then
  2303. SystemNotice( role ,"目前只有普通精灵才能结婚")
  2304. return 0
  2305. end
  2306. -----精灵等级判断
  2307. if  lv_JLone < 20 or lv_JLother < 20   then
  2308. SystemNotice( role ," 精灵级别不足20级不能结婚")
  2309. return 0
  2310. end
  2311. -----精灵是否满体力判断
  2312. if URE_JLone < MAXURE_JLone or URE_JLone < MAXURE_JLone then
  2313. SystemNotice( role ," 结婚是件很耗费体力的事,请保持满体力")
  2314. return 0
  2315. end
  2316. ----身上金钱判断
  2317. local Money_Need = getjlborn_money_main ( Table )
  2318. local Money_Have = GetChaAttr ( role , ATTR_GD )
  2319. if Money_Need > Money_Have then
  2320. SystemNotice( role ,"金钱不足,不能转生")
  2321. return 0
  2322. end
  2323. return 1
  2324. end
  2325. --开始转生,转生主程序入口
  2326. function begin_jlborn_item(...)
  2327. -----是否可以融合检测
  2328. local Check_Canjlborn = 0
  2329. Check_Canjlborn = can_jlborn_item_main ( arg )
  2330. if Check_Canjlborn == 0 then
  2331. return 0
  2332. end
  2333. ------取出数据
  2334. local role = 0
  2335. local ItemBag = {} --道具背包位置
  2336. local ItemCount = {} --道具数量
  2337. local ItemBagCount = {} --道具对象数量
  2338. local ItemBag_Num = 0
  2339. local ItemCount_Num = 0
  2340. local ItemBagCount_Num = 0
  2341. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( arg )
  2342. -----取出道具指针
  2343. local Item_EMstone = GetChaItem ( role , 2 , ItemBag [0] ) --恶魔宝石指针
  2344. local Item_JLone = GetChaItem ( role , 2 , ItemBag [1] ) --一个精灵道具的指针
  2345. local Item_JLother = GetChaItem ( role , 2 , ItemBag [2] ) --另一个精灵道具的指针
  2346. -----扣除金钱
  2347. local Money_Need = getjlborn_money_main ( arg )
  2348. local Money_Have = GetChaAttr ( role , ATTR_GD )
  2349. Money_Have = Money_Have - Money_Need
  2350. SetCharaAttr ( Money_Have , role , ATTR_GD )
  2351. ALLExAttrSet( role )
  2352. -----转生过程
  2353. Check_JLBorn_Item = jlborn_item ( arg )
  2354. if Check_JLBorn_Item == 0  then
  2355. SystemNotice ( role ,"结婚失败,请检查程序")
  2356. end
  2357. local cha_name = GetChaDefaultName ( role )
  2358. SystemNotice ( role ,"结婚成功")
  2359. LG( "JLBorn_ShiBai" , "玩家"..cha_name.."的精灵结婚成功" )
  2360. return 1
  2361. end
  2362. --计算转生费用
  2363. function get_item_jlborn_money(...)
  2364. local Money = getjlborn_money_main ( arg )
  2365. return Money
  2366. end
  2367. --计算转生费用主函数
  2368. function getjlborn_money_main ( Table )
  2369. local role = 0
  2370. local ItemBag = {} --道具背包位置数组
  2371. local ItemCount = {} --道具数量数组
  2372. local ItemBagCount = {} --道具对象数量数组
  2373. local ItemBag_Num = 0 --背包位置数组长度
  2374. local ItemCount_Num = 0 --道具数量数组长度
  2375. local ItemBagCount_Num = 0 --道具对象数量数组长度
  2376. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
  2377. ---取出道具指针
  2378. local Item_JLone = GetChaItem ( role , 2 , ItemBag [1] ) --一个精灵道具的指针
  2379. local Item_JLother = GetChaItem ( role , 2 , ItemBag [2] ) --另一个精灵道具的指针
  2380. ---取一个精灵的五个属性
  2381. local str_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_STR )   --力量
  2382. local con_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_CON )    --体质
  2383. local agi_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_AGI )   --专注
  2384. local dex_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_DEX )  --敏捷
  2385. local sta_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_STA )  --精神
  2386. local lv_JLone = str_JLone + con_JLone + agi_JLone + dex_JLone + sta_JLone  ----一个精灵的等级
  2387. ---取另一个精灵的五个属性
  2388. local str_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_STR )  --力量
  2389. local con_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_CON )   --体质
  2390. local agi_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_AGI ) --专注
  2391. local dex_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_DEX )   --敏捷
  2392. local sta_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_STA )  --精神
  2393. local lv_JLother = str_JLother + con_JLother + agi_JLother + dex_JLother + sta_JLother ----另一个精灵的等级
  2394. local  Money_Need = ( 60 - lv_JLone )*(60 - lv_JLother )*100
  2395. if lv_JLone>60 or lv_JLother>60 then
  2396.  Money_Need = 0
  2397. end
  2398. return Money_Need
  2399. end
  2400. ----相关函数--------------------------------------------------------------------------------------------------------
  2401. ---开始转生
  2402. function jlborn_item ( Table )
  2403. local role = 0
  2404. local ItemBag = {} --道具背包位置
  2405. local ItemCount = {} --道具数量
  2406. local ItemBagCount = {} --道具对象数量
  2407. local ItemBag_Num = 0
  2408. local ItemCount_Num = 0
  2409. local ItemBagCount_Num = 0
  2410. local ItemID_Cuihuaji = 0
  2411. role , ItemBag , ItemCount , ItemBagCount , ItemBag_Num , ItemCount_Num , ItemBagCount_Num = Read_Table ( Table )
  2412. ---取出道具指针
  2413. local Item_EMstone = GetChaItem ( role , 2 , ItemBag [0] ) --恶魔宝石指针
  2414. local Item_JLone = GetChaItem ( role , 2 , ItemBag [1] ) --一个精灵道具的指针
  2415. local Item_JLother = GetChaItem ( role , 2 , ItemBag [2] ) --另一个精灵道具的指针
  2416. local  Item_EMstone_ID = GetItemID ( Item_EMstone )  --恶魔果实ID
  2417. local  Item_JLone_ID = GetItemID ( Item_JLone )  --一个精灵道具ID
  2418. local  Item_JLother_ID = GetItemID ( Item_JLother )  --一个精灵道具ID
  2419. ---取一个精灵的五个属性
  2420. local str_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_STR )   --力量 
  2421. local con_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_CON )  ---体质 
  2422. local agi_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_AGI )  --敏捷 
  2423. local dex_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_DEX )   --专注 
  2424. local sta_JLone = GetItemAttr( Item_JLone ,ITEMATTR_VAL_STA )   --精神 
  2425. local URE_JLone = GetItemAttr( Item_JLone ,ITEMATTR_URE ) --体力 
  2426. local MAXURE_JLone = GetItemAttr( Item_JLone ,ITEMATTR_MAXURE )  --最大体力
  2427. local lv_JLone = str_JLone + con_JLone + agi_JLone + dex_JLone + sta_JLone ----一个精灵的等级
  2428. ---取另一个精灵的五个属性
  2429. local str_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_STR ) --力量
  2430. local con_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_CON )   --体质
  2431. local agi_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_AGI )  --敏捷
  2432. local dex_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_DEX )  --专注
  2433. local sta_JLother = GetItemAttr( Item_JLother ,ITEMATTR_VAL_STA )  --精神
  2434. local URE_JLother = GetItemAttr( Item_JLother ,ITEMATTR_URE )     --体力
  2435. local MAXURE_JLother = GetItemAttr( Item_JLother ,ITEMATTR_MAXURE )  --最大体力
  2436. local lv_JLother = str_JLother + con_JLother + agi_JLother + dex_JLother + sta_JLother ----另一个精灵的等级
  2437. ----取一个精灵的7位数值
  2438. local Num_JLone = GetItemForgeParam ( Item_JLone , 1 )
  2439. local Part1_JLone = GetNum_Part1 ( Num_JLone ) --Get Num Part 1 到 Part 7
  2440. local Part2_JLone = GetNum_Part2 ( Num_JLone )
  2441. local Part3_JLone = GetNum_Part3 ( Num_JLone )
  2442. local Part4_JLone = GetNum_Part4 ( Num_JLone )
  2443. local Part5_JLone = GetNum_Part5 ( Num_JLone )
  2444. local Part6_JLone = GetNum_Part6 ( Num_JLone )
  2445. local Part7_JLone= GetNum_Part7 ( Num_JLone )
  2446. ----取另一个精灵的7位数值
  2447. local Num_JLother = GetItemForgeParam ( Item_JLother , 1 )
  2448. local Part1_JLother = GetNum_Part1 ( Num_JLother ) --Get Num Part 1 到 Part 7
  2449. local Part2_JLother = GetNum_Part2 ( Num_JLother )
  2450. local Part3_JLother = GetNum_Part3 ( Num_JLother )
  2451. local Part4_JLother = GetNum_Part4 ( Num_JLother )
  2452. local Part5_JLother = GetNum_Part5 ( Num_JLother )
  2453. local Part6_JLother = GetNum_Part6 ( Num_JLother )
  2454. local Part7_JLother= GetNum_Part7 ( Num_JLother )
  2455. -----赋予新精灵等级记录在新精灵上
  2456. local new_str = math.floor ((str_JLone+str_JLother)*0.125 )
  2457. local new_con = math.floor ((con_JLone+con_JLother)*0.125 )
  2458. local new_agi = math.floor ((agi_JLone+agi_JLother)*0.125 )
  2459. local new_dex = math.floor ((dex_JLone+dex_JLother)*0.125 )
  2460. local new_sta = math.floor ((sta_JLone+sta_JLother)*0.125 )
  2461. local new_lv = new_str + new_con + new_agi + new_dex + new_sta
  2462. local new_MAXENERGY = 240 * ( new_lv + 1 )
  2463. if new_MAXENERGY > 6480 then
  2464. new_MAXENERGY = 6480
  2465. end
  2466. local new_MAXURE = 5000 + 1000*new_lv
  2467. if new_MAXURE > 32000 then
  2468. new_MAXURE = 32000
  2469. end
  2470. if new_MAXURE ==25000  then
  2471. new_MAXURE = 25000+1
  2472. end
  2473. --------恶魔果实判断
  2474. if Item_EMstone_ID ==3918 then ---青涩恶魔果实
  2475. local j1 =TakeItem( role, 0, 4530, 10 ) ---美味乌贼肉     
  2476. local j2 = TakeItem( role, 0,3434, 10  ) ----废灵武士骸骨 
  2477. if j1==0 or j2==0 then
  2478. SystemNotice ( role ,"删除精灵转生道具失败")
  2479. return
  2480. end 
  2481. local rad = math.random ( 1, 100 )
  2482. local r1 = 0
  2483. local r2 = 0
  2484. if Item_JLone_ID ==680 or Item_JLother_ID ==680 then
  2485. if Item_JLone_ID==Item_JLother_ID then
  2486. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2487. elseif lv_JLone>=20 and lv_JLone<25 and lv_JLother >=20 and lv_JLother<25 and rad>=88 then---12%为摩豆二世
  2488. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2489. elseif lv_JLone>=25 and lv_JLone<35 and lv_JLother >=25 and lv_JLother<35 and rad>=50 then ---50%为摩豆二世
  2490. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2491. elseif lv_JLone>=35 and lv_JLother >=35 and rad>=10 then---90%
  2492. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2493. else
  2494. r1,r2 =MakeItem ( role , 231  , 1 , 4 )
  2495. end
  2496. else
  2497. r1,r2 =MakeItem ( role , 231  , 1 , 4 )
  2498. end
  2499. local Item_newJL = GetChaItem ( role , 2 , r2 ) --取新精灵道具指针
  2500. local Item_newJL_ID = GetItemID ( Item_newJL )
  2501. local Num_newJL = GetItemForgeParam ( Item_newJL , 1 )
  2502. local Part1_newJL = GetNum_Part1 ( Num_newJL ) --Get Num Part 1 到 Part 7
  2503. local Part2_newJL = GetNum_Part2 ( Num_newJL )
  2504. local Part3_newJL = GetNum_Part3 ( Num_newJL )
  2505. local Part4_newJL = GetNum_Part4 ( Num_newJL )
  2506. local Part5_newJL = GetNum_Part5 ( Num_newJL )
  2507. local Part6_newJL = GetNum_Part6 ( Num_newJL )
  2508. local Part7_newJL= GetNum_Part7 ( Num_newJL )
  2509. if lv_JLone>=20 and lv_JLother >=20 then
  2510. Part2_newJL = 6  ---------运之精灵技能编号
  2511. Part3_newJL = 1 ---------初级阶段
  2512. end
  2513. if lv_JLone>=25 and lv_JLother >=25 then
  2514. Part2_newJL = 6  ---------运之精灵技能编号
  2515. Part3_newJL = 2 ---------中级阶段
  2516. end
  2517. if lv_JLone>=35 and lv_JLother >=35 then
  2518. Part2_newJL = 6  ---------运之精灵技能编号
  2519. Part3_newJL = 3 ---------高级阶段
  2520. end
  2521. local rad1 = math.random ( 1, 100 )
  2522. if Part3_newJL==3 then
  2523. GiveItem ( role , 0 , 609  , 1 , 4 ) 
  2524. end
  2525. if Part3_newJL==2 then
  2526. if rad1 <=95 then
  2527. GiveItem ( role , 0 , 608  , 1 , 4 ) 
  2528. elseif rad1 > 95 and rad1 <=100 then
  2529. GiveItem ( role , 0 , 609  , 1 , 4 ) 
  2530. end
  2531. end
  2532. if Part3_newJL==1 then
  2533. if rad1 <=90 then
  2534. GiveItem ( role , 0 , 239  , 1 , 4 ) 
  2535. elseif rad1 > 90 and rad1 <=98 then
  2536. GiveItem ( role , 0 , 608  , 1 , 4 ) 
  2537. elseif rad1 > 98 and rad1 <=100 then
  2538. GiveItem ( role , 0 , 609  , 1 , 4 ) 
  2539. end
  2540. end
  2541. Num_newJL = SetNum_Part1 ( Num_newJL , 1 )  ----------二转标记
  2542. Num_newJL = SetNum_Part2 ( Num_newJL , Part2_newJL )
  2543. Num_newJL = SetNum_Part3 ( Num_newJL , Part3_newJL )
  2544. Num_newJL = SetNum_Part4 ( Num_newJL , Part4_newJL )
  2545. Num_newJL = SetNum_Part5 ( Num_newJL , Part5_newJL )
  2546. Num_newJL = SetNum_Part6 ( Num_newJL , Part6_newJL )
  2547. Num_newJL = SetNum_Part7 ( Num_newJL , Part7_newJL )
  2548. SetItemForgeParam ( Item_newJL , 1 , Num_newJL )
  2549. SetItemAttr ( Item_newJL , ITEMATTR_VAL_STR , new_str )
  2550. SetItemAttr( Item_newJL , ITEMATTR_VAL_DEX , new_dex )  
  2551. SetItemAttr ( Item_newJL , ITEMATTR_VAL_STA , new_sta )
  2552. SetItemAttr( Item_newJL , ITEMATTR_VAL_AGI , new_agi )
  2553. SetItemAttr ( Item_newJL , ITEMATTR_VAL_CON , new_con ) 
  2554. SetItemAttr ( Item_newJL , ITEMATTR_MAXENERGY , new_MAXENERGY ) 
  2555. SetItemAttr ( Item_newJL , ITEMATTR_MAXURE , new_MAXURE ) 
  2556. end
  2557. if Item_EMstone_ID ==3919 then ---勇者恶魔果实  体之精灵----体质加防御
  2558. local j1 = TakeItem( role, 0, 4531, 10 ) ---破碎的阿拉伯珍珠  
  2559. local j2 = TakeItem( role, 0,3435, 10 ) ----废灵弓箭手骸骨    
  2560. if j1==0 or j2==0 then
  2561. SystemNotice ( role ,"删除精灵转生道具失败")
  2562. return
  2563. end
  2564. local rad = math.random ( 1, 100 )
  2565. local r1 = 0
  2566. local r2 = 0
  2567. if Item_JLone_ID ==680 or Item_JLother_ID ==680 then
  2568. if Item_JLone_ID==Item_JLother_ID then
  2569. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2570. elseif  lv_JLone>=20 and lv_JLone<25 and lv_JLother >=20 and lv_JLother<25 and rad>=88 then---12%为摩豆二世
  2571. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2572. elseif lv_JLone>=25 and lv_JLone<35 and lv_JLother >=25 and lv_JLother<35 and rad>=50 then ---50%为摩豆二世
  2573. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2574. elseif lv_JLone>=35 and lv_JLother >=35 and rad>=10 then---90%
  2575. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2576. else
  2577. r1,r2 =MakeItem ( role , 233  , 1 , 4 )
  2578. end
  2579. else
  2580. r1,r2 =MakeItem ( role , 233  , 1 , 4 )
  2581. end
  2582. local Item_newJL = GetChaItem ( role , 2 , r2 ) --取新精灵道具指针
  2583. local Num_newJL = GetItemForgeParam ( Item_newJL , 1 )
  2584. local Part1_newJL = GetNum_Part1 ( Num_newJL ) --Get Num Part 1 到 Part 7
  2585. local Part2_newJL = GetNum_Part2 ( Num_newJL )
  2586. local Part3_newJL = GetNum_Part3 ( Num_newJL )
  2587. local Part4_newJL = GetNum_Part4 ( Num_newJL )
  2588. local Part5_newJL = GetNum_Part5 ( Num_newJL )
  2589. local Part6_newJL = GetNum_Part6 ( Num_newJL )
  2590. local Part7_newJL= GetNum_Part7 ( Num_newJL )
  2591. if lv_JLone>=20 and lv_JLother >=20 then
  2592. Part2_newJL = 7  ---------体之精灵技能编号
  2593. Part3_newJL = 1 ---------初级阶段
  2594. end
  2595. if lv_JLone>=25 and lv_JLother >=25 then
  2596. Part2_newJL = 7  ---------体之精灵技能编号
  2597. Part3_newJL = 2 ---------中级阶段
  2598. end
  2599. if lv_JLone>=35 and lv_JLother >=35 then
  2600. Part2_newJL = 7  ---------体之精灵技能编号
  2601. Part3_newJL = 3 ---------高级阶段
  2602. end
  2603. local rad1 = math.random ( 1, 100 )
  2604. if Part3_newJL==3 then
  2605. GiveItem ( role , 0 , 609  , 1 , 4 ) 
  2606. end
  2607. if Part3_newJL==2 then
  2608. if rad1 <=95 then
  2609. GiveItem ( role , 0 , 608  , 1 , 4 ) 
  2610. elseif rad1 > 95 and rad1 <=100 then
  2611. GiveItem ( role , 0 , 609  , 1 , 4 ) 
  2612. end
  2613. end
  2614. if Part3_newJL==1 then
  2615. if rad1 <=90 then
  2616. GiveItem ( role , 0 , 239  , 1 , 4 ) 
  2617. elseif rad1 > 90 and rad1 <=98 then
  2618. GiveItem ( role , 0 , 608  , 1 , 4 ) 
  2619. elseif rad1 > 98 and rad1 <=100 then
  2620. GiveItem ( role , 0 , 609  , 1 , 4 ) 
  2621. end
  2622. end
  2623. Num_newJL = SetNum_Part1 ( Num_newJL , 1 ) ----------二转标记
  2624. Num_newJL = SetNum_Part2 ( Num_newJL , Part2_newJL )
  2625. Num_newJL = SetNum_Part3 ( Num_newJL , Part3_newJL )
  2626. Num_newJL = SetNum_Part4 ( Num_newJL , Part4_newJL )
  2627. Num_newJL = SetNum_Part5 ( Num_newJL , Part5_newJL )
  2628. Num_newJL = SetNum_Part6 ( Num_newJL , Part6_newJL )
  2629. Num_newJL = SetNum_Part7 ( Num_newJL , Part7_newJL )
  2630. SetItemForgeParam ( Item_newJL , 1 , Num_newJL )
  2631. SetItemAttr ( Item_newJL , ITEMATTR_VAL_STR , new_str )
  2632. SetItemAttr( Item_newJL , ITEMATTR_VAL_DEX , new_dex )  
  2633. SetItemAttr ( Item_newJL , ITEMATTR_VAL_STA , new_sta )
  2634. SetItemAttr( Item_newJL , ITEMATTR_VAL_AGI , new_agi )
  2635. SetItemAttr ( Item_newJL , ITEMATTR_VAL_CON , new_con ) 
  2636. SetItemAttr ( Item_newJL , ITEMATTR_MAXENERGY , new_MAXENERGY ) 
  2637. SetItemAttr ( Item_newJL , ITEMATTR_MAXURE , new_MAXURE ) 
  2638. end
  2639. if Item_EMstone_ID ==3920 then ---力量恶魔果实 力之精灵----力量加攻击
  2640. local j1 =TakeItem( role, 0, 1196, 10 ) ---阿拉伯珍珠碎片  
  2641. local j2 = TakeItem( role, 0,3436, 10 ) ----泣灵武士骸骨    
  2642. if j1==0 or j2==0 then
  2643. SystemNotice ( role ,"删除精灵转生道具失败")
  2644. return
  2645. end
  2646. local rad = math.random ( 1, 100 )
  2647. local r1 = 0
  2648. local r2 = 0
  2649. if Item_JLone_ID ==680 or Item_JLother_ID ==680 then
  2650. if Item_JLone_ID==Item_JLother_ID then
  2651. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2652. elseif  lv_JLone>=20 and lv_JLone<25 and lv_JLother >=20 and lv_JLother<25 and rad>=88 then---12%为摩豆二世
  2653. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2654. elseif lv_JLone>=25 and lv_JLone<35 and lv_JLother >=25 and lv_JLother<35 and rad>=50 then ---50%为摩豆二世
  2655. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2656. elseif lv_JLone>=35 and lv_JLother >=35 and rad>=10 then---90%
  2657. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2658. else
  2659. r1,r2 =MakeItem ( role , 232  , 1 , 4 )
  2660. end
  2661. else
  2662. r1,r2 =MakeItem ( role , 232  , 1 , 4 )
  2663. end
  2664. local Item_newJL = GetChaItem ( role , 2 , r2 ) --取新精灵道具指针
  2665. local Num_newJL = GetItemForgeParam ( Item_newJL , 1 )
  2666. local Part1_newJL = GetNum_Part1 ( Num_newJL ) --Get Num Part 1 到 Part 7
  2667. local Part2_newJL = GetNum_Part2 ( Num_newJL )
  2668. local Part3_newJL = GetNum_Part3 ( Num_newJL )
  2669. local Part4_newJL = GetNum_Part4 ( Num_newJL )
  2670. local Part5_newJL = GetNum_Part5 ( Num_newJL )
  2671. local Part6_newJL = GetNum_Part6 ( Num_newJL )
  2672. local Part7_newJL= GetNum_Part7 ( Num_newJL )
  2673. if lv_JLone>=20 and lv_JLother >=20 then
  2674. Part2_newJL = 8  ---------力之精灵技能编号
  2675. Part3_newJL = 1 ---------初级阶段
  2676. end
  2677. if lv_JLone>=25 and lv_JLother >=25 then
  2678. Part2_newJL = 8  ---------力之精灵技能编号
  2679. Part3_newJL = 2 ---------中级阶段
  2680. end
  2681. if lv_JLone>=35 and lv_JLother >=35 then
  2682. Part2_newJL = 8  ---------力之精灵技能编号
  2683. Part3_newJL = 3 ---------高级阶段
  2684. end
  2685. local rad1 = math.random ( 1, 100 )
  2686. if Part3_newJL==3 then
  2687. GiveItem ( role , 0 , 609  , 1 , 4 ) 
  2688. end
  2689. if Part3_newJL==2 then
  2690. if rad1 <=95 then
  2691. GiveItem ( role , 0 , 608  , 1 , 4 ) 
  2692. elseif rad1 > 95 and rad1 <=100 then
  2693. GiveItem ( role , 0 , 609  , 1 , 4 ) 
  2694. end
  2695. end
  2696. if Part3_newJL==1 then
  2697. if rad1 <=90 then
  2698. GiveItem ( role , 0 , 239  , 1 , 4 ) 
  2699. elseif rad1 > 90 and rad1 <=98 then
  2700. GiveItem ( role , 0 , 608  , 1 , 4 ) 
  2701. elseif rad1 > 98 and rad1 <=100 then
  2702. GiveItem ( role , 0 , 609  , 1 , 4 ) 
  2703. end
  2704. end
  2705. Num_newJL = SetNum_Part1 ( Num_newJL , 1 ) ----------二转标记
  2706. Num_newJL = SetNum_Part2 ( Num_newJL , Part2_newJL )
  2707. Num_newJL = SetNum_Part3 ( Num_newJL , Part3_newJL )
  2708. Num_newJL = SetNum_Part4 ( Num_newJL , Part4_newJL )
  2709. Num_newJL = SetNum_Part5 ( Num_newJL , Part5_newJL )
  2710. Num_newJL = SetNum_Part6 ( Num_newJL , Part6_newJL )
  2711. Num_newJL = SetNum_Part7 ( Num_newJL , Part7_newJL )
  2712. SetItemForgeParam ( Item_newJL , 1 , Num_newJL )
  2713.  
  2714. SetItemAttr ( Item_newJL , ITEMATTR_VAL_STR , new_str )
  2715. SetItemAttr( Item_newJL , ITEMATTR_VAL_DEX , new_dex )  
  2716. SetItemAttr ( Item_newJL , ITEMATTR_VAL_STA , new_sta )
  2717. SetItemAttr( Item_newJL , ITEMATTR_VAL_AGI , new_agi )
  2718. SetItemAttr ( Item_newJL , ITEMATTR_VAL_CON , new_con )
  2719. SetItemAttr ( Item_newJL , ITEMATTR_MAXENERGY , new_MAXENERGY ) 
  2720. SetItemAttr ( Item_newJL , ITEMATTR_MAXURE , new_MAXURE ) 
  2721. end
  2722. if Item_EMstone_ID ==3921 then ---智慧恶魔果实 神之精灵 精神加防御
  2723. local j1 =TakeItem( role, 0, 4533, 10 ) ---蝌蚪尾巴            
  2724. local j2 = TakeItem( role, 0,3437, 10 ) ----泣灵弓箭手骸骨  
  2725. if j1==0 or j2==0 then
  2726. SystemNotice ( role ,"删除精灵转生道具失败")
  2727. return
  2728. end
  2729. local rad = math.random ( 1, 100 )
  2730. local r1 = 0
  2731. local r2 = 0
  2732. if Item_JLone_ID ==680 or Item_JLother_ID ==680 then
  2733. if Item_JLone_ID==Item_JLother_ID then
  2734. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2735. elseif  lv_JLone>=20 and lv_JLone<25 and lv_JLother >=20 and lv_JLother<25 and rad>=88 then---12%为摩豆二世
  2736. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2737. elseif lv_JLone>=25 and lv_JLone<35 and lv_JLother >=25 and lv_JLother<35 and rad>=50 then ---50%为摩豆二世
  2738. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2739. elseif lv_JLone>=35 and lv_JLother >=35 and rad>=10 then---90%
  2740. r1,r2 =MakeItem ( role , 681  , 1 , 4 )
  2741. else
  2742. r1,r2 =MakeItem ( role , 234  , 1 , 4 )
  2743. end
  2744. else
  2745. r1,r2 =MakeItem ( role , 234  , 1 , 4 )
  2746. end
  2747. local Item_newJL = GetChaItem ( role , 2 , r2 ) --取新精灵道具指针
  2748. local Num_newJL = GetItemForgeParam ( Item_newJL , 1 )
  2749. local Part1_newJL = GetNum_Part1 ( Num_newJL ) --Get Num Part 1 到 Part 7
  2750. local Part2_newJL = GetNum_Part2 ( Num_newJL )
  2751. local Part3_newJL = GetNum_Part3 ( Num_newJL )
  2752. local Part4_newJL = GetNum_Part4 ( Num_newJL )
  2753. local Part5_newJL = GetNum_Part5 ( Num_newJL )
  2754. local Part6_newJL = GetNum_Part6 ( Num_newJL )
  2755. local Part7_newJL= GetNum_Part7 ( Num_newJL )
  2756. if lv_JLone>=20 and lv_JLother >=20 then
  2757. Part2_newJL = 9  ---------神之精灵技能编号
  2758. Part3_newJL = 1 ---------初级阶段
  2759. end
  2760. if lv_JLone>=25 and lv_JLother >=25 then
  2761. Part2_newJL = 9  ---------神之精灵技能编号
  2762. Part3_newJL = 2 ---------中级阶段
  2763. end
  2764. if lv_JLone>=35 and lv_JLother >=35 then
  2765. Part2_newJL = 9  ---------神之精灵技能编号
  2766. Part3_newJL = 3 ---------高级阶段
  2767. end
  2768. local rad1 = math.random ( 1, 100 )
  2769. if Part3_newJL==3 then
  2770. GiveItem ( role , 0 , 609  , 1 , 4 ) 
  2771. end
  2772. if Part3_newJL==2 then
  2773. if rad1 <=95 then
  2774. GiveItem ( role , 0 , 608  , 1 , 4 ) 
  2775. elseif rad1 > 95 and rad1 <=100 then
  2776. GiveItem ( role , 0 , 609  , 1 , 4 ) 
  2777. end
  2778. end
  2779. if Part3_newJL==1 then
  2780. if rad1 <=90 then