Advertisement
Guest User

missionsdk.lua

a guest
Feb 8th, 2017
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 232.00 KB | None | 0 0
  1. --------------------------------------------------------------------------
  2. -- --
  3. -- --
  4. -- MissionSdk.lua --
  5. -- --
  6. --ČÎÎńϵͳşŻĘý˝ÓżÚ¶¨Ňĺ --
  7. --------------------------------------------------------------------------
  8. print( "Loading MissionSdk.lua" )
  9.  
  10.  
  11. --¸}Ą»¨t˛ÎŞđ¦^­Č©w¸q
  12. LUA_TRUE = 1
  13. LUA_FALSE = 0
  14. LUA_ERROR = -1
  15. LUA_NULL = 0
  16.  
  17. --Ąô°Č¨t˛Î¸}Ą»
  18. TE_MAPINIT = 0 --ĄXĄÍ
  19. TE_NPC = 1 --npcÄâ±a
  20. TE_KILL = 2 --şR·´Ş«Ąó
  21. TE_GAMETIME = 3 --ąCŔ¸®É¶ˇ
  22. TE_CHAT = 4 --˛á¤ŃĂöÁä¦r
  23. TE_GETITEM = 5 --¬B¨úŞ««~
  24. TE_EQUIPITEM = 6 --¸ËłĆŞ««~
  25. TE_GOTO_MAP = 7 --¨ěąFĄŘĽĐÂI ˇ]¨¤¦âIJµoľą¦sŔxˇ^°ŃĽĆ1ˇA¦aąĎIDˇA °ŃĽĆ2ˇA¦aąĎ¨ěąFradom ˛vˇA°ŃĽĆ3ˇA¦aąĎ§¤ĽĐxˇA°ŃĽĆ4, ¦aąĎ§¤ĽĐy
  26. TE_LEVELUP = 8 --¤ÉŻĹ ˇ]¨¤¦âIJµoľą¦sŔxˇ^°ŃĽĆ1ˇA¬O§_ĄD°ĘĂöł¬ˇ]IJµoľą°Ę§@«áĂöł¬ˇ^ˇA°ŃĽĆ2ˇA¬O§_¨C­ÓµĄŻĹłŁÄ˛µoˇA°ŃĽĆ3ˇA«ü©wµĄŻĹIJµo
  27.  
  28. --IJµoľą®É¶ˇĂţ«¬
  29. TT_CYCLETIME = 0 --®É¶ˇ´`Ŕô
  30. TT_MULTITIME = 1 --´`ŔôąB¦ćn¦¸
  31.  
  32. --IJµoľąłĚ¤jÄâ±a±řĄóĽĆ¶q
  33. TR_MAXNUM_CONDITIONS = 12
  34. TR_MAXNUM_ACTIONS = 12
  35.  
  36. --npcĄô°ČެşA«H®§©w¸q
  37. MIS_ACCEPT = 1 --¦ł˛Ĺ¦X±řĄóĄiĄH±µŞşĄô°Č
  38. MIS_DELIVERY = 2 --¤w§ą¦¨ĄiĄćĄIŞşĄô°Č
  39. MIS_PENDING = 4 --¤w§ą¦¨ĄiĄćĄIŞşĄô°Č
  40. MIS_IGNORE = 8 --¤Ł˛Ĺ¦X±řĄóĄiĄH±µŞşĄô°Č
  41.  
  42. --Ąô°Č¦CŞí­¶ľŢ§@©RĄO
  43. MIS_PREV = 0 --˝Đ¨Dµo°eĄô°Č¦CŞíŞş¤W¤@­¶«H®§
  44. MIS_NEXT = 1 --˝Đ¨Dµo°eĄô°Č¦CŞíŞş¤U¤@­¶«H®§
  45. MIS_PREV_END = 2 --Ąô°Č¦CŞí¨S¦ł¤W¤@­¶«H®§
  46. MIS_NEXT_END = 3 --Ąô°Č¦CŞí¨S¦ł¤U¤@­¶«H®§
  47. MIS_SEL = 4 --˝Đ¨DżďľÜĄô°Č¦CŞí¶µĄŘ
  48. MIS_TALK = 5 --˝Đ¨DĄô°Čąď¸Ü«H®§
  49. MIS_BTNACCEPT = 6 --˝Đ¨D±µ¨üĄô°Č
  50. MIS_BTNDELIVERY= 7 --˝Đ¨DĄćĄIĄô°Č
  51. MIS_BTNPENDING = 8 --ĄĽ¨MĄô°Č˝Đ¨Dˇ]«Č¤áşÝ¸T¤î«ö¶sˇ^
  52. MIS_LOG = 9 --˝Đ¨DĄô°Č¤é»x«H®§
  53.  
  54. --Ąô°Č«H®§©w¸q
  55. --§ą¦¨ Ąô°Č»Ý¨DĂţ«¬©w¸q
  56. MIS_NEED_ITEM = 0 --»Ý­nŔň¨úŞ««~
  57. MIS_NEED_KILL = 1 --»Ý­nşR·´Ş«Ąó
  58. MIS_NEED_SEND = 2 --»Ý­n°eµą¬Y¤H
  59. MIS_NEED_CONVOY = 3 --»Ý­nĹ@°e¨ě¬YŞş
  60. MIS_NEED_EXPLORE = 4 --»Ý­n±´ŻÁ¬YŞş
  61. MIS_NEED_DESP = 5 --¤ĺ¦rŞí­zŞşĄô°ČĄŘĽĐ
  62.  
  63. --§ą¦¨Ąô°ČĽúŔyĂţ«¬©w¸q
  64. MIS_PRIZE_ITEM = 0 --ĽúŔyŞ««~
  65. MIS_PRIZE_MONEY = 1 --ĽúŔyŞ÷żú
  66. MIS_PRIZE_FAME = 2 --ĽúŔyÁn±ć
  67. MIS_PRIZE_CESS = 3 --ĽúŔy¶T©öµ|˛v
  68. MIS_PRIZE_PETEXP = 4 --ĽúŔyĂdŞ«¸gĹç­Č
  69.  
  70. --¨¤¦âÂľ·~Ăţ«¬
  71. MIS_NOVICE = 0 --·s¤â
  72. MIS_FENCER = 1 --ĽC¤h
  73. MIS_HUNTER = 2 --Ây¤H
  74. MIS_EXPERIENCED = 2 --¤ô¤â
  75. MIS_RISKER = 4 --«_ŔIŞĚ
  76. MIS_DOCTOR = 5 --ÂĺĄÍ(¬čÄ@¨Ď)
  77. MIS_TECHNICIAN = 6 --§Ţ®v
  78. MIS_TRADER = 7 --°Ó¤H
  79. MIS_LARGE_FENCER = 8 --Ą¨ĽC¤h
  80. MIS_TWO_FENCER = 9 --ÂůĽC¤h
  81. MIS_SHIELD_FENCER = 10 --ĽC¬Ţ¤h
  82. MIS_WILD_ANIMAL_TRAINER = 11 --ąĄĂ~®v
  83. MIS_GUNMAN = 12 --Ş®Ŕ»¤â
  84. MIS_CLERGY = 13 --¸tÂľŞĚ
  85. MIS_SEALER = 14 --«Ę¦L®v
  86. MIS_SHIPMASTER = 15 --˛îŞř
  87. MIS_VOYAGE = 16 --Żč®ü¤h
  88. MIS_ARRIVISTE = 17 --ĽÉµo¤á
  89. MIS_ENGINEER = 18 --¤uµ{®v
  90.  
  91. --¤˝·|Ăţ«¬
  92. MIS_GUILD_NAVY = 0 --®ü­x¤˝·|
  93. MIS_GUILD_PIRATE = 1 --®üµs¤˝·|
  94.  
  95. --ĄĂ»·¬°°˛
  96. function AlwaysFailure()
  97. return LUA_FALSE
  98. end
  99.  
  100. --ĄĂ¤[¬°Żu
  101. function AlwaysTrue()
  102. return LUA_TRUE
  103. end
  104.  
  105. --¨S¦łľúĄvĽĐĹŇ
  106. function NoRecord( character, record )
  107. if record == nil then
  108. SystemNotice( character, "NoRecord:Function parameter error!" )
  109. return LUA_ERROR
  110. end
  111. local ret = IsValidRecord( character, record )
  112. if ret == LUA_FALSE then
  113. SystemNotice( character, "NoRecord:Invalid story record index error or character index error!" )
  114. return LUA_ERROR
  115. end
  116.  
  117. ret = IsRecord( character, record )
  118. if ret ~= LUA_TRUE then
  119. return LUA_TRUE
  120. end
  121. return LUA_FALSE
  122. end
  123.  
  124. --ŔË´ú§ŢŻŕެşA
  125. function HasState( character, state_id )
  126. if state_id == nil then
  127. SystemNotice( character, "HasState:Function parameter error!" )
  128. return LUA_ERROR
  129. end
  130.  
  131. local ret = GetChaStateLv( character, state_id )
  132. if ret ~= nil then
  133. if ret > 0 then
  134. return LUA_TRUE
  135. end
  136. end
  137. return LUA_FALSE
  138. end
  139.  
  140. --ŔË´ú¨¤¦âĹ髬
  141. function IsChaType( character, type_id )
  142. if type_id == nil then
  143. SystemNotice( character, "IsChaType:Function parameter error!" )
  144. return LUA_ERROR
  145. end
  146.  
  147. local ret = GetChaBody( character )
  148. if ret == type_id then
  149. return LUA_TRUE
  150. end
  151. return LUA_FALSE
  152. end
  153.  
  154. --ŔË´ú¤Ł¬O¨¤¦âĹ髬
  155. function NoChaType( character, type_id )
  156. if type_id == nil then
  157. SystemNotice( character, "NoChaType:Function parameter error!" )
  158. return LUA_ERROR
  159. end
  160.  
  161. local ret = GetChaBody( character )
  162. if ret ~= type_id then
  163. return LUA_TRUE
  164. end
  165. return LUA_FALSE
  166. end
  167. --Ľ˝©ńŻS®Ä
  168. function Starteffect( character, npc, tp )
  169.  
  170. if tp == nil then
  171. PRINT( "Starteffect:Function parameter error!" )
  172. SystemNotice( character, "Starteffect:Function parameter error!" )
  173. return LUA_ERROR
  174. end
  175.  
  176. PRINT( "Starteffect, p1 = "..tp )
  177. PlayEffect( npc, tp )
  178. return LUA_TRUE
  179. end
  180. --¬O§_¦łľúĄvĽĐĹŇ
  181. function HasRecord( character, record )
  182. if record == nil then
  183. SystemNotice( character, "HasRecord:Function parameter error!" )
  184. return LUA_ERROR
  185. end
  186. local ret = IsValidRecord( character, record )
  187. if ret == LUA_FALSE then
  188. SystemNotice( character, "HasRecord:Invalid story record index error or character index error!" )
  189. return LUA_ERROR
  190. end
  191. return IsRecord( character, record )
  192. end
  193.  
  194. --¨S¦łĄô°Č°OżýĽĐĹŇ
  195. function NoFlag( character, id, flag )
  196. if id == nil or flag == nil then
  197. SystemNotice( character, "NoFlag:Function parameter error!" )
  198. return LUA_ERROR
  199. end
  200. local ret = IsValidFlag( character, flag )
  201. if ret == LUA_FALSE then
  202. SystemNotice( character, "NoFlag:Invalid quest record index error or character index error!" )
  203. return LUA_ERROR
  204. end
  205. ret = IsFlag( character, id, flag )
  206. if ret == LUA_TRUE then
  207. return LUA_FALSE
  208. end
  209. return LUA_TRUE
  210. end
  211.  
  212. --¤ŁŻŕ¦ł¸ÓĄô°ČĹ@°eNPC
  213. function NoConvoyNpc( character, misid )
  214. if misid == nil then
  215. SystemNotice( character, "NoConvoyNpc:Function parameter error!" )
  216. return LUA_ERROR
  217. end
  218.  
  219. local ret = HasConvoyNpc( character, misid )
  220. if ret == LUA_TRUE then
  221. return LUA_FALSE
  222. end
  223.  
  224. return LUA_TRUE
  225. end
  226.  
  227. --radom Ąô°Č°eŞ«Ąóµąnpc®ÉˇA§PÂ_¬O§_npc¤w¸g±µ¨üąL¸ÓŞ««~
  228. --function NoRandNpcItemFlag( character, misid, npcid )
  229. -- if misid == nil or npcid == nil then
  230. -- SystemNotice( character, "NoRandNpcItemFlag:Function parameter error!" )
  231. -- return LUA_ERROR
  232. -- end
  233. --
  234. -- local ret = HasRandNpcItemFlag( character, misid, npcid )
  235. -- if ret == LUA_TRUE then
  236. -- return LUA_FALSE
  237. -- end
  238. -- return LUA_TRUE
  239. --end
  240.  
  241. --¨S¦łĄô°ČĽĐĹŇ
  242. function NoMission( character, id )
  243. if id == nil then
  244. SystemNotice( character, "NoMission:Function parameter error!" )
  245. return LUA_ERROR
  246. end
  247. local ret = HasMission( character, id )
  248. if ret == LUA_TRUE then
  249. return LUA_FALSE
  250. end
  251. return LUA_TRUE
  252. end
  253.  
  254. --¨S¦ł«ü©w±oradom Ąô°Č
  255. function NoRandMission( character, id )
  256. if id == nil then
  257. SystemNotice( character, "NoRandMission:function parameter error" )
  258. return LUA_ERROR
  259. end
  260.  
  261. local ret = HasRandMission( character, id )
  262. if ret == LUA_TRUE then
  263. return LUA_FALSE
  264. end
  265. return LUA_TRUE
  266. end
  267.  
  268. --Ąô°Č¨S¦łĄ˘±Ń
  269. function NoMisssionFailure( character, id )
  270. if id == nil then
  271. SystemNotice( character, "NoMisssionFailure:function parameter error" )
  272. return LUA_ERROR
  273. end
  274.  
  275. local ret = HasMisssionFailure( character, id )
  276. if ret == LUA_TRUE then
  277. return LUA_FALSE
  278. end
  279. return LUA_TRUE
  280. end
  281.  
  282. function IsMission( character, id )
  283. if id == nil then
  284. SystemNotice( character, "IsMission:Function parameter error!" )
  285. return LUA_ERROR
  286. end
  287. return HasMission( character, id )
  288. end
  289.  
  290. function NoGuild( character )
  291. local ret = HasGuild( character )
  292. if ret == LUA_TRUE then
  293. return LUA_FALSE
  294. end
  295. return LUA_TRUE
  296. end
  297.  
  298. function NoPfEqual( character, pf )
  299. local ret = PfEqual( character, pf )
  300. if ret == LUA_TRUE then
  301. return LUA_FALSE
  302. end
  303. return LUA_TRUE
  304. end
  305.  
  306. --˛KĄ[«ü©wŞş¤U¤@­ÓĄô°Č°OżýĽĐĹŇ
  307. function AddNextFlag( character, id, startflag, count )
  308. if id == nil or startflag == nil or count == nil then
  309. SystemNotice( character, "AddNextFlag:Function parameter error!" )
  310. end
  311. local num = 0
  312. for i = 1, count, 1 do
  313. local ret = IsFlag( character, id, startflag + num )
  314. if ret == LUA_FALSE then
  315. PRINT( "AddNextFlag: flag = ", startflag + num )
  316. ret = SetFlag( character, id, startflag + num )
  317. if ret ~= LUA_TRUE then
  318. SystemNotice( character, "AddNextFlag:Unable to set quest record label notice error!" )
  319. return LUA_ERROR
  320. end
  321. return LUA_TRUE
  322. end
  323. num = num + 1
  324. end
  325. return LUA_TRUE
  326. end
  327.  
  328. --ł]¸m¤U¤@­Óradom Ąô°Č°OżýĽĐĹŇ
  329. function AddRMNextFlag( character, id, startflag, count )
  330. if id == nil or startflag == nil or count == nil then
  331. SystemNotice( character, "AddRMNextFlag:Function parameter error!" )
  332. end
  333. local num = 0
  334. for i = 1, count, 1 do
  335. local ret = HasFlag( character, id, startflag + num )
  336. if ret == LUA_FALSE then
  337. PRINT( "AddRMNextFlag: flag = ", startflag + num )
  338. ret = SetFlag( character, id, startflag + num )
  339. if ret ~= LUA_TRUE then
  340. SystemNotice( character, "AddRMNextFlag:Unable to set quest record label notice error!" )
  341. return LUA_ERROR
  342. end
  343. return LUA_TRUE
  344. end
  345. num = num + 1
  346. end
  347. return LUA_TRUE
  348. end
  349. -----------˛î©ÎŞĚ¦bło­Ó´ä¤f©ÎŞĚ¦b¨ş­Ó´ä¤f
  350. -- function HasAllBoatInBerth_eitheror( character, p1, p2 )
  351. -- local ret1 = HasAllBoatInBerth( character, p1 )
  352. -- local ret2 = HasAllBoatInBerth( character, p2 )
  353. -- if ret1 ~= LUA_TRUE and ret2 ~= LUA_TRUE then
  354. -- PRINT( "ConditionsTest:HasAllBoatInBerth_eitheror = false" )
  355. -- return LUA_FALSE
  356. -- end
  357. -- if ret1 == LUA_TRUE then
  358. -- return LUA_TRUE
  359. -- end
  360. -- if ret2 == LUA_TRUE then
  361. -- return LUA_TRUE
  362. -- end
  363. -- end
  364. --ŔË´úĄô°Č°OżýĽĐĹŇ«H®§
  365. function HasFlag( character, id, flag )
  366. if id == nil or flag == nil then
  367. SystemNotice( character, "HasFlag:Function parameter error!" )
  368. return LUA_ERROR
  369. end
  370. local ret = IsValidFlag( character, flag )
  371. if ret ~= LUA_TRUE then
  372. SystemNotice( character, "HasFlag:Function parameter error!" )
  373. return LUA_ERROR
  374. end
  375. ret = IsFlag( character, id, flag )
  376. return ret
  377. end
  378.  
  379. --ŔË´ú¤@­Ó§Ç¦CŞşĄô°Č°OżýĽĐĹŇ«H®§
  380. function HasAllFlag( character, id, startflag, count )
  381. if id == nil or startflag == nil or count then
  382. SystemNotice( character, "HasAllFlag:Function parameter error!" )
  383. return LUA_ERROR
  384. end
  385. local num = 0
  386. for i = 1, count, 1 do
  387. local ret = IsFlag( character, id, startflag + num )
  388. if ret ~= LUA_TRUE then
  389. return LUA_FALSE
  390. end
  391. num = num + 1
  392. end
  393. return LUA_TRUE
  394. end
  395.  
  396. --Ŕň¨ú¤@­Ó§Ç¦CŞşĄô°ČĽĐĹŇ°OżýĽĆ¶q«H®§
  397. function GetNumFlag( character, id, startflag, count )
  398. if id == nil or startflag == nil or count == nil then
  399. SystemNotice( character, "GetNumFlag:Function parameter error!" )
  400. return 0
  401. end
  402. local num = 0
  403. for i = 1, count, 1 do
  404. local ret = IsFlag( character, id, startflag + num )
  405. if ret ~= LUA_TRUE then
  406. break
  407. end
  408. num = num + 1
  409. end
  410. return num
  411. end
  412.  
  413. --ŔËĹç­Č
  414. function IsValue( id1, id2 )
  415. if id1 == nil or id2 == nil then
  416. PRINT( "IsValue:Function parameter error!" )
  417. LG( "mission_error", "IsValue:Function parameter error!" )
  418. return LUA_ERROR
  419. end
  420. if id1 == id2 then
  421. return LUA_TRUE
  422. end
  423. return LUA_FALSE
  424. end
  425.  
  426. --ŔË´ú¬O§_¬O«ü©wŞş©ÇŞ«Ăţ«¬
  427. function IsMonster( id1, id2 )
  428. return IsValue( id1, id2 )
  429. end
  430.  
  431. --ŔË´ú¬O§_«ü©wŞşŞ««~Ăţ«¬
  432. function IsItem( id1, id2 )
  433. return IsValue( id1, id2 )
  434. end
  435.  
  436. function NoItem( character, itemid, count )
  437. if itemid == nil or count == nil then
  438. PRINT( "NoItem:parameter error!" )
  439. return LUA_ERROR
  440. end
  441.  
  442. local ret = HasItem( character, itemid, count )
  443. if ret == LUA_TRUE then
  444. return LUA_FALSE
  445. end
  446.  
  447. return LUA_TRUE
  448. end
  449.  
  450. function BankNoItem( character, itemid, count )
  451. if itemid == nil or count == nil then
  452. PRINT( "BankNoItem:parameter error!" )
  453. return LUA_ERROR
  454. end
  455.  
  456. local ret = BankHasItem( character, itemid, count )
  457. if ret == LUA_TRUE then
  458. return LUA_FALSE
  459. end
  460.  
  461. return LUA_TRUE
  462. end
  463.  
  464. function EquipNoItem( character, itemid, count )
  465. if itemid == nil or count == nil then
  466. PRINT( "EquipNoItem:parameter error!" )
  467. return LUA_ERROR
  468. end
  469.  
  470. local ret = EquipHasItem( character, itemid, count )
  471. if ret == LUA_TRUE then
  472. return LUA_FALSE
  473. end
  474.  
  475. return LUA_TRUE
  476. end
  477.  
  478. ----LeoŞşÁn±ć¨çĽĆ§PÂ_ˇA§PÂ_¨¤¦âÁn¤W¬O§_¦ł©T©wŞKŞşÁn±ć
  479. function HasCredit(character,value)
  480. local Role_Credit = GetCredit(character)
  481. if value > Role_Credit then
  482. return LUA_FALSE
  483. else
  484. return LUA_TRUE
  485. end
  486. end
  487.  
  488.  
  489. --Leo end
  490.  
  491. ----LeoŞşÁn±ć¦©°ŁˇA¦©°Ł¨¤¦âÁn¤WŞşÁn±ć
  492. function DelRoleCredit(character,npc,value)
  493. DelCredit(character,value)
  494. return LUA_TRUE
  495. end
  496. --Leo end
  497.  
  498.  
  499. -------------------¦ş¤`ĂŇ©ú----------missdk
  500. function CheckPoint (character,value)
  501. --SystemNotice( character , "value=="..value)
  502. local i= CheckBagItem( character, value )
  503. if i~=1 then
  504. SystemNotice( character , "Please ensure you have at least 1 Proof of Death on you")
  505. return LUA_FALSE
  506. end
  507. local Point_dead = GetChaItem2 ( character , 2 , value )
  508. local Point = GetItemAttr(Point_dead, ITEMATTR_VAL_STR)
  509. --SystemNotice( character , "±z¦ş¤F"..Point.."¦¸")
  510. if Point<41 then
  511. SystemNotice( character , "Please ensure that you have died enough times")
  512. return LUA_FALSE
  513.  
  514. end
  515. return LUA_TRUE
  516. end
  517.  
  518. --------------------§PÂ_­IĄ]¤şµL¬YşŘąD¨ă
  519. function HaveNoItem (character,value)
  520. --SystemNotice( character , "value=="..value)
  521. local i= CheckBagItem( character, value )
  522. --SystemNotice( character , "i=="..i)
  523. if i~=0 then
  524. SystemNotice( character , "Please ensure that you do not have any Proof of Death")
  525. return LUA_FALSE
  526. end
  527. return LUA_TRUE
  528. end
  529. ----µą¨¤¦â­IĄ]©T©w¦ě¸m˛KĄ[ąD¨ă
  530. function AddChaItem1(character,npc,value)
  531. --SystemNotice( character ,"value=="..value)
  532. local item_number = CheckBagItem( character, value )
  533. if item_number >=1 then
  534. SystemNotice( character ,"You already possess a Challenge Letter")
  535. return LUA_FALSE
  536. end
  537. ------------§PÂ_­IĄ]˛Ä¤@Äć¬O§_¬°ŞĹ
  538. --local item1=GetItemP(character,0)
  539. --local itemid1=GetItemID( item1 )
  540. --if itemid1==0 or itemid1==nil then
  541. -- SystemNotice( character, "˝Đ§â­IĄ]˛Ä¤@ÄćŞşŞ««~˛ľ¶}" )
  542. -- return LUA_FALSE
  543. --end
  544.  
  545. ------------¨ú¬DľÔ®ŃŞş«ü°w
  546. local r1=0
  547. local r2=0
  548. --SystemNotice( character ,"r1=="..r1)
  549. r1,r2 =MakeItem ( character , value , 1 , 4 )
  550. local Item_new = GetChaItem ( character , 2 , r2 )
  551.  
  552. ----------°Ożý®É¶ˇ
  553. local now_yes = os.date("%y") -------------¦~
  554. local now_month= os.date("%m") -------------¤ë
  555. local now_day= os.date("%d") -------------¤é
  556. local now_hour= os.date("%H") -------------®É
  557. local now_miniute= os.date("%M") -------------¤Ŕ
  558. local now_scend= os.date("%S") -------------’
  559. now_yes = tonumber(now_yes) -------------¦~
  560. now_month= tonumber(now_month) -------------¤ë
  561. now_day= tonumber(now_day) -------------¤é
  562. now_hour= tonumber(now_hour) -------------®É
  563. now_miniute= tonumber(now_miniute) -------------¤Ŕ
  564. now_scend= tonumber(now_scend) -------------’
  565. --local CheckDateNum = NowMonthNum * 10000 + NowDayNum * 100 + NowTimeNum
  566. --SystemNotice ( character , "now_yes=="..now_yes )
  567. --SystemNotice ( character , "now_month=="..now_month )
  568. --SystemNotice ( character , "now_day=="..now_day )
  569. --SystemNotice ( character , "now_hour=="..now_hour )
  570. --SystemNotice ( character , "now_miniute=="..now_miniute )
  571. --SystemNotice ( character , "now_scend=="..now_scend )
  572. SetItemAttr(Item_new, ITEMATTR_VAL_STA, now_month ) -------------¤ë
  573. SetItemAttr(Item_new, ITEMATTR_VAL_STR, now_day ) -------------¤é
  574. SetItemAttr(Item_new, ITEMATTR_VAL_CON, now_hour ) -------------®É
  575. SetItemAttr(Item_new, ITEMATTR_VAL_DEX, now_miniute ) -------------¤Ŕ
  576. SetItemAttr(Item_new, ITEMATTR_VAL_AGI, now_scend ) -------------’
  577. SynChaKitbag(character,13)
  578. return LUA_TRUE
  579. end
  580. function AddChaItem2(character,npc,value)
  581. local cha = ChaIsBoat ( character )
  582. if cha ==1 then
  583. SystemNotice( character ,"You need to land to complete Genesis quest")
  584. return LUA_FALSE
  585. end
  586. ------------¨ú¬DľÔ®ŃŞş«ü°w
  587. local item1=GetItemP(character,0)
  588. local itemid1=GetItemID( item1 )
  589. if itemid1~=2911 then
  590. SystemNotice( character, "Please place the Challenge Letter in the 1st slot of your inventory." )
  591. return LUA_FALSE
  592. end
  593. ----------°Ożý®É¶ˇ
  594. local now_yes = os.date("%y") -------------¦~
  595. local now_month= os.date("%m") -------------¤ë
  596. local now_day= os.date("%d") -------------¤é
  597. local now_hour= os.date("%H") -------------®É
  598. local now_miniute= os.date("%M") -------------¤Ŕ
  599. local now_scend= os.date("%S") -------------’
  600. now_yes = tonumber(now_yes) -------------¦~
  601. now_month= tonumber(now_month) -------------¤ë
  602. now_day= tonumber(now_day) -------------¤é
  603. now_hour= tonumber(now_hour) -------------®É
  604. now_miniute= tonumber(now_miniute) -------------¤Ŕ
  605. now_scend= tonumber(now_scend) -------------’
  606. --SystemNotice ( character , "now_yes=="..now_yes )
  607. --SystemNotice ( character , "now_month=="..now_month )
  608. --SystemNotice ( character , "now_day=="..now_day )
  609. --SystemNotice ( character , "now_hour=="..now_hour )
  610. --SystemNotice ( character , "now_miniute=="..now_miniute )
  611. --SystemNotice ( character , "now_scend=="..now_scend )
  612.  
  613. local item_old=GetItemP(character,0)
  614. ---------Ąh¦nş~®ŃŞş®É¶ˇ
  615. local old_month = GetItemAttr(item_old, ITEMATTR_VAL_STA) -------------¤ë
  616. local old_day = GetItemAttr(item_old, ITEMATTR_VAL_STR) -------------¤é
  617. local old_hour = GetItemAttr(item_old, ITEMATTR_VAL_CON) -------------®É
  618. local old_miniute = GetItemAttr(item_old, ITEMATTR_VAL_DEX) -------------¤Ŕ
  619. local old_scend = GetItemAttr(item_old, ITEMATTR_VAL_AGI) -------------’
  620. --SystemNotice ( character , "old_month=="..old_month )
  621. --SystemNotice ( character , "old_day=="..old_day )
  622. --SystemNotice ( character , "old_hour=="..old_hour )
  623. --SystemNotice ( character , "old_miniute=="..old_miniute)
  624. --SystemNotice ( character , "old_scend=="..old_scend )
  625.  
  626. ---------§R°Ł¬DľÔ®Ń
  627. local del_item =TakeItem( character, 0,2911, 1 )
  628. if del_item==0 then
  629. SystemNotice ( character ,"Deletion of Challenge Letter failed")
  630. return LUA_FALSE
  631. end
  632.  
  633.  
  634. local used_time=(now_scend - old_scend)+(now_miniute - old_miniute)*60+(now_hour - old_hour)*3600+(now_day - old_day)*86400+(JNSTime_Flag[now_month] - JNSTime_Flag[old_month] )*86400
  635. local cha_name = GetChaDefaultName ( character )
  636.  
  637. if used_time>28800 or used_time<0 then
  638. SystemNotice ( character ,"You took too long to complete Genesis's quest and will not receive any reward. Please try again!")
  639. return LUA_TRUE
  640. elseif used_time < 2400 and used_time>0 then
  641. Notice("Congratulations to "..cha_name.." for completing Genesis Challenge in "..used_time.." sec(s)!")
  642. end
  643. if used_time < JINISI_TIME then
  644. JINISI_TIME=used_time
  645. LG( "JiNiSiJiLu_XinXi" , "Player"..cha_name.."Broke the best record. Total voyage took"..used_time.." sec(s)!" )
  646. end
  647. ------------¨ú¦nş~®ŃŞş«ü°w
  648. local r1=0
  649. local r2=0
  650. r1,r2 =MakeItem ( character , value , 1 , 4 )
  651. local Item_new = GetChaItem ( character , 2 , r2 )
  652. GiveItem ( character , 0 , 3094 , 1 , 4 )
  653. SetItemAttr(Item_new, ITEMATTR_VAL_AGI, used_time ) -------------’
  654. SynChaKitbag(character,13)
  655. return LUA_TRUE
  656. end
  657.  
  658.  
  659. ----µą¨¤¦â­IĄ]˛KĄ[ąD¨ă
  660. function AddChaItem3(character,npc,value)
  661.  
  662. local item_number = CheckBagItem( character, value )
  663. if item_number >=1 then
  664. SystemNotice( character ,"You already possess a Special Operation Card")
  665. return LUA_FALSE
  666. end
  667.  
  668. local r1=0
  669. local r2=0
  670. --SystemNotice( character ,"r1=="..r1)
  671. r1,r2 =MakeItem ( character , value , 1 , 4 )
  672. local Item_new = GetChaItem ( character , 2 , r2 )
  673.  
  674.  
  675.  
  676. ----------°Ożý®É¶ˇ
  677. local now_yes = os.date("%y") -------------¦~
  678. local now_month= os.date("%m") -------------¤ë
  679. local now_day= os.date("%d") -------------¤é
  680. local now_hour= os.date("%H") -------------®É
  681. local now_miniute= os.date("%M") -------------¤Ŕ
  682. local now_scend= os.date("%S") -------------’
  683. now_yes = tonumber(now_yes) -------------¦~
  684. now_month= tonumber(now_month) -------------¤ë
  685. now_day= tonumber(now_day) -------------¤é
  686. now_hour= tonumber(now_hour) -------------®É
  687. now_miniute= tonumber(now_miniute) -------------¤Ŕ
  688. now_scend= tonumber(now_scend) -------------’
  689. --local CheckDateNum = NowMonthNum * 10000 + NowDayNum * 100 + NowTimeNum
  690. --SystemNotice ( character , "now_yes=="..now_yes )
  691. --SystemNotice ( character , "now_month=="..now_month )
  692. --SystemNotice ( character , "now_day=="..now_day )
  693. --SystemNotice ( character , "now_hour=="..now_hour )
  694. --SystemNotice ( character , "now_miniute=="..now_miniute )
  695. --SystemNotice ( character , "now_scend=="..now_scend )
  696. SetItemAttr(Item_new, ITEMATTR_VAL_STA, now_month ) -------------¤ë
  697. SetItemAttr(Item_new, ITEMATTR_VAL_STR, now_day ) -------------¤é
  698. SetItemAttr(Item_new, ITEMATTR_VAL_CON, now_hour ) -------------®É
  699. SetItemAttr(Item_new, ITEMATTR_VAL_DEX, now_miniute ) -------------¤Ŕ
  700. SetItemAttr(Item_new, ITEMATTR_VAL_AGI, now_scend ) -------------’
  701. SynChaKitbag(character,13)
  702. return LUA_TRUE
  703. end
  704.  
  705. function AddChaItem4(character,npc,value)
  706.  
  707. local i= CheckBagItem( character, value )
  708. --SystemNotice( character , "i=="..i)
  709. if i~=1 then
  710. SystemNotice( character , "Please ensure that you have only 1 Special Operation Card")
  711. return LUA_FALSE
  712. end
  713.  
  714.  
  715. ----------°Ożý®É¶ˇ
  716. local now_yes = os.date("%y") -------------¦~
  717. local now_month= os.date("%m") -------------¤ë
  718. local now_day= os.date("%d") -------------¤é
  719. local now_hour= os.date("%H") -------------®É
  720. local now_miniute= os.date("%M") -------------¤Ŕ
  721. local now_scend= os.date("%S") -------------’
  722. now_yes = tonumber(now_yes) -------------¦~
  723. now_month= tonumber(now_month) -------------¤ë
  724. now_day= tonumber(now_day) -------------¤é
  725. now_hour= tonumber(now_hour) -------------®É
  726. now_miniute= tonumber(now_miniute) -------------¤Ŕ
  727. now_scend= tonumber(now_scend) -------------’
  728. --SystemNotice ( character , "now_yes=="..now_yes )
  729. --SystemNotice ( character , "now_month=="..now_month )
  730. --SystemNotice ( character , "now_day=="..now_day )
  731. --SystemNotice ( character , "now_hour=="..now_hour )
  732. --SystemNotice ( character , "now_miniute=="..now_miniute )
  733. --SystemNotice ( character , "now_scend=="..now_scend )
  734.  
  735. local item_old = GetChaItem2 ( character , 2 , value )--------ŻS§O¦ć°ĘĄd
  736. ---------¨úŻS§O¦ć°ĘĄdŞş®É¶ˇ
  737. local old_month = GetItemAttr(item_old, ITEMATTR_VAL_STA) -------------¤ë
  738. local old_day = GetItemAttr(item_old, ITEMATTR_VAL_STR) -------------¤é
  739. local old_hour = GetItemAttr(item_old, ITEMATTR_VAL_CON) -------------®É
  740. local old_miniute = GetItemAttr(item_old, ITEMATTR_VAL_DEX) -------------¤Ŕ
  741. local old_scend = GetItemAttr(item_old, ITEMATTR_VAL_AGI) -------------’
  742. --SystemNotice ( character , "old_month=="..old_month )
  743. --SystemNotice ( character , "old_day=="..old_day )
  744. --SystemNotice ( character , "old_hour=="..old_hour )
  745. --SystemNotice ( character , "old_miniute=="..old_miniute)
  746. --SystemNotice ( character , "old_scend=="..old_scend )
  747.  
  748. ---------§R°ŁŻS§O¦ć°ĘĄd
  749. local del_item =TakeItem( character, 0,value, 1 )--------------
  750. if del_item==0 then
  751. SystemNotice ( character ,"Deletion of Special Operation Card failed")
  752. return LUA_FALSE
  753. end
  754.  
  755.  
  756. local used_time=(now_scend - old_scend)+(now_miniute - old_miniute)*60+(now_hour - old_hour)*3600+(now_day - old_day)*86400+(JNSTime_Flag[now_month] - JNSTime_Flag[old_month] )*86400
  757. local cha_name = GetChaDefaultName ( character )
  758.  
  759. if used_time>900 or used_time<0 then
  760. SystemNotice ( character ,"You took too long to complete this special quest. Please abandon the quest and try again!")
  761. return LUA_FALSE
  762. elseif used_time <= 900 and used_time>0 then
  763. SystemNotice(character ,"Congratulations! You have completed the Special quest! You took "..used_time.." sec(s).")
  764. end
  765.  
  766. SynChaKitbag(character,13)
  767. return LUA_TRUE
  768. end
  769.  
  770.  
  771. ---------------§PÂ_¨¤¦â¬O§_¦ł¬Y¶Ă¤ćÂIĽĆ
  772. function HasFightingPoint(character,value)
  773. --SystemNotice( character , "HasFightingPoint" )
  774. local i= CheckBagItem( character, 3849 )
  775. --SystemNotice( character , "i=="..i)
  776. if i~=1 then
  777. SystemNotice( character , "Please ensure that you have a Medal of Honor")
  778. return LUA_FALSE
  779. end
  780. local ATKER_LD = GetChaItem2 ( character , 2 , 3849 )
  781. local FightingPoint=GetItemAttr ( ATKER_LD , ITEMATTR_MAXENERGY)
  782. --SystemNotice( character , "HasFightingPoint=="..FightingPoint )
  783. if value > FightingPoint then
  784. return LUA_FALSE
  785. else
  786. return LUA_TRUE
  787. end
  788. end
  789.  
  790. ---------------§PÂ_¨¤¦â¬O§_¦ł¬YşaĹAÂIĽĆ
  791. function HasHonorPoint(character,value)
  792. --SystemNotice( character , "HasHonorPoint" )
  793. local i= CheckBagItem( character, 3849 )
  794. --SystemNotice( character , "i=="..i)
  795. if i~=1 then
  796. SystemNotice( character , "Please ensure that you have a Medal of Honor")
  797. return LUA_FALSE
  798. end
  799. local DEFER_RYZ1 = GetChaItem2 ( character , 2 , 3849 )
  800. local HonorPoint = GetItemAttr ( DEFER_RYZ1 , ITEMATTR_VAL_STR)
  801. if value > HonorPoint then
  802. return LUA_FALSE
  803. else
  804. return LUA_TRUE
  805. end
  806. end
  807.  
  808. --§PÂ_¦nş~®Ń®É¶ˇ¬O§_¤p©ó¬Y­Ó­Č
  809. function LessTime( character, value)
  810. local HHS_Num = 0
  811. HHS_Num = CheckBagItem( character, 2912 )
  812. ---SystemNotice(character,""..HHS_Num)
  813. if HHS_Num ~= 1 then
  814. SystemNotice( character, "Please make sure your inventory has only one copy of Bawcock Letter")
  815. return 0
  816. end
  817. local role_HHS = GetChaItem2 ( character , 2 , 2912 )
  818. local attr_num = GetItemAttr ( role_HHS, ITEMATTR_VAL_AGI)
  819. ----SystemNotice(character,""..attr_num)
  820. if value > attr_num then
  821. return LUA_TRUE
  822. end
  823.  
  824. return LUA_FALSE
  825. end
  826. ----LOG---------Ş÷¤ű¤ô¤âĽúŔy
  827. function JINNiuSS(character)
  828.  
  829. local cha_name = GetChaDefaultName ( character )
  830.  
  831. LG( "JINNiuSS" , "Player"..cha_name.."Exchange sailor award" )
  832. end
  833.  
  834. ------------------------------------Ş÷¤ű®üµsĽúŔy
  835. function JINNiuHD ( character,npc )
  836.  
  837. local cha_name = GetChaDefaultName ( character )
  838.  
  839. LG( "JINNiuHD" , "Player"..cha_name.."Exchange for Pirate prize" )
  840. end
  841.  
  842. ------------------------------------Ş÷¤ű˛îŞřĽúŔy
  843. function JINNiuCZ ( character,npc )
  844.  
  845. local cha_name = GetChaDefaultName ( character )
  846.  
  847. LG( "JINNiuCZ" , "Player"..cha_name.."Exchange for captain's award" )
  848. end
  849. ----LOG---------Âů¤l¤ô¤âĽúŔy
  850. function ShuangZiSS (character,npc)
  851.  
  852. local cha_name = GetChaDefaultName ( character )
  853.  
  854. LG( "ShuangZiSS" , "Player"..cha_name.."Exchange sailor award" )
  855. end
  856.  
  857. ------------------------------------Âů¤l®üµsĽúŔy
  858. function ShuangZiHD ( character,npc )
  859.  
  860. local cha_name = GetChaDefaultName ( character )
  861.  
  862. LG( "ShuangZiHD" , "Player"..cha_name.."Exchange for Pirate prize" )
  863. end
  864.  
  865. ------------------------------------Âů¤l˛îŞřĽúŔy
  866. function ShuangZiCZ ( character,npc )
  867.  
  868. local cha_name = GetChaDefaultName ( character )
  869.  
  870. LG( "ShuangZiCZ" , "Player"..cha_name.."Exchange for captain's award" )
  871. end
  872.  
  873. -----------------------------------¶}©lÂŕĄÍ
  874. function ZSSTART ( character,npc )
  875.  
  876. local cha_name = GetChaDefaultName ( character )
  877.  
  878. LG( "ZSSTART" , "Player"..cha_name.."¶}©lÂŕĄÍ" )
  879. end
  880.  
  881. ------------------------------------µ˛§ôÂŕĄÍ
  882. function ZSSTOP ( character,npc )
  883.  
  884. local cha_name = GetChaDefaultName ( character )
  885.  
  886. LG( "ZSSTOP" , "Player"..cha_name.."µ˛§ôÂŕĄÍ" )
  887. end
  888.  
  889. ------------------------------------µ˛§ô¤G¦¸ÂŕĄÍ----dina
  890. function ZSSTOP2 ( character,npc )
  891.  
  892. local cha_name = GetChaDefaultName ( character )
  893.  
  894. LG( "ZSSTOP2" , "Player"..cha_name.."µ˛§ô¤G¦¸ÂŕĄÍ" )
  895. end
  896.  
  897. --§PÂ_¦nş~®Ń®É¶ˇ¬O§_¤j©ó¬Y­Ó­Č
  898. function MoreTime( character, value)
  899. local HHS_Num = 0
  900. HHS_Num = CheckBagItem( character, 2912 )
  901. ---SystemNotice(character,""..HHS_Num)
  902. if HHS_Num ~= 1 then
  903. SystemNotice( character, "Please make sure your inventory has only one copy of Bawcock Letter")
  904. return 0
  905. end
  906. local role_HHS = GetChaItem2 ( character , 2 , 2912 )
  907. local attr_num = GetItemAttr ( role_HHS, ITEMATTR_VAL_AGI)
  908. ----SystemNotice(character,""..attr_num)
  909. if value < attr_num then
  910. return LUA_TRUE
  911. end
  912.  
  913. return LUA_FALSE
  914. end
  915.  
  916. --§PÂ_¬O§_¬ďĆإզϮM¸Ë
  917. function BaiyangOn( character )
  918. local head = GetChaItem ( character , 1 , 0 )
  919. local body = GetChaItem ( character , 1 , 2 )
  920. local hand = GetChaItem ( character , 1 , 3 )
  921. local foot = GetChaItem ( character , 1 , 4 )
  922.  
  923. local Head_ID = GetItemID ( head )
  924. local Body_ID = GetItemID ( body )
  925. local Hand_ID = GetItemID ( hand )
  926. local Foot_ID = GetItemID ( foot )
  927. local Cha_Num = GetChaTypeID( cha )
  928.  
  929. if Body_ID ~= 5341 and Body_ID ~= 5345 and Body_ID ~= 5349 and Body_ID ~= 5353 then
  930. return LUA_FALSE
  931. end
  932. if Hand_ID ~= 5342 and Hand_ID ~= 5346 and Hand_ID ~= 5350 and Hand_ID ~= 5354 then
  933. return LUA_FALSE
  934. end
  935. if Foot_ID ~= 5343 and Foot_ID ~= 5347 and Foot_ID ~= 5351 and Foot_ID ~= 5355 then
  936. return LUA_FALSE
  937. end
  938. if Cha_Num == 4 then
  939. if Head_ID ~= 5352 then
  940. return LUA_FALSE
  941. end
  942. end
  943.  
  944. return LUA_TRUE
  945. end
  946.  
  947. ---------------¦©°Ł¨¤¦â¨­¤WŞş¶Ă¤ćÂIĽĆ
  948. function TakeFightingPoint(character,value)
  949. --SystemNotice( character , "TakeFightingPoint" )
  950. local i= CheckBagItem( character, 3849 )
  951. --SystemNotice( character , "i=="..i)
  952. if i~=1 then
  953. SystemNotice( character , "Please ensure that you have a Medal of Honor")
  954. return LUA_FALSE
  955. end
  956. local ATKER_LD = GetChaItem2 ( character , 2 , 3849 )
  957. local FightingPoint=GetItemAttr ( ATKER_LD , ITEMATTR_MAXENERGY)
  958. --SystemNotice( character , "HasFightingPoint=="..FightingPoint )
  959. if value > FightingPoint then
  960. return LUA_FALSE
  961. else
  962. local new_point=FightingPoint - value
  963. SetItemAttr ( ATKER_LD , ITEMATTR_MAXENERGY , new_point)
  964. return LUA_TRUE
  965. end
  966. end
  967.  
  968. ---------------¦©°Ł¨¤¦â¨­¤WŞşşaĹAÂIĽĆ
  969. function TakeHonorPoint(character,value)
  970. --SystemNotice( character , "TakeHonorPoint" )
  971. local i= CheckBagItem( character, 3849 )
  972. --SystemNotice( character , "i=="..i)
  973. if i~=1 then
  974. SystemNotice( character , "Please ensure that you have a Medal of Honor")
  975. return LUA_FALSE
  976. end
  977. local DEFER_RYZ1 = GetChaItem2 ( character , 2 , 3849 )
  978. local HonorPoint = GetItemAttr ( DEFER_RYZ1 , ITEMATTR_VAL_STR)
  979. if value > HonorPoint then
  980. return LUA_FALSE
  981. else
  982. local new_point=HonorPoint - value
  983. SetItemAttr ( DEFER_RYZ1 , ITEMATTR_VAL_STR , new_point)
  984. return LUA_TRUE
  985. end
  986. end
  987.  
  988. --§PÂ_˛Ő¶¤°^Äm«×
  989. function HasOffer( character, value )
  990. local ret = HasZuDuiGongXianDu( character, value )
  991. if ret == LUA_TRUE then
  992. return LUA_TRUE
  993. end
  994.  
  995. return LUA_FALSE
  996. end
  997.  
  998. --¦©°Ł˛Ő¶¤°^Äm«×
  999. function TakeOffer( character, value )
  1000. local ret = TakeZuDuiGongXianDu( character, value )
  1001. if ret == LUA_TRUE then
  1002. return LUA_TRUE
  1003. end
  1004.  
  1005. return LUA_FALSE
  1006. end
  1007.  
  1008. -------§PÂ_¨¤¦â˛ľ°Ęłt«×¬O§_ąF¨ě¬Y­Č
  1009. function CheckSpeed( character, value)
  1010. local Role_Speed = GetChaAttr( character, ATTR_MSPD )
  1011. if Role_Speed < value then
  1012. return LUA_FALSE
  1013. end
  1014.  
  1015. return LUA_TRUE
  1016.  
  1017. end
  1018.  
  1019. ---------------------------------------------------------------Ş÷¤űŻS§O¦ć°ĘĄd---------missionsdk
  1020.  
  1021. function AddChaItem5(character,npc,value)
  1022.  
  1023. local i= CheckBagItem( character, value )
  1024. --SystemNotice( character , "i=="..i)
  1025. if i~=1 then
  1026. SystemNotice( character , "Please make sure you have 1 Taurus Special Operation Card on you")
  1027. return LUA_FALSE
  1028. end
  1029.  
  1030.  
  1031. ----------°Ożý®É¶ˇ
  1032. local now_yes = os.date("%y") -------------¦~
  1033. local now_month= os.date("%m") -------------¤ë
  1034. local now_day= os.date("%d") -------------¤é
  1035. local now_hour= os.date("%H") -------------®É
  1036. local now_miniute= os.date("%M") -------------¤Ŕ
  1037. local now_scend= os.date("%S") -------------’
  1038. now_yes = tonumber(now_yes) -------------¦~
  1039. now_month= tonumber(now_month) -------------¤ë
  1040. now_day= tonumber(now_day) -------------¤é
  1041. now_hour= tonumber(now_hour) -------------®É
  1042. now_miniute= tonumber(now_miniute) -------------¤Ŕ
  1043. now_scend= tonumber(now_scend) -------------’
  1044. --SystemNotice ( character , "now_yes=="..now_yes )
  1045. --SystemNotice ( character , "now_month=="..now_month )
  1046. --SystemNotice ( character , "now_day=="..now_day )
  1047. --SystemNotice ( character , "now_hour=="..now_hour )
  1048. --SystemNotice ( character , "now_miniute=="..now_miniute )
  1049. --SystemNotice ( character , "now_scend=="..now_scend )
  1050.  
  1051. local item_old = GetChaItem2 ( character , 2 , value )--------Ş÷¤űŻS§O¦ć°ĘĄd
  1052. ---------¨úŻS§O¦ć°ĘĄdŞş®É¶ˇ
  1053. local old_month = GetItemAttr(item_old, ITEMATTR_VAL_STA) -------------¤ë
  1054. local old_day = GetItemAttr(item_old, ITEMATTR_VAL_STR) -------------¤é
  1055. local old_hour = GetItemAttr(item_old, ITEMATTR_VAL_CON) -------------®É
  1056. local old_miniute = GetItemAttr(item_old, ITEMATTR_VAL_DEX) -------------¤Ŕ
  1057. local old_scend = GetItemAttr(item_old, ITEMATTR_VAL_AGI) -------------’
  1058. --SystemNotice ( character , "old_month=="..old_month )
  1059. --SystemNotice ( character , "old_day=="..old_day )
  1060. --SystemNotice ( character , "old_hour=="..old_hour )
  1061. --SystemNotice ( character , "old_miniute=="..old_miniute)
  1062. --SystemNotice ( character , "old_scend=="..old_scend )
  1063.  
  1064. ---------§R°ŁŻS§O¦ć°ĘĄd
  1065. local del_item =TakeItem( character, 0,value, 1 )--------------
  1066. if del_item==0 then
  1067. SystemNotice ( character ,"Deletion of Taurus special quest card failed")
  1068. return LUA_FALSE
  1069. end
  1070.  
  1071.  
  1072. local used_time=(now_scend - old_scend)+(now_miniute - old_miniute)*60+(now_hour - old_hour)*3600+(now_day - old_day)*86400+(JNSTime_Flag[now_month] - JNSTime_Flag[old_month] )*86400
  1073. local cha_name = GetChaDefaultName ( character )
  1074.  
  1075. if used_time>420 or used_time<0 then
  1076. SystemNotice ( character ,"You took too long to complete this special quest. Please abandon the quest and try again!")
  1077. return LUA_FALSE
  1078. elseif used_time <= 420 and used_time>0 then
  1079. SystemNotice(character ,"Congratulations! You have completed the Special quest! You took "..used_time.." sec(s).")
  1080. end
  1081.  
  1082. SynChaKitbag(character,13)
  1083. return LUA_TRUE
  1084. end
  1085.  
  1086. ------------------§PÂ_¬O§_ÂŕĄÍąL
  1087. function CheckZS( character )
  1088. local Zs_Exp = GetChaAttr ( character , ATTR_CSAILEXP )
  1089. if Zs_Exp < 1 then
  1090. return LUA_FALSE
  1091. end
  1092.  
  1093. return LUA_TRUE
  1094.  
  1095. end
  1096.  
  1097. --§PÂ_şaĹA­Č¬O§_¤p©ó¬Y­Ó­Č
  1098. function LessCredit( character, p1, value )
  1099. local ret = LessYongYuZhi( character, p1, value )
  1100. if ret == LUA_TRUE then
  1101. return LUA_TRUE
  1102. end
  1103.  
  1104. return LUA_FALSE
  1105. end
  1106. ------------------ŔË´úąD¨ă¤W˝s¸ą¬O§_¬Ű¦P
  1107. function CheckItem( character, itemid1, itemid2 )
  1108. if itemid1 == nil or itemid2 == nil then
  1109. PRINT( "CheckItem:parameter error!" )
  1110. return LUA_ERROR
  1111. end
  1112. local item1=GetItemP(character,2)
  1113. local item2=GetItemP(character,3)
  1114. local itemida=GetItemID( item1 )
  1115. local itemidb=GetItemID( item2 )
  1116. local itemid1_number=GetItemAttr ( item1 , ITEMATTR_VAL_STR )
  1117. local itemid2_number=GetItemAttr ( item2 , ITEMATTR_VAL_STR )
  1118.  
  1119.  
  1120. if itemid1_number~=itemid2_number or itemida~=2902 or itemidb~=2903 then
  1121. SystemNotice( character, "Love number does not match or is not placed at correct inventory position" )
  1122. return LUA_FALSE
  1123. end
  1124. return LUA_TRUE
  1125. end
  1126.  
  1127. function CheckBag( character, itemid, value1, value2)-----------value1===¦ě¸mˇAvalue2===ĽĆ¶q
  1128. local cha = ChaIsBoat ( character )
  1129. if cha ==1 then
  1130. --SystemNotice( character ,"˝Đ±z¤W©¤±µĄô°Č")
  1131. return LUA_TRUE
  1132. end
  1133. if itemid== nil or value1== nil or value2== nil then
  1134. PRINT( "CheckBag:parameter error!" )
  1135. return LUA_ERROR
  1136. end
  1137. local item=GetItemP(character,value1)
  1138. local itemida=GetItemID( item )
  1139. local i = CheckBagItem( character, itemid ) ---¨úĽĆ¶q
  1140. local item_name=GetItemName ( itemid )
  1141. local item_pos=value1+1
  1142. if itemid~=itemida or i~=value2 then
  1143. SystemNotice( character, "Please ensure that inventory "..item_pos.." position still have "..value2.." "..item_name )
  1144. return LUA_FALSE
  1145. end
  1146. return LUA_TRUE
  1147. end
  1148.  
  1149. function CheckBagEmp( character,value)-----------value===¦ě¸m
  1150. if value==nil then
  1151. PRINT( "CheckBagEmp:parameter error!" )
  1152. return LUA_ERROR
  1153. end
  1154. local item=GetItemP(character,value)
  1155. local itemid=GetItemID( item )
  1156. local item_pos=value+1
  1157. local cha = ChaIsBoat ( character )
  1158. if cha ==1 then
  1159. SystemNotice( character, "To challenge Genesis, player can go to (2217, 2911) and look for Coddy. Also remove your inventory "..item_pos.."move inventory off this space. All players at sea please land")
  1160. return LUA_FALSE
  1161. end
  1162. if itemid~=0 then
  1163. SystemNotice( character, "To challenge Genesis, player can go to (2217, 2911) and look for Coddy. Also remove your inventory "..item_pos.."move inventory off this space. All players at sea please land")
  1164. return LUA_FALSE
  1165. end
  1166. return LUA_TRUE
  1167. end
  1168. --˛M°ŁPKşaĹA­Č
  1169. function AddCredit( character, value )
  1170. local ret = AddYongYuZhi( character, value )
  1171. if ret == LUA_TRUE then
  1172. return LUA_TRUE
  1173. end
  1174.  
  1175. return LUA_FALSE
  1176. end
  1177.  
  1178. --ŔË´úżú¤Ł¨¬
  1179. function NoMoney( character, money )
  1180. PRINT( "NoMoney:HasMoney" )
  1181. local ret = HasMoney( character, money )
  1182. PRINT( "NoMoney:HasMoney return ret = ", ret )
  1183. if ret ~= LUA_TRUE then
  1184. return LUA_TRUE
  1185. end
  1186. return LUA_FALSE
  1187. end
  1188.  
  1189. --Ŕˬd¬O§_˛Ĺ¦XÂŕÂľ±řĄó
  1190. function CheckConvertProfession( character, newpf )
  1191. if newpf == nil then
  1192. PRINT( "CheckConvertProfession:Function parameter error!" )
  1193. SystemNotice( character, "CheckConvertProfession:Function parameter error!" )
  1194. return LUA_ERROR
  1195. end
  1196.  
  1197. --¨ú±o¨¤¦âÂľ·~©MĂţ«¬
  1198. local ret, cat, pf = GetCatAndPf( character )
  1199. PRINT( "CheckConvertProfession: GetCatAndPf: ret =, pf = , newpf = , cat = , Profession = ", ret, pf, newpf, cat, Profession )
  1200. --§PÂ_¬O§_·s¤âˇA·s¤â¨S¦łÂŕÂľ­­¨î
  1201. if pf ~= 0 then
  1202. --ŔË´ú¬O§_¦łÂŕÂľ­­¨î
  1203. if Profession ~= nil and Profession[pf] ~= nil then
  1204. local flag = 0
  1205. PRINT( "CheckConvertProfession: pf count = ", Profession[pf].count )
  1206. for n = 1, Profession[pf].count, 1 do
  1207. PRINT( "CheckConvertProfession: n =, newpf = , pf = ", n, newpf, Profession[pf][n] )
  1208. if Profession[pf][n] == newpf then
  1209. --¸ÓÂľ·~¤ął\ÂŕÂľ
  1210. flag = 1
  1211. break
  1212. end
  1213. end
  1214.  
  1215. --§PÂ_¬O§_ĄiĄHÂŕÂľ
  1216. if flag ~= 1 then
  1217. PRINT( "CheckConvertProfession: return false" )
  1218. return LUA_FALSE
  1219. end
  1220. else
  1221. PRINT( "CheckConvertProfession: return false fo Profession[pf] == nil " )
  1222. return LUA_FALSE
  1223. end
  1224. end
  1225.  
  1226. PRINT( "CheckConvertProfession: Category check cat =, newpf = ", cat, newpf )
  1227. --ŔË´ú¬O§_¦łĹé§Î­­¨î
  1228. if Category ~= nil and Category[cat] ~= nil then
  1229. local flag = 0
  1230. for n = 1, Category[cat].count, 1 do
  1231. PRINT( "CheckConvertProfession:n = , newpf = , catpf = ", n, newpf, Category[cat][n] )
  1232. if Category[cat][n] == newpf then
  1233. PRINT( "CheckConvertProfession: return false" )
  1234. flag = 1
  1235. break
  1236. end
  1237. end
  1238.  
  1239. if flag ~= 1 then
  1240. PRINT( "CheckConvertProfession: return false" )
  1241. return LUA_FALSE
  1242. end
  1243. else
  1244. PRINT( "CheckConvertProfession: return false fo Category[cat] == nil " )
  1245. end
  1246.  
  1247. PRINT( "CheckConvertProfession: return true" )
  1248. return LUA_TRUE
  1249. end
  1250.  
  1251. --¤¤Â_Ąô°Č
  1252. function CancelMission( character, id, sid )
  1253. PRINT( "CancelMission, sid = ", sid )
  1254. if sid == nil or Mission[sid] == nil then
  1255. PRINT( "CancelMission: abandoned quest function parameter cannot be as null!sid = "..sid )
  1256. SystemNotice( character, "CancelMission: abandoned quest function parameter cannot be as null!sid = "..sid )
  1257. LG( "mission_error", "CancelMission: abandoned quest function parameter cannot be as null!sid = "..sid )
  1258. local ret = ClearMission( character, id )
  1259. if ret ~= LUA_TRUE then
  1260. LG( "mission_error", "CancelMission: delete character target quest notice failed!charname = , id = , sid = ", GetCharName( character ), id, sid )
  1261. else
  1262. SystemNotice( character, "has cleared invalid quest notice !ID = "..sid )
  1263. LG( "mission_error", "CancelMission:clear target character quest notice successful!charname = , id = , sid = ", GetCharName( character ), id, sid )
  1264. end
  1265.  
  1266. return LUA_FALSE
  1267. end
  1268.  
  1269. local mission = Mission[sid]
  1270.  
  1271. PRINT( "CancelMission:mission.cancel", mission.cancel )
  1272. if mission.tp == NOMAL_MISSION or mission.tp == WORLD_MISSION then
  1273. if mission.cancel == nil then
  1274. PRINT( "CancelMission:Target quest has not cancel operation. Return true" )
  1275. return LUA_TRUE
  1276. end
  1277.  
  1278. local ret = NpcCancelTrigger( character, mission.cancel, mission.id, mission.sid )
  1279. if ret ~= LUA_TRUE then
  1280. PRINT( "CancelMission:NpcCancelTrigger accept deliver quest trigger failed!" )
  1281. SystemNotice( character, "CancelMission:NpcCancelTrigger accept deliver quest trigger failed!" )
  1282. return LUA_FALSE
  1283. end
  1284. PRINT( "CancelMission: NpcTrigger, return true" )
  1285. elseif mission.tp == RAND_MISSION then
  1286. --Şě©l¤ĆĄţ§˝radom Ąô°Č°ŃĽĆ
  1287. InitRandParam()
  1288.  
  1289. --Ŕň¨ú¨¤¦âŞşradom Ąô°Č°t¸m«H®§
  1290. PRINT( "CancelMission:GetRandMission, id = ", id )
  1291. local ret
  1292. RandParam.id = id
  1293. ret, RandParam.tp, RandParam.level, RandParam.exp, RandParam.money, RandParam.prizedata, RandParam.prizetp, RandParam.numdata = GetRandMission( character, id )
  1294. if ret ~= LUA_TRUE then
  1295. PRINT( "CancelMission:GetRandMission error." )
  1296. SystemNotice( character, "CancelMission:GetRandMission error." )
  1297. return LUA_FALSE
  1298. end
  1299. PRINT( "CancelMission:tp, level, exp, money, item, numdata", RandParam.tp, RandParam.level, RandParam.exp, RandParam.money, RandParam.prizedata, RandParam.prizetp, RandParam.numdata )
  1300.  
  1301. local index = GetRandMissionTypeIndex( mission, RandParam.tp )
  1302. PRINT( "CancelMission:GetRandMissionTypeIndex index = ", index )
  1303. if index == 0 then
  1304. PRINT( "CancelMission:obtain random quest matching type notice failed!" )
  1305. SystemNotice( character, "CancelMission:obtain random quest matching type notice failed!" )
  1306. return LUA_FALSE
  1307. end
  1308.  
  1309. if mission.missionlist == nil or mission.missionlist[index] == nil then
  1310. PRINT( "CancelMission:random quest: quest notice error!mission.missionlist = , tpindex = ", mission.missionlist, index )
  1311. SystemNotice( character, "CancelMission:random quest: quest notice error!mission.missionlist = , tpindex = ", mission.missionlist, index )
  1312. return LUA_FALSE
  1313. end
  1314.  
  1315. if mission.missionlist[index].cancel == nil then
  1316. PRINT( "CancelMission:Target quest has not cancel operation. Return true" )
  1317. return LUA_TRUE
  1318. end
  1319.  
  1320. ret = NpcCancelTrigger( character, mission.missionlist[index].cancel, mission.id, mission.sid )
  1321. if ret ~= LUA_TRUE then
  1322. PRINT( "CancelMission:NpcCancelTrigger accept deliver quest trigger failed!" )
  1323. SystemNotice( character, "CancelMission:NpcCancelTrigger accept deliver quest trigger failed!" )
  1324. return LUA_FALSE
  1325. end
  1326. PRINT( "CancelMission: random quest: NpcCancelTrigger, return true" )
  1327. else
  1328. PRINT( "CancelMission:incorrect quest type notice.ID = "..mission.sid )
  1329. SystemNotice( character, "CancelMission:incorrect quest type notice.ID = "..mission.sid )
  1330. return LUA_FALSE
  1331. end
  1332.  
  1333. return LUA_TRUE
  1334. end
  1335.  
  1336. --±µ¨üĄô°Č
  1337. function AcceptMission( character, npc, missionlist, tpindex )
  1338. PRINT( "AcceptMission" )
  1339. local npcid = GetCharID( npc )
  1340. local ret, id, state, tp = GetMissionTempInfo( character, npcid )
  1341. if ret ~= LUA_TRUE then
  1342. SystemNotice( character, "AcceptMission:obtain character dialogue temporary quest notice error!" )
  1343. return LUA_FALSE
  1344. end
  1345.  
  1346. local mission
  1347. if tp == WORLD_MISSION then
  1348. if Mission[id] == nil then
  1349. SystemNotice( character, "AcceptMission:Obtain character incorrect world quest index notice!ID = "..id )
  1350. LG( "mission_error", "AcceptMission:Obtain character incorrect world quest index notice!ID = "..id )
  1351. return LUA_FALSE
  1352. end
  1353. mission = Mission[id]
  1354. else
  1355. if missionlist[id] == nil then
  1356. PRINT( "AcceptMission:obtain character incorrect common quest index notice!ID = "..id )
  1357. SystemNotice( character, "AcceptMission:obtain character incorrect common quest index notice!ID = "..id )
  1358. LG( "mission_error", "AcceptMission:obtain character incorrect common quest index notice!ID = "..id )
  1359. return LUA_FALSE
  1360. end
  1361. if missionlist == nil then
  1362. PRINT( "AcceptMission:Function parameter error!missionlist = "..missionlist )
  1363. SystemNotice( character, "AcceptMission:Function parameter error!missionlist = "..missionlist )
  1364. LG( "mission_error", "AcceptMission:Function parameter error!missionlist = "..missionlist )
  1365. return LUA_ERROR
  1366. end
  1367. mission = missionlist[id]
  1368. end
  1369.  
  1370. if mission.begin == nil then
  1371. PRINT( "AcceptMission:obtain character incorrect quest start trigger notice!ID = "..id )
  1372. SystemNotice( character, "AcceptMission:obtain character incorrect quest start trigger notice!" )
  1373. LG( "mission_error", "AcceptMission:obtain character incorrect quest start trigger notice!ID = "..id )
  1374. return LUA_FALSE
  1375. end
  1376.  
  1377. PRINT( "AcceptMission:npcid = %d ", npcid )
  1378. if mission.tp == NOMAL_MISSION or mission.tp == WORLD_MISSION then
  1379. PRINT( "AcceptMission:Required number of empty slots in inventory:numgrid = ", mission.begin.baggrid )
  1380. local ret = HasLeaveBagGrid( character, mission.begin.baggrid )
  1381. if ret ~= LUA_TRUE then
  1382. PRINT( "AcceptMission:insufficient inventory slot when character accept quest! num = ", mission.begin.baggrid )
  1383. BickerNotice( character, "Inventory space insufficient, requires "..mission.begin.baggrid.." space. Activation of quest failed!" )
  1384. return LUA_FALSE
  1385. end
  1386.  
  1387. local ret = NpcTrigger( character, npc, mission.begin, mission.id, mission.sid )
  1388. if ret ~= LUA_TRUE then
  1389. PRINT( "AcceptMission:NpcTrigger accept quest trigger management failed!" )
  1390. SystemNotice( character, "AcceptMission:NpcTrigger accept quest trigger management failed!" )
  1391. return LUA_FALSE
  1392. end
  1393. PRINT( "AcceptMission: NpcTrigger, return true" )
  1394. elseif mission.tp == RAND_MISSION then
  1395. if mission.missionlist == nil or mission.missionlist[tpindex] == nil or mission.missionlist[tpindex].begin.baggrid == nil then
  1396. PRINT( "AcceptMission:random quest: quest notice error!mission.missionlist = , tpindex = ", mission.missionlist, tpindex )
  1397. SystemNotice( character, "AcceptMission:random quest: quest notice error!mission.missionlist = , tpindex = ", mission.missionlist, tpindex )
  1398. return LUA_FALSE
  1399. end
  1400.  
  1401. PRINT( "AcceptMission:Required number of empty slots in inventory:numgrid = ", mission.missionlist[tpindex].begin.baggrid )
  1402. local numgrid = mission.missionlist[tpindex].begin.baggrid
  1403. local ret = HasLeaveBagGrid( character, numgrid )
  1404. if ret ~= LUA_TRUE then
  1405. PRINT( "AcceptMission:insufficient inventory slot when character accept quest! num = ", numgrid )
  1406. BickerNotice( character, "Inventory space insufficient, requires "..numgrid.." space. Activation of quest failed!" )
  1407. return LUA_FALSE
  1408. end
  1409.  
  1410. ret = NpcTrigger( character, npc, mission.missionlist[tpindex].begin, mission.id, mission.sid )
  1411. if ret ~= LUA_TRUE then
  1412. PRINT( "AcceptMission:NpcTrigger accept quest trigger management failed!" )
  1413. SystemNotice( character, "AcceptMission:NpcTrigger accept quest trigger management failed!" )
  1414. return LUA_FALSE
  1415. end
  1416. PRINT( "AcceptMission: random quest: NpcTrigger, return true" )
  1417. else
  1418. PRINT( "AcceptMission:incorrect quest type notice.ID = "..mission.sid )
  1419. SystemNotice( character, "AcceptMission:incorrect quest type notice.ID = "..mission.sid )
  1420. return LUA_FALSE
  1421. end
  1422.  
  1423. if tp ~= WORLD_MISSION then
  1424. ret = RefreshMissionState( character, npc )
  1425. if ret ~= LUA_TRUE then
  1426. PRINT( "AcceptMission:random quest: RefreshMissionState accept quest reset npc quest status failed!" )
  1427. SystemNotice( character, "AcceptMission:random quest:RefreshMissionState accept quest change npc quest status failed!" )
  1428. return LUA_FALSE
  1429. end
  1430. end
  1431.  
  1432. return LUA_TRUE
  1433. end
  1434.  
  1435. --§ą¦¨Ąô°Č
  1436. function CompleteMission( character, npc, missionlist, selitem, param )
  1437. PRINT( "CompleteMission" )
  1438. if missionlist == nil then
  1439. SystemNotice( character, "CompleteMission:Function parameter error!" )
  1440. return LUA_ERROR
  1441. end
  1442.  
  1443. local npcid = GetCharID( npc )
  1444. local ret, id, state, tp = GetMissionTempInfo( character, npcid )
  1445. if ret ~= LUA_TRUE then
  1446. SystemNotice( character, "CompleteMission:obtain character dialogue temporary quest notice error!" )
  1447. return LUA_FALSE
  1448. end
  1449.  
  1450. local mission
  1451. if tp == WORLD_MISSION then
  1452. if Mission[id] == nil then
  1453. SystemNotice( character, "CompleteMission:Obtain character incorrect world quest index notice!ID = "..id )
  1454. LG( "mission_error", "CompleteMission:Obtain character incorrect world quest index notice!ID = "..id )
  1455. return LUA_FALSE
  1456. end
  1457. mission = Mission[id]
  1458. else
  1459. if missionlist[id] == nil then
  1460. SystemNotice( character, "CompleteMission:obtain character incorrect common quest index notice!ID = "..id )
  1461. LG( "mission_error", "CompleteMission:obtain character incorrect common quest index notice!ID = "..id )
  1462. return LUA_FALSE
  1463. end
  1464. mission = missionlist[id]
  1465. end
  1466.  
  1467. local ret = HasMisssionFailure( character, mission.id )
  1468. if ret == LUA_TRUE then
  1469. BickerNotice( character, "Quest["..mission.name.."]has failed, please select to abandon to clear quest log!" )
  1470. return LUA_TRUE
  1471. end
  1472.  
  1473. if mission.tp == NOMAL_MISSION or mission.tp == WORLD_MISSION then
  1474. PRINT( "CompleteMission:Required number of empty slots in inventory:numgrid = ", mission.result.baggrid )
  1475. local ret = HasLeaveBagGrid( character, mission.result.baggrid )
  1476. if ret ~= LUA_TRUE then
  1477. PRINT( "CompleteMission:insufficient inventory slot when character completes quest!num = ", mission.result.baggrid )
  1478. BickerNotice( character, "Inventory space insufficient, requires "..mission.result.baggrid.."1 slot. Completion of quest failed!" )
  1479. return LUA_FALSE
  1480. end
  1481.  
  1482. local ret = NpcTrigger( character, npc, mission.result, mission.id, mission.sid )
  1483. if ret ~= LUA_TRUE then
  1484. PRINT( "CompleteMission:NpcTrigger function manage delievery trigger failed!" )
  1485. SystemNotice( character, "CompleteMission:NpcTrigger function manage delievery trigger failed!" )
  1486. return LUA_FALSE
  1487. end
  1488.  
  1489. PRINT( "CompleteMission:prize count = "..mission.prize.count )
  1490. if mission.prize.count > 0 then
  1491. local ret = MisPrizeProc( character, npc, mission, selitem, param )
  1492. if ret ~= LUA_TRUE then
  1493. PRINT( "CompleteMission:MisPrizeProc function manage quest reward failed!" )
  1494. SystemNotice( character, "CompleteMission:MisPrizeProc function manage quest reward failed!" )
  1495. end
  1496. end
  1497. elseif mission.tp == RAND_MISSION then
  1498. local ret, index, loopdata = GetCharRandMission( character, mission.id, mission )
  1499. if ret ~= LUA_TRUE or index == 0 then
  1500. --®ÚľÚradom Ąô°Č°ŃĽĆĄÍ¦¨radom Ąô°Č«H®§żů»~
  1501. PRINT( "CompleteMission:GetcharRandMission, according to random quest parameter generate random quest notice error!" )
  1502. SystemNotice( character, "CompleteMission:GetcharRandMission, according to random quest parameter generate random quest notice error!" )
  1503. return LUA_FALSE
  1504. end
  1505.  
  1506. PRINT( "CompleteMission:Required number of empty slots in inventory:numgrid = ", mission.missionlist[index].result.baggrid )
  1507. local numgrid = mission.missionlist[index].result.baggrid
  1508. local ret = HasLeaveBagGrid( character, numgrid )
  1509. if ret ~= LUA_TRUE then
  1510. PRINT( "CompleteMission:insufficient inventory slot when character accept quest! num = ", numgrid )
  1511. BickerNotice( character, "Inventory space insufficient, requires "..numgrid.."1 slot. Completion of quest failed!" )
  1512. return LUA_FALSE
  1513. end
  1514.  
  1515. local ret = NpcTrigger( character, npc, mission.missionlist[index].result, mission.id, mission.sid )
  1516. if ret ~= LUA_TRUE then
  1517. PRINT( "CompleteMission:random quest: NpcTrigger function manage delievery trigger failed!" )
  1518. SystemNotice( character, "CompleteMission:random quest: NpcTrigger function manage delievery trigger failed!" )
  1519. return LUA_FALSE
  1520. end
  1521.  
  1522. PRINT( "CompleteMission:prize count = "..mission.missionlist[index].prize.count )
  1523. if mission.missionlist[index].prize.count > 0 then
  1524. local ret = MisPrizeProc( character, npc, mission.missionlist[index], selitem, param )
  1525. if ret ~= LUA_TRUE then
  1526. PRINT( "CompleteMission:MisPrizeProc function manage quest reward failed!" )
  1527. SystemNotice( character, "CompleteMission:MisPrizeProc function manage quest reward failed!" )
  1528. end
  1529. end
  1530.  
  1531. PRINT( "CompleteMission:CompleteRandMission, id = ", mission.id )
  1532. ret = CompleteRandMissionCount( character, mission.id )
  1533. if ret ~= LUA_TRUE then
  1534. PRINT( "CompleteRandMission:random quest completion completes calculation function transfer failed:misid = ", mission.id )
  1535. LG( "randmission_error", "CompleteRandMission:random quest completion completes calculation function transfer failed:misid = ", mission.id )
  1536. end
  1537.  
  1538. --§PÂ_¬O§_¶]Ŕôµ˛§ô
  1539. local ret, loopnum = GetRandMissionNum( character, mission.id )
  1540. if ret ~= LUA_TRUE then
  1541. PRINT( "CompleteRandMission:GetRandMissionNum function transfer failed. Unable to obtain character random quest loop count!id = ", id )
  1542. LG( "randmission_error", "CompleteRandMission:GetRandMissionNum function transfer failed. Unable to obtain character random quest loop count!id = ", id )
  1543. SystemNotice( character, "CompleteRandMission:GetRandMissionNum function transfer failed. Unable to obtain character random quest loop count!id = "..id )
  1544. --˛M°Ł¸Ó¨¤¦â¸Óradom Ąô°Č­pĽĆ
  1545. ResetRandMissionNum( character, mission.id )
  1546. else
  1547. loopnum = loopnum + 1 --Âŕ´«¬°luaĽĆ˛ŐŻÁ¤Ţ
  1548. PRINT( "CompleteRandMission:loopnum, loopinfo", loopnum, mission.loopinfo[loopnum] )
  1549.  
  1550. if loopdata == nil or mission.loopinfo[loopnum] == nil then
  1551. PRINT( "CompleteRandMission:quest cycle data error!loopnum = "..loopnum.." id = "..mission.id.." loopdata = "..loopdata )
  1552. LG( "randmission_error", "CompleteRandMission:quest cycle data error!loopnum = "..loopnum.." id = "..mission.id.." loopdata = "..loopdata )
  1553. SystemNotice( character, "CompleteRandMission:quest cycle data error!loopnum = "..loopnum.." id = "..mission.id.." loopdata = "..loopdata )
  1554. ResetRandMissionNum( character, mission.id )
  1555. return LUA_FALSE
  1556. end
  1557.  
  1558. local ret = HasRandMissionCount( character, mission.id, mission.loopinfo[loopnum].num )
  1559. if ret == LUA_TRUE then
  1560. --˛M°Ł¸ÓŔôĄô°Č­pĽĆˇA¦P®ÉŔô­pĽĆĽWĄ[
  1561. ret = AddRandMissionNum( character, mission.id )
  1562. if ret ~= LUA_TRUE then
  1563. PRINT( "CompleteRandMission:AddRandMissionNum reset quest cycle calculation failed!id = ", mission.id )
  1564. LG( "randmission_error", "CompleteRandMission:AddRandMissionNum reset quest cycle calculation failed!id ", mission.id )
  1565. SystemNotice( character, "CompleteRandMission:AddRandMissionNum reset quest cycle calculation failed!id = "..mission.id )
  1566. return LUA_FALSE
  1567. end
  1568. if loopdata[loopnum + 1] == nil then
  1569. --˛M°Ł¸Óradom Ąô°Č­pĽĆ¦]¬°¤w¸g¶]Ŕô§ą˛¦,Ąô°Č­pĽĆ±qŔY¶}©l
  1570. PRINT( "CompleteRandMission:ResetRandMissionNum:quest cycle completed!" )
  1571. ResetRandMissionNum( character, mission.id )
  1572. SystemNotice( character, "quest cycle completed!" )
  1573. end
  1574. end
  1575. end
  1576.  
  1577. else
  1578. PRINT( "CompleteMission:Parameter quest type unknown. Invalid!" )
  1579. SystemNotice( character, "CompleteMission:Parameter quest type unknown. Invalid!" )
  1580. return LUA_FALSE
  1581. end
  1582.  
  1583. if tp ~= WORLD_MISSION then
  1584. PRINT( "CompleteMission:ResetMissionState" )
  1585. ret = RefreshMissionState( character, npc )
  1586. if ret ~= LUA_TRUE then
  1587. PRINT( "CompleteMission:RefreshMissionState deliver quest reset npc quest status failed!" )
  1588. SystemNotice( character, "CompleteMission:RefreshMissionState deliver quest change npc quest status failed!" )
  1589. return LUA_FALSE
  1590. end
  1591. end
  1592.  
  1593. PRINT( "CompleteMission: return true" )
  1594. return LUA_TRUE
  1595. end
  1596.  
  1597. --żďľÜĄô°Č¦CŞí
  1598. function SelMissionList( character, npc, selindex, missionlist )
  1599. local npcid = GetCharID( npc )
  1600. local ret, id, state = GetMissionInfo( character, npcid, selindex )
  1601. if ret ~= LUA_TRUE then
  1602. PRINT( "SelMissionList:obtain quest notice failed!" )
  1603. return SystemNotice( character, "MissionProc:obtain quest notice failed!" )
  1604. end
  1605.  
  1606. PRINT( "SelMissionList:id = %d, state = %d", id, state )
  1607. if missionlist[id] == nil then
  1608. PRINT( "SelMissionList:Server does not have requested quest notice error!" )
  1609. return SystemNotice( character, "MissionProc:Server does not have requested quest notice error!" )
  1610. end
  1611.  
  1612. ret = SetMissionTempInfo( character, npcid, id, state, missionlist[id].tp )
  1613. if ret ~= LUA_TRUE then
  1614. PRINT( "SelMissionList:set quest temporary data notice failed!" )
  1615. return SystemNotice( character, "MissionProc:set quest temporary data notice failed!" )
  1616. end
  1617.  
  1618. if missionlist[id].tp == NOMAL_MISSION then
  1619. PRINT( "SelMissioinList:NomalMission type" )
  1620. --®ÚľÚĄô°ČެşAµo°eĄô°ČŞş¤Ł¦P«H®§
  1621. if state == MIS_DELIVERY then
  1622. return SendDeliveryPage( character, npcid, missionlist[id], missionlist[id].id )
  1623. elseif state == MIS_ACCEPT then
  1624. return SendAcceptPage( character, npcid, missionlist[id], missionlist[id].id )
  1625. elseif state == MIS_PENDING then
  1626. return SendPendingPage( character, npcid, missionlist[id], missionlist[id].id )
  1627. else
  1628. PRINT( "SelMissionList:incorrect type of quest status notice!" )
  1629. return SystemNotice( character, "SelMissionList:incorrect type of quest status notice!" )
  1630. end
  1631. elseif missionlist[id].tp == RAND_MISSION then
  1632. PRINT( "SelMissioinList:RandMission type" )
  1633. --§PÂ_¬O§_¤w¸g±µ¨ü¤F¸Óradom Ąô°ČˇA¦pŞG±µ¨ü¤F«h¬O¨ÓÁŮĄô°Č±o
  1634. ret = HasRandMission( character, missionlist[id].id )
  1635. if ret ~= LUA_TRUE then
  1636. --radom Ąô°Č¦bżďľÜ®É´N¤w¸g˛ŁĄÍ¨ĂĄBPlayer±µ¨üĄô°Č
  1637. local ret = IsMissionFull( character )
  1638. if ret == LUA_TRUE then
  1639. return SystemNotice( character, "You quest log is full. Please abandon an existing quest before activating another!" )
  1640. end
  1641.  
  1642. local ret = NpcTriggerCheck( character, missionlist[id].begin )
  1643. if ret ~= LUA_TRUE then
  1644. PRINT( "SelMissionList:NpcTriggerCheck accept random quest condition trigger management failed!" )
  1645. SystemNotice( character, "SelMissionList:NpcTriggerCheck accept random quest condition trigger management failed!" )
  1646. return LUA_FALSE
  1647. end
  1648.  
  1649. PRINT( "SelMissionList:missionlist[id] = , id = ", missionlist[id], id )
  1650. local ret, index = CreateRandMission( character, npc, missionlist[id] )
  1651. if ret ~= LUA_TRUE then
  1652. if index ~= nil then
  1653. -- Şí©ú­IĄ]®e¶q¤Ł¨¬
  1654. return LUA_TRUE
  1655. end
  1656.  
  1657. PRINT( "SelMissionList:CreateRandMission, generate random quest failed!" )
  1658. return LUA_FALSE
  1659. end
  1660.  
  1661. ret = AcceptMission( character, npc, missionlist, index )
  1662. if ret ~= LUA_TRUE then
  1663. PRINT( "SelMissionList:AcceptMission: accept quest failed!" )
  1664. SystemNotice( character, "SelMissionList:AcceptMission: accept quest failed!" )
  1665. return LUA_FALSE
  1666. end
  1667.  
  1668. --µo°eradom Ąô°ČŞşĄćĄI­¶­±«H®§
  1669. local ret, randid, state = GetMissionInfo( character, npcid, selindex )
  1670. if ret ~= LUA_TRUE or id ~= randid then
  1671. ret, state = GetCharMission( character, npcid, id )
  1672. if ret ~= LUA_TRUE then
  1673. PRINT( "SelMissionList:GetCharMissionobtain quest notice failed!" )
  1674. return SystemNotice( character, "MissionProc:GetCharMissionobtain quest notice failed!" )
  1675. end
  1676. end
  1677.  
  1678. --if state == MIS_PENDING then
  1679. PRINT( "SelMissionList:SendPendingPage, index =, mission = ", index, missionlist[id].missionlist[index] )
  1680. return SendPendingPage( character, npcid, missionlist[id].missionlist[index], missionlist[id].id )
  1681. --elseif state == MIS_DELIVERY then
  1682. --PRINT( "SelMissionList:SendDeliveryPage, index = , mission = ", index, missionlist[id].missionlist[index] )
  1683. --return SendDeliveryPage( character, npcid, missionlist[id].missionlist[index], missionlist[id].id )
  1684. --else
  1685. --PRINT( "SelMissionList:radom Ąô°Č±µ¨ü®ÉŔł¬°PENDING or DELIVERYެşAˇA¦ý¬OŔË´úĄXެşA¤ŁąďˇCstate = "..state )
  1686. --return SystemNotice( character, "SelMissionList:radom Ąô°Č±µ¨ü®ÉŔł¬°PENDING or DELIVERYެşAˇA¦ý¬OŔË´úĄXެşA¤ŁąďˇCstate = "..state )
  1687. --end
  1688. else
  1689. local ret, index = GetCharRandMission( character, missionlist[id].id, missionlist[id] )
  1690. if ret ~= LUA_TRUE or index == 0 then
  1691. --®ÚľÚradom Ąô°Č°ŃĽĆĄÍ¦¨radom Ąô°Č«H®§żů»~
  1692. PRINT( "SelMissionList:GetcharRandMission, according to random quest parameter generate random quest notice error!" )
  1693. return SystemNotice( character, "SelMissionList:GetcharRandMission, according to random quest parameter generate random quest notice error!" )
  1694. end
  1695.  
  1696. if state ~= MIS_DELIVERY then
  1697. PRINT( "SelMissionList:SendPendingPage, index =, mission = ", index, missionlist[id].missionlist[index] )
  1698. return SendPendingPage( character, npcid, missionlist[id].missionlist[index], missionlist[id].id )
  1699. end
  1700.  
  1701. PRINT( "SelMissionList:SendDeliveryPage, index = , mission = ", index, missionlist[id].missionlist[index] )
  1702. return SendDeliveryPage( character, npcid, missionlist[id].missionlist[index], missionlist[id].id )
  1703. end
  1704.  
  1705. else
  1706. PRINT( "SelMissionList:Parameter quest type unknown. Invalid!" )
  1707. SystemNotice( character, "SelMissionList:Parameter quest type unknown. Invalid!" )
  1708. return LUA_FALSE
  1709. end
  1710.  
  1711. end
  1712.  
  1713. --Ąô°ČłB˛z
  1714. function MissionProc( character, npc, rpk, missionlist )
  1715. if missionlist == nil then
  1716. SystemNotice( character, "MissionProc:parameter error!" )
  1717. return LUA_FALSE
  1718. end
  1719.  
  1720. local byCmd = ReadByte( rpk )
  1721. if byCmd == MIS_SEL then
  1722. local selindex = ReadByte( rpk )
  1723. return SelMissionList( character, npc, selindex, missionlist )
  1724. elseif byCmd == MIS_BTNACCEPT then
  1725. local ret = IsMissionFull( character )
  1726. if ret == LUA_TRUE then
  1727. return BickerNotice( character, "Quest slots are all taken. accept quest failed!" )
  1728. end
  1729. return AcceptMission( character, npc, missionlist )
  1730. elseif byCmd == MIS_BTNDELIVERY then
  1731. local byParam1 = ReadByte( rpk )
  1732. local byParam2 = ReadByte( rpk )
  1733. local ret = CompleteMission( character, npc, missionlist, byParam1, byParam2 )
  1734. --if ret == LUA_TRUE then
  1735. --§ą¦¨Ąô°Č«áÄ~Äň¤U¤@­ÓĄô°Č
  1736. --local npcid = GetCharID( npc )
  1737. --local ret, index, id, state = GetNextMission( character, npcid )
  1738. --PRINT( "MissionProc:GetNextMission: ret, index, id, state", ret, index, id, state )
  1739. --if ret == LUA_TRUE then
  1740. --PRINT( "MissionProc:SelMissionList" )
  1741. --return SelMissionList( character, npc, index, missionlist )
  1742. --end
  1743. --end
  1744. --elseif byCmd == MIS_BTNPENDING then
  1745. --elseif byCmd == MIS_TALK then
  1746. else
  1747. PRINT( "MissionProc:incorrect quest page command type!" )
  1748. return SystemNotice( character, "MissionProc:incorrect quest page command type!" )
  1749. end
  1750. end
  1751.  
  1752. --¬d¸ßĄô°Č¤é»x«H®§
  1753. function MissionLog( character, sid )
  1754. PRINT( "MissionLog" )
  1755. if sid == nil or Mission[sid] == nil then
  1756. PRINT( "MissionLog: cannot locate quest script noticeˇAsid = "..sid )
  1757. LG( "mission_error", "MissionLog: cannot locate quest script noticeˇAsid = "..sid )
  1758. SystemNotice( character, "MissionLog: cannot locate quest script noticeˇAsid = "..sid )
  1759. return
  1760. end
  1761.  
  1762. if Mission[sid].tp == NOMAL_MISSION or Mission[sid].tp == WORLD_MISSION then
  1763. SendMissionLog( character, Mission[sid], Mission[sid].id, Mission[sid].name )
  1764. elseif Mission[sid].tp == RAND_MISSION then
  1765. local ret, index, loopdata = GetCharRandMission( character, Mission[sid].id, Mission[sid] )
  1766. if ret ~= LUA_TRUE or index == 0 then
  1767. --®ÚľÚradom Ąô°Č°ŃĽĆĄÍ¦¨radom Ąô°Č«H®§żů»~
  1768. PRINT( "MissionLog:GetcharRandMission, according to random quest parameter generate random quest notice error!" )
  1769. SystemNotice( character, "MissionLog:GetcharRandMission, according to random quest parameter generate random quest notice error!" )
  1770. return
  1771. end
  1772.  
  1773. PRINT( "MissionLog:SendMissionLog, index = , mission = ", index, Mission[sid].missionlist[index] )
  1774. SendMissionLog( character, Mission[sid].missionlist[index], Mission[sid].id, Mission[sid].name )
  1775. else
  1776. PRINT( "MissionLog:Parameter quest type unknown. Invalid!ID = "..sid )
  1777. SystemNotice( character, "SelMissionList:Parameter quest type unknown. Invalid!ID = "..sid )
  1778. end
  1779. end
  1780.  
  1781. --µo°eĄô°Č¤é»x«H®§
  1782. function SendMissionLog( character, mission, id, name )
  1783. PRINT( "SendMissionLog" )
  1784. if id == nil or mission == nil then
  1785. return SystemNotice( character, "Have not found target quest log notice,ID = "..id )
  1786. end
  1787.  
  1788. local packet = GetPacket()
  1789. WriteCmd( packet, CMD_MC_MISLOGINFO )
  1790. WriteWord( packet, id )
  1791.  
  1792. --µo°eĄô°Č»Ý¨D«H®§
  1793. WriteString( packet, name )
  1794. PRINT( "SendMissionLog:misname = ", name )
  1795. WriteByte( packet, mission.need.count )
  1796. PRINT( "SendMissionLog:need count = "..mission.need.count )
  1797. for n = 1, mission.need.count, 1 do
  1798. PRINT( "SendMissionLog:need n = , tp, p1, p2, p3 ", n, mission.need[n].tp, mission.need[n].p1, mission.need[n].p2, mission.need[n].p3 )
  1799. WriteByte( packet, mission.need[n].tp )
  1800. if mission.need[n].tp == MIS_NEED_ITEM then
  1801. WriteWord( packet, mission.need[n].p1 )
  1802. WriteWord( packet, mission.need[n].p2 )
  1803. --Ŕň¨úĄô°Č»Ý¨D§ą¦¨­pĽĆ
  1804. local ret, num = GetNeedItemCount( character, id, mission.need[n].p1 )
  1805. PRINT( "SendMissionLog:GetNeedItemCount, num = ", num )
  1806. if ret ~= LUA_TRUE then
  1807. PRINT( "SendMissionLog:GetNeedItemCount,errorˇCmisid = , itemid = , num = ", id, mission.need[n].p1, mission.need[n].p2 )
  1808. SystemNotice( character, "SendMissionLog:GetNeedItemCount,errorˇC" )
  1809. LG( "mislog_error", "SendMissionLog:GetNeedItemCount,errorˇCmisid = , itemid = , num = ", id, mission.need[n].p1, mission.need[n].p2 )
  1810. num = 0
  1811. end
  1812. WriteByte( packet, num )
  1813. elseif mission.need[n].tp == MIS_NEED_KILL then
  1814. WriteWord( packet, mission.need[n].p1 )
  1815. WriteWord( packet, mission.need[n].p2 )
  1816. --Ŕň¨úĄô°Č»Ý¨D§ą¦¨­pĽĆ
  1817. PRINT( "SendMissionLog:GetNumFlag:GetNumFalg, id, p1, p2", id, mission.need[n].p3, mission.need[n].p2 )
  1818. WriteByte( packet, GetNumFlag( character, id, mission.need[n].p3, mission.need[n].p2 ) )
  1819. elseif mission.need[n].tp == MIS_NEED_DESP then
  1820. WriteString( packet, mission.need[n].p1 )
  1821. else
  1822. PRINT( "SendMissionLog:unknown quest required type!mission id = ", id )
  1823. SystemNotice( character, "SendMissionLog:unknown quest required type!mission id = ", id )
  1824. return
  1825. end
  1826. end
  1827.  
  1828. --µo°eĄô°ČĽúŔy«H®§
  1829. WriteByte( packet, mission.prize.seltp )
  1830. WriteByte( packet, mission.prize.count )
  1831. PRINT( "SendMissionLog:prize count = , seltype =", mission.prize.count, mission.prize.seltp )
  1832. for i = 1, mission.prize.count, 1 do
  1833. PRINT( "SendMissionLog:prize i = , tp, p1, p2 ", i, mission.prize[i].tp, mission.prize[i].p1, mission.prize[i].p2 )
  1834. WriteByte( packet, mission.prize[i].tp )
  1835. WriteWord( packet, mission.prize[i].p1 )
  1836. WriteWord( packet, mission.prize[i].p2 )
  1837. end
  1838.  
  1839. --µo°eĄô°Č´y­z«H®§
  1840. PRINT( "SendMissionLog:begin talk = "..mission.begin.talk )
  1841. WriteString( packet, mission.begin.talk )
  1842. SendPacket( character, packet )
  1843. end
  1844.  
  1845. --µo°eĄô°ČĄćĄI­¶«H®§
  1846. function SendDeliveryPage( character, npcid, mission, id )
  1847. PRINT( "SendDeliveryPage" )
  1848.  
  1849. --µo°ełř¤ĺ«H®§
  1850. local packet = GetPacket()
  1851. WriteCmd( packet, CMD_MC_MISPAGE )
  1852. WriteByte( packet, MIS_BTNDELIVERY )
  1853. WriteDword( packet, npcid )
  1854. WriteString( packet, mission.name )
  1855. PRINT( "SenddeliveryPage:missionname = ", mission.name )
  1856. PRINT( "SendDeliveryPage:need = ", mission.need )
  1857.  
  1858. --µo°eĄô°Č»Ý¨D«H®§
  1859. --§ą¦¨Ąô°Č­¶¤Łµo°eĄô°Č»Ý¨D®ř®§
  1860. WriteByte( packet, 0 )
  1861. --WriteByte( packet, mission.need.count )
  1862. --PRINT( "SendDeliveryPage:need count = "..mission.need.count )
  1863. --for n = 1, mission.need.count, 1 do
  1864. --PRINT( "SendDeliveryPage:need n = , tp, p1, p2, p3 ", n, mission.need[n].tp, mission.need[n].p1, mission.need[n].p2, mission.need[n].p3 )
  1865. --WriteByte( packet, mission.need[n].tp )
  1866. --if mission.need[n].tp == MIS_NEED_ITEM then
  1867. --WriteWord( packet, mission.need[n].p1 )
  1868. --WriteWord( packet, mission.need[n].p2 )
  1869. ----Ŕň¨úĄô°Č»Ý¨D§ą¦¨­pĽĆ
  1870. --local ret, num = GetNeedItemCount( character, id, mission.need[n].p1 )
  1871. --PRINT( "SendDeliveryPage:GetNeedItemCount, num = ", num )
  1872. --if ret ~= LUA_TRUE then
  1873. --PRINT( "SendDeliveryPage:GetNeedItemCount,errorˇCitemid = , num = ", mission.need[n].p1, mission.need[n].p2 )
  1874. --SystemNotice( character, "SendDeliveryPage:GetNeedItemCount,errorˇC" )
  1875. --LG( "mislog_error", "SendDeliveryPage:GetNeedItemCount,errorˇCitemid = , num = ", mission.need[n].p1, mission.need[n].p2 )
  1876. --num = 0
  1877. --end
  1878. --WriteByte( packet, num )
  1879. --elseif mission.need[n].tp == MIS_NEED_KILL then
  1880. --WriteWord( packet, mission.need[n].p1 )
  1881. --WriteWord( packet, mission.need[n].p2 )
  1882. ----Ŕň¨úĄô°Č»Ý¨D§ą¦¨­pĽĆ
  1883. --PRINT( "SendDeliveryPage:GetNumFlag:GetNumFalg, id, p1, p2", id, mission.need[n].p3, mission.need[n].p2 )
  1884. --WriteByte( packet, GetNumFlag( character, id, mission.need[n].p3, mission.need[n].p2 ) )
  1885. --elseif mission.need[n].tp == MIS_NEED_DESP then
  1886. --WriteString( packet, mission.need[n].p1 )
  1887. --else
  1888. --PRINT( "SendDeliveryPage:unknown quest required type!mission id = ", id )
  1889. --SystemNotice( character, "SendDeliveryPage:unknown quest required type!mission id = ", id )
  1890. --return
  1891. --end
  1892. --end
  1893.  
  1894. --µo°eĄô°ČĽúŔy«H®§
  1895. WriteByte( packet, mission.prize.seltp )
  1896. WriteByte( packet, mission.prize.count )
  1897. PRINT( "SendDeliveryPage:prize count = , seltype =", mission.prize.count, mission.prize.seltp )
  1898. for i = 1, mission.prize.count, 1 do
  1899. PRINT( "SendDeliveryPage:prize i = , tp, p1, p2 ", i, mission.prize[i].tp, mission.prize[i].p1, mission.prize[i].p2 )
  1900. WriteByte( packet, mission.prize[i].tp )
  1901. WriteWord( packet, mission.prize[i].p1 )
  1902. WriteWord( packet, mission.prize[i].p2 )
  1903. --WriteWord( packet, mission.prize[i].p3 )
  1904. --WriteWord( packet, mission.prize[i].p4 )
  1905. end
  1906.  
  1907. --µo°eĄô°Č´y­z«H®§
  1908. PRINT( "SendDeliveryPage:result talk = "..mission.result.talk )
  1909. WriteString( packet, mission.result.talk )
  1910. SendPacket( character, packet )
  1911. end
  1912.  
  1913. --µo°e¤@­ÓĄô°Čµą¨¤¦â
  1914. function GiveMission( character, id )
  1915. if id == nil or Mission[id] == nil then
  1916. PRINT( "GiveMission:Invalid quest! ID = "..id )
  1917. LG( "mission_error", "GiveMission:Invalid quest! ID = "..id )
  1918. SystemNotice( character, "GiveMission:Invalid quest! ID = "..id )
  1919. return LUA_FALSE
  1920. end
  1921.  
  1922. local ret, npc = GetEudemon()
  1923. if ret ~= LUA_TRUE then
  1924. PRINT( "GetEudemon:functiontransfer failed!" )
  1925. SystemNotice( character, "GetEudemon:functiontransfer failed!" )
  1926. return LUA_FALSE
  1927. end
  1928.  
  1929. local npcid = GetCharID( npc )
  1930. PRINT( "GiveMission: npcid, id, mistp", npcid, id, Mission[id].tp )
  1931. ret = SetMissionTempInfo( character, npcid, id, MIS_ACCEPT, Mission[id].tp )
  1932. if ret ~= LUA_TRUE then
  1933. PRINT( "SelMissionList:set quest temporary data notice failed!" )
  1934. SystemNotice( character, "MissionProc:set quest temporary data notice failed!" )
  1935. return LUA_FALSE
  1936. end
  1937.  
  1938. SendAcceptPage( character, npcid, Mission[id], Mission[id].id )
  1939. return LUA_TRUE
  1940. end
  1941.  
  1942. --±j¨îĄćĄI¤@­ÓĄô°Č
  1943. function ObligeCompleteMission( character, id )
  1944. if id == nil or Mission[id] == nil then
  1945. PRINT( "ObligeCompleteMission:Invalid quest! ID = "..id )
  1946. LG( "mission_error", "ObligeCompleteMission:Invalid quest! ID = "..id )
  1947. SystemNotice( character, "ObligeCompleteMission:Invalid quest! ID = "..id )
  1948. return LUA_FALSE
  1949. end
  1950.  
  1951. local ret, npc = GetEudemon()
  1952. if ret ~= LUA_TRUE then
  1953. PRINT( "ObligeCompleteMission:GetEudemon:functiontransfer failed!" )
  1954. SystemNotice( character, "ObligeCompleteMission:GetEudemon:functiontransfer failed!" )
  1955. return LUA_FALSE
  1956. end
  1957.  
  1958. local npcid = GetCharID( npc )
  1959. PRINT( "ObligeCompleteMission: npcid, id, mistp", npcid, id, Mission[id].tp )
  1960. ret = SetMissionTempInfo( character, npcid, id, MIS_ACCEPT, Mission[id].tp )
  1961. if ret ~= LUA_TRUE then
  1962. PRINT( "ObligeCompleteMission:SetMissionTempInfo:set quest temporary data notice failed!" )
  1963. SystemNotice( character, "ObligeCompleteMission:SetMissionTempInfo:set quest temporary data notice failed!" )
  1964. return LUA_FALSE
  1965. end
  1966.  
  1967. ret = CompleteMission( character, npc )
  1968. if ret ~= LUA_TRUE then
  1969. SystemNotice( "ObligeCompleteMission:CompleteMission: force character accept completion failed!" )
  1970. LG( "mission_error", "ObligeCompleteMission:CompleteMission: Forced completion of quest failed!" )
  1971. return LUA_FALSE
  1972. end
  1973.  
  1974. --SendPendingPage( character, npcid, Mission[id], Mission[id].id )
  1975. BickerNotice( character, "Quest["..Mission[id].name.."]Successfully completed delivery!" )
  1976. return LUA_TRUE
  1977. end
  1978.  
  1979. --±j¨î±µ¨ü¤@­ÓĄô°Č
  1980. function ObligeAcceptMission( character, id )
  1981. if id == nil or Mission[id] == nil then
  1982. PRINT( "ObligeMission:Invalid quest! ID = "..id )
  1983. LG( "mission_error", "ObligeMission:Invalid quest! ID = "..id )
  1984. SystemNotice( character, "ObligeMission:Invalid quest! ID = "..id )
  1985. return LUA_FALSE
  1986. end
  1987.  
  1988. local ret, npc = GetEudemon()
  1989. if ret ~= LUA_TRUE then
  1990. PRINT( "ObligeMission:GetEudemon:functiontransfer failed!" )
  1991. SystemNotice( character, "ObligeMission:GetEudemon:functiontransfer failed!" )
  1992. return LUA_FALSE
  1993. end
  1994.  
  1995. ret = IsMissionFull( character )
  1996. if ret == LUA_TRUE then
  1997. SystemNotice( character, "Your quest log is full. Please make space before activating a new quest!" )
  1998. return LUA_TRUE
  1999. end
  2000.  
  2001. local npcid = GetCharID( npc )
  2002. PRINT( "ObligeMission: npcid, id, mistp", npcid, id, Mission[id].tp )
  2003. ret = SetMissionTempInfo( character, npcid, id, MIS_ACCEPT, Mission[id].tp )
  2004. if ret ~= LUA_TRUE then
  2005. PRINT( "ObligeMission:set quest temporary data notice failed!" )
  2006. SystemNotice( character, "ObligeMission:set quest temporary data notice failed!" )
  2007. return LUA_FALSE
  2008. end
  2009.  
  2010. ret = AcceptMission( character, npc )
  2011. if ret ~= LUA_TRUE then
  2012. SystemNotice( "ObligeMission:AcceptMission: forced character accept quest failed!" )
  2013. LG( "mission_error", "ObligeMission:AcceptMission: forced character accept quest failed!" )
  2014. return LUA_FALSE
  2015. end
  2016.  
  2017. SendPendingPage( character, npcid, Mission[id], Mission[id].id )
  2018. return LUA_TRUE
  2019. end
  2020.  
  2021. --µo°eĄô°Č±µ¨ü­¶«H®§
  2022. function SendAcceptPage( character, npcid, mission, id )
  2023. PRINT( "SendAcceptPage" )
  2024.  
  2025. --µo°ełř¤ĺ«H®§
  2026. local packet = GetPacket()
  2027. WriteCmd( packet, CMD_MC_MISPAGE )
  2028. WriteByte( packet, MIS_BTNACCEPT )
  2029. WriteDword( packet, npcid )
  2030. WriteString( packet, mission.name )
  2031. PRINT( "SendAcceptPage: name = ", mission.name )
  2032.  
  2033. --µo°eĄô°Č»Ý¨D«H®§
  2034. WriteByte( packet, mission.need.count )
  2035. PRINT( "SendAcceptPage:need count = "..mission.need.count )
  2036. for n = 1, mission.need.count, 1 do
  2037. PRINT( "SendAcceptPage:need n = , tp, p1, p2, p3 ", n, mission.need[n].tp, mission.need[n].p1, mission.need[n].p2, mission.need[n].p3 )
  2038. WriteByte( packet, mission.need[n].tp )
  2039. if mission.need[n].tp == MIS_NEED_ITEM or mission.need[n].tp == MIS_NEED_KILL then
  2040. WriteWord( packet, mission.need[n].p1 )
  2041. WriteWord( packet, mission.need[n].p2 )
  2042. --Ŕň¨úĄô°Č»Ý¨D§ą¦¨­pĽĆ
  2043. WriteByte( packet, 0 )
  2044. elseif mission.need[n].tp == MIS_NEED_DESP then
  2045. WriteString( packet, mission.need[n].p1 )
  2046. else
  2047. PRINT( "SendAcceptPage:unknown quest required type!mission id = ", id )
  2048. SystemNotice( character, "SendAcceptPage:unknown quest required type!mission id = ", id )
  2049. return
  2050. end
  2051. end
  2052.  
  2053. --µo°eĄô°ČĽúŔy«H®§
  2054. WriteByte( packet, mission.prize.seltp )
  2055. WriteByte( packet, mission.prize.count )
  2056. PRINT( "SendAcceptPage:prize count = , seltype =", mission.prize.count, mission.prize.seltp )
  2057. for i = 1, mission.prize.count, 1 do
  2058. PRINT( "SendAcceptPage:prize i = , tp, p1, p2 ", i, mission.prize[i].tp, mission.prize[i].p1, mission.prize[i].p2 )
  2059. WriteByte( packet, mission.prize[i].tp )
  2060. WriteWord( packet, mission.prize[i].p1 )
  2061. WriteWord( packet, mission.prize[i].p2 )
  2062. --WriteWord( packet, mission.prize[i].p3 )
  2063. --WriteWord( packet, mission.prize[i].p4 )
  2064. end
  2065.  
  2066. --µo°eĄô°Č´y­z«H®§
  2067. PRINT( "SendAcceptPage:begin talk = "..mission.begin.talk )
  2068. WriteString( packet, mission.begin.talk )
  2069. SendPacket( character, packet )
  2070. end
  2071.  
  2072. --µo°eĄô°ČĄĽ¨M­¶«H®§
  2073. function SendPendingPage( character, npcid, mission, id )
  2074. PRINT( "SendPendingPage" )
  2075.  
  2076. --µo°ełř¤ĺ«H®§
  2077. local packet = GetPacket()
  2078. WriteCmd( packet, CMD_MC_MISPAGE )
  2079. WriteByte( packet, MIS_BTNPENDING )
  2080. WriteDword( packet, npcid )
  2081. WriteString( packet, mission.name )
  2082. PRINT( "SendPendingPage: name = ", mission.name )
  2083.  
  2084. --µo°eĄô°Č»Ý¨D«H®§
  2085. WriteByte( packet, mission.need.count )
  2086. PRINT( "SendPendingPage:need count = "..mission.need.count )
  2087. for n = 1, mission.need.count, 1 do
  2088. PRINT( "SendPendingPage:need n = , tp, p1, p2, p3 ", n, mission.need[n].tp, mission.need[n].p1, mission.need[n].p2, mission.need[n].p3 )
  2089. WriteByte( packet, mission.need[n].tp )
  2090. if mission.need[n].tp == MIS_NEED_ITEM then
  2091. WriteWord( packet, mission.need[n].p1 )
  2092. WriteWord( packet, mission.need[n].p2 )
  2093. --Ŕň¨úĄô°Č»Ý¨D§ą¦¨­pĽĆ
  2094. local ret, num = GetNeedItemCount( character, id, mission.need[n].p1 )
  2095. PRINT( "SendPendingPage:GetNeedItemCount, num = ", num )
  2096. if ret ~= LUA_TRUE then
  2097. PRINT( "SendPendingPage:GetNeedItemCount,errorˇCitemid = , num = ", mission.need[n].p1, mission.need[n].p2 )
  2098. SystemNotice( character, "SendPendingPage:GetNeedItemCount,errorˇC" )
  2099. num = 0
  2100. end
  2101. WriteByte( packet, num )
  2102. elseif mission.need[n].tp == MIS_NEED_KILL then
  2103. WriteWord( packet, mission.need[n].p1 )
  2104. WriteWord( packet, mission.need[n].p2 )
  2105. --Ŕň¨úĄô°Č»Ý¨D§ą¦¨­pĽĆ
  2106. local numflag = GetNumFlag( character, id, mission.need[n].p3, mission.need[n].p2 )
  2107. PRINT( "SendPendingPage:GetNumFlag, numflag = ", numflag )
  2108. WriteByte( packet, numflag )
  2109. elseif mission.need[n].tp == MIS_NEED_DESP then
  2110. WriteString( packet, mission.need[n].p1 )
  2111. else
  2112. PRINT( "SendPendingPage:unknown quest required type!mission id = ", id )
  2113. SystemNotice( character, "SendPendingPage:unknown quest required type!mission id = "..id )
  2114. return
  2115. end
  2116. end
  2117.  
  2118. --µo°eĄô°ČĽúŔy«H®§
  2119. WriteByte( packet, mission.prize.seltp )
  2120. WriteByte( packet, mission.prize.count )
  2121. PRINT( "SendPendingPage:prize count = , seltype =", mission.prize.count, mission.prize.seltp )
  2122. for i = 1, mission.prize.count, 1 do
  2123. PRINT( "SendPendingPage:prize i = , tp, p1, p2 ", i, mission.prize[i].tp, mission.prize[i].p1, mission.prize[i].p2 )
  2124. WriteByte( packet, mission.prize[i].tp )
  2125. WriteWord( packet, mission.prize[i].p1 )
  2126. WriteWord( packet, mission.prize[i].p2 )
  2127. --WriteWord( packet, mission.prize[i].p3 )
  2128. --WriteWord( packet, mission.prize[i].p4 )
  2129. end
  2130.  
  2131. --µo°eĄô°Č´y­z«H®§
  2132. PRINT( "SendPendingPage:help = ", mission.result.help )
  2133. WriteString( packet, mission.result.help )
  2134. SendPacket( character, packet )
  2135. end
  2136.  
  2137. --Ąô°ČĽúŔyľŢ§@
  2138. function MisPrizeProc( character, npc, mission, selitem, param )
  2139. if mission == nil then
  2140. SystemNotice( character, "MisPrizeProc:parameter error!" )
  2141. return LUA_FALSE
  2142. end
  2143. PRINT( "MisPrizeProc:prize count =, sel type = , selitem = ", mission.prize.count, mission.prize.seltp, selitem )
  2144. if mission.prize.seltp == PRIZE_SELONE then
  2145. --łćżď
  2146. if selitem == nil then
  2147. SystemNotice( character, "MisPrizeProc: select parameter invalid!" )
  2148. return LUA_FALSE
  2149. end
  2150. selitem = selitem + 1
  2151. if selitem > mission.prize.count or mission.prize == nil or mission.prize[selitem] == nil then
  2152. SystemNotice( character, "MisPrizeProc: select an invalid reward notice index !" )
  2153. return LUA_FALSE
  2154. end
  2155. if mission.prize[selitem].tp == nil or mission.prize[selitem].p1 == nil or mission.prize[selitem].p2 == nil then
  2156. SystemNotice( character, "MisPrizeProc:selected reward notice invalid! Please check!" )
  2157. return LUA_FALSE
  2158. end
  2159. return MisPrizeAction( character, npc, mission.prize[selitem].tp, mission.prize[selitem].p1, mission.prize[selitem].p2, mission.prize[selitem].p3, mission.prize[selitem].p4 )
  2160. elseif mission.prize.seltp == PRIZE_SELALL then
  2161. --Ąţżď
  2162. for n = 1, mission.prize.count, 1 do
  2163. PRINT( "MisPrizeProc: prize n = "..n )
  2164. if mission.prize[n].tp == nil or mission.prize[n].p1 == nil or mission.prize[n].p2 == nil then
  2165. SystemNotice( character, "MisPrizeProc:selected reward notice invalid! Please check!" )
  2166. return LUA_FALSE
  2167. end
  2168. local ret = MisPrizeAction( character, npc, mission.prize[n].tp, mission.prize[n].p1, mission.prize[n].p2, mission.prize[n].p3, mission.prize[n].p4 )
  2169. if ret ~= LUA_TRUE then
  2170. return LUA_FALSE
  2171. end
  2172. end
  2173. else
  2174. PRINT( "MisPrizeProc: Invalid reward notice selection data type!" )
  2175. SystemNotice( character, "MisPrizeProc: Invalid reward notice selection data type!" )
  2176. return LUA_FALSE
  2177. end
  2178. return LUA_TRUE
  2179. end
  2180.  
  2181. function AddPetExp( character, p1, p2 )
  2182. PRINTF( "AddPetExp: p1 = , p2 = ", p1, p2 )
  2183. if p1 == nil or p2 == nil then
  2184. SystemNotice( character, "AddRMNextFlag:Function parameter error!" )
  2185. return LUA_FALSE
  2186. end
  2187.  
  2188. return Give_ElfEXP_MISSION ( character , p1 + Rand( p2 ) )
  2189. end
  2190.  
  2191. --Ąô°ČĽúŔyľŢ§@
  2192. function MisPrizeAction( character, npc, tp, p1, p2, p3, p4 )
  2193. PRINT( "MisPrizeAction:tp, p1, p2, p3, p4", tp, p1, p2, p3, p4 )
  2194. if tp == MIS_PRIZE_ITEM then
  2195. PRINT( "MisPrizeAction:GiveItem, p1 = , p2 = ", p1, p2, p3 )
  2196. local ret = GiveItem( character, npc, p1, p2, p3 )
  2197. if ret ~= LUA_TRUE then
  2198. SystemNotice( character, "MisPrizeAction:GiveItem:functiontransfer failed!" )
  2199. LG( "mission_error", "MisPrizeAction:GiveItem:functiontransfer failed!npcname = , tp = , p1 = , p2 =, p3 = ", GetCharName( npc ), tp, p1, p2, p3 )
  2200. return LUA_FALSE
  2201. end
  2202. elseif tp == MIS_PRIZE_MONEY then
  2203. PRINT( "MisPrizeAction:AddMoney, p1 = "..p1 )
  2204. local ret = AddMoney( character, npc, p1 )
  2205. if ret ~= LUA_TRUE then
  2206. SystemNotice( character, "MisPrizeAction:AddMoney:functiontransfer failed!" )
  2207. LG( "mission_error", "MisPrizeAction:AddMoney:functiontransfer failed!npcname = , tp = , p1 = , p2 ", GetCharName( npc ), tp, p1, p2 )
  2208. return LUA_FALSE
  2209. end
  2210. elseif tp == MIS_PRIZE_FAME then
  2211. PRINT( "MisPrizeAction:AddFame, p1 = "..p1 )
  2212. --local ret = AddFame( character, npc, p1 )
  2213. --if ret ~= LUA_TRUE then
  2214. --SystemNotice( character, "MisPrizeAction:AddFame:functiontransfer failed!" )
  2215. --LG( "mission_error", "MisPrizeAction:AddFame:functiontransfer failed!npcname = , tp = , p1 = , p2 ", GetCharName( npc ), tp, p1, p2 )
  2216. --return LUA_FALSE
  2217. --end
  2218. elseif tp == MIS_PRIZE_CESS then
  2219. PRINT( "MisPrizeAction:AdjustTradeCess" )
  2220. local ret = AdjustTradeCess( character, p1, p2 )
  2221. if ret ~= LUA_TRUE then
  2222. SystemNotice( character, "MisPrizeAction:AdjustTradeCess:functiontransfer failed!" )
  2223. LG( "mission_error", "MisPrizeAction:AdjustTradeCess:functiontransfer failed!npcname = , tp = , p1 = , p2 ", GetCharName( npc ), tp, p1, p2 )
  2224. return LUA_FALSE
  2225. end
  2226. elseif tp == MIS_PRIZE_PETEXP then
  2227. PRINT( "MisPrizeAction:AddPetExp" )
  2228. local ret = AddPetExp( character, p1, p2 )
  2229. if ret ~= LUA_TRUE then
  2230. SystemNotice( character, "MisPrizeAction:AddPetExp:functiontransfer failed!" )
  2231. LG( "mission_error", "MisPrizeAction:AddPetExp:functiontransfer failed!npcname = , tp = , p1 = , p2 = ", GetCharName( npc ), tp, p1, p2 )
  2232. return LUA_FALSE
  2233. end
  2234. else
  2235. SystemNotice( character, "MisPrizeAction: Invalid reward type notice!" )
  2236. return LUA_FALSE
  2237. end
  2238. return LUA_TRUE
  2239. end
  2240.  
  2241. --Ąô°ČNPCެşAŔË´ú
  2242. function MissionState( character, npcid, missionlist )
  2243. PRINT( "MissionState" )
  2244. if missionlist == nil then
  2245. SystemNotice( character, "MissionState:Npc quest notice as null!" )
  2246. return LUA_FALSE
  2247. end
  2248. --ŔË´úĄô°ČެşA
  2249. for i = 1, 32, 1 do
  2250. if missionlist[i] == nil then
  2251. break
  2252. end
  2253. local mission = missionlist[i]
  2254. if mission.name == nil or mission.id == nil then
  2255. SystemNotice( character, "MissionState:NPC quest list name ord id value cannot be as null!" )
  2256. return LUA_FALSE
  2257. end
  2258. if mission.tp == NOMAL_MISSION then
  2259. PRINT( "MissionState:nomal mission" )
  2260. --§PÂ_¨¤¦â¬O§_¦ł¸ÓĄô°Č
  2261. PRINT( "MissionState:2, ID =", mission.id )
  2262. local ret = HasMission( character, mission.id )
  2263. PRINT( "MissionState:5" )
  2264. if ret == LUA_TRUE then
  2265. if mission.result == nil then
  2266. SystemNotice( character, "MissionState:quest completion trigger cannot be as null!" )
  2267. else
  2268. local ret = NpcTriggerCheck( character, mission.result )
  2269. if ret == LUA_TRUE then
  2270. --ŔË´ú¨ěĄiĄHÁŮĄô°Č¸őĄX´`ŔôŔË´ú¨Ă°OżýĽĆľÚ«H®§
  2271. PRINT( "MissionState:Add state = %d delivery, i = %d", MIS_DELIVERY, i )
  2272. AddMissionState( character, npcid, i, MIS_DELIVERY )
  2273. elseif mission.show ~= COMPLETE_SHOW then
  2274. PRINT( "MissionState:Add state = %d pending, i = %d", MIS_PENDING, i )
  2275. AddMissionState( character, npcid, i, MIS_PENDING )
  2276. end
  2277. end
  2278. else
  2279. PRINT( "MissionState:3" )
  2280. if mission.begin == nil then
  2281. SystemNotice( character, "MissionState: quest start trigger cannot be as null!" )
  2282. else
  2283. local ret = NpcTriggerCheck( character, mission.begin )
  2284. if ret == LUA_TRUE then
  2285. --ŔË´ú¨ěĄiĄH±µĄô°Č°OżýĽĆľÚ«H®§
  2286. PRINT( "MissionState:Add state = %d accept, i = %d", MIS_ACCEPT, i )
  2287. AddMissionState( character, npcid, i, MIS_ACCEPT )
  2288. end
  2289. end
  2290. end
  2291. elseif mission.tp == RAND_MISSION then
  2292. PRINT( "MissionState:rand mission, mission.id", mission.id )
  2293. local ret = HasRandMission( character, mission.id )
  2294. if ret == LUA_TRUE then
  2295. --¤w¸g±µ¤Fradom Ąô°ČˇA¬d¬ÝĄL¬O§_ĄiĄHĄćĄI
  2296. PRINT( "MissionState, GetCharRandMission" )
  2297. local ret, index = GetCharRandMission( character, mission.id, mission )
  2298. PRINT( "MissionState:GetCharRandMission, ret =, index = ", ret, index )
  2299. if ret == LUA_TRUE and index ~= 0 then
  2300. PRINT( "MissionState: proc rand mission" )
  2301. if mission.missionlist[index] == nil or mission.missionlist[index].result == nil then
  2302. SystemNotice( character, "MissionState:radom quest completion trigger cannot be as null!" )
  2303. else
  2304. PRINT( "MissionState: RandMission, NpcTriggerCheck" )
  2305. ret = NpcTriggerCheck( character, mission.missionlist[index].result )
  2306. if ret == LUA_TRUE then
  2307. --ŔË´ú¨ěĄiĄHÁŮĄô°Č¸őĄX´`ŔôŔË´ú¨Ă°OżýĽĆľÚ«H®§
  2308. PRINT( "MissionState:random quest: Add state = %d delivery, i = %d", MIS_DELIVERY, i )
  2309. AddMissionState( character, npcid, i, MIS_DELIVERY )
  2310. else
  2311. PRINT( "MissionState:random quest: Add state = %d pending, i = %d", MIS_PENDING, i )
  2312. AddMissionState( character, npcid, i, MIS_PENDING )
  2313. end
  2314. end
  2315. end
  2316. else
  2317. --ĄĽ±µradom Ąô°ČˇA¬Ý¬O§_ĄiĄH±µ
  2318. local ret = IsRandMissionAccept( character, mission )
  2319. if ret == LUA_TRUE then
  2320. ret = NpcTriggerCheck( character, mission.begin )
  2321. if ret == LUA_TRUE then
  2322. PRINT( "MissionState:random quest: Add state = %d accept, i = %d", MIS_ACCEPT, i )
  2323. AddMissionState( character, npcid, i, MIS_ACCEPT )
  2324. end
  2325. end
  2326. end
  2327.  
  2328. else
  2329. PRINT( "MissionState:mission tp error, mission.tp = ", mission.tp )
  2330. end
  2331. end
  2332.  
  2333. PRINT( "MissionState:return true" )
  2334. return LUA_TRUE
  2335. end
  2336.  
  2337. --¨ę·snpcĄô°ČެşAĽĐ»x«H®§
  2338. function RefreshMissionState( character, npc )
  2339. if character == nil or npc == nil then
  2340. PRINT( "RefreshMissionState: parameter error!" )
  2341. end
  2342. return ResetMissionState( character, npc )
  2343. end
  2344.  
  2345. --¨ę·sĄô°Č§ą¦¨Ş¬şA
  2346. function RefreshCompleteFlag( character, sid )
  2347. PRINT( "RefreshCompleteFlag" )
  2348. if sid == nil or Mission[sid] == nil then
  2349. PRINT( "RefreshCompleteFlag:incorrect quest script ID number,sid = "..sid )
  2350. SystemNotice( character, "RefreshCompleteFlag:incorrect quest script ID number,sid = "..sid )
  2351. return LUA_FALSE
  2352. end
  2353.  
  2354. local mission
  2355. if Mission[sid].tp == NOMAL_MISSION then
  2356. mission = Mission[sid]
  2357. elseif Mission[sid].tp == RAND_MISSION then
  2358. --¤w¸g±µ¤Fradom Ąô°ČˇA¬d¬ÝĄL¬O§_ĄiĄHĄćĄI
  2359. PRINT( "RefreshCompleteFlag, GetCharRandMission" )
  2360. local ret, index = GetCharRandMission( character, Mission[sid].id, Mission[sid] )
  2361. PRINT( "RefreshCompleteFlag:GetCharRandMission, ret =, index = ", ret, index )
  2362. if ret == LUA_TRUE and index ~= 0 then
  2363. PRINT( "RefreshCompleteFlag: proc rand mission" )
  2364. if Mission[sid].missionlist[index] == nil or Mission[sid].missionlist[index].result == nil then
  2365. SystemNotice( character, "MissionState:radom quest completion trigger cannot be as null!" )
  2366. return LUA_FALSE
  2367. end
  2368. mission = Mission[sid].missionlist[index]
  2369. else
  2370. PRINT( "RefreshCompleteFlag:GetCharRandMission: Function transfer error!" )
  2371. return LUA_FALSE
  2372. end
  2373. end
  2374.  
  2375. PRINT( "RefreshCompleteFlag:NpcTriggerCheck" )
  2376. local ret = NpcTriggerCheck( character, mission.result )
  2377. if ret == LUA_TRUE then
  2378. --ŔË´ú¨ěĄô°Č§ą¦¨
  2379. PRINT( "RefreshCompleteFlag:quest has completed!" )
  2380. --SystemNotice( character, "RefreshCompleteFlag:quest has completed!" )
  2381. ret = SetMissionComplete( character, Mission[sid].id )
  2382. if ret ~= LUA_TRUE then
  2383. PRINT( "RefreshCompleteFlag:SetMissionComplete set quest completion label failed!" )
  2384. SystemNotice( character, "RefreshCompleteFlag:SetMissionComplete set quest completion label failed!" )
  2385. end
  2386. end
  2387.  
  2388. PRINT( "RefreshCompleteFlag:return true" )
  2389. return LUA_TRUE
  2390. end
  2391.  
  2392. --Ąô°Č±řĄó§PÂ_łB˛z¨çĽĆ
  2393. function ConditionsTest( character, conditions, param1, param2, npc )
  2394. if conditions == nil then
  2395. SystemNotice( character, "ConditionsTest: condition test function conditions parameter cannot be as null!" )
  2396. return LUA_FALSE
  2397. end
  2398.  
  2399. if conditions[1] == nil then
  2400. PRINT( "ConditionsTest: condition as null return real!" )
  2401. else
  2402. local num = TR_MAXNUM_CONDITIONS
  2403. if conditions.count ~= nil then
  2404. num = conditions.count
  2405. end
  2406. for i = 1, num, 1 do --ŔË´úIJµoľą­­¨î±řĄółĚ¦h12­Ó±řĄó
  2407. if conditions[i] == nil then
  2408. break;
  2409. end
  2410. if conditions[i].func == nil then
  2411. --SystemNotice( character, "ConditionsTest: condition management function cannot be as null!" )
  2412. end
  2413. if conditions[i].func == NoMission then
  2414. PRINT( "ConditionsTest:NoMission, p1 = ", conditions[i].p1 )
  2415. local Ret = NoMission( character, conditions[i].p1 )
  2416. if Ret ~= LUA_TRUE then
  2417. PRINT( "ConditionsTest: NoMission = false" )
  2418. return LUA_FALSE
  2419. end
  2420. elseif conditions[i].func == HasMission then
  2421. PRINT( "ConditionsTest:HasMission, p1 = ", conditions[i].p1 )
  2422. local ret = HasMission( character, conditions[i].p1 )
  2423. if ret ~= LUA_TRUE then
  2424. PRINT( "ConditionsTest: HasMission = false" )
  2425. return LUA_FALSE
  2426. end
  2427. elseif conditions[i].func == HasRandMission then
  2428. PRINT( "ConditionsTest:HasRandMission, p1 = ", conditions[i].p1 )
  2429. local ret = HasRandMission( character, conditions[i].p1 )
  2430. if ret ~= LUA_TRUE then
  2431. PRINT( "ConditionsTest: HasRandMission = false" )
  2432. return LUA_FALSE
  2433. end
  2434. elseif conditions[i].func == HasMisssionFailure then
  2435. PRINT( "ConditionsTest:HasMisssionFailure, p1 = ", conditions[i].p1 )
  2436. local ret = HasMisssionFailure( character, conditions[i].p1 )
  2437. if ret ~= LUA_TRUE then
  2438. PRINT( "ConditionsTest: HasMisssionFailure = false" )
  2439. return LUA_FALSE
  2440. end
  2441. elseif conditions[i].func == NoMisssionFailure then
  2442. PRINT( "ConditionsTest:NoMisssionFailure, p1 = ", conditions[i].p1 )
  2443. local ret = NoMisssionFailure( character, conditions[i].p1 )
  2444. if ret ~= LUA_TRUE then
  2445. PRINT( "ConditionsTest: NoMisssionFailure = false" )
  2446. return LUA_FALSE
  2447. end
  2448. elseif conditions[i].func == CheckDayLog then
  2449. PRINT( "ConditionsTest:CheckDayLog, p1 = ", conditions[i].p1 )
  2450. local ret = CheckDayLog( character , conditions[i].p1 )
  2451. if ret ~= LUA_TRUE then
  2452. PRINT( "ConditionsTest:CheckDayLog = false" )
  2453. return LUA_FALSE
  2454. end
  2455.  
  2456. elseif conditions[i].func == QuestFunc then
  2457. local ret = QuestFunc(character, conditions[i].p1, conditions[i].p2, conditions[i].p3)
  2458. if ret ~= LUA_TRUE then
  2459. return LUA_FALSE
  2460. end
  2461. elseif conditions[i].func == NoRecord then
  2462. PRINT( "ConditionsTest:NoRecord, p1 = ", conditions[i].p1 )
  2463. local ret = NoRecord( character, conditions[i].p1 )
  2464. if ret ~= LUA_TRUE then
  2465. PRINT( "ConditionsTest: NoRecord = false" )
  2466. return LUA_FALSE
  2467. end
  2468.  
  2469. elseif conditions[i].func == HasState then
  2470. PRINT( "ConditionsTest:HasState, p1 = ", conditions[i].p1 )
  2471. local ret = HasState( character, conditions[i].p1 )
  2472. if ret ~= LUA_TRUE then
  2473. PRINT( "ConditionsTest: HasState = false" )
  2474. return LUA_FALSE
  2475. end
  2476. elseif conditions[i].func == IsChaType then
  2477. PRINT( "ConditionsTest:IsChaType, p1 = ", conditions[i].p1 )
  2478. local ret = IsChaType( character, conditions[i].p1 )
  2479. if ret ~= LUA_TRUE then
  2480. PRINT( "ConditionsTest: IsChaType = false" )
  2481. return LUA_FALSE
  2482. end
  2483. elseif conditions[i].func == NoChaType then
  2484. PRINT( "ConditionsTest:NoChaType, p1 = ", conditions[i].p1 )
  2485. local ret = NoChaType( character, conditions[i].p1 )
  2486. if ret ~= LUA_TRUE then
  2487. PRINT( "ConditionsTest: NoChaType = false" )
  2488. return LUA_FALSE
  2489. end
  2490. elseif conditions[i].func == HasRecord then
  2491. PRINT( "ConditionsTest:HasRecord, p1 = ", conditions[i].p1 )
  2492. local ret = HasRecord( character, conditions[i].p1 )
  2493. if ret ~= LUA_TRUE then
  2494. PRINT( "ConditionsTest: HasRecord = false" )
  2495. return LUA_FALSE
  2496. end
  2497. elseif conditions[i].func == NoFlag then
  2498. PRINT( "ConditionsTest:NoFlag, p1 =, p2 = ", conditions[i].p1, conditions[i].p2 )
  2499. local ret = NoFlag( character, conditions[i].p1, conditions[i].p2 )
  2500. if ret ~= LUA_TRUE then
  2501. PRINT( "ConditionsTest:NoFlag = false" )
  2502. return LUA_FALSE
  2503. end
  2504. elseif conditions[i].func == HasAllFlag then
  2505. PRINT( "ConditionsTest:HasAllFlag, p1 =, p2 = ", conditions[i].p1, conditions[i].p2, conditions[i].p3 )
  2506. local ret = HasAllFlag( character, conditions[i].p1, conditions[i].p2, conditions[i].p3 )
  2507. if ret ~= LUA_TRUE then
  2508. PRINT( "ConditionsTest: HasAllFlag = false" )
  2509. return LUA_FALSE
  2510. end
  2511. elseif conditions[i].func == HasFlag then
  2512. PRINT( "ConditionsTest:HasFlag, p1 =, p2 = ", conditions[i].p1, conditions[i].p2 )
  2513. local ret = HasFlag( character, conditions[i].p1, conditions[i].p2 )
  2514. if ret ~= LUA_TRUE then
  2515. PRINT( "ConditionsTest:HasFlag = false" )
  2516. return LUA_FALSE
  2517. end
  2518. elseif conditions[i].func == HasItem then
  2519. PRINT( "ConditionsTest: HasItem, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2520. local ret = HasItem( character, conditions[i].p1, conditions[i].p2 )
  2521. if ret ~= LUA_TRUE then
  2522. PRINT( "ConditionsTest:HasItem = false" )
  2523. return LUA_FALSE
  2524. end
  2525. elseif conditions[i].func == NoItem then
  2526. PRINT( "ConditionsTest: NoItem, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2527. local ret = NoItem( character, conditions[i].p1, conditions[i].p2 )
  2528. if ret ~= LUA_TRUE then
  2529. PRINT( "ConditionsTest:NoItem = false" )
  2530. return LUA_FALSE
  2531. end
  2532. elseif conditions[i].func == HasCredit then
  2533. PRINT( "ConditionsTest: HasCredit, p1 = ", conditions[i].p1)
  2534. local ret = HasCredit( character, conditions[i].p1)
  2535. if ret ~= LUA_TRUE then
  2536. PRINT( "ConditionsTest:HasCredit = false" )
  2537. return LUA_FALSE
  2538. end
  2539. elseif conditions[i].func == HasHonorPoint then
  2540. PRINT( "ConditionsTest: HasHonorPoint, p1 = ", conditions[i].p1)
  2541. local ret = HasHonorPoint( character, conditions[i].p1)
  2542. if ret ~= LUA_TRUE then
  2543. PRINT( "ConditionsTest:HasHonorPoint = false" )
  2544. return LUA_FALSE
  2545. end
  2546. elseif conditions[i].func == HasFightingPoint then
  2547. PRINT( "ConditionsTest: HasFightingPoint, p1 = ", conditions[i].p1)
  2548. local ret = HasFightingPoint( character, conditions[i].p1)
  2549. if ret ~= LUA_TRUE then
  2550. PRINT( "ConditionsTest:HasFightingPoint = false" )
  2551. return LUA_FALSE
  2552. end
  2553. elseif conditions[i].func == CheckPoint then
  2554. PRINT( "ConditionsTest: CheckPoint, p1 = ", conditions[i].p1)
  2555. local ret = CheckPoint( character,conditions[i].p1)
  2556. if ret ~= LUA_TRUE then
  2557. PRINT( "ConditionsTest:CheckPoint = false" )
  2558. return LUA_FALSE
  2559. end
  2560. elseif conditions[i].func == HaveNoItem then
  2561. PRINT( "ConditionsTest: HaveNoItem, p1 = ", conditions[i].p1)
  2562. local ret = HaveNoItem( character,conditions[i].p1)
  2563. if ret ~= LUA_TRUE then
  2564. PRINT( "ConditionsTest:HaveNoItem = false" )
  2565. return LUA_FALSE
  2566. end
  2567. elseif conditions[i].func == BankNoItem then
  2568. PRINT( "ConditionsTest: BankNoItem, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2569. local ret = BankNoItem( character, conditions[i].p1, conditions[i].p2 )
  2570. if ret ~= LUA_TRUE then
  2571. PRINT( "ConditionsTest:BankNoItem = false" )
  2572. return LUA_FALSE
  2573. end
  2574. elseif conditions[i].func == EquipNoItem then
  2575. PRINT( "ConditionsTest: EquipNoItem, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2576. local ret = EquipNoItem( character, conditions[i].p1, conditions[i].p2 )
  2577. if ret ~= LUA_TRUE then
  2578. PRINT( "ConditionsTest:EquipNoItem = false" )
  2579. return LUA_FALSE
  2580. end
  2581. elseif conditions[i].func == CheckTeam1 then
  2582. PRINT( "ConditionsTest:CheckTeam1, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2583. local ret = CheckTeam1( character, conditions[i].p1, conditions[i].p2 )
  2584. if ret ~= LUA_TRUE then
  2585. PRINT( "ConditionsTest:CheckTeam1 = false" )
  2586. return LUA_FALSE
  2587. end
  2588. elseif conditions[i].func == CheckRightNum then
  2589. PRINT( "ConditionsTest:CheckRightNum, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2590. local ret = CheckRightNum( character, conditions[i].p1, conditions[i].p2 )
  2591. if ret ~= LUA_TRUE then
  2592. PRINT( "ConditionsTest:CheckRightNum = false" )
  2593. return LUA_FALSE
  2594. end
  2595. elseif conditions[i].func == CheckErroNum then
  2596. PRINT( "ConditionsTest:CheckErroNum, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2597. local ret = CheckErroNum( character, conditions[i].p1, conditions[i].p2 )
  2598. if ret ~= LUA_TRUE then
  2599. PRINT( "ConditionsTest:CheckErroNum = false" )
  2600. return LUA_FALSE
  2601. end
  2602. elseif conditions[i].func == HasReadExp then --¤p´úĹç®ÉĄ˛¶·¦ł¸gĹç
  2603. local ret = HasReadExp( character )
  2604. if ret ~= LUA_TRUE then
  2605. return LUA_FALSE
  2606. end
  2607. elseif conditions[i].func == HasNoItem then
  2608. PRINT( "ConditionsTest: HasNoItem, p1 = ", conditions[i].p1)
  2609. local ret = HasNoItem( character, conditions[i].p1)
  2610. if ret ~= LUA_TRUE then
  2611. PRINT( "ConditionsTest:HasNoItem = false" )
  2612. return LUA_FALSE
  2613. end
  2614. elseif conditions[i].func == CheckXSZCh then
  2615. PRINT( "ConditionsTest: CheckXSZCh, p1 = ", conditions[i].p1)
  2616. local ret = CheckXSZCh( character, conditions[i].p1)
  2617. if ret ~= LUA_TRUE then
  2618. PRINT( "ConditionsTest:CheckXSZCh = false" )
  2619. return LUA_FALSE
  2620. end
  2621. elseif conditions[i].func == Checksailexpless then
  2622. PRINT( "ConditionsTest: Checksailexpless, p1 = ", conditions[i].p1)
  2623. local ret = Checksailexpless( character, conditions[i].p1)
  2624. if ret ~= LUA_TRUE then
  2625. PRINT( "ConditionsTest:Checksailexpless = false" )
  2626. return LUA_FALSE
  2627. end
  2628. elseif conditions[i].func == Checksailexpmore then
  2629. PRINT( "ConditionsTest: Checksailexpmore, p1 = ", conditions[i].p1)
  2630. local ret = Checksailexpmore( character, conditions[i].p1)
  2631. if ret ~= LUA_TRUE then
  2632. PRINT( "ConditionsTest:Checksailexpmore = false" )
  2633. return LUA_FALSE
  2634. end
  2635. elseif conditions[i].func == CheckKJNum then
  2636. PRINT( "ConditionsTest: CheckKJNum, p1 = ", conditions[i].p1)
  2637. local ret = CheckKJNum( character, conditions[i].p1)
  2638. if ret ~= LUA_TRUE then
  2639. PRINT( "ConditionsTest:CheckKJNum = false" )
  2640. return LUA_FALSE
  2641. end
  2642. elseif conditions[i].func == CheckRealNpc then
  2643. PRINT( "ConditionsTest:CheckRealNpc, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2644. local ret = CheckRealNpc( character, conditions[i].p1, conditions[i].p2 )
  2645. if ret ~= LUA_TRUE then
  2646. PRINT( "ConditionsTest:CheckRealNpc = false" )
  2647. return LUA_FALSE
  2648. end
  2649. elseif conditions[i].func == NoMoney then
  2650. PRINT( "ConditionsTest: NoMoney, p1 = ", conditions[i].p1 )
  2651. local ret = NoMoney( character, conditions[i].p1 )
  2652. if ret ~= LUA_TRUE then
  2653. PRINT( "ConditionsTest:NoMoney = false" )
  2654. return LUA_FALSE
  2655. end
  2656. elseif conditions[i].func == HasMoney then
  2657. PRINT( "ConditionsTest: HasMoney, p1 = ", conditions[i].p1 )
  2658. local ret = HasMoney( character, conditions[i].p1 )
  2659. if ret ~= LUA_TRUE then
  2660. PRINT( "ConditionsTest:HasMoney = false" )
  2661. return LUA_FALSE
  2662. end
  2663. elseif conditions[i].func == HasCancelMissionMoney then
  2664. PRINT( "ConditionsTest: HasCancelMissionMoney" )
  2665. local ret = HasCancelMissionMoney( character )
  2666. if ret ~= LUA_TRUE then
  2667. PRINT( "ConditionsTest:HasCancelMissionMoney = false" )
  2668. return LUA_FALSE
  2669. end
  2670. elseif conditions[i].func == IsMonster then
  2671. PRINT( "ConditionsTest:IsMonster, p1 =, p2 =", conditions[i].p1, param1 )
  2672. if param1 == nil then
  2673. SystemNotice( "ConditionsTest: determine destroy item type function, parameter invalid!param1 = nil" )
  2674. return LUA_FALSE
  2675. end
  2676. local ret = IsMonster( conditions[i].p1, param1 )
  2677. if ret ~= LUA_TRUE then
  2678. PRINT( "ConditionsTest:IsMonster = false" )
  2679. return LUA_FALSE
  2680. end
  2681. elseif conditions[i].func == IsItem then
  2682. PRINT( "ConditionsTest:IsItem, p1 =, p2 =", conditions[i].p1, param1 )
  2683. if param1 == nil then
  2684. SystemNotice( "ConditionsTest:determine obtain item type function, parameter invalid!param1 = nil" )
  2685. return LUA_FALSE
  2686. end
  2687. local ret = IsItem( conditions[i].p1, param1 )
  2688. if ret ~= LUA_TRUE then
  2689. PRINT( "ConditionsTest:IsItem = false" )
  2690. return LUA_FALSE
  2691. end
  2692. elseif conditions[i].func == IsMapNpc then
  2693. PRINT( "ConditionsTest:IsMapNpc, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2694. local ret = IsMapNpc( npc, conditions[i].p1, conditions[i].p2 )
  2695. if ret ~= LUA_TRUE then
  2696. PRINT( "ConditionsTest:IsMapNpc = false" )
  2697. return LUA_FALSE
  2698. end
  2699. elseif conditions[i].func == IsMapChar then
  2700. PRINT( "ConditionsTest:IsMapChar, p1 =", conditions[i].p1 )
  2701. local ret = IsMapChar( character )
  2702. if ret ~= LUA_TRUE then
  2703. PRINT( "ConditionsTest:IsMapChar = false" )
  2704. return LUA_FALSE
  2705. end
  2706. elseif conditions[i].func == LvCheck then
  2707. PRINT( "ConditionsTest:LvCheck, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2708. local ret = LvCheck( character, conditions[i].p1, conditions[i].p2 )
  2709. if ret ~= LUA_TRUE then
  2710. PRINT( "ConditionsTest:LvCheck = false" )
  2711. return LUA_FALSE
  2712. end
  2713. elseif conditions[i].func == HpCheck then
  2714. PRINT( "ConditionsTest:HpCheck, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2715. local ret = HpCheck( character, conditions[i].p1, conditions[i].p2 )
  2716. if ret ~= LUA_TRUE then
  2717. PRINT( "ConditionsTest:HpCheck = false" )
  2718. return LUA_FALSE
  2719. end
  2720. elseif conditions[i].func == SpCheck then
  2721. PRINT( "ConditionsTest:SpCheck, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2722. local ret = SpCheck( character, conditions[i].p1, conditions[i].p2 )
  2723. if ret ~= LUA_TRUE then
  2724. PRINT( "ConditionsTest:SpCheck = false" )
  2725. return LUA_FALSE
  2726. end
  2727. elseif conditions[i].func == PfEqual then
  2728. PRINT( "ConditionsTest:PfEqual, p1 =", conditions[i].p1 )
  2729. local ret = PfEqual( character, conditions[i].p1 )
  2730. if ret ~= LUA_TRUE then
  2731. PRINT( "ConditionsTest:PfEqual = false" )
  2732. return LUA_FALSE
  2733. end
  2734. elseif conditions[i].func == NoPfEqual then
  2735. PRINT( "ConditionsTest:PfEqual, p1 =", conditions[i].p1 )
  2736. local ret = NoPfEqual( character, conditions[i].p1 )
  2737. if ret ~= LUA_TRUE then
  2738. PRINT( "ConditionsTest:PfEqual = false" )
  2739. return LUA_FALSE
  2740. end
  2741. elseif conditions[i].func == HasFame then
  2742. PRINT( "ConditionsTest:HasFame, p1 =", conditions[i].p1 )
  2743. local ret = HasFame( character, conditions[i].p1 )
  2744. if ret ~= LUA_TRUE then
  2745. PRINT( "ConditionsTest:HasFame = false" )
  2746. return LUA_FALSE
  2747. end
  2748. elseif conditions[i].func == IsInArea then
  2749. PRINT( "ConditionsTest:IsInArea, p1 =", conditions[i].p1 )
  2750. local ret = IsInArea( character, conditions[i].p1 )
  2751. if ret ~= LUA_TRUE then
  2752. PRINT( "ConditionsTest:IsInArea = false" )
  2753. return LUA_FALSE
  2754. end
  2755. elseif conditions[i].func == Checkjlktime then
  2756. PRINT( "ConditionsTest:Checkjlktime, p1 =", conditions[i].p1 )
  2757. local ret = Checkjlktime( character, conditions[i].p1 )
  2758. if ret ~= LUA_TRUE then
  2759. PRINT( "ConditionsTest:Checkjlktime = false" )
  2760. return LUA_FALSE
  2761. end
  2762. elseif conditions[i].func == IsInMap then
  2763. PRINT( "ConditionsTest:IsInMap, p1 =, p2 =, p3 = , p4 = ", conditions[i].p1, conditions[i].p2, conditions[i].p3, conditions[i].p4 )
  2764. local ret = IsInMap( character, conditions[i].p1, conditions[i].p2, conditions[i].p3, conditions[i].p4, 10000, 10000 )
  2765. if ret ~= LUA_TRUE then
  2766. PRINT( "ConditionsTest:IsInMap = false" )
  2767. return LUA_FALSE
  2768. end
  2769. elseif conditions[i].func == AlwaysFailure then
  2770. PRINT( "ConditionsTest:AlwaysFailure," )
  2771. local ret = AlwaysFailure()
  2772. if ret ~= LUA_TRUE then
  2773. PRINT( "ConditionsTest:AlwaysFailure = false" )
  2774. return LUA_FALSE
  2775. end
  2776. elseif conditions[i].func == AlwaysTrue then
  2777. PRINT( "ConditionsTest:AlwaysTrue," )
  2778. local ret = AlwaysTrue()
  2779. --if ret ~= LUA_TRUE then
  2780. --PRINT( "ConditionsTest:AlwaysTrue = false" )
  2781. --return LUA_FALSE
  2782. --end
  2783. elseif conditions[i].func == HasRandMissionNpc then
  2784. PRINT( "ConditionsTest:HasRandMissionNpc,p1, p2, p3", conditions[i].p1, conditions[i].p2, conditions[i].p3 )
  2785. local ret = HasRandMissionNpc( character, conditions[i].p1, conditions[i].p2, conditions[i].p3 )
  2786. if ret ~= LUA_TRUE then
  2787. PRINT( "ConditionsTest:HasRandMissionNpc = false" )
  2788. return LUA_FALSE
  2789. end
  2790. elseif conditions[i].func == HasRandNpcItemFlag then
  2791. PRINT( "ConditionsTest:HasRandNpcItemFlag,p1, p2", conditions[i].p1, conditions[i].p2 )
  2792. local ret = HasRandNpcItemFlag( character, conditions[i].p1, conditions[i].p2 )
  2793. if ret ~= LUA_TRUE then
  2794. PRINT( "ConditionsTest:HasRandNpcItemFlag = false" )
  2795. return LUA_FALSE
  2796. end
  2797. elseif conditions[i].func == NoRandNpcItemFlag then
  2798. PRINT( "ConditionsTest:NoRandNpcItemFlag,p1, p2", conditions[i].p1, conditions[i].p2 )
  2799. local ret = NoRandNpcItemFlag( character, conditions[i].p1, conditions[i].p2 )
  2800. if ret ~= LUA_TRUE then
  2801. PRINT( "ConditionsTest:NoRandNpcItemFlag = false" )
  2802. return LUA_FALSE
  2803. end
  2804. elseif conditions[i].func == HasConvoyNpc then
  2805. PRINT( "ConditionsTest:HasConvoyNpc,p1 = ", conditions[i].p1 )
  2806. local ret = HasConvoyNpc( character, conditions[i].p1 )
  2807. if ret ~= LUA_TRUE then
  2808. PRINT( "ConditionsTest:HasConvoyNpc = false" )
  2809. return LUA_FALSE
  2810. end
  2811. elseif conditions[i].func ==CheckItem then
  2812. PRINT( "ConditionsTest: CheckItem, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2813. local ret = CheckItem( character, conditions[i].p1, conditions[i].p2 )
  2814. if ret ~= LUA_TRUE then
  2815. PRINT( "ConditionsTest:CheckItem = false" )
  2816. return LUA_FALSE
  2817. end
  2818. elseif conditions[i].func ==CheckBag then
  2819. PRINT( "ConditionsTest: CheckBag, p1 =, p2 =", conditions[i].p1, conditions[i].p2 ,conditions[i].p3)
  2820. local ret = CheckBag( character, conditions[i].p1, conditions[i].p2 ,conditions[i].p3)
  2821. if ret ~= LUA_TRUE then
  2822. PRINT( "ConditionsTest:CheckBag = false" )
  2823. return LUA_FALSE
  2824. end
  2825. elseif conditions[i].func ==CheckBagEmp then
  2826. PRINT( "ConditionsTest: CheckBagEmp, p1 =, p2 =", conditions[i].p1)
  2827. local ret = CheckBagEmp( character, conditions[i].p1 )
  2828. if ret ~= LUA_TRUE then
  2829. PRINT( "ConditionsTest:CheckBagEmp = false" )
  2830. return LUA_FALSE
  2831. end
  2832. elseif conditions[i].func == NoConvoyNpc then
  2833. PRINT( "ConditionsTest:NoConvoyNpc,p1 = ", conditions[i].p1 )
  2834. local ret = NoConvoyNpc( character, conditions[i].p1 )
  2835. if ret ~= LUA_TRUE then
  2836. PRINT( "ConditionsTest:NoConvoyNpc = false" )
  2837. return LUA_FALSE
  2838. end
  2839. elseif conditions[i].func == IsConvoyNpc then
  2840. PRINT( "ConditionsTest:IsConvoyNpc,p1 = , p2 = ", conditions[i].p1, conditions[i].p2 )
  2841. local ret = IsConvoyNpc( character, conditions[i].p1, conditions[i].p2 )
  2842. if ret ~= LUA_TRUE then
  2843. PRINT( "ConditionsTest:IsConvoyNpc = false" )
  2844. return LUA_FALSE
  2845. end
  2846. elseif conditions[i].func == IsCategory then
  2847. PRINT( "ConditionsTest:IsCategory,p1 = ", conditions[i].p1 )
  2848. local ret = IsCategory( character, conditions[i].p1 )
  2849. if ret ~= LUA_TRUE then
  2850. PRINT( "ConditionsTest:IsCategory = false" )
  2851. return LUA_FALSE
  2852. end
  2853. elseif conditions[i].func == CheckConvertProfession then
  2854. PRINT( "ConditionsTest:CheckConvertProfession,p1 = ", conditions[i].p1 )
  2855. local ret = CheckConvertProfession( character, conditions[i].p1 )
  2856. if ret ~= LUA_TRUE then
  2857. PRINT( "ConditionsTest:CheckConvertProfession = false" )
  2858. return LUA_FALSE
  2859. end
  2860. elseif conditions[i].func == IsSpawnPos then
  2861. PRINT( "ConditionsTest:IsSpawnPos, p1 =", conditions[i].p1 )
  2862. local ret = IsSpawnPos( character, conditions[i].p1 )
  2863. if ret ~= LUA_TRUE then
  2864. PRINT( "ConditionsTest:IsSpawnPos = false" )
  2865. return LUA_FALSE
  2866. end
  2867. elseif conditions[i].func == HasLeaveBagGrid then
  2868. PRINT( "ConditionsTest:HasLeaveBagGrid, p1 =", conditions[i].p1 )
  2869. local ret = HasLeaveBagGrid( character, conditions[i].p1 )
  2870. if ret ~= LUA_TRUE then
  2871. PRINT( "ConditionsTest:HasLeaveBagGrid = false" )
  2872. return LUA_FALSE
  2873. end
  2874. elseif conditions[i].func == HasLeaveBagTempGrid then
  2875. PRINT( "ConditionsTest:HasLeaveBagTempGrid, p1 =", conditions[i].p1 )
  2876. local ret = HasLeaveBagTempGrid( character, conditions[i].p1 )
  2877. if ret ~= LUA_TRUE then
  2878. PRINT( "ConditionsTest:HasLeaveBagTempGrid = false" )
  2879. return LUA_FALSE
  2880. end
  2881. elseif conditions[i].func == IsBoatFull then
  2882. PRINT( "ConditionsTest:IsBoatFull" )
  2883. local ret = IsBoatFull( character )
  2884. if ret ~= LUA_TRUE then
  2885. PRINT( "ConditionsTest:IsBoatFull = false" )
  2886. return LUA_FALSE
  2887. end
  2888. elseif conditions[i].func == BoatBuildCheck then
  2889. PRINT( "ConditionsTest:BoatBuildCheck, p1 =", conditions[i].p1 )
  2890. local ret = BoatBuildCheck( character, conditions[i].p1 )
  2891. if ret ~= LUA_TRUE then
  2892. PRINT( "ConditionsTest:BoatBuildCheck = false" )
  2893. return LUA_FALSE
  2894. end
  2895. elseif conditions[i].func == HasBoatInBerth then
  2896. PRINT( "ConditionsTest:HasBoatInBerth, p1 =", conditions[i].p1 )
  2897. local ret = HasBoatInBerth( character, conditions[i].p1 )
  2898. if ret ~= LUA_TRUE then
  2899. PRINT( "ConditionsTest:HasBoatInBerth = false" )
  2900. return LUA_FALSE
  2901. end
  2902. elseif conditions[i].func == HasDeadBoatInBerth then
  2903. PRINT( "ConditionsTest:HasDeadBoatInBerth, p1 =", conditions[i].p1 )
  2904. local ret = HasDeadBoatInBerth( character, conditions[i].p1 )
  2905. if ret ~= LUA_TRUE then
  2906. PRINT( "ConditionsTest:HasDeadBoatInBerth = false" )
  2907. return LUA_FALSE
  2908. end
  2909. elseif conditions[i].func == XmasNotice then
  2910. PRINT( "ConditionsTest: XmasNotice, p1 =, p2 =", conditions[i].p1, conditions[i].p2 )
  2911. local ret = XmasNotice( character, conditions[i].p1, conditions[i].p2 )
  2912. if ret ~= LUA_TRUE then
  2913. PRINT( "ConditionsTest:XmasNotice = false" )
  2914. return LUA_FALSE
  2915. end
  2916. elseif conditions[i].func == CheckSpeed then
  2917. PRINT( "ConditionsTest:CheckSpeed, p1 = ", conditions[i].p1 )
  2918. local ret = CheckSpeed( character, conditions[i].p1 )
  2919. if ret ~= LUA_TRUE then
  2920. PRINT( "ConditionsTest:CheckSpeed = false" )
  2921. return LUA_FALSE
  2922. end
  2923. elseif conditions[i].func == CheckZS then
  2924. PRINT( "ConditionsTest:CheckZS, p1 = ", conditions[i].p1 )
  2925. local ret = CheckZS( character, conditions[i].p1 )
  2926. if ret ~= LUA_TRUE then
  2927. PRINT( "ConditionsTest:CheckZS = false" )
  2928. return LUA_FALSE
  2929. end
  2930. elseif conditions[i].func == HasAllBoatInBerth then
  2931. PRINT( "ConditionsTest:HasAllBoatInBerth, p1 =", conditions[i].p1 )
  2932. local ret = HasAllBoatInBerth( character, conditions[i].p1 )
  2933. if ret ~= LUA_TRUE then
  2934. PRINT( "ConditionsTest:HasAllBoatInBerth = false" )
  2935. return LUA_FALSE
  2936. end
  2937. --elseif conditions[i].func == HasAllBoatInBerth_eitheror then
  2938. -- PRINT( "ConditionsTest:HasAllBoatInBerth , p1 = , p2 = ", conditions[i].p1, conditions[i].p2 )
  2939. -- local ret = HasAllBoatInBerth_eitheror( character, conditions[i].p1, conditions[i].p2 )
  2940. -- if ret ~= LUA_TRUE then
  2941. -- PRINT( "ConditionsTest:HasAllBoatInBerth_eitheror = false" )
  2942. -- return LUA_FALSE
  2943. -- end
  2944. elseif conditions[i].func == HasLuanchOut then
  2945. PRINT( "ConditionsTest:HasLuanchOut" )
  2946. local ret = HasLuanchOut( character )
  2947. if ret ~= LUA_TRUE then
  2948. PRINT( "ConditionsTest:HasLuanchOut = false" )
  2949. return LUA_FALSE
  2950. end
  2951. elseif conditions[i].func == HasGuild then
  2952. PRINT( "ConditionsTest:HasGuild" )
  2953. local ret = HasGuild( character )
  2954. if ret ~= LUA_TRUE then
  2955. PRINT( "ConditionsTest:HasGuild = false" )
  2956. return LUA_FALSE
  2957. end
  2958. elseif conditions[i].func == NoGuild then
  2959. PRINT( "ConditionsTest:NoGuild" )
  2960. local ret = NoGuild( character )
  2961. if ret ~= LUA_TRUE then
  2962. PRINT( "ConditionsTest:NoGuild = false" )
  2963. return LUA_FALSE
  2964. end
  2965. elseif conditions[i].func == HasPirateGuild then
  2966. PRINT( "ConditionsTest:HasPirateGuild" )
  2967. local ret = HasPirateGuild( character )
  2968. if ret ~= LUA_TRUE then
  2969. PRINT( "ConditionsTest:HasPirateGuild = false" )
  2970. return LUA_FALSE
  2971. end
  2972. elseif conditions[i].func == NoPirateGuild then
  2973. PRINT( "ConditionsTest:NoPirateGuild" )
  2974. local ret = NoPirateGuild( character )
  2975. if ret ~= LUA_TRUE then
  2976. PRINT( "ConditionsTest:NoPirateGuild = false" )
  2977. return LUA_FALSE
  2978. end
  2979. elseif conditions[i].func == HasNavyGuild then
  2980. PRINT( "ConditionsTest:HasNavyGuild" )
  2981. local ret = HasNavyGuild( character )
  2982. if ret ~= LUA_TRUE then
  2983. PRINT( "ConditionsTest:HasNavyGuild = false" )
  2984. return LUA_FALSE
  2985. end
  2986. elseif conditions[i].func == NoNavyGuild then
  2987. PRINT( "ConditionsTest:NoNavyGuild" )
  2988. local ret = NoNavyGuild( character )
  2989. if ret ~= LUA_TRUE then
  2990. PRINT( "ConditionsTest:NoNavyGuild = false" )
  2991. return LUA_FALSE
  2992. end
  2993. elseif conditions[i].func == IsGuildType then
  2994. PRINT( "ConditionsTest:IsGuildType, p1 = ", conditions[i].p1 )
  2995. local ret = IsGuildType( character, conditions[i].p1 )
  2996. if ret ~= LUA_TRUE then
  2997. PRINT( "ConditionsTest:IsGuildType = false" )
  2998. return LUA_FALSE
  2999. end
  3000. elseif conditions[i].func == TradeItemLevelCheck then
  3001. PRINT( "ConditionsTest:TradeItemLevelCheck, p1 = , p2 = ", conditions[i].p1, conditions[i].p2 )
  3002. local ret = TradeItemLevelCheck( character, conditions[i].p1, conditions[i].p2 )
  3003. if ret ~= LUA_TRUE then
  3004. PRINT( "ConditionsTest:TradeItemLevelCheck = false" )
  3005. return LUA_FALSE
  3006. end
  3007. elseif conditions[i].func == TradeItemDataCheck then
  3008. PRINT( "ConditionsTest:TradeItemDataCheck, p1 = , p2 = ", conditions[i].p1, conditions[i].p2 )
  3009. local ret = TradeItemDataCheck( character, conditions[i].p1, conditions[i].p2 )
  3010. if ret ~= LUA_TRUE then
  3011. PRINT( "ConditionsTest:TradeItemDataCheck = false" )
  3012. return LUA_FALSE
  3013. end
  3014. elseif conditions[i].func == HasOffer then
  3015. PRINT( "ConditionsTest:HasOffer, p1 = ", conditions[i].p1 )
  3016. local ret = HasOffer( character, conditions[i].p1 )
  3017. if ret ~= LUA_TRUE then
  3018. PRINT( "ConditionsTest:HasOffer = false" )
  3019. return LUA_FALSE
  3020. end
  3021. elseif conditions[i].func == LessCredit then
  3022. PRINT( "ConditionsTest:LessCredit, p1 = , p2 = ", conditions[i].p1, conditions[i].p2 )
  3023. local ret = LessCredit( character, conditions[i].p1, conditions[i].p2 )
  3024. if ret ~= LUA_TRUE then
  3025. PRINT( "ConditionsTest:LessCredit = false" )
  3026. return LUA_FALSE
  3027. end
  3028. elseif conditions[i].func == LessTime then
  3029. PRINT( "ConditionsTest:LessTime, p1 = ", conditions[i].p1 )
  3030. local ret = LessTime( character, conditions[i].p1 )
  3031. if ret ~= LUA_TRUE then
  3032. PRINT( "ConditionsTest:LessTime = false" )
  3033. return LUA_FALSE
  3034. end
  3035. elseif conditions[i].func == MoreTime then
  3036. PRINT( "ConditionsTest:MoreTime, p1 = ", conditions[i].p1 )
  3037. local ret = MoreTime( character, conditions[i].p1 )
  3038. if ret ~= LUA_TRUE then
  3039. PRINT( "ConditionsTest:MoreTime = false" )
  3040. return LUA_FALSE
  3041. end
  3042. elseif conditions[i].func == BaiyangOn then
  3043. PRINT( "ConditionsTest:BaiyangOn, p1 = ", conditions[i].p1 )
  3044. local ret = BaiyangOn( character, conditions[i].p1 )
  3045. if ret ~= LUA_TRUE then
  3046. PRINT( "ConditionsTest:BaiyangOn = false" )
  3047. return LUA_FALSE
  3048. end
  3049. elseif conditions[i].func == CheckEnergy then
  3050. PRINT( "ConditionsTest:CheckEnergy, p1 = ", conditions[i].p1 )
  3051. local ret = CheckEnergy( character, conditions[i].p1 )
  3052. if ret ~= LUA_TRUE then
  3053. PRINT( "ConditionsTest:CheckEnergy = false" )
  3054. return LUA_FALSE
  3055. end
  3056. elseif conditions[i].func == HasXmasYB then
  3057. PRINT( "ConditionsTest:HasXmasYB,p1, p2", conditions[i].p1, conditions[i].p2 )
  3058. local ret = HasXmasYB( character, conditions[i].p1, conditions[i].p2 )
  3059. if ret ~= LUA_TRUE then
  3060. PRINT( "ConditionsTest:HasXmasYB = false" )
  3061. return LUA_FALSE
  3062. end
  3063. elseif conditions[i].func == CheckHJ then
  3064. PRINT( "ConditionsTest:CheckHJ, p1 = ", conditions[i].p1 )
  3065. local ret = CheckHJ( character, conditions[i].p1 )
  3066. if ret ~= LUA_TRUE then
  3067. PRINT( "ConditionsTest:CheckHJ = false" )
  3068. return LUA_FALSE
  3069. end
  3070. elseif conditions[i].func == HasNOZSExp then
  3071. PRINT( "ConditionsTest:HasNOZSExp, p1 = ", conditions[i].p1 )
  3072. local ret = HasNOZSExp( character, conditions[i].p1 )
  3073. if ret ~= LUA_TRUE then
  3074. PRINT( "ConditionsTest:HasNOZSExp = false" )
  3075. return LUA_FALSE
  3076. end
  3077. elseif conditions[i].func == HasGuildLevel then
  3078. PRINT( "ConditionsTest:HasGuildLevel, p1 = ", conditions[i].p1 )
  3079. local ret = HasGuildLevel( character, conditions[i].p1 )
  3080. if ret ~= LUA_TRUE then
  3081. PRINT( "ConditionsTest:HasGuildLevel = false" )
  3082. return LUA_FALSE
  3083. end
  3084. elseif conditions[i].func == crablife then
  3085. PRINT( "ConditionsTest:crablife, p1 = ", conditions[i].p1 )
  3086. local ret = crablife( character, conditions[i].p1 )
  3087. if ret ~= LUA_TRUE then
  3088. PRINT( "ConditionsTest:crablife = false" )
  3089. return LUA_FALSE
  3090. end
  3091. elseif conditions[i].func == KitbagLock then
  3092. PRINT( "ConditionsTest:KitbagLock, p1 = ", conditions[i].p1 )
  3093. local ret = KitbagLock( character, conditions[i].p1 )
  3094. if ret ~= LUA_TRUE then
  3095. PRINT( "ConditionsTest:KitbagLock = false" )
  3096. return LUA_FALSE
  3097. end
  3098. elseif conditions[i].func == ValentinesRing then
  3099. PRINT( "ConditionsTest:ValentinesRing, p1 = ", conditions[i].p1 )
  3100. local ret = ValentinesRing( character, conditions[i].p1 )
  3101. if ret ~= LUA_TRUE then
  3102. PRINT( "ConditionsTest:ValentinesRing = false" )
  3103. return LUA_FALSE
  3104. end
  3105. elseif conditions[i].func == ValentinesRingJudge then
  3106. PRINT( "ConditionsTest:ValentinesRingJudge, p1 = ", conditions[i].p1 )
  3107. local ret = ValentinesRingJudge( character, conditions[i].p1 )
  3108. if ret ~= LUA_TRUE then
  3109. PRINT( "ConditionsTest:ValentinesRingJudge = false" )
  3110. return LUA_FALSE
  3111. end
  3112. elseif conditions[i].func ==CheckTime then
  3113. PRINT( "ConditionsTest: CheckTime, p1 =, p2 =", conditions[i].p1)
  3114. local ret = CheckTime( character, conditions[i].p1 )
  3115. if ret ~= LUA_TRUE then
  3116. PRINT( "ConditionsTest:CheckTime = false" )
  3117. return LUA_FALSE
  3118. end
  3119. else
  3120. PRINT( "ConditionsTest: unknown condition function!i = %d", i )
  3121. --SystemNotice( character, "ConditionsTest:unknown condition function error!" )
  3122. return LUA_ERROR
  3123. end
  3124. end
  3125. end
  3126.  
  3127. PRINT( "ConditionsTest: return true" )
  3128. return LUA_TRUE
  3129. end
  3130.  
  3131. --Ąô°Č°Ę§@łB˛z¨çĽĆ
  3132. function ActionsProc( character, actions, npc, page, misid, scriptid, param1, param2 )
  3133. PRINT( "ActionProc: actions proc" )
  3134. if actions == nil then
  3135. PRINT( "ActionProc:quest action management function parameter actions cannot be as null!" )
  3136. SystemNotice( character, "ActionProc:quest action management function parameter actions cannot be as null!" )
  3137. return LUA_ERROR
  3138. end
  3139.  
  3140. --IJµoľą˛Ĺ¦X±řĄó°Ę§@
  3141. local num = TR_MAXNUM_ACTIONS
  3142. if actions.count ~= nil then
  3143. num = actions.count
  3144. end
  3145. PRINT( "ActionsProc:Actions num = ", num )
  3146. for i = 1, num, 1 do
  3147. PRINT( "ActionProc23: actions i = ", i, actions[i] )
  3148. if actions[i] == nil then
  3149. PRINT( "ActionProc23: break" )
  3150. break
  3151. end
  3152. PRINT( "ActionProc: actions i = ", i )
  3153. if actions[i].func == JumpPage then
  3154. PRINT( "ActionProc:JumpPage, page =, p1 = ", page, actions[i].p1 )
  3155. JumpPage( character, npc, page, actions[i].p1 )
  3156. elseif actions[i].func == CloseTalk then
  3157. PRINT( "ActionProc:CloseTalk" )
  3158. CloseTalk( character, npc )
  3159. elseif actions[i].func == AddMission then
  3160. PRINT( "ActionProc: AddMission actions[i].p1 = , scriptid = ", actions[i].p1, scriptid )
  3161. local ret = AddMission( character, actions[i].p1, scriptid )
  3162. if ret ~= LUA_TRUE then
  3163. PRINT( "ActionProc: AddMission failed!" )
  3164. SystemNotice( character, "ActionProc: Adds quest failed!" )
  3165. return LUA_FALSE
  3166. end
  3167. elseif actions[i].func == AddTrigger then
  3168. PRINT( "ActionProc: AddTrigger, misid, p1 = , p2 = , p3 = , p4 = , p5 = , p6 = , p7 = , p8 = ", misid, actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4, actions[i].p5, actions[i].p6, actions[i].p7, actions[i].p8 )
  3169. local ret = AddTrigger( character, misid, actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4, actions[i].p5, actions[i].p6, actions[i].p7, actions[i].p8 )
  3170. if ret ~= LUA_TRUE then
  3171. PRINT( "ActionProc: AddTrigger failed!" )
  3172. SystemNotice( character, "ActionProc: adds trigger failed!" )
  3173. return LUA_FALSE
  3174. end
  3175. elseif actions[i].func == AddDayLog then
  3176. PRINT( "ActionsProc:AddDayLog, p1 = ", actions[i].p1 )
  3177. local ret = AddDayLog( character , actions[i].p1 )
  3178. if ret ~= LUA_TRUE then
  3179. PRINT( "ActionsProc:AddDayLog failed!" )
  3180. return LUA_FALSE
  3181. end
  3182. elseif actions[i].func == AddNpcTrigger then
  3183. PRINT( "ActionProc: AddNpcTrigger, p1 = , p2 = , p3 = , p4 = , p5 = , p6 = ", actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4, actions[i].p5, actions[i].p6 )
  3184. local ret = AddNpcTrigger( character, actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4, actions[i].p5, actions[i].p6 )
  3185. if ret ~= LUA_TRUE then
  3186. PRINT( "ActionProc: AddNpcTrigger failed!" )
  3187. LG( "trigger_error", "ActionProc: AddNpcTrigger adds trigger failed!NPC = "..GetCharName( character ) )
  3188. return LUA_FALSE
  3189. end
  3190. elseif actions[i].func == AddNextFlag then
  3191. PRINT( "ActionProc:AddNextFlag, p1, p2, p3", actions[i].p1, actions[i].p2, actions[i].p3 )
  3192. local ret = AddNextFlag( character, actions[i].p1, actions[i].p2, actions[i].p3 )
  3193. if ret ~= LUA_TRUE then
  3194. PRINT( "ActionProc: AddNextFlag failed!" )
  3195. SystemNotice( character, "ActionProc: adds list quest record label failed!" )
  3196. return LUA_FALSE
  3197. end
  3198. elseif actions[i].func == AddRMNextFlag then
  3199. PRINT( "ActionProc:AddRMNextFlag, p1, p2, p3", actions[i].p1, actions[i].p2, actions[i].p3 )
  3200. local ret = AddRMNextFlag( character, actions[i].p1, actions[i].p2, actions[i].p3 )
  3201. if ret ~= LUA_TRUE then
  3202. PRINT( "ActionProc: AddRMNextFlag failed!" )
  3203. SystemNotice( character, "ActionProc: AddRMNextFlag adds list to quest record label failed!" )
  3204. return LUA_FALSE
  3205. end
  3206. elseif actions[i].func == SetFlag then
  3207. PRINT( "ActionProc:SetFlag, p1, p2 ", actions[i].p1, actions[i].p2 )
  3208. local ret = SetFlag( character, actions[i].p1, actions[i].p2 )
  3209. if ret ~= LUA_TRUE then
  3210. PRINT( "ActionProc:SetFlag failed!" )
  3211. SystemNotice( character, "ActionProc: Set quest record label failed!" )
  3212. return LUA_FALSE
  3213. end
  3214. elseif actions[i].func == QuestFunc then
  3215. local ret = QuestFunc(character, actions[i].p1, actions[i].p2, actions[i].p3)
  3216. if ret ~= LUA_TRUE then
  3217. return LUA_FALSE
  3218. end
  3219. elseif actions[i].func == SetRecord then
  3220. PRINT( "ActionProc:SetRecord, p1 = ", actions[i].p1 )
  3221. local ret = SetRecord( character, actions[i].p1 )
  3222. if ret ~= LUA_TRUE then
  3223. PRINT( "ActionProc:SetRecord failed!" )
  3224. SystemNotice( character, "ActionProc:Set story record label failed!" )
  3225. return LUA_FALSE
  3226. end
  3227.  
  3228. elseif actions[i].func == GiveNSDX then
  3229. PRINT( "ActionProc: GiveNSDX, p1 = ", actions[i].p1)
  3230. local ret = GiveNSDX( character,npc, actions[i].p1)
  3231. if ret ~= LUA_TRUE then
  3232. PRINT( "ActionProc:GiveNSDX = false" )
  3233. return LUA_FALSE
  3234. end
  3235. elseif actions[i].func == JINNiuSS then
  3236. PRINT( "ActionProc:JINNiuSS, p1 = " )
  3237. local ret = JINNiuSS( character)
  3238. if ret ~= LUA_TRUE then
  3239. PRINT( "ActionProc:JINNiuSS failed!" )
  3240. --SystemNotice( character, "ActionProc:Set story record label failed!" )
  3241. return LUA_FALSE
  3242. end
  3243. elseif actions[i].func == JINNiuHD then
  3244. PRINT( "ActionProc:JINNiuHD, p1 = " )
  3245. local ret = JINNiuHD( character)
  3246. if ret ~= LUA_TRUE then
  3247. PRINT( "ActionProc:JINNiuHD failed!" )
  3248. --SystemNotice( character, "ActionProc:Set story record label failed!" )
  3249. return LUA_FALSE
  3250. end
  3251. elseif actions[i].func == JINNiuCZ then
  3252. PRINT( "ActionProc:JINNiuCZ, p1 = " )
  3253. local ret = JINNiuCZ( character)
  3254. if ret ~= LUA_TRUE then
  3255. PRINT( "ActionProc:JINNiuCZ failed!" )
  3256. --SystemNotice( character, "ActionProc:Set story record label failed!" )
  3257. return LUA_FALSE
  3258. end
  3259.  
  3260. elseif actions[i].func == ShuangZiSS then
  3261. PRINT( "ActionProc:ShuangZiSS, p1 = " )
  3262. local ret = ShuangZiSS( character)
  3263. if ret ~= LUA_TRUE then
  3264. PRINT( "ActionProc:ShuangZiSS failed!" )
  3265. --SystemNotice( character, "ActionProc:Set story record label failed!" )
  3266. return LUA_FALSE
  3267. end
  3268. elseif actions[i].func == ShuangZiHD then
  3269. PRINT( "ActionProc:ShuangZiHD, p1 = " )
  3270. local ret = ShuangZiHD( character)
  3271. if ret ~= LUA_TRUE then
  3272. PRINT( "ActionProc:ShuangZiHD failed!" )
  3273. --SystemNotice( character, "ActionProc:Set story record label failed!" )
  3274. return LUA_FALSE
  3275. end
  3276. elseif actions[i].func == ShuangZiCZ then
  3277. PRINT( "ActionProc:ShuangZiCZ, p1 = " )
  3278. local ret = ShuangZiCZ( character)
  3279. if ret ~= LUA_TRUE then
  3280. PRINT( "ActionProc:ShuangZiCZ failed!" )
  3281. --SystemNotice( character, "ActionProc:Set story record label failed!" )
  3282. return LUA_FALSE
  3283. end
  3284. elseif actions[i].func == AddReadingBook then
  3285. PRINT( "ActionProc:AddReadingBook, p1 = ", actions[i].p1 )
  3286. local ret = AddReadingBook( character, actions[i].p1 )
  3287. if ret ~= LUA_TRUE then
  3288. PRINT( "ActionProc:AddReadingBook failed!" )
  3289. SystemNotice( character, "ActionProc:˛KĄ[®ŃĄ»failed!" )
  3290. return LUA_FALSE
  3291. end
  3292. elseif actions[i].func == AddExpPer then
  3293. PRINT( "ActionProc:AddExpPer, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3294. local ret = AddExpPer( character, actions[i].p1, actions[i].p2 )
  3295. if ret ~= LUA_TRUE then
  3296. PRINT( "ActionProc: AddExpPer failed!" )
  3297. SystemNotice( character, "ActionProc: µą¤©¸gĹçfailed!" )
  3298. return LUA_FALSE
  3299. end
  3300. elseif actions[i].func == ZSSTART then
  3301. PRINT( "ActionProc:ZSSTART, p1 = " )
  3302. local ret = ZSSTART( character)
  3303. if ret ~= LUA_TRUE then
  3304. PRINT( "ActionProc:ZSSTART failed!" )
  3305. --SystemNotice( character, "ActionProc:Set story record label failed!" )
  3306. return LUA_FALSE
  3307. end
  3308.  
  3309. elseif actions[i].func == AddChaHJ then
  3310. PRINT( "ActionProc: AddChaHJ, p1 = ", actions[i].p1)
  3311. local ret = AddChaHJ( character,npc, actions[i].p1)
  3312. if ret ~= LUA_TRUE then
  3313. PRINT( "ActionProc:AddChaHJ = false" )
  3314. return LUA_FALSE
  3315. end
  3316.  
  3317. elseif actions[i].func == AddExpNextLv1 then
  3318. PRINT( "ActionProc:AddExpNextLv1, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3319. local ret = AddExpNextLv1( character, npc, actions[i].p1, actions[i].p2 )
  3320. if ret ~= LUA_TRUE then
  3321. PRINT( "ActionProc: AddExpNextLv1 failed!" )
  3322. SystemNotice( character, "ActionProc: AddExpNextLv1 Add Exp failed!" )
  3323. return LUA_FALSE
  3324. end
  3325.  
  3326. elseif actions[i].func == AddExpNextLv2 then
  3327. PRINT( "ActionProc:AddExpNextLv2, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3328. local ret = AddExpNextLv2( character, npc, actions[i].p1, actions[i].p2 )
  3329. if ret ~= LUA_TRUE then
  3330. PRINT( "ActionProc: AddExpNextLv2 failed!" )
  3331. SystemNotice( character, "ActionProc:AddExpNextLv2 Add Exp failed!" )
  3332. return LUA_FALSE
  3333. end
  3334. elseif actions[i].func == ZSSTOP then
  3335. PRINT( "ActionProc:ZSSTOP, p1 = " )
  3336. local ret = ZSSTOP( character)
  3337. if ret ~= LUA_TRUE then
  3338. PRINT( "ActionProc:ZSSTOP failed!" )
  3339. --SystemNotice( character, "ActionProc:Set story record label failed!" )
  3340. return LUA_FALSE
  3341. end
  3342. elseif actions[i].func == ZSSTOP2 then
  3343. PRINT( "ActionProc:ZSSTOP2, p1 = " )
  3344. local ret = ZSSTOP2( character)
  3345. if ret ~= LUA_TRUE then
  3346. PRINT( "ActionProc:ZSSTOP2 failed!" )
  3347. --SystemNotice( character, "ActionProc:Set story record label failed!" )
  3348. return LUA_FALSE
  3349. end
  3350. elseif actions[i].func == AddExp then
  3351. PRINT( "ActionProc:AddExp, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3352. local ret = AddExp( character, npc, actions[i].p1, actions[i].p2 )
  3353. if ret ~= LUA_TRUE then
  3354. PRINT( "ActionProc: AddExp Failed!" )
  3355. SystemNotice( character, "ActionProc: AddExp add experience failed!" )
  3356. return LUA_FALSE
  3357. end
  3358.  
  3359. elseif actions[i].func == AddSailExp then
  3360. PRINT( "ActionProc:AddSailExp, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3361. local ret = AddSailExp( character, npc, actions[i].p1, actions[i].p2 )
  3362. if ret ~= LUA_TRUE then
  3363. PRINT( "ActionProc: AddSailExp failed!" )
  3364. SystemNotice( character, "ActionProc: AddSailExp Add Exp failed!" )
  3365. return LUA_FALSE
  3366. end
  3367. elseif actions[i].func == AddLifeExp then
  3368. PRINT( "ActionProc:AddLifeExp, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3369. local ret = AddLifeExp( character, npc, actions[i].p1, actions[i].p2 )
  3370. if ret ~= LUA_TRUE then
  3371. PRINT( "ActionProc: AddLifeExp failed!" )
  3372. SystemNotice( character, "ActionProc: AddLifeExp Add Exp failed!" )
  3373. return LUA_FALSE
  3374. end
  3375. elseif actions[i].func == AddChaItem7 then
  3376. PRINT( "ActionsProc:AddChaItem7, p1 = ", actions[i].p1 )
  3377. local ret = AddChaItem7( character, actions[i].p1 )
  3378. if ret ~= LUA_TRUE then
  3379. PRINT( "ActionsProc:AddChaItem7 failed!" )
  3380. SystemNotice( character, "ActionsProc:AddChaItem7 failed!" )
  3381. return LUA_FALSE
  3382. end
  3383. elseif actions[i].func == AddChaItem8 then
  3384. PRINT( "ActionsProc:AddChaItem8, p1 = ", actions[i].p1 )
  3385. local ret = AddChaItem8( character, actions[i].p1 )
  3386. if ret ~= LUA_TRUE then
  3387. PRINT( "ActionsProc:AddChaItem8 failed!" )
  3388. SystemNotice( character, "ActionsProc:AddChaItem8 failed!" )
  3389. return LUA_FALSE
  3390. end
  3391. elseif actions[i].func == checkcytime then
  3392. PRINT( "ActionsProc:checkcytime, p1 = ", actions[i].p1 )
  3393. local ret = checkcytime( character, actions[i].p1 )
  3394. if ret ~= LUA_TRUE then
  3395. PRINT( "ActionsProc:checkcytime failed!" )
  3396. SystemNotice( character, "ActionsProc:checkcytime failed!" )
  3397. return LUA_FALSE
  3398. end
  3399. elseif actions[i].func == checksjtime then
  3400. PRINT( "ActionsProc:checksjtime, p1 = ", actions[i].p1 )
  3401. local ret = checksjtime( character, actions[i].p1 )
  3402. if ret ~= LUA_TRUE then
  3403. PRINT( "ActionsProc:checksjtime failed!" )
  3404. SystemNotice( character, "ActionsProc:checksjtime failed!" )
  3405. return LUA_FALSE
  3406. end
  3407. elseif actions[i].func == AddExpAndType then
  3408. PRINT( "ActionProc:AddExpAndType, p1 = , p2 = , p3 = ", actions[i].p1, actions[i].p2, actions[i].p3 )
  3409. local ret = AddExpAndType( character, npc, actions[i].p1, actions[i].p2, actions[i].p3 )
  3410. if ret ~= LUA_TRUE then
  3411. PRINT( "ActionProc: AddExpAndType failed!" )
  3412. SystemNotice( character, "ActionProc: AddExpAndType Add Exp failed!" )
  3413. return LUA_FALSE
  3414. end
  3415. elseif actions[i].func == AddMoney then
  3416. PRINT( "ActionProc:AddMoney, p1 =", actions[i].p1 )
  3417. local ret = AddMoney( character, npc, actions[i].p1 )
  3418. if ret ~= LUA_TRUE then
  3419. PRINT( "ActionProc: AddMoney failed!param1 = %d", actions[i].p1 )
  3420. SystemNotice( character, "ActionProc: AddMoney failed!" )
  3421. return LUA_FALSE
  3422. end
  3423. elseif actions[i].func == TakeCredit then
  3424. PRINT( "ActionProc: TakeCredit, p1 = ", actions[i].p1)
  3425. local ret = DelRoleCredit( character,npc, actions[i].p1)
  3426. if ret ~= LUA_TRUE then
  3427. PRINT( "ActionProc:TakeCredit = false" )
  3428. return LUA_FALSE
  3429. end
  3430. elseif actions[i].func == TakeFightingPoint then
  3431. PRINT( "ActionProc: TakeFightingPoint, p1 = ", actions[i].p1)
  3432. local ret = TakeFightingPoint( character,actions[i].p1)
  3433. if ret ~= LUA_TRUE then
  3434. PRINT( "ActionProc:DelRoleFightingPoint = false" )
  3435. return LUA_FALSE
  3436. end
  3437. elseif actions[i].func == Leaveprison then
  3438. PRINT( "ActionProc: Leaveprison, p1 = ", actions[i].p1)
  3439. local ret = Leaveprison( character, actions[i].p1)
  3440. if ret ~= LUA_TRUE then
  3441. PRINT( "ActionProc:Leaveprison = false" )
  3442. return LUA_FALSE
  3443. end
  3444. elseif actions[i].func == Givejiluka then
  3445. PRINT( "ActionProc: Givejiluka, p1 = ", actions[i].p1)
  3446. local ret = Givejiluka( character, actions[i].p1)
  3447. if ret ~= LUA_TRUE then
  3448. PRINT( "ActionProc:Givejiluka = false" )
  3449. return LUA_FALSE
  3450. end
  3451.  
  3452. elseif actions[i].func == TakeHonorPoint then
  3453. PRINT( "ActionProc: TakeHonorPoint, p1 = ", actions[i].p1)
  3454. local ret = TakeHonorPoint( character, actions[i].p1)
  3455. if ret ~= LUA_TRUE then
  3456. PRINT( "ActionProc:TakeHonorPoint = false" )
  3457. return LUA_FALSE
  3458. end
  3459. elseif actions[i].func == Starteffect then
  3460. PRINT( "ActionProc: Starteffect, p1 = ", actions[i].p1)
  3461. local ret = Starteffect( character,npc, actions[i].p1)
  3462. if ret ~= LUA_TRUE then
  3463. PRINT( "ActionProc:Starteffect = false" )
  3464. return LUA_FALSE
  3465. end
  3466. elseif actions[i].func == AddChaItem1 then
  3467. PRINT( "ActionProc: AddChaItem1, p1 = ", actions[i].p1)
  3468. local ret = AddChaItem1( character,npc, actions[i].p1)
  3469. if ret ~= LUA_TRUE then
  3470. PRINT( "ActionProc:AddChaItem1 = false" )
  3471. return LUA_FALSE
  3472. end
  3473. elseif actions[i].func == AddChaItem2 then
  3474. PRINT( "ActionProc: AddChaItem2, p1 = ", actions[i].p1)
  3475. local ret = AddChaItem2( character,npc, actions[i].p1)
  3476. if ret ~= LUA_TRUE then
  3477. PRINT( "ActionProc:AddChaItem2 = false" )
  3478. return LUA_FALSE
  3479. end
  3480. elseif actions[i].func == AddChaItem3 then
  3481. PRINT( "ActionProc: AddChaItem1, p1 = ", actions[i].p1)
  3482. local ret = AddChaItem3( character,npc, actions[i].p1)
  3483. if ret ~= LUA_TRUE then
  3484. PRINT( "ActionProc:AddChaItem1 = false" )
  3485. return LUA_FALSE
  3486. end
  3487. elseif actions[i].func == AddChaItem5 then
  3488. PRINT( "ActionProc: AddChaItem2, p1 = ", actions[i].p1)
  3489. local ret = AddChaItem5( character,npc, actions[i].p1)
  3490. if ret ~= LUA_TRUE then
  3491. PRINT( "ActionProc:AddChaItem2 = false" )
  3492. return LUA_FALSE
  3493. end
  3494. elseif actions[i].func == AddChaItem4 then
  3495. PRINT( "ActionProc: AddChaItem2, p1 = ", actions[i].p1)
  3496. local ret = AddChaItem4( character,npc, actions[i].p1)
  3497. if ret ~= LUA_TRUE then
  3498. PRINT( "ActionProc:AddChaItem2 = false" )
  3499. return LUA_FALSE
  3500. end
  3501. elseif actions[i].func == DelRoleCredit then
  3502. PRINT( "ActionProc: DelRoleCredit, p1 = ", actions[i].p1)
  3503. local ret = DelRoleCredit( character,npc, actions[i].p1)
  3504. if ret ~= LUA_TRUE then
  3505. PRINT( "ActionProc:DelRoleCredit = false" )
  3506. return LUA_FALSE
  3507. end
  3508. elseif actions[i].func == TakeMoney then
  3509. PRINT( "ActionProc:TakeMoney, p1 = ", actions[i].p1 )
  3510. local ret = TakeMoney( character, npc, actions[i].p1 )
  3511. if ret ~= LUA_TRUE then
  3512. PRINT( "ActionProc: TakeMoney failed!param1 = %d", actions[i].p1 )
  3513. SystemNotice( character, "ActionProc: TakeMoney failed!" )
  3514. return LUA_FALSE
  3515. end
  3516. elseif actions[i].func == TakeCancelMissionMoney then
  3517. PRINT( "ActionProc:TakeMoney" )
  3518. local ret = TakeCancelMissionMoney( character, npc )
  3519. if ret ~= LUA_TRUE then
  3520. PRINT( "ActionProc: TakeCancelMissionMoney failed!param1 = %d", actions[i].p1 )
  3521. SystemNotice( character, "ActionProc: TakeCancelMissionMoney failed!" )
  3522. return LUA_FALSE
  3523. end
  3524. elseif actions[i].func == GiveItem then
  3525. PRINT( "ActionProc:GiveItem, p1 = , p2 = , p3 = ", actions[i].p1, actions[i].p2, actions[i].p3 )
  3526. local ret = GiveItem( character, npc, actions[i].p1, actions[i].p2, actions[i].p3 )
  3527. if ret ~= LUA_TRUE then
  3528. PRINT( "ActionProc: GiveItem failed!" )
  3529. SystemNotice( character, "ActionProc: give character item failed!" )
  3530. return LUA_FALSE
  3531. end
  3532. elseif actions[i].func == TakeItem then
  3533. PRINT( "ActionProc:TakeItem, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3534. local ret = TakeItem( character, npc, actions[i].p1, actions[i].p2 )
  3535. if ret ~= LUA_TRUE then
  3536. PRINT( "ActionProc: TakeItem failed!" )
  3537. SystemNotice( character, "ActionProc: obtain character item failed!" )
  3538. return LUA_FALSE
  3539. end
  3540. elseif actions[i].func == TakeRandNpcItem then
  3541. PRINT( "ActionProc:TakeRandNpcItem, p1 = , p2 = , p3 = ", actions[i].p1, actions[i].p2, actions[i].p3 )
  3542. local ret = TakeRandNpcItem( character, actions[i].p1, actions[i].p2, actions[i].p3 )
  3543. if ret ~= LUA_TRUE then
  3544. PRINT( "ActionProc: TakeRandNpcItem failed!" )
  3545. SystemNotice( character, "ActionProc: TakeRandNpcItem obtain NPC item failed!" )
  3546. return LUA_FALSE
  3547. end
  3548. elseif actions[i].func == TakeAllRandItem then
  3549. PRINT( "ActionProc:TakeAllRandItem, p1 = ", actions[i].p1 )
  3550. local ret = TakeAllRandItem( character, actions[i].p1 )
  3551. if ret ~= LUA_TRUE then
  3552. PRINT( "ActionProc: TakeAllRandItem failed!" )
  3553. SystemNotice( character, "ActionProc: TakeAllRandItem: obtain NPC item failed!" )
  3554. return LUA_FALSE
  3555. end
  3556. elseif actions[i].func == ClearMission then
  3557. PRINT( "ActionProc:ClearMission, p1 = ", actions[i].p1 )
  3558. local ret = ClearMission( character, actions[i].p1 )
  3559. if ret ~= LUA_TRUE then
  3560. PRINT( "ActionProc: ClearMission failed!" )
  3561. SystemNotice( character, "ActionProc: clear quest ID failed!" )
  3562. return LUA_FALSE
  3563. end
  3564. elseif actions[i].func == ClearTrigger then
  3565. PRINT( "ActionProc:ClearTrigger, p1 = ", actions[i].p1 )
  3566. local ret = ClearTrigger( character, actions[i].p1 )
  3567. if ret ~= LUA_TRUE then
  3568. PRINT( "ActionProc: ClearTrigger failed!" )
  3569. SystemNotice( character, "ActionProc: clear trigger ID failed!" )
  3570. return LUA_FALSE
  3571. end
  3572. elseif actions[i].func == DeleteTrigger then
  3573. PRINT( "ActionProc:DeleteTrigger, p1 = ", actions[i].p1 )
  3574. local ret = DeleteTrigger( character, actions[i].p1 )
  3575. if ret ~= LUA_TRUE then
  3576. PRINT( "ActionProc: DeleteTrigger failed!" )
  3577. SystemNotice( character, "ActionProc:delete trigger ID failed!" )
  3578. return LUA_FALSE
  3579. end
  3580. elseif actions[i].func == ClearFlag then
  3581. PRINT( "ActionProc:ClearFlag, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3582. local ret = ClearFlag( character, actions[i].p1, actions[i].p2 )
  3583. if ret ~= LUA_TRUE then
  3584. PRINT( "ActionProc: ClearFlag failed!" )
  3585. SystemNotice( character, "ActionProc: Clear quest label failed!" )
  3586. return LUA_FALSE
  3587. end
  3588. elseif actions[i].func == ClearRecord then
  3589. PRINT( "ActionProc:ClearRecord, p1 = ", actions[i].p1 )
  3590. local ret = ClearRecord( character, actions[i].p1 )
  3591. if ret ~= LUA_TRUE then
  3592. PRINT( "ActionProc:ClearRecord failed!" )
  3593. SystemNotice( character, "ActionProc: clearn history record label failed!" )
  3594. return LUA_FALSE
  3595. end
  3596. elseif actions[i].func == RefreshCompleteFlag then
  3597. PRINT( "ActionProc:RefreshCompleteFlag, p1 = ", actions[i].p1 )
  3598. local ret = RefreshCompleteFlag( character, actions[i].p1 )
  3599. if ret ~= LUA_TRUE then
  3600. PRINT( "ActionProc:RefreshCompleteFlag failed!" )
  3601. SystemNotice( character, "ActionProc:RefreshCompleteFlag, refresh quest completion status error!" )
  3602. return LUA_FALSE
  3603. end
  3604. elseif actions[i].func == ReAll then
  3605. PRINT( "ActionProc:ReAll" )
  3606. ReAll( character )
  3607. elseif actions[i].func == ReAllHp then
  3608. PRINT( "ActionProc:ReAllHp" )
  3609. ReAllHp( character )
  3610. elseif actions[i].func == ReAllSp then
  3611. PRINT( "ActionProc:ReAllSp" )
  3612. ReAllSp( character )
  3613. elseif actions[i].func == ReHp then
  3614. PRINT( "ActionProc:ReHp, p1 = ", actions[i].p1 )
  3615. ReHp( character, actions[i].p1 )
  3616. elseif actions[i].func == ReSp then
  3617. PRINT( "ActionProc:ReSp, p1 = ", actions[i].p1 )
  3618. ReSp( character, actions[i].p1 )
  3619. elseif actions[i].func == SystemNotice then
  3620. PRINT( "ActionProc:SystemNotice, p1 = ", actions[i].p1 )
  3621. SystemNotice( character, actions[i].p1 )
  3622. elseif actions[i].func == BickerNotice then
  3623. PRINT( "ActionProc:BickerNotice, p1 = ", actions[i].p1 )
  3624. BickerNotice( character, actions[i].p1 )
  3625. elseif actions[i].func == HelpInfo then
  3626. PRINT( "ActionProc:HelpInfo, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3627. HelpInfo( character, actions[i].p1, actions[i].p2 )
  3628. elseif actions[i].func == Show then
  3629. PRINT( "ActionProc:Show" )
  3630. Show( character )
  3631. elseif actions[i].func == Hide then
  3632. PRINT( "ActionProc:Hide" )
  3633. Hide( character )
  3634. elseif actions[i].func == UpdateGoodsData then
  3635. PRINT( "ActionProc:UpdateGoodsData" )
  3636. UpdateGoodsData( character )
  3637. elseif actions[i].func == UpdateGoodsKinds then
  3638. PRINT( "ActionProc:UpdateGoodsKinds" )
  3639. UpdateGoodsKinds( character )
  3640. elseif actions[i].func == GiveMission then
  3641. PRINT( "ActionsProc:GiveMission, p1 = ", actions[i].p1 )
  3642. local ret = GiveMission( character, actions[i].p1 )
  3643. if ret ~= LUA_TRUE then
  3644. PRINT( "ActionProc:GiveMission failed!" )
  3645. SystemNotice( character, "ActionProc:GiveMissionfailed!" )
  3646. return LUA_FALSE
  3647. end
  3648. elseif actions[i].func == ObligeAcceptMission then
  3649. PRINT( "ActionsProc:ObligeAcceptMission, p1 = ", actions[i].p1 )
  3650. local ret = ObligeAcceptMission( character, actions[i].p1 )
  3651. if ret ~= LUA_TRUE then
  3652. PRINT( "ActionProc:ObligeAcceptMission failed!" )
  3653. SystemNotice( character, "ActionProc:ObligeAcceptMissionfailed!" )
  3654. return LUA_FALSE
  3655. end
  3656. elseif actions[i].func == ObligeCompleteMission then
  3657. PRINT( "ActionsProc:ObligeCompleteMission, p1 = ", actions[i].p1 )
  3658. local ret = ObligeCompleteMission( character, actions[i].p1 )
  3659. if ret ~= LUA_TRUE then
  3660. PRINT( "ActionProc:ObligeCompleteMission failed!" )
  3661. SystemNotice( character, "ActionProc:ObligeCompleteMissionfailed!" )
  3662. return LUA_FALSE
  3663. end
  3664. elseif actions[i].func == SummonNpc then
  3665. PRINT( "ActionsProc:SummonNpc, p1, p2, p3, p4", actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4 )
  3666. local ret = SummonNpc( actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4 )
  3667. if ret ~= LUA_TRUE then
  3668. PRINT( "ActionsProc:SummonNpc failed!" )
  3669. SystemNotice( character, "ActionsProc:SummonNpc failed!" )
  3670. return LUA_FALSE
  3671. end
  3672. elseif actions[i].func == ConvoyNpc then
  3673. PRINT( "ActionsProc:ConvoyNpc, p1, p2, p3, p4", actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4 )
  3674. local ret = ConvoyNpc( character, actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4 )
  3675. if ret ~= LUA_TRUE then
  3676. PRINT( "ActionsProc:ConvoyNpc failed!" )
  3677. SystemNotice( character, "ActionsProc:ConvoyNpc failed!" )
  3678. return LUA_FALSE
  3679. end
  3680. elseif actions[i].func == ClearConvoyNpc then
  3681. PRINT( "ActionsProc:ClearConvoyNpc, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3682. local ret = ClearConvoyNpc( character, actions[i].p1, actions[i].p2 )
  3683. if ret ~= LUA_TRUE then
  3684. PRINT( "ActionsProc:ClearConvoyNpc failed!" )
  3685. SystemNotice( character, "ActionsProc:ClearConvoyNpc failed!" )
  3686. return LUA_FALSE
  3687. end
  3688. elseif actions[i].func == TakeXmasYB then
  3689. PRINT( "ActionProc:TakeXmasYB, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3690. local ret = TakeXmasYB( character, actions[i].p1, actions[i].p2 )
  3691. if ret ~= LUA_TRUE then
  3692. PRINT( "ActionProc: TakeXmasYB failed!" )
  3693. SystemNotice( character, "ActionProc: ´Ł¨úµwąôfailed!" )
  3694. return LUA_FALSE
  3695. end
  3696. elseif actions[i].func == CpHuojiNum then
  3697. PRINT( "ActionsProc:CpHuojiNum, p1 = ", actions[i].p1 )
  3698. local ret = CpHuojiNum( character, actions[i].p1 )
  3699. if ret ~= LUA_TRUE then
  3700. PRINT( "ActionsProc:CpHuojiNum failed!" )
  3701. SystemNotice( character, "ActionsProc:CpHuojiNum failed!" )
  3702. return LUA_FALSE
  3703. end
  3704. elseif actions[i].func == CpMiluNum then
  3705. PRINT( "ActionsProc:CpMiluNum, p1 = ", actions[i].p1 )
  3706. local ret = CpMiluNum( character, actions[i].p1 )
  3707. if ret ~= LUA_TRUE then
  3708. PRINT( "ActionsProc:CpMiluNum failed!" )
  3709. SystemNotice( character, "ActionsProc:CpMiluNum failed!" )
  3710. return LUA_FALSE
  3711. end
  3712. elseif actions[i].func == CpXuerenNum then
  3713. PRINT( "ActionsProc:CpXuerenNum, p1 = ", actions[i].p1 )
  3714. local ret = CpXuerenNum( character, actions[i].p1 )
  3715. if ret ~= LUA_TRUE then
  3716. PRINT( "ActionsProc:CpXuerenNum failed!" )
  3717. SystemNotice( character, "ActionsProc:CpXuerenNum failed!" )
  3718. return LUA_FALSE
  3719. end
  3720. elseif actions[i].func == ClearAllConvoyNpc then
  3721. PRINT( "ActionsProc:ClearAllConvoyNpc, p1 = ", actions[i].p1 )
  3722. local ret = ClearAllConvoyNpc( character, actions[i].p1 )
  3723. if ret ~= LUA_TRUE then
  3724. PRINT( "ActionsProc:ClearAllConvoyNpc failed!" )
  3725. SystemNotice( character, "ActionsProc:ClearAllConvoyNpc failed!" )
  3726. return LUA_FALSE
  3727. end
  3728. elseif actions[i].func == SetMissionFailure then
  3729. PRINT( "ActionsProc:SetMissionFailure, p1 = ", actions[i].p1 )
  3730. local ret = SetMissionFailure( character, actions[i].p1 )
  3731. if ret ~= LUA_TRUE then
  3732. PRINT( "ActionsProc:SetMissionFailure failed!" )
  3733. SystemNotice( character, "ActionsProc:SetMissionFailure failed!" )
  3734. return LUA_FALSE
  3735. end
  3736. elseif actions[i].func == SetMissionComplete then
  3737. PRINT( "ActionsProc:SetMissionComplete, p1 = ", actions[i].p1 )
  3738. local ret = SetMissionComplete( character, actions[i].p1 )
  3739. if ret ~= LUA_TRUE then
  3740. PRINT( "ActionsProc:SetMissionComplete failed!" )
  3741. SystemNotice( character, "ActionsProc:SetMissionComplete failed!" )
  3742. return LUA_FALSE
  3743. end
  3744. elseif actions[i].func == SetTestTime then
  3745. PRINT( "ActionProc:SetTestTime, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3746. local ret = SetTestTime( character, npc, actions[i].p1, actions[i].p2 )
  3747. if ret ~= LUA_TRUE then
  3748. PRINT( "ActionProc: SetTestTime failed!" )
  3749. SystemNotice( character, "ActionProc: SetTestTimeł]¸mŞě©l®É¶ˇfailed!" )
  3750. return LUA_FALSE
  3751. end
  3752. elseif actions[i].func == RenewTestTime1 then
  3753. PRINT( "ActionProc:RenewTestTime1, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3754. local ret = RenewTestTime1( character, npc, actions[i].p1, actions[i].p2 )
  3755. if ret ~= LUA_TRUE then
  3756. PRINT( "ActionProc: RenewTestTime1 failed!" )
  3757. SystemNotice( character, "ActionProc: RenewTestTime1ŔË´ú·sŞş®É¶ˇfailed!" )
  3758. return LUA_FALSE
  3759. end
  3760. elseif actions[i].func == RenewTestTime2 then
  3761. PRINT( "ActionProc:RenewTestTime2, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3762. local ret = RenewTestTime2( character, npc, actions[i].p1, actions[i].p2 )
  3763. if ret ~= LUA_TRUE then
  3764. PRINT( "ActionProc: RenewTestTime2 failed!" )
  3765. SystemNotice( character, "ActionProc: RenewTestTime2ŔË´ú·sŞş®É¶ˇfailed!" )
  3766. return LUA_FALSE
  3767. end
  3768. elseif actions[i].func == FailureRandMissionCount then
  3769. PRINT( "ActionsProc:FailureRandMissionCount, p1 = ", actions[i].p1 )
  3770. local ret = FailureRandMissionCount( character, actions[i].p1 )
  3771. if ret ~= LUA_TRUE then
  3772. PRINT( "ActionsProc:FailureRandMissionCount failed!" )
  3773. SystemNotice( character, "ActionsProc:FailureRandMissionCount failed!" )
  3774. return LUA_FALSE
  3775. end
  3776. elseif actions[i].func == SetSpawnPos then
  3777. PRINT( "ActionsProc:SetSpawnPos, p1 = ", actions[i].p1 )
  3778. local ret = SetSpawnPos( character, actions[i].p1 )
  3779. if ret ~= LUA_TRUE then
  3780. PRINT( "ActionsProc:SetSpawnPos failed!" )
  3781. SystemNotice( character, "ActionsProc:SetSpawnPos failed!" )
  3782. return LUA_FALSE
  3783. end
  3784. elseif actions[i].func == SetProfession then
  3785. PRINT( "ActionsProc:SetProfession, p1 = ", actions[i].p1 )
  3786. local ret = SetProfession( character, actions[i].p1 )
  3787. if ret ~= LUA_TRUE then
  3788. PRINT( "ActionsProc:SetProfession failed!" )
  3789. SystemNotice( character, "ActionsProc:SetProfession failed!" )
  3790. return LUA_FALSE
  3791. end
  3792. elseif actions[i].func == GoTo then
  3793. PRINT( "ActionsProc:GoTo, p1 = , p2 = , p3 = ", actions[i].p1, actions[i].p2, actions[i].p3 )
  3794. local ret = GoTo( character, actions[i].p1, actions[i].p2, actions[i].p3 )
  3795. PRINT( "Goto: ret = ", ret )
  3796. if ret ~= LUA_TRUE then
  3797. PRINT( "ActionsProc:GoTo failed!" )
  3798. SystemNotice( character, "ActionsProc:GoTo failed!" )
  3799. return LUA_FALSE
  3800. end
  3801. elseif actions[i].func == MultiTrigger then
  3802. PRINT( "ActionsProc:MultiTrigger, p1, p2 ", actions[i].p1, actions[i].p2 )
  3803. local ret = MultiTrigger( character, npc, page, actions[i].p1, actions[i].p2 )
  3804. if ret ~= LUA_TRUE then
  3805. PRINT( "ActionsProc:MultiTrigger failed!" )
  3806. SystemNotice( character, "ActionsProc:MultiTrigger failed!" )
  3807. return LUA_FALSE
  3808. end
  3809. elseif actions[i].func == SaveMissionData then
  3810. PRINT( "ActionsProc:SaveMissionData" )
  3811. local ret = SaveMissionData( character )
  3812. if ret ~= LUA_TRUE then
  3813. PRINT( "ActionsProc:SaveMissionData failed!" )
  3814. SystemNotice( character, "ActionsProc:SaveMissionData failed!" )
  3815. return LUA_FALSE
  3816. end
  3817. elseif actions[i].func == SetPkState then
  3818. PRINT( "ActionsProc:SetPkState, p1 = ", actions[i].p1 )
  3819. local ret = SetPkState( character, actions[i].p1 )
  3820. if ret ~= LUA_TRUE then
  3821. PRINT( "ActionsProc:SetPkState failed!" )
  3822. SystemNotice( character, "ActionsProc:SetPkState failed!" )
  3823. return LUA_FALSE
  3824. end
  3825. elseif actions[i].func == MoveCity then
  3826. PRINT( "ActionsProc:MoveCity, p1 = ", actions[i].p1 )
  3827. local ret = MoveCity( character, actions[i].p1 )
  3828. if ret ~= LUA_TRUE then
  3829. PRINT( "ActionsProc:MoveCity failed!" )
  3830. SystemNotice( character, "ActionsProc:MoveCity failed!" )
  3831. return LUA_FALSE
  3832. end
  3833. elseif actions[i].func == CreateGuild then
  3834. PRINT( "ActionsProc:CreateGuild, p1 = ", actions[i].p1 )
  3835. local ret = CreateGuild( character, actions[i].p1 )
  3836. if ret ~= LUA_TRUE then
  3837. PRINT( "ActionsProc:CreateGuild failed!" )
  3838. SystemNotice( character, "ActionsProc:CreateGuild failed!" )
  3839. return LUA_FALSE
  3840. end
  3841. elseif actions[i].func == ListAllGuild then
  3842. PRINT( "ActionsProc:ListAllGuild, p1 = ", actions[i].p1 )
  3843. local ret = ListAllGuild( character, actions[i].p1 )
  3844. if ret ~= LUA_TRUE then
  3845. PRINT( "ActionsProc:ListAllGuild failed!" )
  3846. SystemNotice( character, "ActionsProc:ListAllGuild failed!" )
  3847. return LUA_FALSE
  3848. end
  3849. elseif actions[i].func == RepairBoat then
  3850. PRINT( "ActionsProc:RepairBoat" )
  3851. local ret = RepairBoat( character )
  3852. if ret ~= LUA_TRUE then
  3853. PRINT( "ActionsProc:RepairBoat failed!" )
  3854. SystemNotice( character, "ActionsProc:RepairBoat failed!" )
  3855. return LUA_FALSE
  3856. end
  3857. elseif actions[i].func == SupplyBoat then
  3858. PRINT( "ActionsProc:SupplyBoat" )
  3859. local ret = SupplyBoat( character )
  3860. if ret ~= LUA_TRUE then
  3861. PRINT( "ActionsProc:SupplyBoat failed!" )
  3862. SystemNotice( character, "ActionsProc:SupplyBoat failed!" )
  3863. return LUA_FALSE
  3864. end
  3865. elseif actions[i].func == CreateBoat then
  3866. PRINT( "ActionsProc:CreateBoat, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3867. local ret = CreateBoat( character, actions[i].p1, actions[i].p2 )
  3868. if ret ~= LUA_TRUE then
  3869. PRINT( "ActionsProc:CreateBoat failed!" )
  3870. --SystemNotice( character, "ActionsProc:CreateBoat failed!" )
  3871. return LUA_FALSE
  3872. end
  3873. elseif actions[i].func == BoatLuanchOut then
  3874. PRINT( "ActionsProc:BoatLuanchOut, p1 = , p2 = , p3 = , p4 = , p5 = ", actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4, actions[i].p5 )
  3875. local ret = BoatLuanchOut( character, actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4, actions[i].p5 )
  3876. if ret ~= LUA_TRUE then
  3877. PRINT( "ActionsProc:BoatLuanchOut failed!" )
  3878. SystemNotice( character, "ActionsProc:BoatLuanchOut failed!" )
  3879. return LUA_FALSE
  3880. end
  3881. elseif actions[i].func == LuanchBerthList then
  3882. --PRINT( "ActionsProc:RemoveYS" )
  3883. PRINT( "ActionsProc:BoatBerthList, p1 = , p2 = , p3 = , p4 = ", actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4 )
  3884. local ret = LuanchBerthList( character, npc, actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4 )
  3885. --local ret1 = RemoveYS( character )
  3886. if ret ~= LUA_TRUE then
  3887. PRINT( "ActionsProc:LuanchBerthList failed!" )
  3888. SystemNotice( character, "ActionsProc:LuanchBerthList failed!" )
  3889. return LUA_FALSE
  3890. end
  3891. --if ret1 ~= 1 then
  3892. -- PRINT( "ActionsProc:RemoveYS failed!" )
  3893. -- SystemNotice( character, "ActionsProc:RemoveYS failed!" )
  3894. -- return LUA_FALSE
  3895. --end
  3896. elseif actions[i].func == TradeBerthList then
  3897. PRINT( "ActionsProc:TradeBerthList, p1 = ", actions[i].p1 )
  3898. local ret = TradeBerthList( character, npc, actions[i].p1 )
  3899. if ret ~= LUA_TRUE then
  3900. PRINT( "ActionsProc:TradeBerthList failed!" )
  3901. SystemNotice( character, "ActionsProc:TradeBerthList failed!" )
  3902. return LUA_FALSE
  3903. end
  3904. elseif actions[i].func == CreatBBBB then
  3905. local ret = CreatBBBB( character, actions[i].p1)
  3906. if ret ~= LUA_TRUE then
  3907. return LUA_FALSE
  3908. end
  3909. elseif actions[i].func == CheckBBBB then
  3910. local ret = CheckBBBB( character )
  3911. if ret ~= LUA_TRUE then
  3912. return LUA_FALSE
  3913. end
  3914. elseif actions[i].func == RepairBerthList then
  3915. PRINT( "ActionsProc:RepairBerthList, p1 = ", actions[i].p1 )
  3916. local ret = RepairBerthList( character, npc, actions[i].p1 )
  3917. if ret ~= LUA_TRUE then
  3918. PRINT( "ActionsProc:RepairBerthList failed!" )
  3919. SystemNotice( character, "ActionsProc:RepairBerthList failed!" )
  3920. return LUA_FALSE
  3921. end
  3922. elseif actions[i].func == SalvageBerthList then
  3923. PRINT( "ActionsProc:SalvageBerthList, p1 = ", actions[i].p1 )
  3924. local ret = SalvageBerthList( character, npc, actions[i].p1 )
  3925. if ret ~= LUA_TRUE then
  3926. PRINT( "ActionsProc:SalvageBerthList failed!" )
  3927. SystemNotice( character, "ActionsProc:SalvageBerthList failed!" )
  3928. return LUA_FALSE
  3929. end
  3930. elseif actions[i].func == SupplyBerthList then
  3931. PRINT( "ActionsProc:SupplyBerthList, p1 = ", actions[i].p1 )
  3932. local ret = SupplyBerthList( character, npc, actions[i].p1 )
  3933. if ret ~= LUA_TRUE then
  3934. PRINT( "ActionsProc:SupplyBerthList failed!" )
  3935. SystemNotice( character, "ActionsProc:SupplyBerthList failed!" )
  3936. return LUA_FALSE
  3937. end
  3938. elseif actions[i].func == BoatLevelBerthList then
  3939. PRINT( "ActionsProc:BoatLevelBerthList, p1 = ", actions[i].p1 )
  3940. local ret = BoatLevelBerthList( character, npc, actions[i].p1 )
  3941. if ret ~= LUA_TRUE then
  3942. PRINT( "ActionsProc:BoatLevelBerthList failed!" )
  3943. SystemNotice( character, "ActionsProc:BoatLevelBerthList failed!" )
  3944. return LUA_FALSE
  3945. end
  3946. elseif actions[i].func == BoatBerth then
  3947. PRINT( "ActionsProc:BoatBerth, p1 = , p2 = , p3 = , p4 = ", actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4 )
  3948. local ret = BoatBerth( character, actions[i].p1, actions[i].p2, actions[i].p3, actions[i].p4 )
  3949. if ret ~= LUA_TRUE then
  3950. PRINT( "ActionsProc:BoatBerth failed!" )
  3951. SystemNotice( character, "ActionsProc:BoatBerth failed!" )
  3952. return LUA_FALSE
  3953. end
  3954. elseif actions[i].func == PackBagList then
  3955. PRINT( "ActionsProc:PackBagList, p1 = , p2 = , p3 = ", actions[i].p1, actions[i].p2, actions[i].p3 )
  3956. local ret = PackBagList( character, actions[i].p1, actions[i].p2, actions[i].p3 )
  3957. if ret ~= LUA_TRUE then
  3958. PRINT( "ActionsProc:PackBagList failed!" )
  3959. SystemNotice( character, "ActionsProc:PackBagList failed!" )
  3960. return LUA_FALSE
  3961. end
  3962. elseif actions[i].func == SetTradeItemLevel then
  3963. PRINT( "ActionsProc:SetTradeItemLevel, p1 = ", actions[i].p1 )
  3964. local ret = SetTradeItemLevel( character, actions[i].p1 )
  3965. if ret ~= LUA_TRUE then
  3966. PRINT( "ActionsProc:SetTradeItemLevel failed!" )
  3967. SystemNotice( character, "ActionsProc:SetTradeItemLevel failed!" )
  3968. return LUA_FALSE
  3969. end
  3970. elseif actions[i].func == AdjustTradeCess then
  3971. PRINT( "ActionsProc:AdjustTradeCess, p1 = , p2 = ", actions[i].p1, actions[i].p2 )
  3972. local ret = AdjustTradeCess( character, actions[i].p1, actions[i].p2 )
  3973. if ret ~= LUA_TRUE then
  3974. PRINT( "ActionsProc:AdjustTradeCess failed!" )
  3975. SystemNotice( character, "ActionsProc:AdjustTradeCess failed!" )
  3976. return LUA_FALSE
  3977. end
  3978. elseif actions[i].func == OpenBank then
  3979. PRINT( "ActionsProc:OpenBank" )
  3980. local ret = OpenBank( character, npc )
  3981. if ret ~= LUA_TRUE then
  3982. PRINT( "ActionsProc:OpenBank failed!" )
  3983. SystemNotice( character, "ActionsProc:OpenBank failed!" )
  3984. return LUA_FALSE
  3985. end
  3986. elseif actions[i].func == OpenHair then
  3987. PRINT( "ActionsProc:OpenHair" )
  3988. local ret = OpenHair( character, npc )
  3989. if ret ~= LUA_TRUE then
  3990. PRINT( "ActionsProc:OpenHair failed!" )
  3991. SystemNotice( character, "ActionsProc:OpenHair failed!" )
  3992. return LUA_FALSE
  3993. end
  3994. elseif actions[i].func == OpenRepair then
  3995. PRINT( "ActionsProc:OpenRepair" )
  3996. local ret = OpenRepair( character, npc )
  3997. if ret ~= LUA_TRUE then
  3998. PRINT( "ActionsProc:OpenRepair failed!" )
  3999. SystemNotice( character, "ActionsProc:OpenRepair failed!" )
  4000. return LUA_FALSE
  4001. end
  4002. elseif actions[i].func == RandFunction then
  4003. PRINT( "ActionsProc:RandFunction, page = , p1 = , p2 = ", page, actions[i].p1, actions[i].p2 )
  4004. local ret = RandFunction( character, npc, page, actions[i].p1, actions[i].p2 )
  4005. if ret ~= LUA_TRUE then
  4006. PRINT( "ActionsProc:RandFunction failed!" )
  4007. SystemNotice( character, "ActionsProc:RandFunction failed!" )
  4008. return LUA_FALSE
  4009. end
  4010. elseif actions[i].func == AddCredit then
  4011. PRINT( "ActionsProc:AddCredit, p1 = ", actions[i].p1 )
  4012. local ret = AddCredit( character, actions[i].p1 )
  4013. if ret ~= LUA_TRUE then
  4014. PRINT( "ActionsProc:AddCredit failed!" )
  4015. SystemNotice( character, "ActionsProc:AddCredit failed!" )
  4016. return LUA_FALSE
  4017. end
  4018. elseif actions[i].func == Givecrab then
  4019. PRINT( "ActionProc: Givecrab, p1 = ", actions[i].p1)
  4020. local ret = Givecrab( character,npc, actions[i].p1)
  4021. if ret ~= LUA_TRUE then
  4022. PRINT( "ActionProc:Givecrab = false" )
  4023. return LUA_FALSE
  4024. end
  4025. elseif actions[i].func == TakeOffer then
  4026. PRINT( "ActionsProc:TakeOffer, p1 = ", actions[i].p1 )
  4027. local ret = TakeOffer( character, actions[i].p1 )
  4028. if ret ~= LUA_TRUE then
  4029. PRINT( "ActionsProc:TakeOffer failed!" )
  4030. SystemNotice( character, "ActionsProc:TakeOffer failed!" )
  4031. return LUA_FALSE
  4032. end
  4033. elseif actions[i].func == ValentinesRing then
  4034. PRINT( "ActionsProc:ValentinesRing, p1 = ", actions[i].p1 )
  4035. local ret = ValentinesRing( character, actions[i].p1 )
  4036. if ret ~= LUA_TRUE then
  4037. PRINT( "ActionsProc:ValentinesRing failed!" )
  4038. SystemNotice( character, "ActionsProc:ValentinesRing failed!" )
  4039. return LUA_FALSE
  4040. end
  4041. elseif actions[i].func == AddExp_1 then
  4042. PRINT( "ActionProc: AddExp_1, p1 = ", actions[i].p1)
  4043. local ret = AddExp_1( character,npc, actions[i].p1)
  4044. if ret ~= LUA_TRUE then
  4045. PRINT( "ActionProc:AddExp_1 = false" )
  4046. return LUA_FALSE
  4047. end
  4048. elseif actions[i].func == AddExp_2 then
  4049. PRINT( "ActionProc: AddExp_2, p1 = ", actions[i].p1)
  4050. local ret = AddExp_2( character,npc, actions[i].p1)
  4051. if ret ~= LUA_TRUE then
  4052. PRINT( "ActionProc:AddExp_2 = false" )
  4053. return LUA_FALSE
  4054. end
  4055. elseif actions[i].func == AddExp_3 then
  4056. PRINT( "ActionProc: AddExp_3, p1 = ", actions[i].p1)
  4057. local ret = AddExp_3( character,npc, actions[i].p1)
  4058. if ret ~= LUA_TRUE then
  4059. PRINT( "ActionProc:AddExp_3 = false" )
  4060. return LUA_FALSE
  4061. end
  4062. elseif actions[i].func == AddExp_4 then
  4063. PRINT( "ActionProc: AddExp_4, p1 = ", actions[i].p1)
  4064. local ret = AddExp_4( character,npc, actions[i].p1)
  4065. if ret ~= LUA_TRUE then
  4066. PRINT( "ActionProc:AddExp_4 = false" )
  4067. return LUA_FALSE
  4068. end
  4069.  
  4070. elseif actions[i].func == AddExp_5 then
  4071. PRINT( "ActionProc: AddExp_5, p1 = ", actions[i].p1)
  4072. local ret = AddExp_5( character,npc, actions[i].p1)
  4073. if ret ~= LUA_TRUE then
  4074. PRINT( "ActionProc:AddExp_5 = false" )
  4075. return LUA_FALSE
  4076. end
  4077. elseif actions[i].func == AddExp_6 then
  4078. PRINT( "ActionProc: AddExp_6, p1 = ", actions[i].p1)
  4079. local ret = AddExp_6( character,npc, actions[i].p1)
  4080. if ret ~= LUA_TRUE then
  4081. PRINT( "ActionProc:AddExp_6 = false" )
  4082. return LUA_FALSE
  4083. end
  4084. else
  4085. PRINT( "ActionProc:unknown operation error function notice!" )
  4086. SystemNotice( character, "ActionProc:unknown operation error function!" )
  4087. return LUA_FALSE
  4088. end
  4089. end
  4090.  
  4091. PRINT( "ActionProc: return true" )
  4092. return LUA_TRUE
  4093. end
  4094.  
  4095. --NPCIJµoľą±řĄóŔˬd¨çĽĆ
  4096. function NpcTriggerCheck( character, trigger )
  4097. PRINT( "NpcTriggerCheck" )
  4098. if trigger == nil or trigger.conditions == nil then
  4099. SystemNotice( character, "NpcTriggerCheck:Function parameter error!" )
  4100. return LUA_ERROR
  4101. end
  4102. PRINT( "NpcTriggerCheck: ConditionsTest" )
  4103. return ConditionsTest( character, trigger.conditions )
  4104. end
  4105.  
  4106. --¬O§_Ąô°Č¤w¸g§ą¦¨
  4107. function NpcTriggerResult( character, trigger )
  4108. PRINT( "NpcTriggerResult" )
  4109. if trigger == nil then
  4110. SystemNotice( character, "NpcTriggerResult:Function parameter error!" )
  4111. return LUA_ERROR
  4112. end
  4113.  
  4114. --Ŕq»{¦pŞGIJµoľą¨S¦łµ˛ŞG±řĄó«h¬°ĄĂ»·¤Ł˛Ĺ¦X±řĄó
  4115. if trigger.restul == nil or trigger.result[1] == nil then
  4116. PRINT( "NpcTriggerResult: condition as null, consent return FALSE, denote does not match requirement permanently!" )
  4117. return LUA_FALSE
  4118. end
  4119.  
  4120. PRINT( "NpcTriggerResult: ConditionsTest" )
  4121. return ConditionsTest( character, trigger.result )
  4122. end
  4123.  
  4124. --¨ú®ř¤@­ÓĄô°Č
  4125. function NpcCancelTrigger( character, trigger, misid, scriptid )
  4126. PRINT( "NpcCancelTrigger" )
  4127. if trigger == nil or trigger.actions == nil then
  4128. SystemNotice( character, "NpcCancelTrigger:Function parameter error!" )
  4129. return LUA_ERROR
  4130. end
  4131.  
  4132. --ŔË´úIJµoľą­­¨î±řĄó
  4133. PRINT( "NpcCancelTrigger:conditions test" )
  4134. if trigger.conditions ~= nil and trigger.conditions[1] ~= nil then
  4135. local ret = ConditionsTest( character, trigger.conditions )
  4136. if ret ~= LUA_TRUE then
  4137. PRINT( "NpcCancelTrigger: conditions return false, return false" )
  4138. return LUA_FALSE
  4139. end
  4140. end
  4141.  
  4142. PRINT( "NpcCancelTrigger:actions proc" )
  4143. if trigger.actions.count ~= nil then
  4144. local actions = {}
  4145. actions[1] = {}
  4146. actions.count = 1
  4147. for n = 1, trigger.actions.count, 1 do
  4148. actions[1].func = trigger.actions[n].func
  4149. actions[1].p1 = trigger.actions[n].p1
  4150. actions[1].p2 = trigger.actions[n].p2
  4151. actions[1].p3 = trigger.actions[n].p3
  4152. actions[1].p4 = trigger.actions[n].p4
  4153. actions[1].p5 = trigger.actions[n].p5
  4154. actions[1].p6 = trigger.actions[n].p6
  4155. actions[1].p7 = trigger.actions[n].p7
  4156. actions[1].p8 = trigger.actions[n].p8
  4157. PRINT( "NpcCancelTrigger:actions proc, func, p1, p2, p3, p4, p5, p6", trigger.actions[n].func, trigger.actions[n].p1, trigger.actions[n].p2, trigger.actions[n].p3, trigger.actions[n].p4 )
  4158. local ret = ActionsProc( character, actions, nil, nil, misid, scriptid )
  4159. if ret ~= LUA_TRUE then
  4160. PRINT( "NpcCancelTrigger: actions return false, return false" )
  4161. end
  4162. end
  4163. end
  4164.  
  4165. PRINT( "NpcCancelTrigger: return true" )
  4166. return LUA_TRUE
  4167. end
  4168.  
  4169. function NpcTrigger( character, npc, trigger, misid, scriptid )
  4170. PRINT( "NpcTrigger" )
  4171. if trigger == nil or trigger.actions == nil then
  4172. SystemNotice( character, "NpcTrigger:Function parameter error!" )
  4173. return LUA_ERROR
  4174. end
  4175.  
  4176. --ŔË´úIJµoľą­­¨î±řĄó
  4177. PRINT( "NpcTrigger:conditions test" )
  4178. if trigger.conditions ~= nil and trigger.conditions[1] ~= nil then
  4179. local ret = ConditionsTest( character, trigger.conditions )
  4180. if ret ~= LUA_TRUE then
  4181. PRINT( "NpcTrigger: conditions return false, return false" )
  4182. return LUA_FALSE
  4183. end
  4184. end
  4185.  
  4186. PRINT( "NpcTrigger:actions proc" )
  4187. if trigger.actions ~= nil and trigger.actions[1] ~= nil then
  4188. local ret = ActionsProc( character, trigger.actions, npc, nil, misid, scriptid )
  4189. if ret ~= LUA_TRUE then
  4190. PRINT( "NpcTrigger: actions return false, return false" )
  4191. end
  4192. end
  4193.  
  4194. PRINT( "NpcTrigger: return true" )
  4195. return LUA_TRUE
  4196. end
  4197.  
  4198. function TriggerProc( character, id, param1, param2, param3, param4 )
  4199. PRINT( "TriggerProc:2 ID = , Trigger = , p1 = , p2 = , p3 = , p4 = ", id, TriggerList[id], param1, param2, param3, param4 )
  4200. if id == nil or TriggerList[id] == nil or TriggerList[id].actions == nil or param1 == nil or param2 == nil then
  4201. SystemNotice( character, "TriggerProc:incorrect function notice or trigger does not have action notice!ID = "..id )
  4202. return LUA_ERROR
  4203. end
  4204.  
  4205. PRINT( "TriggerProc: conditions proc!" )
  4206. local trigger = TriggerList[id]
  4207. if trigger.tp == MIS_TRIGGER_NOMAL then
  4208. --ŔË´úIJµoľą­­¨î±řĄó
  4209. if trigger.conditions ~= nil and trigger.conditions[1] ~= nil then
  4210. local ret = ConditionsTest( character, trigger.conditions, param1, param2 )
  4211. if ret ~= LUA_TRUE then
  4212. PRINT( "TriggerProc: conditions return false, return false" )
  4213. return LUA_FALSE
  4214. end
  4215. end
  4216.  
  4217. --łB˛zIJµoľą°Ę§@
  4218. PRINT( "TriggerProc:actions proc" )
  4219. if trigger.actions ~= nil and trigger.actions[1] ~= nil then
  4220. local ret = ActionsProc( character, trigger.actions, nil, nil, 0, 0, param1, param2 )
  4221. if ret ~= LUA_TRUE then
  4222. PRINT( "TriggerProc: actions return false, return false" )
  4223. SystemNotice( character, "TriggerProc: actions return false, return false" )
  4224. return LUA_FALSE
  4225. end
  4226. end
  4227.  
  4228. elseif trigger.tp == MIS_TRIGGER_RAND then
  4229. PRINT( "TriggerProc:random quest: param3, param4", param3, param4 )
  4230. if trigger.actions[1].func == AddRMNextFlag then
  4231. if param3 == nil or param4 == nil then
  4232. PRINT( "TriggerProc:random quest:while reseting AddRMNextFlagfunction parameter, param3, param4 cannot be nil" )
  4233. SystemNotice( character, "TriggerProc:random quest:while reseting AddRMNextFlagfunction parameter, param3, param4 cannot be nil" )
  4234. LG( "randmission_error", "TriggerProc:random quest:while reseting AddRMNextFlagfunction parameter, param3, param4 cannot be nil, triggerid = ", id )
  4235. return LUA_FALSE
  4236. end
  4237.  
  4238. trigger.actions[1].p2 = param3
  4239. trigger.actions[1].p3 = param4
  4240. end
  4241.  
  4242. --ŔË´úIJµoľą­­¨î±řĄó
  4243. if trigger.conditions ~= nil and trigger.conditions[1] ~= nil then
  4244. local ret = ConditionsTest( character, trigger.conditions, param1, param2 )
  4245. if ret ~= LUA_TRUE then
  4246. PRINT( "TriggerProc: random quest: conditions return false, return false" )
  4247. return LUA_FALSE
  4248. end
  4249. end
  4250.  
  4251. --łB˛zIJµoľą°Ę§@
  4252. PRINT( "TriggerProc:random quest: actions proc" )
  4253. if trigger.actions ~= nil and trigger.actions[1] ~= nil then
  4254. local ret = ActionsProc( character, trigger.actions )
  4255. if ret ~= LUA_TRUE then
  4256. PRINT( "TriggerProc: random quest: actions return false, return false" )
  4257. SystemNotice( character, "TriggerProc: random quest: actions return false, return false" )
  4258. return LUA_FALSE
  4259. end
  4260. end
  4261. --reset rand mission trigger actions's value
  4262. trigger.actions[1].p2 = 0
  4263. trigger.actions[1].p3 = 0
  4264. else
  4265. PRINT( "TriggerProc:incorrect trigger type notice.id = ", id )
  4266. SystemNotice( character, "TriggerProc:incorrect trigger type notice.id = "..id )
  4267. return LUA_FALSE
  4268. end
  4269.  
  4270. PRINT( "TriggerProc: return true." )
  4271. return LUA_TRUE
  4272. end
  4273.  
  4274. function TriggerResult( character, id, param1, param2 )
  4275. PRINT( "TriggerResult" )
  4276. if id == nil or TriggerList[id] == nil or param1 == nil or param2 == nil then
  4277. SystemNotice( character, "TriggerResult:incorrect function notice!" )
  4278. return LUA_ERROR
  4279. end
  4280.  
  4281. PRINT( "TriggerResult: conditions proc!" )
  4282. local trigger = TriggerList[id]
  4283.  
  4284. --łB˛zIJµoľąµ˛§ô°Ę§@
  4285. PRINT( "TriggerProc:failures proc" )
  4286. if trigger.failures ~= nil and trigger.failures[1] ~= nil then
  4287. local ret = ActionsProc( character, trigger.failures )
  4288. if ret ~= LUA_TRUE then
  4289. PRINT( "TriggerProc: failures return false, return false" )
  4290. end
  4291. end
  4292.  
  4293. PRINT( "TriggerResult: return true" )
  4294. return LUA_TRUE
  4295. end
  4296.  
  4297. --Ŕň¨ú¨¤¦âŞşľA¦XŞşradom Ąô°ČĄÍ¦¨«H®§¬q
  4298. function GetRandMissionLevel( character, sid, leveltp )
  4299. if leveltp == MIS_LEVEL_CHAR then --¨¤¦âradom Ąô°ČµĄŻĹĂţ«¬
  4300. local level = GetCharMissionLevel( character )
  4301. if level == nil then
  4302. return 10000
  4303. end
  4304. return level --1 + GetSection( level, 5 )
  4305. elseif leveltp == MIS_LEVEL_GANG then --¤˝·|radom Ąô°ČµĄŻĹĂţ«¬
  4306. local level = GetCharGangLevel( character )
  4307. return level
  4308. else
  4309. SystemNotice( character, "GetRandMissionLevel:incorrect random quest level type!missid = "..sid )
  4310. LG( "randmission_error", "GetRandMissionLevel:incorrect random quest level type!missid = "..sid )
  4311. return 10000
  4312. end
  4313. return 10000
  4314. end
  4315.  
  4316. --®ÚľÚradom Ąô°Č°eŞ«Ąó®w¤¤radom ĄÍ¦¨¤@­ÓŞ«ĄóˇAµąPlayer°e¨ěNPCłB
  4317. function GetRandMissionSendItem( itemlist )
  4318. PRINT( "GetRandMissionSendItem:itemlist = , itemlist.count = ", itemlist, itemlist.count )
  4319. local id = Rand( itemlist.count ) + 1
  4320. PRINT( "GetRandMissionSendItem:rand value = , item id = ", id, itemlist[id] )
  4321. return itemlist[id]
  4322. end
  4323.  
  4324. --®ÚľÚ¨¤¦â§ą¦¨Şşradom Ąô°Č¦¸ĽĆradom ˛ŁĄÍ¤@­Ó°ŞŻĹŞ««~ˇA§@¬°Ąô°ČĽúŔy
  4325. function GetRandMissionPrize( character, misname, id, loopinfo, loopdata )
  4326. PRINT( "GetRandMissionPrize" )
  4327. if loopinfo == nil or loopdata == nil or id == nil or misname == nil then
  4328. PRINT( "GetRandMissionPrize: id = , loopdata = ", id, loopdata )
  4329. LG( "randmission_error", "GetRandMissionPrize: function parameter error!prizeitem = nil and id = "..id )
  4330. SystemNotice( character, "GetRandMissionPrize:function parameter errorˇAreward failed!" )
  4331. return 0, 0
  4332. end
  4333.  
  4334. local ret, loopnum = GetRandMissionNum( character, id )
  4335. if ret ~= LUA_TRUE then
  4336. PRINT( "GetRandMissionPrize:GetRandMissionNum function transfer failed. Unable to obtain character random quest loop count!id = ", id )
  4337. LG( "randmission_error", "GetRandMissionPrize:GetRandMissionNum function transfer failed. Unable to obtain character random quest loop count!id = ", id )
  4338. SystemNotice( character, "GetRandMissionPrize:GetRandMissionNum function transfer failed. Unable to obtain character random quest loop count!id = "..id )
  4339. --˛M°Ł¸Ó¨¤¦â¸Óradom Ąô°Č­pĽĆ
  4340. ResetRandMissionNum( character, id )
  4341. return 0, 0
  4342. else
  4343. loopnum = loopnum + 1 --Âŕ´«¬°luaĽĆ˛ŐŻÁ¤Ţ
  4344. PRINT( "GetRandMissionPrize:GetRandMissionNum: return loopnum = ", loopnum )
  4345. PRINT( "loopdata, loopdata", loopdata, loopdata[loopnum] )
  4346. if loopinfo[loopnum] == nil or loopdata[loopnum] == nil or loopdata[loopnum].Prize == nil then
  4347. PRINT( "GetRandMissionPrize: invalid random quest cycle data notice or reward item notice,id = , loopnum = ", id, loopnum )
  4348. SystemNotice( character, "GetRandMissionPrize: invalid random quest cycle data notice or reward item notice,id = "..id.." loopnum = "..loopnum )
  4349. --˛M°Ł¸Ó¨¤¦â¸Óradom Ąô°Č­pĽĆ
  4350. ResetRandMissionNum( character, id )
  4351. return 0, 0
  4352. end
  4353.  
  4354. local ret, miscount = GetRandMissionCount( character, id )
  4355. miscount = miscount + 1
  4356. SystemNotice( character, "You have accepted quest ["..misname.."] No."..miscount.."!" )
  4357.  
  4358. PRINT( "GetRandMissionPrize:HasRandMissionCount, id = , num = ", loopinfo[loopnum].num )
  4359. local ret = HasRandMissionCount( character, id, loopinfo[loopnum].num - 1 )
  4360. if ret == LUA_TRUE then
  4361. --˛M°Ł¸ÓŔôĄô°Č­pĽĆˇA¦P®ÉŔô­pĽĆĽWĄ[
  4362. --ret = AddRandMissionNum( character, id )
  4363. --if ret ~= LUA_TRUE then
  4364. --PRINT( "GetRandMissionPrizeItem:AddRandMissionNum reset quest cycle calculation failed!id = ", id )
  4365. --LG( "randmission_error", "GetRandMissionPrizeItem:AddRandMissionNum reset quest cycle calculation failed!id ", id )
  4366. --SystemNotice( character, "GetRandMissionPrizeItem:AddRandMissionNum reset quest cycle calculation failed!id = "..id )
  4367. --return 0, 0
  4368. --end
  4369.  
  4370. PRINT( "GetRandMissionPrize:Prize", loopdata[loopnum].Prize )
  4371. --¨¤¦â¤Ł¦P¬q¦ě§@radom Ąô°ČŔň±o°ŞŻĹŞ««~Şş´X˛v±N·|ŔH¬q¦ěĽWĄ[¦Ó¤U­°
  4372. local prizelist = loopdata[loopnum].Prize
  4373. local value = Rand( 100 )
  4374. PRINT( "GetRandMissionPrize: prize rand value = , odds = ", value, loopinfo[loopnum].odds )
  4375. if value >= loopinfo[loopnum].odds then
  4376. return 0, 0
  4377. end
  4378.  
  4379. if prizelist.tp == MIS_PRIZE_ITEM then
  4380. --­pşâ°ŞŻĹŞ««~ĽúŔyradom ˛v
  4381. local randdata = 0
  4382. for n = 1, prizelist.count, 1 do
  4383. randdata = randdata + prizelist[n].p2
  4384. PRINT( "GetRandMissionPrize: n = , randdata = , p2 = ", n, randdata, prizelist[n].p2 )
  4385. end
  4386. local prizevalue = Rand( randdata )
  4387. local tempdata = 0
  4388. for n = 1, prizelist.count, 1 do
  4389. if prizevalue >= tempdata and prizevalue < tempdata + prizelist[n].p2 then
  4390. PRINT( "GetRandMissionPrize: return n = , prizevalue = , prizetp = , p1 = ", n, prizevalue, prizelist[n].tp, prizelist[n].p1 )
  4391. return prizelist[n].tp, prizelist[n].p1
  4392. end
  4393. tempdata = tempdata + prizelist[n].p2
  4394. end
  4395. else
  4396. local index = Rand( prizelist.count ) + 1
  4397. PRINT( "GetRandMissionPrize:prizetp = , p1 = , p2 = index = ", prizelist[index].tp, prizelist[index].p1, prizelist[index].p2, index )
  4398. if prizelist[index] == nil then
  4399. SystemNotice( character, "Error: cannot locate random quest high level equipment reward notice!id = "..id.."prize index = "..index )
  4400. LG( "randmission_error", "Error: cannot locate random quest high level equipment reward notice!id = "..id.." prize index = "..index )
  4401. return 0
  4402. end
  4403.  
  4404. --local charname = GetCharName( character )
  4405. --local str = "GetRandMissionPrizeItem, ¤Ŕ°tµą¤F¨¤¦â¤@­Ó°ŞµĄŻĹradom Ąô°Č¸ËłĆˇIname = ˇm"
  4406. --str = str..charname.."ˇn item id = "..prizelist[index].."misid = "..id.."loopnum = "..loopnum
  4407. --LG( "randmission_info", str )
  4408.  
  4409. PRINT( "GetRandMissionPrize: return prizetp = , p1 = ", prizelist[index].tp, prizelist[index].p1 )
  4410. return prizelist[index].tp, prizelist[index].p1
  4411. end
  4412. end
  4413. end
  4414.  
  4415. PRINT( "GetRandMissionPrize: return 0" )
  4416. return 0, 0
  4417. end
  4418.  
  4419. --§PÂ_¸Óradom Ąô°Č¬O§_ĄiĄHłQ¸Ó¨¤¦â±µ¨ü
  4420. function IsRandMissionAccept( character, mission )
  4421. PRINT( "IsRandMissionAccept:character, mission", character, mission )
  4422. if mission == nil or mission.tp ~= RAND_MISSION then
  4423. PRINT( "IsRandMissionAccept:parameter error or non random quest type data notice!" )
  4424. SystemNotice( character, "IsRandMissionAccept:parameter error or non random quest type data notice!" )
  4425. return LUA_FALSE
  4426. end
  4427.  
  4428. --Ŕň¨ú¸Ó¨¤¦âradom Ąô°ČĽĆľÚ¬q­Č
  4429. local level = GetRandMissionLevel( character, mission.sid, mission.leveltp )
  4430. PRINT( "IsRandMissionAccept:GetRandMissionLevel : level = ", level )
  4431. if mission.RandInfo == nil or mission.RandInfo[level] == nil then
  4432. PRINT( "IsRandMissionAccept: no level info and return false " )
  4433. return LUA_FALSE
  4434. end
  4435.  
  4436. PRINT( "IsRandMissionAccept:GetRandMissionLevel : return true " )
  4437. return LUA_TRUE
  4438. end
  4439.  
  4440. --´ú¸Ő­pşâradom Ąô°Č¤˝¦ˇ
  4441. function GetRandMissionExp( loopnum, miscount, exp )
  4442. --X*(350+Z*550)*0.0001*((10+Y*15)*0.001+INT(Y*0.1)*0.075)
  4443. --x=Á`¸gĹç
  4444. --y=¤pŔôĽĆ
  4445. --z=¤jŔôĽĆ
  4446.  
  4447. if loopnum == nil or miscount == nil or exp == nil then
  4448. PRINT( "GetRandMissionExp:Function parameter error!loopnum, miscount, exp", loopnum, miscount, exp )
  4449. LG( "randmission_error", "GetRandMissionExp:Function parameter error!" )
  4450. return 0
  4451. end
  4452.  
  4453. --local value = exp*(350 + loopnum*550)*0.0001*((10 + miscount*15)*0.001 + (miscount*0.1)*0.075)
  4454. local value = exp*((20 + miscount*5)*0.002 + ToDword(miscount*0.1)*0.05)
  4455. local newexp = ToDword( value )
  4456. PRINT( "GetRandMissionExp:newexp = ", newexp )
  4457. if newexp == nil then
  4458. return 0
  4459. end
  4460. PRINT( "GetRandMissionExp:loopnum, miscount, exp, newexp", loopnum, miscount, exp, newexp )
  4461. return newexp
  4462. end
  4463.  
  4464. function GetRandMissionMoney( loopnum, miscount, money )
  4465. if loopnum == nil or miscount == nil or money == nil then
  4466. PRINT( "GetRandMissionExp:Function parameter error!loopnu, miscount, money", loopnum, miscount, money )
  4467. LG( "randmission_error", "GetRandMissionMoney:Function parameter error!" )
  4468. return 0
  4469. end
  4470.  
  4471. --local value = money*(350 + loopnum*550)*0.0001*((10 + miscount*15)*0.001 + (miscount*0.1)*0.075)
  4472. local value = money*((20 + miscount*5)*0.002 + ToDword(miscount*0.1)*0.05)
  4473. local newmoney = ToDword( value )
  4474. PRINT( "GetRandMissionExp:newmoney = ", newmoney )
  4475. if newmoney == nil then
  4476. return 0
  4477. end
  4478.  
  4479. return newmoney
  4480. end
  4481.  
  4482. --®ÚľÚ¨¤¦âŞş«H®§ĄÍ¦¨¤@­Óradom Ąô°Č
  4483. function CreateRandMission( character, npc, mission )
  4484. PRINT( "CreateRandMission:character, npc, mission", character, npc, mission )
  4485. if mission == nil or mission.tp ~= RAND_MISSION then
  4486. PRINT( "CreateRandMission:parameter error or non random quest type data notice!" )
  4487. SystemNotice( character, "CreateRandMission:parameter error or non random quest type data notice!" )
  4488. return LUA_FALSE
  4489. end
  4490.  
  4491. --Şě©l¤ĆĄţ§˝radom Ąô°Č°ŃĽĆ
  4492. InitRandParam()
  4493. RandParam.id = mission.id
  4494. RandParam.sid = mission.sid
  4495. RandParam.bounty = mission.bounty
  4496. RandParam.npcname = mission.npcname
  4497. RandParam.npcarea = mission.npcarea
  4498. PRINT( "CreateRandMission:RandParam.id = , RandParam.sid = , bounty = , name = , area = ", RandParam.id, RandParam.sid, RandParam.bounty, RandParam.npcname, RandParam.npcarea )
  4499.  
  4500. --Ŕň¨ú¸Ó¨¤¦âradom Ąô°ČĽĆľÚ¬q­Č
  4501. RandParam.level = GetRandMissionLevel( character, mission.sid, mission.leveltp )
  4502. PRINT( "CreateRandMission:RandParam.level =, mission.RandInfo =, mission.RandInfo[level] = ", RandParam.level, mission.RandInfo, mission.RandInfo[RandParam.level] )
  4503. if mission.RandInfo == nil or mission.RandInfo[RandParam.level] == nil then
  4504. PRINT( "CreateRandMission:mission notice does not exist random quest data generated notice, please checl.llevel = "..RandParam.level )
  4505. local desp = GetCharName( npc )
  4506. desp = desp..": Sorry, I do not have any quest suitable for your level. Please look elsewhere."
  4507. HelpInfo( character, MIS_HELP_DESP, desp )
  4508. return LUA_FALSE
  4509. end
  4510.  
  4511. PRINT( "CreateRandMission: rand type count = ", mission.RandInfo[RandParam.level].tpinfo.count )
  4512. --radom ¤@­ÓĄô°ČĂţ«¬
  4513. --local tpinfoid = Rand( mission.RandInfo[RandParam.level].tpinfo.count ) + 1
  4514. local tpinfoid = GetRandTpinfoIndex( mission.RandInfo[RandParam.level].tpinfo )
  4515.  
  4516. PRINT( "CreateRandMission:Rand mission info, tpinfoid =, type = ", tpinfoid, mission.RandInfo[RandParam.level].tpinfo[tpinfoid].tp )
  4517. if mission.RandInfo[RandParam.level].tpinfo[tpinfoid] == nil or mission.RandInfo[RandParam.level].tpinfo[tpinfoid].tp == nil then
  4518. PRINT( "CreateRandMission:Random quest type shortcut notice as nil.level, tpinfoid", RandParam.level, tpinfoid )
  4519. LG( "randmission_error", "CreateRandMission:Random quest type shortcut notice as nil.level = , tpinfoid = ", RandParam.level, tpinfoid )
  4520. SystemNotice( character, "CreateRandMission:Random quest type shortcut notice as nil.level = , tpinfoid = "..RandParam.level..tpinfoid )
  4521. return LUA_FALSE
  4522. end
  4523.  
  4524. --radom ¨ú¤@­ÓĄô°ČĽĆľÚ
  4525. RandParam.tp = mission.RandInfo[RandParam.level].tpinfo[tpinfoid].tp
  4526. local tpindex = GetRandMissionTypeIndex( mission, RandParam.tp )
  4527. PRINT( "CreateRandMission:tpindex = ", tpindex )
  4528. if tpindex == 0 then
  4529. LG( "randmission_error", "CreateRandMission:GetRandMissionTypeIndex:id, tp, level, exp, money, item, numdata", RandParam.id, RandParam.tp, RandParam.level, RandParam.exp, RandParam.money, RandParam.prizedata, RandParam.prizetp, RandParam.numdata )
  4530. PRINT( "CreateRandMission:GetRandMission:GetRandMissionTypeIndex has not found any quest mission that matches with random question type initialization date notice" )
  4531. SystemNotice( character, "CreateRandMission:GetRandMissionGetRandMissionTypeIndex has not found any quest mission that matches with random question type initialization date notice" )
  4532. return LUA_FALSE
  4533. end
  4534.  
  4535. local randnum = mission.missionlist[tpindex].randnum
  4536. if randnum == nil or randnum < 1 or randnum > 4 then
  4537. LG( "randmission_error", "CreateRandMission:random quest highest random value type cannot be less than 1 or greater than 4! num = "..randnum )
  4538. PRINT( "CreateRandMission:random quest highest random value type cannot be less than 1 or greater than 4! num = "..randnum )
  4539. SystemNotice( character, "CreateRandMission:random quest highest random value type cannot be less than 1 or greater than 4! num = "..randnum )
  4540. return LUA_FALSE
  4541. end
  4542. PRINT( "CreateRandMission:randnum = , val = ", mission.missionlist[tpindex].randnum, randnum )
  4543.  
  4544. --Ŕň¨úradom Ąô°ČŞş­pĽĆ
  4545. local ret, miscount = GetRandMissionCount( character, mission.id )
  4546. --if miscount == 0 then
  4547. --miscount = 1
  4548. --end
  4549. miscount = miscount + 1
  4550.  
  4551. local ret, misloopnum = GetRandMissionNum( character, mission.id )
  4552. --if misloopnum == 0 then
  4553. --misloopnum = 1
  4554. --end
  4555. misloopnum = misloopnum + 1
  4556.  
  4557. --X*(350+Z*550)*0.0001*((10+Y*15)*0.001+INT(Y*0.1)*0.075)
  4558. --x=Á`¸gĹç
  4559. --y=¤pŔôĽĆ
  4560. --z=¤jŔôĽĆ
  4561.  
  4562. if RandParam.tp == MIS_RAND_KILL then --Ây±ţ©ÇŞ«
  4563. --radom łĚ¤j4­Ó©ÇŞ«Ăţ«¬
  4564. RandParam.numdata = Rand( randnum ) + 1
  4565. PRINT( "CreateRandMission:rand numdata = ", RandParam.numdata )
  4566. if RandParam.numdata > mission.RandInfo[RandParam.level].KillInfo.count then
  4567. RandParam.numdata = mission.RandInfo[RandParam.level].KillInfo.count
  4568. end
  4569. PRINT( "CreateRandMission:rand numdata = ", RandParam.numdata )
  4570. if RandParam.numdata <= 0 then
  4571. PRINT( "CreateRandMission, hunt monster quest random value cannot be less than zero. Please check if level of monster item matches! Level = ", RandParam.level )
  4572. SystemNotice( character, "CreateRandMission, hunt monster quest random value cannot be less than zero. Please check if level of monster item matches!Level = "..RandParam.level )
  4573. return LUA_FALSE
  4574. end
  4575.  
  4576. for n = 1, RandParam.numdata, 1 do
  4577. local flag = 1
  4578. local infoid = Rand( mission.RandInfo[RandParam.level].KillInfo.count ) + 1
  4579. PRINT( "CreateRandMission:rand infoid = ", infoid )
  4580. --Ŕˬd¬O§_¦ł­«˝ĆŞşĽĆľÚŻÁ¤Ţ«H®§
  4581. for i = 1, n - 1, 1 do
  4582. if RandParam.data[i].id == infoid then
  4583. PRINT( "CreateRandMission:3" )
  4584. n = n - 1
  4585. flag = 0
  4586. break
  4587. end
  4588. PRINT( "CreateRandMission:2" )
  4589. end
  4590. PRINT( "CreateRandMission:4" )
  4591. if flag == 1 then
  4592. --«O¦sĽĆľÚ
  4593. PRINT( "CreateRandMission:5" )
  4594. RandParam.data[n].id = infoid
  4595. RandParam.data[n].p1 = mission.RandInfo[RandParam.level].KillInfo[infoid].p1
  4596. RandParam.data[n].p2 = mission.RandInfo[RandParam.level].KillInfo[infoid].p2 + Rand(mission.RandInfo[RandParam.level].KillInfo[infoid].p3)
  4597. PRINT( "CreateRandMission:6" )
  4598. RandParam.data[n].p3 = 0
  4599. RandParam.data[n].p4 = 0
  4600. RandParam.data[n].p5 = 0
  4601. RandParam.data[n].p6 = 0
  4602. RandParam.data[n].p7 = 0
  4603. RandParam.data[n].p8 = 0
  4604. --RandParam.exp = GetRandMissionExp( misloopnum, miscount, RandParam.exp + mission.RandInfo[RandParam.level].KillInfo[infoid].p4 * RandParam.data[n].p2 )
  4605. RandParam.exp = GetRandMissionExp( misloopnum, miscount, RandParam.exp + mission.RandInfo[RandParam.level].KillInfo[infoid].p4 )
  4606. PRINT( "CreateRandMission:7" )
  4607. --RandParam.money = GetRandMissionMoney( misloopnum, miscount, RandParam.money + mission.RandInfo[RandParam.level].KillInfo[infoid].p5 * RandParam.data[n].p2 )
  4608. RandParam.money = GetRandMissionMoney( misloopnum, miscount, RandParam.money + mission.RandInfo[RandParam.level].KillInfo[infoid].p5 )
  4609. PRINT( "CreateRandMission:rand data info: id, p1, p2, p3, p4", RandParam.data[n].id, RandParam.data[n].p1, RandParam.data[n].p2, RandParam.data[n].p3, RandParam.data[n].p4 )
  4610. end
  4611. end
  4612.  
  4613. elseif RandParam.tp == MIS_RAND_GET then --Ŕň¨úŞ««~
  4614. --radom łĚ¤j4­Ó©ÇŞ«Ăţ«¬
  4615. RandParam.numdata = Rand( randnum ) + 1
  4616. if RandParam.numdata > mission.RandInfo[RandParam.level].GetInfo.count then
  4617. RandParam.numdata = mission.RandInfo[RandParam.level].GetInfo.count
  4618. end
  4619. if RandParam.numdata <= 0 then
  4620. PRINT( "CreateRandMission, Obtain item random quest quantity must be greater than zero, please check if target's level quest notice is correct! Level = ", RandParam.level )
  4621. SystemNotice( character, "CreateRandMission, Obtain item random quest quantity must be greater than zero, please check if target's level quest notice is correct! Level = "..RandParam.level )
  4622. return LUA_FALSE
  4623. end
  4624.  
  4625. for n = 1, RandParam.numdata, 1 do
  4626. local flag = 1
  4627. local infoid = Rand( mission.RandInfo[RandParam.level].GetInfo.count ) + 1
  4628. PRINT( "CreateRandMission:rand infoid = ", infoid )
  4629. --Ŕˬd¬O§_¦ł­«˝ĆŞşĽĆľÚŻÁ¤Ţ«H®§
  4630. for i = 1, n - 1, 1 do
  4631. if RandParam.data[i].id == infoid then
  4632. n = n - 1
  4633. flag = 0
  4634. break
  4635. end
  4636. end
  4637.  
  4638. if flag == 1 then
  4639. --«O¦sĽĆľÚ
  4640. RandParam.data[n].id = infoid
  4641. RandParam.data[n].p1 = mission.RandInfo[RandParam.level].GetInfo[infoid].p1
  4642. RandParam.data[n].p2 = mission.RandInfo[RandParam.level].GetInfo[infoid].p2 + Rand(mission.RandInfo[RandParam.level].GetInfo[infoid].p3)
  4643. RandParam.data[n].p3 = 0
  4644. RandParam.data[n].p4 = 0
  4645. RandParam.data[n].p5 = 0
  4646. RandParam.data[n].p6 = 0
  4647. RandParam.data[n].p7 = 0
  4648. RandParam.data[n].p8 = 0
  4649. --RandParam.exp = GetRandMissionExp( misloopnum, miscount, RandParam.exp + mission.RandInfo[RandParam.level].GetInfo[infoid].p4 * RandParam.data[n].p2 )
  4650. RandParam.exp = GetRandMissionExp( misloopnum, miscount, RandParam.exp + mission.RandInfo[RandParam.level].GetInfo[infoid].p4 )
  4651. --RandParam.money = GetRandMissionMoney( misloopnum, miscount, RandParam.money + mission.RandInfo[RandParam.level].GetInfo[infoid].p5 * RandParam.data[n].p2 )
  4652. RandParam.money = GetRandMissionMoney( misloopnum, miscount, RandParam.money + mission.RandInfo[RandParam.level].GetInfo[infoid].p5 )
  4653. PRINT( "CreateRandMission:rand data info: id, p1, p2, p3, p4", RandParam.data[n].id, RandParam.data[n].p1, RandParam.data[n].p2, RandParam.data[n].p3, RandParam.data[n].p4 )
  4654. end
  4655. end
  4656.  
  4657. elseif RandParam.tp == MIS_RAND_SEND then --°eµąŞ««~
  4658. --radom żďľÜ¤@©wĂţ«¬ĽĆ¶qŞşNPC
  4659. PRINT( "Rand send" )
  4660. local npcinfoid = nil --GetNpcInfoID( npc ) --Ŕň¨ú·í«eNPCŞşinfoidˇAÁקK¦ł¦Ű¤vµo«H¦Ű¤v¦¬«HŞş±ˇŞpĄX˛{
  4661. RandParam.numdata = Rand( randnum ) + 1
  4662. PRINT( "CreateRandMission1: numdata = , randnum = , RandParam.level = , infocount = , itemcount = ", RandParam.numdata, randnum, RandParam.level, mission.RandInfo[RandParam.level].SendInfo.count, mission.RandInfo[RandParam.level].SendItem.count )
  4663. if RandParam.numdata > mission.RandInfo[RandParam.level].SendInfo.count then
  4664. RandParam.numdata = mission.RandInfo[RandParam.level].SendInfo.count
  4665. end
  4666. if RandParam.numdata > mission.RandInfo[RandParam.level].SendItem.count then
  4667. RandParam.numdata = mission.RandInfo[RandParam.level].SendItem.count
  4668. end
  4669. if RandParam.numdata <= 0 then
  4670. PRINT( "CreateRandMission, send letter quest random value cannot be greater than zero. Please check target level of send letter notice is correct!Level = ", RandParam.level )
  4671. SystemNotice( character, "CreateRandMission, send letter quest random value cannot be greater than zero. Please check target level of send letter notice is correct!Level = "..RandParam.level )
  4672. return LUA_FALSE
  4673. end
  4674.  
  4675. PRINT( "CreateRandMission2: numdata = , randnum = ", RandParam.numdata, randnum )
  4676. for n = 1, RandParam.numdata, 1 do
  4677. local flag = 1
  4678. local infoid = Rand( mission.RandInfo[RandParam.level].SendInfo.count ) + 1
  4679. local itemid = GetRandMissionSendItem( mission.RandInfo[RandParam.level].SendItem )
  4680. PRINT( "CreateRandMission:rand infoid = , itemid = ", infoid, itemid )
  4681. --Ŕˬd¬O§_¦ł­«˝ĆŞşĽĆľÚŻÁ¤Ţ«H®§
  4682. if mission.RandInfo[RandParam.level].SendInfo[infoid].p1 == npcinfoid then
  4683. n = n - 1
  4684. flag = 0
  4685. else
  4686. for i = 1, n - 1, 1 do
  4687. if RandParam.data[i].id == infoid or RandParam.data[i].p2 == itemid then
  4688. PRINT( "CreateRandMission:send item ,rand value repeat" )
  4689. n = n - 1
  4690. flag = 0
  4691. break
  4692. end
  4693. end
  4694. end
  4695.  
  4696. if flag == 1 then
  4697. --«O¦sĽĆľÚ
  4698. RandParam.data[n].id = infoid
  4699. RandParam.data[n].p1 = mission.RandInfo[RandParam.level].SendInfo[infoid].p1 --npc info id
  4700. RandParam.data[n].p2 = itemid --item id
  4701. RandParam.data[n].p3 = mission.RandInfo[RandParam.level].SendInfo[infoid].p2 --area id
  4702. RandParam.data[n].p4 = 0
  4703. RandParam.data[n].p5 = 0
  4704. RandParam.data[n].p6 = 0
  4705. RandParam.data[n].p7 = 0
  4706. RandParam.data[n].p8 = 0
  4707. RandParam.exp = GetRandMissionExp( misloopnum, miscount, RandParam.exp + mission.RandInfo[RandParam.level].SendInfo[infoid].p4 )
  4708. RandParam.money = GetRandMissionMoney( misloopnum, miscount, RandParam.money + mission.RandInfo[RandParam.level].SendInfo[infoid].p5 )
  4709. PRINT( "CreateRandMission:rand data info: id, p1, p2, p3, p4", RandParam.data[n].id, RandParam.data[n].p1, RandParam.data[n].p2, RandParam.data[n].p3, RandParam.data[n].p4 )
  4710. end
  4711. end
  4712.  
  4713. elseif RandParam.tp == MIS_RAND_CONVOY then --Ĺ@°eNPC
  4714. PRINT( "Convoy npc" )
  4715. --radom żďľÜ¤@­ÓĹ@°eNPCĄŘĽĐ
  4716. RandParam.numdata = 1 --Ĺ@°eĄô°ČĽČ®ÉĄu¤ä«ůĹ@°e¤@­ÓNPCˇA¦ý¬Oµ{§Ç¤ä«ůĹ@°e¦h­ÓNPC
  4717. if RandParam.numdata > mission.RandInfo[RandParam.level].ConvoyInfo.count then
  4718. RandParam.numdata = mission.RandInfo[RandParam.level].ConvoyInfo.count
  4719. end
  4720. if RandParam.numdata <= 0 then
  4721. PRINT( "CreateRandMission, escort NPC quest quantity must be greater than zero, please check if target's level escort notice is correct!Level = ", RandParam.level )
  4722. SystemNotice( character, "CreateRandMission, escort NPC quest quantity must be greater than zero, please check if target's level escort notice is correct! Level = "..RandParam.level )
  4723. return LUA_FALSE
  4724. end
  4725.  
  4726. for n = 1, RandParam.numdata, 1 do
  4727. local flag = 1
  4728. local infoid = Rand( mission.RandInfo[RandParam.level].ConvoyInfo.count ) + 1
  4729. --Ŕˬd¬O§_¦ł­«˝ĆŞşĽĆľÚŻÁ¤Ţ«H®§
  4730. for i = 1, n - 1, 1 do
  4731. if RandParam.data[i].id == infoid then
  4732. PRINT( "CreateRandMission:convoy npc ,rand value repeat" )
  4733. n = n - 1
  4734. flag = 0
  4735. break
  4736. end
  4737. end
  4738.  
  4739. if flag == 1 then
  4740. --«O¦sĽĆľÚ
  4741. RandParam.data[n].id = infoid
  4742. RandParam.data[n].p1 = mission.RandInfo[RandParam.level].ConvoyInfo[infoid].p1 --char info id
  4743. RandParam.data[n].p2 = mission.RandInfo[RandParam.level].ConvoyInfo[infoid].p2 --map id
  4744. RandParam.data[n].p3 = mission.RandInfo[RandParam.level].ConvoyInfo[infoid].p3 --areaid
  4745. RandParam.data[n].p4 = mission.RandInfo[RandParam.level].ConvoyInfo[infoid].p4 --x
  4746. RandParam.data[n].p5 = mission.RandInfo[RandParam.level].ConvoyInfo[infoid].p5 --y
  4747. RandParam.data[n].p6 = mission.RandInfo[RandParam.level].ConvoyInfo[infoid].p6 --scope
  4748. RandParam.data[n].p7 = 0
  4749. RandParam.data[n].p8 = 0
  4750. RandParam.exp = GetRandMissionExp( misloopnum, miscount, RandParam.exp + mission.RandInfo[RandParam.level].ConvoyInfo[infoid].p7 )
  4751. RandParam.money = GetRandMissionMoney( misloopnum, miscount, RandParam.money + mission.RandInfo[RandParam.level].ConvoyInfo[infoid].p8 )
  4752. PRINT( "CreateRandMission:rand data info: id, p1, p2, p3, p4, p5, p6", RandParam.data[n].id, RandParam.data[n].p1, RandParam.data[n].p2, RandParam.data[n].p3, RandParam.data[n].p4, RandParam.data[n].p5, RandParam.data[n].p6 )
  4753. end
  4754. end
  4755.  
  4756. elseif RandParam.tp == MIS_RAND_EXPLORE then --±´ŻÁ¦aąĎ
  4757.  
  4758. else
  4759. PRINT( "CreateRandMission: invalid random quest type!tp = "..RandParam.tp )
  4760. SystemNotice( character, "CreateRandMission: invalid random quest type!tp = "..RandParam.tp )
  4761. LG( "randmission_error", "CreateRandMission: invalid random quest type!tp = "..RandParam.tp )
  4762. return LUA_FALSE
  4763. end
  4764.  
  4765. PRINT( "CreateRandMission: name, id, level, loopinfo, loopdata", mission.name, RandParam.id, mission.loopinfo, mission.RandInfo[RandParam.level].LoopData )
  4766. RandParam.prizetp, RandParam.prizedata = GetRandMissionPrize( character, mission.name, RandParam.id, mission.loopinfo, mission.RandInfo[RandParam.level].LoopData )
  4767.  
  4768. --ł]¸mradom Ąô°ČŞş¸gĹçĂţ«¬
  4769. if mission.missionlist[tpindex].exptp == nil then
  4770. LG( "randmission_error", "Invalid random quest experience type!exptp = ", mission.missionlist[tpindex].exptp )
  4771. PRINT( "Invalid random quest experience type!exptp = ", mission.missionlist[tpindex].exptp )
  4772. SystemNotice( character, "Invalid random quest experience type!exptp = ", mission.missionlist[tpindex].exptp )
  4773. return LUA_FALSE
  4774. end
  4775. RandParam.exptp = mission.missionlist[tpindex].exptp
  4776. PRINT( "CreateRandMission:exptp = ", RandParam.exptp )
  4777.  
  4778. --®ÚľÚ°ŃĽĆĄÍ¦¨radom Ąô°Č«H®§
  4779. local ret = RandMission( mission.missionlist[tpindex], RandParam )
  4780. if ret ~= LUA_TRUE then
  4781. LG( "randmission_error", "CreateRandMission:RandMission:id, sid, tp, level, exp, money, item, numdata", RandParam.id, RandParam.sid, RandParam.tp, RandParam.level, RandParam.exp, RandParam.money, RandParam.prizedata, RandParam.prizetp, RandParam.numdata )
  4782. PRINT( "CreateRandMission:RandMission generate random quest notice error!" )
  4783. SystemNotice( character, "CreateRandMission:RandMission generate random quest notice error!" )
  4784. return LUA_FALSE
  4785. end
  4786.  
  4787. --ŔË´úradom Ąô°Č­IĄ]»Ý¨D
  4788. PRINT( "CreateRandMission:Required number of empty slots in inventory:numgrid = ", mission.missionlist[tpindex].begin.baggrid )
  4789. local numgrid = mission.missionlist[tpindex].begin.baggrid
  4790. local ret = HasLeaveBagGrid( character, numgrid )
  4791. if ret ~= LUA_TRUE then
  4792. PRINT( "CreateRandMission:insufficient inventory slot when character accept quest! num = ", numgrid )
  4793. BickerNotice( character, "Inventory space insufficient, requires "..numgrid.." space. Activation of quest failed!" )
  4794. return LUA_FALSE, 0
  4795. end
  4796.  
  4797. --¦sŔxĄÍ¦¨ŞşĽĆľÚ¨ě¨¤¦â¤¤
  4798. PRINT( "CreateRandMission:AddRandMission:id, sid, tp, level, exp, money, prizedata, prizetp, numdata", RandParam.id, RandParam.sid, RandParam.tp, RandParam.level, RandParam.exp, RandParam.money, RandParam.prizedata, RandParam.prizetp, RandParam.numdata )
  4799. local ret = AddRandMission( character, RandParam.id, RandParam.sid, RandParam.tp, RandParam.level, RandParam.exp, RandParam.money, RandParam.prizedata, RandParam.prizetp, RandParam.numdata )
  4800. if ret ~= LUA_TRUE then
  4801. LG( "randmission_error", "AddRandMission:id, sid, tp, level, exp, money, prizedata, prizetp, numdata", RandParam.id, RandParam.sid, RandParam.tp, RandParam.level, RandParam.exp, RandParam.money, RandParam.prizedata, RandParam.prizetp, RandParam.numdata )
  4802. PRINT( "CreateRandMission:AddRandMission add character random quest notice failed!" )
  4803. SystemNotice( character, "CreateRandMission:AddRandMission add character random quest notice failed!" )
  4804. return LUA_FALSE
  4805. end
  4806.  
  4807. for n = 1, RandParam.numdata, 1 do
  4808. PRINT( "CreateRandMission:SetRandMissionData:id, index, p1, p2, p3, p4, p5, p6", RandParam.id, n - 1, RandParam.data[n].p1, RandParam.data[n].p2, RandParam.data[n].p3, RandParam.data[n].p4, RandParam.data[n].p5, RandParam.data[n].p6 )
  4809. ret = SetRandMissionData( character, RandParam.id, n - 1, RandParam.data[n].p1, RandParam.data[n].p2, RandParam.data[n].p3, RandParam.data[n].p4, RandParam.data[n].p5, RandParam.data[n].p6 )
  4810. if ret ~= LUA_TRUE then
  4811. PRINT( "CreateRandMission:SetRandMissionData adds character random quest notice failed!, n = ", n )
  4812. SystemNotice( character, "CreateRandMission:SetRandMissionData adds character random quest notice failed!n = "..n )
  4813. return LUA_FALSE
  4814. end
  4815. end
  4816. local str = "["
  4817. local name = GetCharName( npc )
  4818. str = str..name.."] has given you a random quest. Complete it!"
  4819. SystemNotice( character, str )
  4820.  
  4821. return LUA_TRUE, tpindex
  4822. end
  4823.  
  4824. --Ŕň¨úradom Ąô°ČŞş¤Ç°tĂţ«¬ŻÁ¤Ţ
  4825. function GetRandMissionTypeIndex( mission, tp )
  4826. if mission == nil or tp == nil then
  4827. PRINT( "GetRandMissionTypeIndex:parameter cannot be equal to nil. mission = nil or tp = nil" )
  4828. LG( "randmission_error", "GetRandMissionTypeIndex:parameter cannot be equal to nil. mission = nil or tp = nil" )
  4829. return 0
  4830. end
  4831. PRINT( "GetRandMissionTypeIndex:mission, tp, mission.missionlist.count", mission, tp, mission.missionlist.count )
  4832. for i = 1, mission.missionlist.count, 1 do
  4833. PRINT( "GetRandMissionTypeIndex,mission.missionlist[i].tp = ", mission.missionlist[i].tp )
  4834. if tp == mission.missionlist[i].tp then
  4835. return i
  4836. end
  4837. end
  4838.  
  4839. return 0
  4840. end
  4841.  
  4842. --Ŕň¨úradom Ąô°Č«H®§radom ĽĆ
  4843. function GetRandTpinfoIndex( tpinfo )
  4844. local randdata = 0
  4845. for n = 1, tpinfo.count, 1 do
  4846. randdata = randdata + tpinfo[n].tprand
  4847. PRINT( "GetRandTpinfoIndex: n = , randdata = , tprand = ", n, randdata, tpinfo[n].tprand )
  4848. end
  4849. local randvalue = Rand( randdata )
  4850. local tempdata = 0
  4851. for n = 1, tpinfo.count, 1 do
  4852. if randvalue >= tempdata and randvalue < tempdata + tpinfo[n].tprand then
  4853. PRINT( "GetRandTpinfoIndex: return n = , tprandvalue = , tprand = ", n, randvalue, tpinfo[n].tprand )
  4854. return n
  4855. end
  4856. tempdata = tempdata + tpinfo[n].tprand
  4857. end
  4858. return 0
  4859. end
  4860.  
  4861. --®ÚľÚ¨¤¦âŞş«O¦sŞşradom ĄÍ¦¨Ąô°Č°t¸m«H®§­«şcĄô°Č
  4862. function GetCharRandMission( character, id, mission )
  4863. PRINT( "GetRandMission:character", character )
  4864.  
  4865. --§PÂ_¨¤¦â¬O§_¦łradom Ąô°Č°t¸m«H®§
  4866. if HasRandMission( character, id ) ~= LUA_TRUE then
  4867. PRINT( "GetRandMission:HasRandMission does not detect random quest notice on target,ID = "..id )
  4868. SystemNotice( character, "GetRandMission: does not detect random quest notice on target,ID = "..id )
  4869. return LUA_TRUE, 0
  4870. end
  4871.  
  4872. --Şě©l¤ĆĄţ§˝radom Ąô°Č°ŃĽĆ
  4873. InitRandParam()
  4874.  
  4875. --Ŕň¨ú¨¤¦âŞşradom Ąô°Č°t¸m«H®§
  4876. PRINT( "GetCharRandMission:GetRandMission, id = ", id )
  4877. local ret
  4878. RandParam.id = id
  4879. RandParam.bounty = mission.bounty
  4880. RandParam.npcname = mission.npcname
  4881. RandParam.npcarea = mission.npcarea
  4882. PRINT( "CreateRandMission:RandParam.id = , RandParam.sid = , bounty = , name = , area = ", RandParam.id, RandParam.sid, RandParam.bounty, RandParam.npcname, RandParam.npcarea )
  4883.  
  4884. ret, RandParam.tp, RandParam.level, RandParam.exp, RandParam.money, RandParam.prizedata, RandParam.prizetp, RandParam.numdata = GetRandMission( character, id )
  4885. if ret ~= LUA_TRUE then
  4886. PRINT( "GetCharRandMission:GetRandMission error." )
  4887. SystemNotice( character, "GetCharRandMission:GetRandMission error." )
  4888. return LUA_FALSE
  4889. end
  4890. PRINT( "GetCharRandMission:tp, level, exp, money, prizedata, prizetp, numdata", RandParam.tp, RandParam.level, RandParam.exp, RandParam.money, RandParam.prizedata, RandParam.prizetp, RandParam.numdata )
  4891. --Ŕň¨ú°t¸m«H®§¦CŞí
  4892. for n = 1, RandParam.numdata, 1 do
  4893. ret, RandParam.data[n].p1, RandParam.data[n].p2, RandParam.data[n].p3, RandParam.data[n].p4, RandParam.data[n].p5, RandParam.data[n].p6 = GetRandMissionData( character, id, n - 1 )
  4894. PRINT( "GetRandMissionData: p1, p2, p3, p4, p5, p6 ", RandParam.data[n].p1, RandParam.data[n].p2, RandParam.data[n].p3, RandParam.data[n].p4, RandParam.data[n].p5, RandParam.data[n].p6 )
  4895. if ret ~= LUA_TRUE then
  4896. PRINT( "GetCharRandMission:GetRandMissionData error." )
  4897. SystemNotice( character, "GetCharRandMission:GetRandMissionData error." )
  4898. return LUA_FALSE
  4899. end
  4900. end
  4901.  
  4902. local index = GetRandMissionTypeIndex( mission, RandParam.tp )
  4903. PRINT( "GetCharRandMission:GetRandMissionTypeIndex index = ", index )
  4904. if index == 0 then
  4905. PRINT( "GetRandMission:obtain random quest matching type notice failed!" )
  4906. SystemNotice( character, "GetRandMission:obtain random quest matching type notice failed!" )
  4907. return LUA_FALSE
  4908. end
  4909.  
  4910. --ł]¸mradom Ąô°ČŞş¸gĹçĂţ«¬
  4911. if mission.missionlist[index].exptp == nil then
  4912. LG( "randmission_error", "Invalid random quest experience type!exptp = ", mission.missionlist[index].exptp )
  4913. PRINT( "Invalid random quest experience type!exptp = ", mission.missionlist[index].exptp )
  4914. SystemNotice( character, "Invalid random quest experience type!exptp = ", mission.missionlist[index].exptp )
  4915. return LUA_FALSE
  4916. end
  4917. RandParam.exptp = mission.missionlist[index].exptp
  4918. PRINT( "CreateRandMission:exptp = ", RandParam.exptp )
  4919.  
  4920. local ret = RandMission( mission.missionlist[index], RandParam )
  4921. if ret ~= LUA_TRUE then
  4922. PRINT( "GetRandMission: according to random quest setting notice resulted in random quest failed!" )
  4923. SystemNotice( character, "GetRandMission: according to random quest setting notice resulted in random quest failed!" )
  4924. return LUA_FALSE
  4925. end
  4926.  
  4927. PRINT( "GetRandMission: return true, index = ", index )
  4928. return LUA_TRUE, index, mission.RandInfo[RandParam.level].LoopData
  4929. end
  4930.  
  4931. --radom ĄÍ¦¨¤@­ÓĄô°Č
  4932. function RandMission( mission, param )
  4933. PRINT( "RandMission" )
  4934. if mission == nil or param == nil or param.tp ~= mission.tp then
  4935. PRINT( "RandMission:mission = nil or param = nil or param.tp ~= mission.tp" )
  4936. return LUA_FALSE
  4937. end
  4938.  
  4939. --Şě©l¤Ć¨¤¦âĄô°Č­IĄ]®e¶q»Ý¨D
  4940. mission.begin.baggrid = 0
  4941. mission.result.baggrid = 0
  4942.  
  4943. PRINT( "RandMission, mission.tp = , param.tp", mission.tp, param.tp )
  4944. --®ÚľÚŔHľ÷Ąô°ČŞşĂţ«¬©M°ŃĽĆĄÍ¦¨¤@­Ó·sĄô°Č
  4945. if mission.tp == MIS_RAND_KILL then --şR·´Ş«Ąó
  4946. --Ây±ţŞş©ÇŞ«Ăţ«¬ĽĆ¶q
  4947. local num = 0
  4948. mission.begin.actions.count = param.numdata
  4949. mission.result.conditions.count = param.numdata
  4950. mission.need.count = param.numdata + 1
  4951. mission.need[1].p1 = " <b"..param.npcarea..">'s<y"..param.npcname.."> needs you to hunt"
  4952.  
  4953. --mission.begin.talk = "<t>¶ŮˇAŞB¤ÍˇC¦łżł˝ě±Ă­Ó¤pżú¶ÜˇH§Úło¸Ě­č¦n¦ł­Ó®·ÂyĄô°ČˇAĄu­n®·¨ě"
  4954. --mission.result.help = "<t>¶ŮˇAŞB¤ÍˇA§A­n®É¨č°O±oµŞŔł§ÚŞş¨Ć±ˇ®@ˇAĄu­n®·¨ě"
  4955.  
  4956. PRINT( mission.begin.talkstart, mission.result.talkstart, mission.result.helpstart )
  4957. PRINT( mission.begin.talkend, mission.result.talkend, mission.result.helpend )
  4958. mission.begin.talk = mission.begin.talkstart
  4959. mission.result.talk = mission.result.talkstart
  4960. mission.result.help = mission.result.helpstart
  4961. PRINT( "RandMission,1" )
  4962. for n = 1, param.numdata, 1 do
  4963. --§ó·sĄô°Č»Ý¨D
  4964. mission.need[n+1].p1 = param.data[n].p1 --©ÇŞ«Ăţ«¬ID
  4965. mission.need[n+1].p2 = param.data[n].p2 --©ÇŞ«ĽĆ¶q
  4966. mission.need[n+1].p3 = num --¶}©l°OżýĽĐĹҦě¸m
  4967.  
  4968. --§ó·sĄô°Č¶}©lIJµoľą°Ę§@«H®§(AddTrigger)
  4969. mission.begin.actions[n].p3 = param.data[n].p1 --©ÇŞ«Ăţ«¬ID
  4970. mission.begin.actions[n].p4 = param.data[n].p2 --©ÇŞ«ĽĆ¶q
  4971. mission.begin.actions[n].p5 = num --¶}©l°OżýĽĐĹҦě¸m
  4972. mission.begin.actions[n].p6 = 0
  4973.  
  4974. --§ó·sĄô°Č§ą¦¨±řĄó«H®§
  4975. num = num + param.data[n].p2
  4976. mission.result.conditions[n].p2 = num - 1 --±ţ¦ş©ÇŞ«Ä˛µoľą°OżýŞşĽĐ°O
  4977.  
  4978. --Ąô°Č¶}©l´y­z«H®§
  4979. PRINT( "RandMission, 2" )
  4980. local monstername = GetMonsterName( param.data[n].p1 )
  4981. PRINT( "RandMission, 3, count, talk, need[count].p2, monstername", n, mission.begin.talk, mission.need[n].p2, monstername )
  4982. local nummonster = 0
  4983. if mission.need[n+1].p2 ~= nil then
  4984. nummonster = mission.need[n+1].p2
  4985. end
  4986. mission.begin.talk = mission.begin.talk.."<r"..nummonster.."> <r\""..monstername.."\">"
  4987. mission.result.help = mission.result.help.."<r"..nummonster.."> <r\""..monstername.."\">"
  4988. mission.need[1].p1 = mission.need[1].p1.."<r"..nummonster.."> <r\""..monstername.."\">"
  4989. if n < param.numdata then
  4990. mission.begin.talk = mission.begin.talk.."ˇA"
  4991. mission.result.help = mission.result.help.."ˇA"
  4992. mission.need[1].p1 = mission.need[1].p1.."ˇA"
  4993. end
  4994. end
  4995.  
  4996. --Ąô°Čµ˛§ô°Ę§@(AddExpAndType)
  4997. mission.result.actions[2].p1 = param.exptp
  4998. mission.result.actions[2].p2 = param.exp
  4999. mission.result.actions[2].p3 = param.exp
  5000. PRINT( "RandMission:AddExpAndType, exp = ", mission.result.actions[2].p1 )
  5001.  
  5002. --Ąô°Č´y­z«H®§
  5003. --mission.begin.talk = mission.begin.talk.."ˇC"
  5004. --mission.result.talk = "<t>¶âˇA¬Ý°_¨Ó§AĆZ¨ăłĆ˝ŕŞ÷Ây¤HŞşŻŕ¤OŞşąŔˇAŘoˇAło¬Oµą§AĽúŔyˇA§Ć±ć§Ú­Ě¤U¦¸¦A¦X§@ˇC"
  5005. --mission.result.help = mission.result.help.."ˇC"
  5006.  
  5007. mission.begin.talk = mission.begin.talk..mission.begin.talkend
  5008. mission.result.talk = mission.result.talk..mission.result.talkend
  5009. mission.result.help = mission.result.help..mission.result.helpend
  5010. mission.need[1].p1 = mission.need[1].p1.."ˇC"
  5011.  
  5012. PRINT( "RandMission,4 " )
  5013. --ŔHľ÷Ąô°ČĽúŔy
  5014. mission.prize[1].p1 = param.money
  5015. if param.prizedata ~= 0 then
  5016. PRINT( "RandMission,5, prizetp, prizedata", param.prizetp, param.prizedata )
  5017. mission.prize[2].tp = param.prizetp
  5018. mission.prize[2].p1 = param.prizedata
  5019. mission.prize.count = 2
  5020. if param.prizetp == MIS_PRIZE_ITEM then
  5021. mission.prize[2].p2 = 1
  5022. mission.prize[2].p3 = param.bounty
  5023. mission.result.baggrid = 1
  5024. elseif param.prizetp == MIS_PRIZE_CESS then
  5025. mission.prize[2].p2 = 0
  5026. elseif param.prizetp == MIS_PRIZE_FAME then
  5027. mission.prize[2].p2 = 0
  5028. else
  5029. PRINT( "RandMission:Invalid reward type notice!misid = , tp = , p1 = ", param.id, param.prizetp, param.prizedata )
  5030. LG( "mission_error", "RandMission:: Invalid reward type notice!misid = , tp = , p1 = ", param.id, param.prizetp, param.prizedata )
  5031. mission.prize[2].tp = 0
  5032. mission.prize[2].p1 = 0
  5033. mission.prize.count = 1
  5034. end
  5035. else
  5036. PRINT( "RandMission,6" )
  5037. mission.prize.count = 1
  5038. end
  5039. PRINT( "RandMission,7" )
  5040. elseif mission.tp == MIS_RAND_GET then --Ŕň¨úŞ««~
  5041. --Ŕň¨úŞşŞ««~Ăţ«¬ĽĆ¶q
  5042. PRINT( "RandMission:tp = MIS_RAND_GET:param.numdata = ", param.numdata )
  5043. local num = 0
  5044. mission.begin.actions.count = param.numdata
  5045. mission.result.conditions.count = param.numdata * 2
  5046. mission.result.actions.count = 2 + param.numdata
  5047. mission.need.count = param.numdata + 1
  5048. mission.need[1].p1 = " <b"..param.npcarea..">'s<y"..param.npcname..">requires your help to collect"
  5049. mission.need[1].p1 = mission.need[1].p1.."<r"..param.numdata.."> items,"
  5050.  
  5051. --mission.begin.talk = "<t>§A¦nˇAŞB¤ÍˇC§Úło¸Ě«ć»Ý"
  5052. --mission.begin.talk = mission.begin.talk.."<r"..param.numdata..">ĽËŞF¦čˇA˝Đ§AŔ°§Ú¦¬¶°¨ěˇG"
  5053. --mission.result.help = "hmmˇA§A¦łŔ°§Ú¦¬¶°§Ú­nŞşŞF¦č»ňˇH§A¤Ł·|§Ń°O¤F§aˇH§Ú»Ý­n"
  5054. --mission.result.help = mission.result.help.."<r"..param.numdata..">ĽËŞF¦čˇA"
  5055. PRINT( mission.begin.talkstart, mission.result.talkstart, mission.result.helpstart )
  5056. PRINT( mission.begin.talkend, mission.result.talkend, mission.result.helpend )
  5057. mission.begin.talk = mission.begin.talkstart
  5058. mission.result.talk = mission.result.talkstart
  5059. mission.result.help = mission.result.helpstart
  5060.  
  5061. for n = 1, param.numdata, 1 do
  5062. --§ó·sĄô°Č»Ý¨D
  5063. mission.need[n+1].p1 = param.data[n].p1 --Ş««~Ăţ«¬ID
  5064. mission.need[n+1].p2 = param.data[n].p2 --Ş««~ĽĆ¶q
  5065. mission.need[n+1].p3 = num --¶}©l°OżýĽĐĹҦě¸m
  5066.  
  5067. --§ó·sĄô°Č¶}©lIJµoľą°Ę§@«H®§(AddTrigger)
  5068. mission.begin.actions[n].p3 = param.data[n].p1 --Ş««~Ăţ«¬ID
  5069. mission.begin.actions[n].p4 = param.data[n].p2 --Ş««~ĽĆ¶q
  5070. mission.begin.actions[n].p5 = num --¶}©l°OżýĽĐĹҦě¸m
  5071. mission.begin.actions[n].p6 = 0
  5072.  
  5073. --Ąô°Čµ˛§ô°Ę§@(TakeItem)
  5074. mission.result.actions[n+2].p1 = param.data[n].p1
  5075. mission.result.actions[n+2].p2 = param.data[n].p2
  5076. PRINT( "RandMission:TakeItem, item = , num = ", mission.result.actions[n+2].p1, mission.result.actions[n+2].p2 )
  5077.  
  5078. --§ó·sĄô°Č§ą¦¨±řĄó«H®§
  5079. num = num + param.data[n].p2
  5080. --ł]¸mHasFlag ¨çĽĆ°ŃĽĆ
  5081. mission.result.conditions[1 + (n - 1)*2].p2 = num - 1 --Ŕň¨úŞ««~IJµoľą°OżýŞşĽĐ°O
  5082. --ł]¸mHasItem ¨çĽĆ°ŃĽĆ
  5083. mission.result.conditions[2 + (n - 1)*2].p1 = param.data[n].p1 --Ŕň¨úŞ««~Ăţ«¬ID
  5084. mission.result.conditions[2 + (n - 1)*2].p2 = param.data[n].p2 --Ŕň¨úŞ««~ĽĆ¶q
  5085.  
  5086. --Ąô°Č¶}©l´y­z«H®§
  5087. local itemname = GetItemName( param.data[n].p1 )
  5088. mission.begin.talk = mission.begin.talk.."<r"..mission.need[n+1].p2.."> <r"..itemname..">"
  5089. mission.result.help = mission.result.help.."<r"..mission.need[n+1].p2.."> <r"..itemname..">"
  5090. mission.need[1].p1 = mission.need[1].p1.."<r"..mission.need[n+1].p2.."> <r"..itemname..">"
  5091. if n < param.numdata then
  5092. mission.begin.talk = mission.begin.talk.."ˇA"
  5093. mission.result.help = mission.result.help.."ˇA"
  5094. mission.need[1].p1 = mission.need[1].p1.."ˇA"
  5095. end
  5096. end
  5097.  
  5098. --Ąô°Čµ˛§ô°Ę§@(AddExpAndType)
  5099. mission.result.actions[2].p1 = param.exptp
  5100. mission.result.actions[2].p2 = param.exp
  5101. mission.result.actions[2].p3 = param.exp
  5102. PRINT( "RandMission:AddExpAndType, exp = ", mission.result.actions[2].p1 )
  5103.  
  5104. --Ąô°Č´y­z«H®§
  5105. --mission.begin.talk = mission.begin.talk.."ˇC"
  5106. --mission.result.help = mission.begin.talk.."°O¦n¤FˇA¤Ö¤@­ÓłŁ¤Ł¦ćˇI"
  5107. --mission.result.talk = "<t>°Ú«˘ˇA©Ż¦n¦ł§AŔ°¦ŁˇAło¦¸§ÚŞş¦¬ÂĂ«~§óĄ[Â×´I¤FˇAło¬Oµą§AŞşĽúŔyˇA¦pŞG§A¦łżł˝ě¦A¨Ó§ä§ÚˇC"
  5108. mission.need[1].p1 = mission.need[1].p1.."ˇC"
  5109.  
  5110. mission.begin.talk = mission.begin.talk..mission.begin.talkend
  5111. mission.result.talk = mission.result.talk..mission.result.talkend
  5112. mission.result.help = mission.result.help..mission.result.helpend
  5113.  
  5114. --ŔHľ÷Ąô°ČĽúŔy
  5115. mission.prize[1].p1 = param.money
  5116. if param.prizedata ~= 0 then
  5117. PRINT( "RandMission,5, prizetp, prizedata", param.prizetp, param.prizedata )
  5118. mission.prize[2].tp = param.prizetp
  5119. mission.prize[2].p1 = param.prizedata
  5120. mission.prize.count = 2
  5121. if param.prizetp == MIS_PRIZE_ITEM then
  5122. mission.prize[2].p2 = 1
  5123. mission.prize[2].p3 = param.bounty
  5124. mission.result.baggrid = 1
  5125. elseif param.prizetp == MIS_PRIZE_CESS then
  5126. mission.prize[2].p2 = 0
  5127. elseif param.prizetp == MIS_PRIZE_FAME then
  5128. mission.prize[2].p2 = 0
  5129. else
  5130. PRINT( "RandMission:Invalid reward type notice!misid = , tp = , p1 = ", param.id, param.prizetp, param.prizedata )
  5131. LG( "mission_error", "RandMission:Invalid reward type notice!misid = , tp = , p1 = ", param.id, param.prizetp, param.prizedata )
  5132. mission.prize[2].tp = 0
  5133. mission.prize[2].p1 = 0
  5134. mission.prize.count = 1
  5135. end
  5136. else
  5137. PRINT( "RandMission,6" )
  5138. mission.prize.count = 1
  5139. end
  5140.  
  5141. elseif mission.tp == MIS_RAND_SEND then --°eŞ««~
  5142. --°eŞşŞ««~Ăţ«¬ĽĆ¶q
  5143. local num = 0
  5144. mission.begin.actions.count = param.numdata
  5145. mission.result.conditions.count = param.numdata
  5146. mission.need.count = param.numdata + 1 --»Ý­nĄH«á˛KĄ[·sŞşĄô°ČĄŘĽĐĂţ«¬
  5147. mission.need[1].p1 = " <b"..param.npcarea..">'s<y"..param.npcname..">needs you to help him on an errand. He will reward you after you return."
  5148.  
  5149. --mission.begin.talk = "<t>§A¦nˇAŞB¤ÍˇC§Úło¸Ě¦ł"
  5150. --mission.begin.talk = mission.begin.talk.."<r"..param.numdata..">ĽËŞF¦čˇA˝Đ§â"
  5151. --mission.result.help = "<t>¶ŮˇAŞB¤ÍˇA§Ú¦«§A°eŞş"
  5152. --mission.result.help = mission.result.help.."<r"..param.numdata..">ĽËŞF¦čłŁ°e¨ě¤F¨S¦ł®@ˇH§â"
  5153.  
  5154. PRINT( mission.begin.talkstart, mission.result.talkstart, mission.result.helpstart )
  5155. PRINT( mission.begin.talkend, mission.result.talkend, mission.result.helpend )
  5156. mission.begin.talk = mission.begin.talkstart
  5157. mission.result.talk = mission.result.talkstart
  5158. mission.result.help = mission.result.helpstart
  5159.  
  5160. for n = 1, param.numdata, 1 do
  5161. --§ó·sĄô°Č¶}©lIJµoľą°Ę§@«H®§(GiveItem)
  5162. mission.begin.actions[n].p1 = param.data[n].p2 --Ş««~ID
  5163. mission.begin.actions[n].p2 = 1
  5164. PRINT( "RandMission: GiveItem item = , count = ", mission.begin.actions[n].p2, 1 )
  5165.  
  5166. --§ó·sĄô°Č§ą¦¨±řĄó«H®§(HasRandItemFlag)
  5167. mission.result.conditions[n].p2 = param.data[n].p1 --ŔË´ú¬O§_¦łNPC¦¬¨ěŞ«ĄóŞşĽĐ°O
  5168.  
  5169. --Ąô°Č¶}©l´y­z«H®§
  5170. local npcname = GetNpcName( param.data[n].p1 )
  5171. PRINT( "RandMission, npcname = ", npcname )
  5172. local areaname = GetAreaName( param.data[n].p3 )
  5173. PRINT( "RandMission, areaname = ", areaname )
  5174. local itemname = GetItemName( param.data[n].p2 )
  5175. mission.begin.talk = mission.begin.talk.."<r["..itemname.."]> to give <p"..areaname..">'s <b\""..npcname.."\">"
  5176. mission.result.help = mission.result.help.."<r["..itemname.."]> to give <p"..areaname..">'s <b\""..npcname.."\">"
  5177. if n < param.numdata then
  5178. mission.begin.talk = mission.begin.talk.."ˇA"
  5179. mission.result.help = mission.result.help.."ˇA"
  5180. end
  5181. PRINT( "RandMission, talk = ", mission.begin.talk )
  5182.  
  5183. --§ó·sĄô°Č»Ý¨D
  5184. mission.need[n+1].p1 = n..") hold <r["..itemname.."]> pass to <p"..areaname..">'s <b\""..npcname.."\">" --Ąô°ČĄŘĽĐ
  5185. PRINT( "RandMission: need.p1 = ", mission.need[n+1].p1 )
  5186. end
  5187.  
  5188. --Ąô°Čµ˛§ô°Ę§@(AddExpAndType)
  5189. mission.result.actions[2].p1 = param.exptp
  5190. mission.result.actions[2].p2 = param.exp
  5191. mission.result.actions[2].p3 = param.exp
  5192. PRINT( "RandMission:AddExpAndType, exp = ", mission.result.actions[2].p1 )
  5193.  
  5194. --Ąô°Č´y­z«H®§
  5195. mission.begin.baggrid = param.numdata
  5196. --mission.begin.talk = mission.begin.talk.."ˇC"
  5197. --mission.result.help = mission.result.help.."ˇC"
  5198. --mission.result.talk = "<t>«zˇA§AŞşłt«×¦n§ÖąŔˇA´N¤w¸g§âŞF¦č°e¨ě¤F®@ˇAÁÂÁ§AŞB¤ÍˇAło¬O§AŞşłŇ°Ę©Ň±oˇA¤U¦¸¦łŞĹ¦A¨Ó®@ˇC"
  5199.  
  5200. mission.begin.talk = mission.begin.talk..mission.begin.talkend
  5201. mission.result.talk = mission.result.talk..mission.result.talkend
  5202. mission.result.help = mission.result.help..mission.result.helpend
  5203.  
  5204. --ŔHľ÷Ąô°ČĽúŔy
  5205. mission.prize[1].p1 = param.money
  5206. if param.prizedata ~= 0 then
  5207. PRINT( "RandMission,5, prizetp, prizedata", param.prizetp, param.prizedata )
  5208. mission.prize[2].tp = param.prizetp
  5209. mission.prize[2].p1 = param.prizedata
  5210. mission.prize.count = 2
  5211. if param.prizetp == MIS_PRIZE_ITEM then
  5212. mission.prize[2].p2 = 1
  5213. mission.prize[2].p3 = param.bounty
  5214. mission.result.baggrid = 1
  5215. elseif param.prizetp == MIS_PRIZE_CESS then
  5216. mission.prize[2].p2 = 0
  5217. elseif param.prizetp == MIS_PRIZE_FAME then
  5218. mission.prize[2].p2 = 0
  5219. else
  5220. PRINT( "RandMission:Invalid reward type notice!misid = , tp = , p1 = ", param.id, param.prizetp, param.prizedata )
  5221. LG( "mission_error", "RandMission: Invalid reward type notice!misid = , tp = , p1 = ", param.id, param.prizetp, param.prizedata )
  5222. mission.prize[2].tp = 0
  5223. mission.prize[2].p1 = 0
  5224. mission.prize.count = 1
  5225. end
  5226. else
  5227. PRINT( "RandMission,6" )
  5228. mission.prize.count = 1
  5229. end
  5230.  
  5231. elseif mission.tp == MIS_RAND_CONVOY then --Ĺ@°eNPC
  5232. --Ĺ@°eŞşNPC
  5233. local num = 0
  5234. mission.begin.actions.count = 1 + param.numdata*2
  5235. mission.result.conditions.count = param.numdata
  5236. mission.need.count = param.numdata + 1 --»Ý­nĄH«á˛KĄ[·sŞşĄô°ČĄŘĽĐĂţ«¬
  5237. mission.need[1].p1 = " <b"..param.npcarea..">'s <y"..param.npcname..">needs your help to escort some people to another place. You can get your reward from him after you return."
  5238.  
  5239. --mission.begin.talk = "<t>§A¦nˇAŞB¤ÍˇC§AÄ@·N"
  5240.  
  5241. PRINT( mission.begin.talkstart, mission.result.talkstart, mission.result.helpstart )
  5242. PRINT( mission.begin.talkend, mission.result.talkend, mission.result.helpend )
  5243. mission.begin.talk = mission.begin.talkstart
  5244. mission.result.talk = mission.result.talkstart
  5245. mission.result.help = mission.result.helpstart
  5246.  
  5247. for n = 1, param.numdata, 1 do
  5248. --§ó·sĄô°Č¶}©lIJµoľą°Ę§@«H®§(AddTrigger)
  5249. mission.begin.actions[2 + (n - 1)*2].p3 = param.data[n].p2 --map ID
  5250. mission.begin.actions[2 + (n - 1)*2].p4 = param.data[n].p4 --x
  5251. mission.begin.actions[2 + (n - 1)*2].p5 = param.data[n].p5 --y
  5252. mission.begin.actions[2 + (n - 1)*2].p6 = param.data[n].p6 --scope
  5253.  
  5254. --ConvoyNpc
  5255. mission.begin.actions[3 + (n - 1)*2].p2 = n - 1 --convoy index npc
  5256. mission.begin.actions[3 + (n - 1)*2].p3 = param.data[n].p1 -- charid
  5257.  
  5258. PRINT( "RandMission: Convoy npcid = to map = , x = , y = , scope = ", mission.begin.actions[3 + (n - 1)*2].p3, mission.begin.actions[2 + (n - 1)*2].p3, mission.begin.actions[2 + (n - 1)*2].p4, mission.begin.actions[2 + (n - 1)*2].p5, mission.begin.actions[2 + (n - 1)*2].p6 )
  5259.  
  5260. --§ó·sĄô°Č§ą¦¨±řĄó«H®§(HasFlag)
  5261.  
  5262. --Ąô°Č¶}©l´y­z«H®§
  5263. local npcname = GetMonsterName( param.data[n].p1 ) --charinfo name
  5264. PRINT( "RandMission, npcname = ", npcname )
  5265. local areaname = GetAreaName( param.data[n].p3 )
  5266. PRINT( "RandMission, areaname = ", areaname )
  5267.  
  5268. mission.begin.talk = mission.begin.talk.."escort <b\""..npcname.."\"> reached <p"..areaname..">'s <b"..param.data[n].p4.."ˇA"..param.data[n].p5.."> nearby?"
  5269. PRINT( "RandMission, talk = ", mission.begin.talk )
  5270.  
  5271. --§ó·sĄô°Č»Ý¨D
  5272. mission.need[n+1].p1 = n..") escort <b\""..npcname.."\"> reached <p"..areaname..">" --Ąô°ČĄŘĽĐ
  5273. PRINT( "RandMission: need.p1 = ", mission.need[n+1].p1 )
  5274. end
  5275.  
  5276. --Ąô°Čµ˛§ô°Ę§@(AddExpAndType)
  5277. mission.result.actions[2].p1 = param.exptp
  5278. mission.result.actions[2].p2 = param.exp
  5279. mission.result.actions[2].p3 = param.exp
  5280. PRINT( "RandMission:AddExpAndType, exp = ", mission.result.actions[2].p1 )
  5281.  
  5282. --Ąô°Č´y­z«H®§
  5283. --mission.begin.talk = mission.begin.talk.."§A­n¦b<r¤@­Ó¤p®É>ĄH¤şżě§´łoĄó¨ĆˇC"
  5284. --mission.result.talk = mission.begin.talk
  5285. --mission.result.help = mission.begin.talk
  5286.  
  5287. mission.begin.talk = mission.begin.talk..mission.begin.talkend
  5288. mission.result.talk = mission.result.talk..mission.result.talkend
  5289. mission.result.help = mission.result.help..mission.result.helpend
  5290.  
  5291. --ŔHľ÷Ąô°ČĽúŔy
  5292. mission.prize[1].p1 = param.money
  5293. if param.prizedata ~= 0 then
  5294. PRINT( "RandMission,5, prizetp, prizedata", param.prizetp, param.prizedata )
  5295. mission.prize[2].tp = param.prizetp
  5296. mission.prize[2].p1 = param.prizedata
  5297. mission.prize.count = 2
  5298. if param.prizetp == MIS_PRIZE_ITEM then
  5299. mission.prize[2].p2 = 1
  5300. mission.prize[2].p3 = param.bounty
  5301. mission.result.baggrid = 1
  5302. elseif param.prizetp == MIS_PRIZE_CESS then
  5303. mission.prize[2].p2 = 0
  5304. elseif param.prizetp == MIS_PRIZE_FAME then
  5305. mission.prize[2].p2 = 0
  5306. else
  5307. PRINT( "RandMission:Invalid reward type notice!misid = , tp = , p1 = ", param.id, param.prizetp, param.prizedata )
  5308. LG( "mission_error", "RandMission:Invalid reward type notice!misid = , tp = , p1 = ", param.id, param.prizetp, param.prizedata )
  5309. mission.prize[2].tp = 0
  5310. mission.prize[2].p1 = 0
  5311. mission.prize.count = 1
  5312. end
  5313. else
  5314. PRINT( "RandMission,6" )
  5315. mission.prize.count = 1
  5316. end
  5317.  
  5318. elseif mission.tp == MIS_RAND_EXPLORE then --±´ŻÁ¦aąĎ
  5319.  
  5320. end
  5321.  
  5322. return LUA_TRUE
  5323. end
  5324.  
  5325. ------------µą¤©0Żŕ¶qŞş¤kŻ«ŔJął
  5326. function GiveNSDX ( character , npc , value )
  5327. local r1=0
  5328. local r2=0
  5329. r1,r2 =MakeItem ( character , value , 1 , 4 )
  5330. local Item_NSDX = GetChaItem2 ( character , 2 , r2 )
  5331. local NUM_NOW = 0
  5332. local Item_NSDX_NOW = GetChaItem2 ( character , 2 , 3010 )
  5333. SetItemAttr( Item_NSDX_NOW , ITEMATTR_ENERGY , NUM_NOW )
  5334. RefreshCha( character )
  5335. end
  5336.  
  5337. -----------§PÂ_¤kŻ«ŔJąłŻŕ¶q¬O§_ąF¨ě999
  5338. function CheckEnergy ( character )
  5339. local NSDX_Num = CheckBagItem( character, 3010 )
  5340. ---SystemNotice(character,""..HHS_Num)
  5341. if NSDX_Num ~= 1 then
  5342. return 0
  5343. end
  5344. local role_NSDX = GetChaItem2 ( character , 2 , 3010 )
  5345. local attr_energy = GetItemAttr ( role_NSDX, ITEMATTR_ENERGY)
  5346. if attr_energy ~= 999 then
  5347. return LUA_FALSE
  5348. end
  5349.  
  5350. return LUA_TRUE
  5351. end
  5352.  
  5353. -----------------------§PÂ_¨¤¦â¨S¦łÂŕĄÍ¸gĹç
  5354. function HasNOZSExp ( character )
  5355. local attr_zsexp = GetChaAttr ( character , ATTR_CSAILEXP )
  5356. if attr_zsexp == 0 then
  5357. return LUA_TRUE
  5358. end
  5359.  
  5360. return LUA_FALSE
  5361. end
  5362.  
  5363. ------------------------§PÂ_¨­¤W¨S¦ł¬YşŘąD¨ă
  5364. function HasNoItem( character ,value )
  5365. local item_number = CheckBagItem( character, value )
  5366. if item_number >= 1 then
  5367. return LUA_FALSE
  5368. end
  5369. return LUA_TRUE
  5370. end
  5371. function AddChaItem7(character)
  5372. ------------¨ú¤ÉŻĹ¦Ň¨÷Şş«ü°w
  5373. local r1=0
  5374. local r2=0
  5375. r1,r2 =MakeItem ( character , 3280 , 1 , 4 )
  5376. local Item_new = GetChaItem ( character , 2 , r2 )
  5377.  
  5378. ----------°Ożý®É¶ˇ
  5379. local now_yes = os.date("%y") -------------¦~
  5380. local now_month= os.date("%m") -------------¤ë
  5381. local now_day= os.date("%d") -------------¤é
  5382. local now_hour= os.date("%H") -------------®É
  5383. local now_miniute= os.date("%M") -------------¤Ŕ
  5384. local now_scend= os.date("%S") -------------’
  5385. now_yes = tonumber(now_yes) -------------¦~
  5386. now_month= tonumber(now_month) -------------¤ë
  5387. now_day= tonumber(now_day) -------------¤é
  5388. now_hour= tonumber(now_hour) -------------®É
  5389. now_miniute= tonumber(now_miniute) -------------¤Ŕ
  5390. now_scend= tonumber(now_scend) -------------’
  5391. SetItemAttr(Item_new, ITEMATTR_VAL_STA, now_month ) -------------¤ë
  5392. SetItemAttr(Item_new, ITEMATTR_VAL_STR, now_day ) -------------¤é
  5393. SetItemAttr(Item_new, ITEMATTR_VAL_CON, now_hour ) -------------®É
  5394. SetItemAttr(Item_new, ITEMATTR_VAL_DEX, now_miniute ) -------------¤Ŕ
  5395. SetItemAttr(Item_new, ITEMATTR_VAL_AGI, now_scend ) -------------’
  5396. SynChaKitbag(character,13)
  5397. return LUA_TRUE
  5398. end
  5399.  
  5400. function CheckKJNum ( character )
  5401. local num_kj=CheckBagItem( character , 3280 )
  5402. if num_kj == 1 then
  5403. return LUA_TRUE
  5404. end
  5405. end
  5406. function AddChaItem8(character)
  5407. ------------¨ú¤ÉŻĹ¦Ň¨÷Şş«ü°w
  5408. local role_kj=GetChaItem2( character , 2 , 3280 )
  5409. ----------°Ożý®É¶ˇ
  5410. local now_yes = os.date("%y") -------------¦~
  5411. local now_month= os.date("%m") -------------¤ë
  5412. local now_day= os.date("%d") -------------¤é
  5413. local now_hour= os.date("%H") -------------®É
  5414. local now_miniute= os.date("%M") -------------¤Ŕ
  5415. local now_scend= os.date("%S") -------------’
  5416. now_yes = tonumber(now_yes) -------------¦~
  5417. now_month= tonumber(now_month) -------------¤ë
  5418. now_day= tonumber(now_day) -------------¤é
  5419. now_hour= tonumber(now_hour) -------------®É
  5420. now_miniute= tonumber(now_miniute) -------------¤Ŕ
  5421. now_scend= tonumber(now_scend) -------------’
  5422.  
  5423. ---------¨ú¤ÉŻĹ¦Ň¨÷Şş®É¶ˇ
  5424. local old_month = GetItemAttr(role_kj, ITEMATTR_VAL_STA) -------------¤ë
  5425. local old_day = GetItemAttr(role_kj, ITEMATTR_VAL_STR) -------------¤é
  5426. local old_hour = GetItemAttr(role_kj, ITEMATTR_VAL_CON) -------------®É
  5427. local old_miniute = GetItemAttr(role_kj, ITEMATTR_VAL_DEX) -------------¤Ŕ
  5428. local old_scend = GetItemAttr(role_kj, ITEMATTR_VAL_AGI) -------------’
  5429. ---------§R°Ł¤ÉŻĹ¦Ň¨÷
  5430. local del_item =TakeItem( character, 0,3280, 1 )
  5431. if del_item==0 then
  5432. SystemNotice ( character ,"§R°Ł¤ÉŻĹ¦Ň¨÷Ą˘±Ń")
  5433. end
  5434.  
  5435. local used_time=(now_scend - old_scend)+(now_miniute - old_miniute)*60+(now_hour - old_hour)*3600+(now_day - old_day)*86400+(JNSTime_Flag[now_month] - JNSTime_Flag[old_month] )*86400
  5436. ------------¨ú¤ÉŻĹ¦¨ÁZłćŞş«ü°w
  5437. local r1=0
  5438. local r2=0
  5439. r1,r2 =MakeItem ( character , 3281 , 1 , 4 )
  5440. local Item_new = GetChaItem ( character , 2 , r2 )
  5441. SetItemAttr(Item_new, ITEMATTR_VAL_AGI, used_time ) -------------’
  5442. SynChaKitbag(character,13)
  5443. return LUA_TRUE
  5444. end
  5445.  
  5446.  
  5447. ----------´úĹç§PÂ_¦¨ÁZłć®É¶ˇ
  5448. function checkcytime( character , npc )
  5449. local role_xsz = GetChaItem2 ( character , 2 , 3289 )
  5450. local exp_xsz = GetItemAttr ( role_xsz , ITEMATTR_ENERGY ) -----¨úľÇĄÍĂŇ·í«e¸gĹç
  5451. local mexp_xsz = GetItemAttr ( role_xsz , ITEMATTR_MAXENERGY ) -----¨úľÇĄÍĂҳ̤j¸gĹç
  5452. local newexp_xsz = exp_xsz * 1000
  5453. local ch_xsz = GetItemAttr ( role_xsz , ITEMATTR_URE ) -----¨úľÇĄÍĂŇ·í«eľÇ¤Ŕ
  5454. local mch_xsz = GetItemAttr ( role_xsz, ITEMATTR_MAXURE ) -----¨úľÇĄÍĂҳ̤jľÇ¤Ŕ
  5455. local role_cjd = GetChaItem2 ( character , 2 , 3279 )
  5456. local cha_name = GetChaDefaultName ( character )
  5457. local newch_xsz = ch_xsz + math.floor(50*(exp_xsz/mexp_xsz))
  5458. if newch_xsz <= mch_xsz then
  5459. SystemNotice ( character , "®Ąłß§AłqąL¤F¦Ň¸ŐľÇ¤ŔĽWĄ[")
  5460. SetItemAttr ( role_xsz , ITEMATTR_URE , newch_xsz ) ------ł]¸mľÇĄÍĂŇ·sŞşľÇ¤Ŕ
  5461. AddExp ( character , npc , newexp_xsz , newexp_xsz )
  5462. SetItemAttr ( role_xsz, ITEMATTR_ENERGY, 0 )
  5463. RefreshCha( character )
  5464. else
  5465. SystemNotice( character , "®Ąłß§AłqąL¦Ň¸ŐˇAľÇ¤Ŕ¤wąF¤W­­ˇA¤ŁŻŕĽWĄ[")
  5466. AddExp ( character , npc, newexp_xsz , newexp_xsz )
  5467. SetItemAttr ( role_xsz , ITEMATTR_URE , mch_xsz ) ------ł]¸mľÇĄÍĂŇ·sŞşľÇ¤Ŕ
  5468. SetItemAttr ( role_xsz, ITEMATTR_ENERGY, 0 )
  5469. RefreshCha( character )
  5470. end
  5471. local del_item =TakeItem( character, 0,3279, 1 )
  5472. if del_item == 0 then
  5473. SystemNotice( character, "§R°Ł´úĹ禨ÁZłćĄ˘±Ń")
  5474. end
  5475. return LUA_TRUE
  5476. end
  5477.  
  5478. ----------¤ÉŻĹ¦Ň¸Ő§PÂ_¦¨ÁZłć®É¶ˇ
  5479. function checksjtime( character ,npc )
  5480. local role_xsz = GetChaItem2 ( character , 2 , 3289 )
  5481. local lv_ch = GetItemAttr ( role_xsz , ITEMATTR_FORGE ) ----¨úľÇĄÍĂŇ·í«eľÇľú
  5482. local role_cjd = GetChaItem2 ( character , 2 , 3281 )
  5483. local time_cjd = GetItemAttr ( role_cjd , ITEMATTR_VAL_AGI )
  5484. local cha_name = GetChaDefaultName ( character )
  5485. if time_cjd > 0 and time_cjd <= 1800 then
  5486. LG("Player"..cha_name.."¦¨Ą\łqąL¤ÉŻĹ¦Ň¸ŐˇAľÇľú¤WŞ@ˇI")
  5487. lv_ch = lv_ch + 1
  5488. SetItemAttr( role_xsz , ITEMATTR_FORGE , lv_ch ) ----ł]¸mľÇĄÍĂŇ·sŞşľÇľú
  5489. SetItemAttr( role_xsz , ITEMATTR_URE , 0 ) ----ľÇ¤Ŕ˛Mąs
  5490. local new_mch = Reading_Credit[lv_ch]
  5491. local new_mexp = Reading_EXP[lv_ch]
  5492. SetItemAttr( role_xsz , ITEMATTR_MAXURE , new_mch ) ----ł]¸mľÇĄÍĂŇ·sŞşłĚ¤jľÇ¤Ŕ
  5493. SetItemAttr( role_xsz , ITEMATTR_MAXENERGY , new_mexp ) ----ł]¸mľÇĄÍĂŇ·sŞşłĚ¤j¸gĹç
  5494. RefreshCha( character )
  5495. elseif time_cjd > 1800 then
  5496. LG("Player"..cha_name.."ĄĽŻŕłqąL¤ÉŻĹ¦Ň¸ŐˇA»Ý­nŻdŻĹˇI")
  5497. end
  5498. local del_item =TakeItem( character, 0,3281, 1 )
  5499. if del_item == 0 then
  5500. SystemNotice( character, "§R°Ł¤ÉŻĹ¦Ň¸Ő¦¨ÁZłćĄ˘±Ń")
  5501. end
  5502. return LUA_TRUE
  5503. end
  5504. ------------------addexp¸gĹç˛~łB˛zĄ]´ß
  5505. --function AddExp2 ( role , npc, p1, p2 )
  5506. -- local lv = GetChaAttr(role, ATTR_LV)
  5507. -- if lv == 100 then
  5508. -- local i = CheckBagItem ( role, 171 )
  5509. -- if i == 1 then
  5510. -- local role_jyp = GetChaItem2 ( role, 2, 171)
  5511. -- local exp_store = GetItemAttr ( role_jyp, ITEMATTR_VAL_PARAM1 )
  5512. -- local exp_add = (p1+p2)/2
  5513. -- exp_store = exp_store+exp_add
  5514. -- SetItemAttr ( role_jyp, ITEMATTR_VAL_PARAM1, exp_store)
  5515. -- SystemNotice( role, "§AŞş¸gĹç˛~¤¤Şşżn¤ŔĽWĄ[¤F"..exp_add)
  5516. -- else
  5517. -- AddExp ( role , npc , p1 , p2 )
  5518. -- end
  5519. -- else
  5520. -- AddExp ( role , npc , p1 , p2 )
  5521. -- end
  5522. -- return LUA_TRUE
  5523. --end
  5524.  
  5525. function HasXmasYB ( role, value ) -------------§PÂ_¬O§_¦ł¨¬°÷µwąô
  5526. local num_wyyb = CheckBagItem( role, 2962 )
  5527. local num_bwyb = CheckBagItem( role, 2963 )
  5528. local money = num_wyyb + num_bwyb * 100
  5529. if money >= value then
  5530. return LUA_TRUE
  5531. end
  5532. end
  5533.  
  5534. function TakeXmasYB ( role, value ) -------------´Ł¨úµwąô
  5535. local num_bwyb = math.floor( value/100 )
  5536. local num_wyyb = math.mod ( value , 100 )
  5537. local bag_bwyb = CheckBagItem( role, 2963 )
  5538. local bag_wyyb = CheckBagItem( role, 2962 )
  5539. if bag_wyyb < num_wyyb then
  5540. num_bwyb = num_bwyb +1
  5541. zhaoling = num_bwyb * 100 - value
  5542. num_wyyb = 0
  5543. GiveItem ( role , 0, 2962, zhaoling, 4)
  5544. elseif bag_bwyb < num_bwyb then
  5545. num_bwyb = bag_bwyb
  5546. num_wyyb = value - ( num_bwyb * 100 )
  5547. end
  5548. if num_wyyb ~= 0 then
  5549. local ret1 = TakeItem ( role, 0, 2962, num_wyyb)
  5550. end
  5551. if num_bwyb ~= 0 then
  5552. local ret2 = TakeItem ( role, 0, 2963, num_bwyb)
  5553. end
  5554. return LUA_TRUE
  5555. end
  5556.  
  5557. function CpHuojiNum ( role ) -----------------­pşâłQ±ţ¤őÂűĽĆ¶q
  5558. XmasMonsterNum1 = XmasMonsterNum1 + 100
  5559. XmasMonsterNum4 = XmasMonsterNum4 + 100
  5560. XmasMonsterNum5 = XmasMonsterNum5 + 100
  5561. return LUA_TRUE
  5562. end
  5563.  
  5564. function CpMiluNum ( role ) ------------------­pşâłQ±ţÂGłŔĽĆ¶q
  5565. XmasMonsterNum2 = XmasMonsterNum2 + 100
  5566. XmasMonsterNum4 = XmasMonsterNum4 + 100
  5567. XmasMonsterNum5 = XmasMonsterNum5 + 100
  5568. return LUA_TRUE
  5569. end
  5570.  
  5571. function CpXuerenNum ( role ) ------------------­pşâłQ±ţł·¤HĽĆ¶q
  5572. XmasMonsterNum3 = XmasMonsterNum3 + 100
  5573. XmasMonsterNum5 = XmasMonsterNum5 + 100
  5574. return LUA_TRUE
  5575. end
  5576.  
  5577. function XmasNotice ( role, value ) ------------------¸t˝Ď§ř¦Ű°Ę´ŁĄÜ
  5578. local cha_name = GetChaDefaultName ( role )
  5579. local message={}
  5580. message[1]="Santa Claus: Welcome to the Christmas Village," .. cha_name .. ", if you are a first time here, you can find next to the Christmas Village • mushrooms first to find out the village!"
  5581. message[2]="Indigenous revelers:" .. cha_name .. "~ to dance with us, dancing around the campfire together dance, prayer will be better next year!"
  5582. message[3]="Cohen said quietly to you:" .. cha_name .. ", Come on, I referred to you to complete the task to so that more of the BOSS comes to Christmas in the Arena!"
  5583. message[4]="small Tom: see ah ah ~ ~ look at that person I know that he called" .. cha_name .. ", I grow up I as he must be so strong!"
  5584. SystemNotice( role , message[value] )
  5585. return LUA_TRUE
  5586. end
  5587.  
  5588. function QuestFunc(Player, Mission, Type, Func)
  5589. local Name = GetChaDefaultName(Player)
  5590. local Day = (tonumber(os.date("%Y")) * 10000) + (tonumber(os.date("%m")) * 100) + (tonumber(os.date("%d")))
  5591. local Week = (tonumber(os.date("%Y")) * 100) + (os.date("%V"))
  5592. if QuestLog[Name] == nil then
  5593. QuestLog[Name] = {}
  5594. end
  5595. if QuestLog[Name][Mission] == nil then
  5596. QuestLog[Name][Mission] = {}
  5597. end
  5598. if Type == "Daily" then
  5599. if QuestLog[Name][Mission][Day] == nil then
  5600. QuestLog[Name][Mission][Day] = false
  5601. end
  5602. if Func == "Check" then
  5603. if QuestLog[Name][Mission][Day] == false then
  5604. return LUA_TRUE
  5605. elseif QuestLog[Name][Mission][Day] == true then
  5606. return LUA_FALSE
  5607. end
  5608. elseif Func == "Completed" then
  5609. QuestLog[Name][Mission][Day] = true
  5610. return LUA_TRUE
  5611. end
  5612. elseif Type == "Weekly" then
  5613. if QuestLog[Name][Mission][Week] == nil then
  5614. QuestLog[Name][Mission][Week] = false
  5615. end
  5616. if Func == "Check" then
  5617. if QuestLog[Name][Mission][Week] == false then
  5618. return LUA_TRUE
  5619. elseif QuestLog[Name][Mission][Week] == true then
  5620. return LUA_FALSE
  5621. end
  5622. elseif Func == "Completed" then
  5623. QuestLog[Name][Mission][Week] = true
  5624. return LUA_TRUE
  5625. end
  5626. end
  5627. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement