V14 Event zum laufen bringen!

  • Werbung zur Unterstützung des Forums ( Bitte AddBlocker deaktivieren )

  • Ganz cleverer Bursche, einfach v14 Events nehmen..
    Auf sowas kommt man ja nicht so schnell :>

    EventFunc.lua

    Brainfuck-Quellcode

    1. tEvent = {} -- À̺¥Æ® ÀúÀå Å×À̺í
    2. tNotice = {} -- Á¡°Ë ÀÚµ¿ °øÁö
    3. bNotice = false
    4. function SEC( n )
    5. return n*1000
    6. end
    7. function MIN( n )
    8. return n*SEC(60)
    9. end
    10. -----------------------------------------------------------------------------------
    11. function Notice( strTime, nInterval, nNoticeCount )
    12. tNotice.strTime = strTime
    13. tNotice.nInterval = nInterval
    14. tNotice.nNoticeCount = nNoticeCount
    15. tNotice.tMessage = {}
    16. end
    17. function AddMessage( strMessage )
    18. local nSize = table.getn( tNotice.tMessage ) + 1
    19. tNotice.tMessage[nSize] = strMessage
    20. end
    21. function IsNoticeTime()
    22. if( (bNotice == true) and (tNotice.nNoticeCount > 0) and (tNotice.strTime == os.date("%a %H:%M")) ) then
    23. tNotice.nNoticeCount = tNotice.nNoticeCount - 1
    24. SetNextNoticeTime()
    25. return true
    26. end
    27. return false
    28. end
    29. function SetNextNoticeTime()
    30. local nMin = tonumber( os.date( "%M" ) )
    31. local nHour = tonumber( os.date( "%H" ) )
    32. local strTemp;
    33. tNotice.strTime = os.date( "%a " )
    34. nMin = nMin + tNotice.nInterval;
    35. if( nMin > 59 ) then
    36. nMin = 60 - nMin
    37. nHour = nHour + 1
    38. end
    39. -- ½Ã
    40. strTemp = tostring( nHour )..":"
    41. if( nHour < 10 ) then strTemp = "0"..strTemp end
    42. tNotice.strTime = tNotice.strTime .. strTemp
    43. -- ºÐ
    44. strTemp = tostring( nMin )
    45. if( nMin < 10 ) then strTemp = "0"..strTemp end
    46. tNotice.strTime = tNotice.strTime .. strTemp
    47. end
    48. function GetNoticeMessage()
    49. return tNotice.tMessage
    50. end
    51. -----------------------------------------------------------------------------------
    52. ------- C¿¡¼* È£ÃâÇÒ ·ç¾Æ ÇÔ¼ö ----------------------------------------------------
    53. -----------------------------------------------------------------------------------
    54. -- º¯°æµÈ À̺¥Æ® ¸®½ºÆ® (DBSERVER)
    55. function GetEventState()
    56. local tReturn = {}
    57. local nCount = 1
    58. for i in pairs(tEvent) do
    59. local OldState = tEvent[i].State
    60. for j in pairs(tEvent[i].Time) do
    61. if( tEvent[i].Time[j].nStart <= tonumber(os.date("%Y%m%d%H%M")) ) then
    62. if( tEvent[i].Time[j].nEnd > tonumber(os.date("%Y%m%d%H%M")) ) then
    63. if( tEvent[i].State == 0 ) then
    64. tEvent[i].State = 1
    65. end
    66. else
    67. if( tEvent[i].State == 1 ) then
    68. tEvent[i].State = 0
    69. end
    70. end
    71. end
    72. end
    73. if( OldState ~= tEvent[i].State ) then
    74. tReturn[nCount] = {}
    75. tReturn[nCount].nId = i
    76. tReturn[nCount].State = tEvent[i].State
    77. nCount = nCount + 1
    78. end
    79. end
    80. return tReturn
    81. end
    82. -- WORLDSERVER¿¡¼* ½ÇÇàµÈ ½ºÅ©¸³Æ® ÆÄÀÏ¿¡µµ º¯°æµÈ state¸¦ Àû¿ëÇϱâ À§ÇÑ ÇÔ¼ö
    83. function SetState( nId, nState )
    84. if( tEvent[nId] == nil ) then
    85. TRACE( string.format( "Have Not Event - ID:%d", nId ) )
    86. ERROR( string.format( "Have Not Event - ID:%d", nId ) )
    87. return false;
    88. end
    89. tEvent[nId].State = nState
    90. TRACE( string.format( "Event - ID:%d, Title:%s, State:%d", nId, tEvent[nId].Desc, tEvent[nId].State ) )
    91. ERROR( string.format( "Event - ID:%d, Title:%s, State:%d", nId, tEvent[nId].Desc, tEvent[nId].State ) )
    92. return true;
    93. end
    94. -- ÁøÇàÁßÀÎ À̺¥Æ® ¸®½ºÆ®
    95. function GetEventList()
    96. local tList = {}
    97. local nCount = 1
    98. for i in pairs(tEvent) do
    99. if( tEvent[i].State == 1 ) then
    100. tList[nCount] = i
    101. nCount = nCount + 1
    102. end
    103. end
    104. return tList
    105. end
    106. -- À̺¥Æ® Å×ÀÌºí¿¡ ÀÖ´Â ¸ðµç ¸®½ºÆ®
    107. function GetAllEventList()
    108. local tAllList = {}
    109. local nCount = 1
    110. for i in pairs(tEvent) do
    111. tAllList[nCount] = {}
    112. tAllList[nCount].nId = i
    113. tAllList[nCount].strTitle = tEvent[i].Desc
    114. tAllList[nCount].nState = tEvent[i].State
    115. nCount = nCount + 1
    116. end
    117. return tAllList
    118. end
    119. -- À̺¥Æ® »ó¼¼ Á¤º¸ Å×À̺íÀ» ¸®ÅÏ
    120. function GetEventInfo( nId )
    121. local tEventInfo = {}
    122. if( tEvent[nId] == nil ) then
    123. tEventInfo[1] = "No EventInfo ID = "..nId
    124. return tEventInfo
    125. end
    126. local nCount = 3
    127. tEventInfo[1] = "Title = " .. tEvent[nId].Desc
    128. tEventInfo[2] = "State = " .. tEvent[nId].State
    129. for i in pairs(tEvent[nId].Time) do
    130. local strTime = tEvent[nId].Time[i].nStart .. ", " ..tEvent[nId].Time[i].nEnd
    131. tEventInfo[nCount] = "Time["..i.."] = " .. strTime
    132. nCount = nCount + 1
    133. end
    134. for i in pairs(tEvent[nId].Item) do
    135. local strItem = tEvent[nId].Item[i].ItemId ..", ".. tEvent[nId].Item[i].ItemMaxNum ..", ".. tEvent[nId].Item[i].ItemNum ..", ".. tEvent[nId].Item[i].nLevel
    136. tEventInfo[nCount] = "Item["..i.."] = " .. strItem
    137. nCount = nCount + 1
    138. end
    139. if( tEvent[nId].fExpFactor ~= 1 ) then
    140. tEventInfo[nCount] = "ExpFactor = " .. tEvent[nId].fExpFactor
    141. nCount = nCount + 1
    142. end
    143. if( tEvent[nId].fItemDropRate ~= 1 ) then
    144. tEventInfo[nCount] = "ItemDropRate = " .. tEvent[nId].fItemDropRate
    145. nCount = nCount + 1
    146. end
    147. if( tEvent[nId].fPieceItemDropRate ~= 1 ) then
    148. tEventInfo[nCount] = "fPieceItemDropRate = " .. tEvent[nId].fPieceItemDropRate
    149. nCount = nCount + 1
    150. end
    151. if( tEvent[nId].fGoldDropFactor ~= 1 ) then
    152. tEventInfo[nCount] = "fGoldDropFactor = " .. tEvent[nId].fGoldDropFactor
    153. nCount = nCount + 1
    154. end
    155. if( tEvent[nId].nAttackPower ~= 0 ) then
    156. tEventInfo[nCount] = "nAttackPower = " .. tEvent[nId].nAttackPower
    157. nCount = nCount + 1
    158. end
    159. if( tEvent[nId].nDefensePower ~= 0 ) then
    160. tEventInfo[nCount] = "nDefensePower = " .. tEvent[nId].nDefensePower
    161. nCount = nCount + 1
    162. end
    163. if( tEvent[nId].nCouponEvent ~= 0 ) then
    164. if( tEvent[nId].nCouponEvent < MIN(1) ) then
    165. tEventInfo[nCount] = "nCouponEventTime = " .. tEvent[nId].nCouponEvent / SEC(1) .. "Sec"
    166. else
    167. tEventInfo[nCount] = "nCouponEventTime = " .. tEvent[nId].nCouponEvent / MIN(1) .. "Min"
    168. end
    169. nCount = nCount + 1
    170. end
    171. for i in pairs(tEvent[nId].Gift) do
    172. local strGift = tEvent[nId].Gift[i].nLevel ..", ".. tEvent[nId].Gift[i].strAccount ..", ".. tEvent[nId].Gift[i].strItemId ..", ".. tEvent[nId].Gift[i].nItemNum
    173. tEventInfo[nCount] = "Gift["..i.."] = " .. strGift
    174. nCount = nCount + 1
    175. end
    176. if( tEvent[nId].fCheerExpFactor ~= 1 ) then
    177. tEventInfo[nCount] = "fCheerExpFactor = " .. tEvent[nId].fCheerExpFactor
    178. nCount = nCount + 1
    179. end
    180. return tEventInfo
    181. end
    182. -- À̺¥Æ® ¼³¸í
    183. function GetDesc( nId )
    184. local strDesc = tEvent[nId].Desc
    185. return strDesc
    186. end
    187. -- ½Ã°£À» ¼ýÀÚ·Î ¹Ù²ãÁÖ´Â ÇÔ¼ö
    188. function GetTimeToNumber( strTime )
    189. local strTemp = ""
    190. local j = 0
    191. for i in string.gfind( strTime, "%d+" ) do
    192. j = j + 1
    193. if( (j~=1) and (tonumber(i)<10) ) then
    194. i = "0"..tonumber(i)
    195. end
    196. strTemp = strTemp..i
    197. end
    198. return tonumber( strTemp )
    199. end
    200. ---------------------------------------------------------------------------
    201. ------ µ¥ÀÌÅÍ Ãß°¡ ÇÔ¼ö ---------------------------------------------------
    202. ---------------------------------------------------------------------------
    203. -- »õ·Î¿î À̺¥Æ® Ãß°¡
    204. function AddEvent( strDesc )
    205. local nEventId = table.getn(tEvent) + 1
    206. tEvent[nEventId] = {}
    207. tEvent[nEventId].Item = {}
    208. tEvent[nEventId].Time = {}
    209. tEvent[nEventId].Desc = strDesc
    210. tEvent[nEventId].fExpFactor = 1
    211. tEvent[nEventId].fItemDropRate = 1
    212. tEvent[nEventId].fPieceItemDropRate = 1
    213. tEvent[nEventId].fGoldDropFactor = 1
    214. tEvent[nEventId].State = 0
    215. tEvent[nEventId].nAttackPower = 0
    216. tEvent[nEventId].nDefensePower = 0
    217. tEvent[nEventId].nCouponEvent = 0
    218. tEvent[nEventId].Gift = {}
    219. tEvent[nEventId].fCheerExpFactor = 1
    220. end
    221. -- ½ÃÀ۽ð£, ³¡½Ã°£
    222. function SetTime( strStart, strEnd )
    223. local nEventId = table.getn(tEvent)
    224. local nSize = table.getn( tEvent[nEventId].Time ) + 1
    225. tEvent[nEventId].Time[nSize] = {}
    226. tEvent[nEventId].Time[nSize].nStart = GetTimeToNumber( strStart )
    227. tEvent[nEventId].Time[nSize].nEnd = GetTimeToNumber( strEnd )
    228. end
    229. -- ¾ÆÀÌÅÛ
    230. function SetItem( ItemId, nItemMaxNum, nItemNum, nLevel )
    231. local nEventId = table.getn(tEvent)
    232. local nSize = table.getn(tEvent[nEventId].Item)
    233. tEvent[nEventId].Item[nSize+1] = {}
    234. tEvent[nEventId].Item[nSize+1].ItemId = ItemId
    235. tEvent[nEventId].Item[nSize+1].ItemMaxNum = nItemMaxNum
    236. tEvent[nEventId].Item[nSize+1].ItemNum = nItemNum
    237. tEvent[nEventId].Item[nSize+1].nLevel = nLevel
    238. tEvent[nEventId].Item[nSize+1].TimeOut = 0
    239. tEvent[nEventId].Item[nSize+1].Skip = 0
    240. local tInterval = {}
    241. local nTotal = 0
    242. for i in pairs(tHour) do
    243. nTotal = nTotal + tHour[i]
    244. end
    245. for i in pairs(tHour) do
    246. tInterval[i] = 3600000 / ( nItemMaxNum * tHour[i] / nTotal )
    247. tInterval[i] = math.floor(tInterval[i])
    248. end
    249. tEvent[nEventId].Item[nSize+1].tInterval = tInterval
    250. end
    251. -- µå·ÓµÉ ¾ÆÀÌÅÛ ¸ñ·Ï
    252. function GetItem( nTickCount, nLevel )
    253. local nHour = tonumber(os.date("%H")) + 1
    254. local tList = GetEventList()
    255. local tReturn = {}
    256. local nCount = 1
    257. for i in pairs(tList) do
    258. local tItem = tEvent[tList[i]].Item
    259. for j in pairs(tItem) do
    260. local nRandom = math.random(0, tItem[j].ItemNum)
    261. if( (nRandom > 0) and (nTickCount >= tItem[j].TimeOut) and (tItem[j].nLevel <= nLevel) ) then
    262. tItem[j].TimeOut = tItem[j].tInterval[nHour] + nTickCount
    263. if( tItem[j].Skip == 0 ) then
    264. tReturn[nCount] = {}
    265. tReturn[nCount].ItemId = tItem[j].ItemId
    266. tReturn[nCount].ItemNum = nRandom
    267. tItem[j].Skip = nRandom - 1
    268. nCount = nCount + 1
    269. TRACE( "Event.lua : GetItem() - Drop - "..tItem[j].ItemId..", "..nRandom.."°³, Skip:"..tItem[j].Skip.." ½Ã°£´ë:"..(nHour-1).." ~ "..nHour )
    270. else
    271. tItem[j].Skip = tItem[j].Skip - 1
    272. TRACE( "Event.lua : GetItem() - Skip - "..tItem[j].ItemId..", ³²Àº Skip:"..tItem[j].Skip.." ½Ã°£´ë:"..(nHour-1).." ~ "..nHour )
    273. end
    274. end
    275. end
    276. end
    277. return tReturn
    278. end
    279. -- °æÇèÄ¡ ¹è¼ö
    280. function SetExpFactor( fExpFactor )
    281. local nEventId = table.getn(tEvent)
    282. tEvent[nEventId].fExpFactor = fExpFactor
    283. end
    284. function GetExpFactor()
    285. local tList = GetEventList()
    286. local fExpFactor = 1
    287. for i in pairs(tList) do
    288. if( tEvent[tList[i]].fExpFactor ~= nil ) then
    289. fExpFactor = fExpFactor * tEvent[tList[i]].fExpFactor
    290. end
    291. end
    292. return fExpFactor
    293. end
    294. -- ¾ÆÀÌÅÛ µå·Ó·ü ¹è¼ö
    295. function SetItemDropRate( fItemDropRate )
    296. local nEventId = table.getn(tEvent)
    297. tEvent[nEventId].fItemDropRate = fItemDropRate
    298. end
    299. function GetItemDropRate()
    300. local tList = GetEventList()
    301. local fItemDropRate = 1
    302. for i in pairs(tList) do
    303. if( tEvent[tList[i]].fItemDropRate ~= nil ) then
    304. fItemDropRate = fItemDropRate * tEvent[tList[i]].fItemDropRate
    305. end
    306. end
    307. return fItemDropRate
    308. end
    309. -- °³º° ¾ÆÀÌÅÛ µå·Ó·ü ¹è¼ö
    310. function SetPieceItemDropRate( fPieceItemDropRate )
    311. local nEventId = table.getn(tEvent)
    312. tEvent[nEventId].fPieceItemDropRate = fPieceItemDropRate
    313. end
    314. function GetPieceItemDropRate()
    315. local tList = GetEventList()
    316. local fPieceItemDropRate = 1
    317. for i in pairs(tList) do
    318. if( tEvent[tList[i]].fPieceItemDropRate ~= nil ) then
    319. fPieceItemDropRate = fPieceItemDropRate * tEvent[tList[i]].fPieceItemDropRate
    320. end
    321. end
    322. return fPieceItemDropRate
    323. end
    324. -- Æä³Ä µå·Ó ¹è¼ö
    325. function SetGoldDropFactor( fGoldDropFactor )
    326. local nEventId = table.getn(tEvent)
    327. tEvent[nEventId].fGoldDropFactor = fGoldDropFactor
    328. end
    329. function GetGoldDropFactor()
    330. local tList = GetEventList()
    331. local fGoldDropFactor = 1
    332. for i in pairs(tList) do
    333. if( tEvent[tList[i]].fGoldDropFactor ~= nil ) then
    334. fGoldDropFactor = fGoldDropFactor * tEvent[tList[i]].fGoldDropFactor
    335. end
    336. end
    337. return fGoldDropFactor
    338. end
    339. -- °ø°Ý·Â Áõ°¡
    340. function SetAttackPower( nAttackPower )
    341. local nEventId = table.getn(tEvent)
    342. tEvent[nEventId].nAttackPower = nAttackPower
    343. end
    344. function GetAttackPower()
    345. local tList = GetEventList()
    346. local nAttackPower = 0
    347. for i in pairs(tList) do
    348. if( tEvent[tList[i]].nAttackPower ~= nil ) then
    349. nAttackPower = nAttackPower + tEvent[tList[i]].nAttackPower
    350. end
    351. end
    352. return nAttackPower
    353. end
    354. -- ¹æ¾î·Â Áõ°¡
    355. function SetDefensePower( nDefensePower )
    356. local nEventId = table.getn(tEvent)
    357. tEvent[nEventId].nDefensePower = nDefensePower
    358. end
    359. function GetDefensePower()
    360. local tList = GetEventList()
    361. local nDefensePower = 0
    362. for i in pairs(tList) do
    363. if( tEvent[tList[i]].nDefensePower ~= nil ) then
    364. nDefensePower = nDefensePower + tEvent[tList[i]].nDefensePower
    365. end
    366. end
    367. return nDefensePower
    368. end
    369. -- ÄíÆù À̺¥Æ®
    370. function SetCouponEvent( nTime )
    371. local nEventId = table.getn(tEvent)
    372. tEvent[nEventId].nCouponEvent = nTime
    373. end
    374. function GetCouponEvent()
    375. local tList = GetEventList()
    376. for i in pairs(tList) do
    377. if( tEvent[tList[i]].nCouponEvent ~= 0 ) then
    378. return tEvent[tList[i]].nCouponEvent
    379. end
    380. end
    381. return 0
    382. end
    383. function SetLevelUpGift( nLevel, strAccount, strItemId, nItemNum, byFlag )
    384. local nEventId = table.getn(tEvent)
    385. local nSize = table.getn(tEvent[nEventId].Gift)
    386. tEvent[nEventId].Gift[nSize+1] = {}
    387. tEvent[nEventId].Gift[nSize+1].nLevel = nLevel
    388. tEvent[nEventId].Gift[nSize+1].strAccount = strAccount
    389. tEvent[nEventId].Gift[nSize+1].strItemId = strItemId
    390. tEvent[nEventId].Gift[nSize+1].nItemNum = nItemNum
    391. tEvent[nEventId].Gift[nSize+1].byFlag = byFlag
    392. end
    393. function GetLevelUpGift( nLevel, strAccount )
    394. local nCount = 1
    395. local tGiftList = {}
    396. local tList = GetEventList()
    397. for i in pairs(tList) do
    398. local tGift = tEvent[tList[i]].Gift
    399. for j in pairs(tGift) do
    400. local nTemp = string.find( strAccount, tGift[j].strAccount )
    401. if( (tGift[j].strAccount == "all") or (nTemp ~= nil) ) then
    402. if( tGift[j].nLevel == nLevel ) then
    403. tGiftList[nCount] = {}
    404. tGiftList[nCount].strItemId = tGift[j].strItemId
    405. tGiftList[nCount].nItemNum = tGift[j].nItemNum
    406. tGiftList[nCount].byFlag = tGift[j].byFlag
    407. nCount = nCount + 1
    408. end
    409. end
    410. end
    411. end
    412. return tGiftList
    413. end
    414. function SetCheerExpFactor( fCheerExpFactor )
    415. local nEventId = table.getn(tEvent)
    416. tEvent[nEventId].fCheerExpFactor = fCheerExpFactor
    417. end
    418. function GetCheerExpFactor()
    419. local tList = GetEventList()
    420. local fCheerExpFactor = 1
    421. for i in pairs(tList) do
    422. if( tEvent[tList[i]].fCheerExpFactor ~= nil ) then
    423. fCheerExpFactor = fCheerExpFactor * tEvent[tList[i]].fCheerExpFactor
    424. end
    425. end
    426. return fCheerExpFactor
    427. end
    Alles anzeigen


    Event.lua

    Brainfuck-Quellcode

    1. ----------------------------------------------------------------------
    2. ---- À̺¥Æ® °ü·Ã ·ç¾Æ ÇÔ¼ö ·Îµù --------------------------------------
    3. ----------------------------------------------------------------------
    4. dofile(".\\LuaFunc\\EventFunc.lua")
    5. ----------------------------------------------------------------------
    6. -- ÀÚµ¿ °øÁö (°¢ ¼*¹ö±º TRANS Server ¸¸ ¼öÁ¤ÇÏ¸é µÅ¿ä ^^) ------------
    7. ----------------------------------------------------------------------
    8. bNotice = true -- ÀÚµ¿ °øÁö ½ÇÇà ¿©ºÎ(true or false)
    9. Notice( "Tue 08:44", 5, 10 ) -- ÀÚµ¿°øÁö½Ã°£, °øÁö°£°Ý(MIN), °øÁö Ƚ¼ö
    10. --{
    11. AddMessage( "¾È³çÇϼ¼¿ä. Flyff ÀÔ´Ï´Ù." )
    12. AddMessage( "¿ÀÀü 9½ÃºÎÅÍ ¿øÈ°ÇÑ ¼*ºñ½º¸¦ À§ÇÑ" )
    13. AddMessage( "Á¤±â Á¡°ËÀÌ ÁøÇà µÉ ¿¹Á¤ ÀÔ´Ï´Ù." )
    14. AddMessage( "¾ÈÀüÇÑ Àå¼Ò¿¡¼* Á¢¼Ó Á¾·á¸¦ ÇØ Áֽñ⠹ٶø´Ï´Ù." )
    15. --}
    16. ----------------------------------------------------------------------
    17. ---- ÃʱâÈ* ----------------------------------------------------------
    18. ----------------------------------------------------------------------
    19. -- ½Ã°£´ëº° ¾ÆÀÌÅÛ µå·Ó °¡ÁßÄ¡
    20. tHour = { 505, 409, 324, 280, 220, 203, 202, 212,
    21. 227, 261, 302, 349, 571, 701, 764, 803,
    22. 790, 789, 754, 849, 936, 940, 919, 720 }
    23. ----------------------------------------------------------------------
    24. ----------------------------------------------------------------------------------------------------------------
    25. ---- 1. AddEvent( strDesc ) -- À̺¥Æ® Ãß°¡ ¹× ¼³¸í µî·Ï
    26. ---- 2. SetTime( strStartTime, strEndTime ) -- ÇØ´ç À̺¥Æ®ÀÇ ½ÃÀÛ ½Ã°£, Á¾·á ½Ã°£ µî·Ï(¿©·¯°³ ¼³Á¤ °¡´É)
    27. ---- ( ½Ã°£ Çü½Ä -- "2007-05-03 17:53" )
    28. ---- 3. SetItem( ItemId, nMax, nNum, nLevel ) -- À̺¥Æ®¿ë µå·Ó ¾ÆÀÌÅÛ, ÀÏÀÏ ÃÖ´ë·®, µå·Ó °¹¼ö(·£´ý),
    29. ---- ¾ÆÀÌÅÛÀ» µå·ÓÇÒ ¸ó½ºÅÍÀÇ ÃÖ¼Ò ·¹º§ - ¿©·¯°³ °¡´É
    30. ---- 4. SetExpFactor( fFactor ) -- °æÇèÁö Áõ°¡ ¹è¼ö
    31. ---- 5. SetItemDropRate( fFactor ) -- ¾ÆÀÌÅÛ µå·Ó·ü Áõ°¡ ¹è¼ö
    32. ---- 6. SetPieceItemDropRate( fFactor ) -- ¸ó½ºÅͰ¡ °¡Áö°í ÀÖ´Â ³¹°³ ¾ÆÀÌÅÛÀÇ µå¶ø·ü Áõ°¡ ¹è¼ö
    33. ---- 7. SetGoldDropFactor( fFactor ) -- Æä³Ä µå·Ó ¹è¼ö
    34. ---- 8. SetAttackPower( nAttackPower ) -- °ø°Ý·Â Áõ°¡
    35. ---- 9. SetDefensePower( nDefensePower ) -- ¹æ¾î·Â Áõ°¡
    36. ---- 10. SetCouponEvent( SEC(n) ) -- ÄíÆù À̺¥Æ®( Á¢¼Ó½Ã°£ - SEC(n) ¶Ç´Â MIN(n) )
    37. ---- 11. SetLevelUpGift( nLevel, "all", ItemId, nNum ) -- ·¹º§¾÷ ¼±¹°( nLevel´Þ¼º½Ã ¾ÆÀÌÅÛ Áö±Þ, "all" ºÎºÐ¿¡ ƯÁ¤ °èÁ¤ ÁöÁ¤ °¡´É(¿¹. "__bu" - ¹öµð, "__an" - ¿£Á© )
    38. ---- *** À̺¥Æ® Ãß°¡ µî·Ï½Ã 1¹øºÎÅÍ ¹Ýº¹Çϰí 3~11¹øÀº Çʿ信 µû¶ó »ý·«°¡´ÉÇÏ´Ù.
    39. ----------------------------------------------------------------------------------------------------------------
    40. --[[ SAMPLE
    41. AddEvent( "EVENT TEST 01" )
    42. --{
    43. SetTime( "2007-06-08 14:23", "2007-06-08 16:11" )
    44. SetTime( "2007-06-09 14:23", "2007-06-10 00:00" )
    45. SetItem( "II_SYS_SYS_EVE_HAPPYMONEY01", 30000, 5, 15 )
    46. SetItem( "II_SYS_SYS_EVE_PUMPKIN01", 2000, 3, 15 )
    47. SetExpFactor( 2 )
    48. SetItemDropRate( 2 )
    49. SetPieceItemDropRate( 2 )
    50. SetGoldDropFactor( 2 )
    51. SetAttackPower( 150 )
    52. SetDefensePower( 100 )
    53. SetCouponEvent( MIN(120) )
    54. SetLevelUpGift( 15, "__bu", "II_SYS_SYS_SCR_BX_PET_LAWOLF7", 1 )
    55. --}
    56. --]]
    57. -------------------------------------------------------------------------
    58. ---- Begin Script -------------------------------------------------------
    59. -------------------------------------------------------------------------
    60. AddEvent( "ÁÖ¸»¿£ ´õ ½Å³ª°Ô~~~~~!!" )
    61. --{
    62. SetTime( "2008-12-23 17:00", "2008-12-29 00:00" )
    63. SetTime( "2009-01-01 00:00", "2009-01-05 00:00" )
    64. SetTime( "2009-01-09 00:00", "2009-01-12 00:00" )
    65. SetTime( "2009-01-16 00:00", "2009-01-19 00:00" )
    66. SetTime( "2009-01-23 00:00", "2009-01-28 00:00" )
    67. SetTime( "2009-01-30 00:00", "2009-02-02 00:00" )
    68. SetExpFactor( 1.5 )
    69. --}
    70. AddEvent( "ÇÁ¸®ÇÁ¸¸ Áñ°Üµµ ¾ÆÀÌÅÛÀÌ ¿Í¸£¸£~" )
    71. --{
    72. SetTime( "2008-11-25 10:00", "2009-02-02 00:00" )
    73. --}
    74. AddEvent( "¿øÇÏ´Â »óǰÀ» °®ÀÚ~! Ç÷¹ÀÌ ÄíÆù!" )
    75. --{
    76. SetTime( "2008-12-16 00:00", "2009-01-28 00:00" )
    77. SetCouponEvent( MIN(60) )
    78. --}
    79. AddEvent( "´Ü Çѹø! ½ºÅÝ º¯°æÀÇ ±âȸ!" )
    80. --{
    81. SetTime( "2009-01-13 00:00", "2009-02-03 10:00" )
    82. --}
    83. AddEvent( "¾ÆÀÌÅÛÀÇ ±âºÐ ÁÁÀº º¯È*! Æ®·£Áö ¾ÆÀÌÅÛ~" )
    84. --{
    85. SetTime( "2009-01-13 00:00", "2009-02-03 10:00" )
    86. --}
    87. AddEvent( "¼³³¯ ƯÁý! º¹ÁָӴϰ¡ ³»¼Õ¿¡~" )
    88. --{
    89. SetTime( "2009-01-23 00:00", "2009-02-01 00:00" )
    90. SetItem( "II_SYS_SYS_EVE_COMMERGIFTBOX55", 500, 1, 15 )
    91. --}
    Alles anzeigen


    Wie du immer sagst "haha selfowned !!!!einseinself"
  • Spoiler anzeigen
    tEvent = {} -- ??? ?? ???
    tNotice = {} -- ?? ?? ??
    bNotice = false

    function SEC( n )
    return n*1000
    end

    function MIN( n )
    return n*SEC(60)
    end

    -----------------------------------------------------------------------------------
    function Notice( strTime, nInterval, nNoticeCount )
    tNotice.strTime = strTime
    tNotice.nInterval = nInterval
    tNotice.nNoticeCount = nNoticeCount
    tNotice.tMessage = {}
    end

    function AddMessage( strMessage )
    local nSize = table.getn( tNotice.tMessage ) + 1
    tNotice.tMessage[nSize] = strMessage
    end

    function IsNoticeTime()
    if( (bNotice == true) and (tNotice.nNoticeCount > 0) and (tNotice.strTime == os.date("%a %H:%M")) ) then
    tNotice.nNoticeCount = tNotice.nNoticeCount - 1
    SetNextNoticeTime()
    return true
    end

    return false
    end

    function SetNextNoticeTime()
    local nMin = tonumber( os.date( "%M" ) )
    local nHour = tonumber( os.date( "%H" ) )
    local strTemp;

    tNotice.strTime = os.date( "%a " )
    nMin = nMin + tNotice.nInterval;
    if( nMin > 59 ) then
    nMin = 60 - nMin
    nHour = nHour + 1
    end
    -- ?
    strTemp = tostring( nHour )..":"
    if( nHour < 10 ) then strTemp = "0"..strTemp end
    tNotice.strTime = tNotice.strTime .. strTemp
    -- ?
    strTemp = tostring( nMin )
    if( nMin < 10 ) then strTemp = "0"..strTemp end
    tNotice.strTime = tNotice.strTime .. strTemp
    end

    function GetNoticeMessage()
    return tNotice.tMessage
    end

    -----------------------------------------------------------------------------------
    ------- C?? ??? ?? ?? ----------------------------------------------------
    -----------------------------------------------------------------------------------
    -- ??? ??? ??? (DBSERVER)
    function GetEventState()
    local tReturn = {}
    local nCount = 0
    for i in pairs(tEvent) do
    local OldState = tEvent.State
    for j in pairs(tEvent[i].Time) do
    if( tEvent[i].Time[j].nStart <= tonumber(os.date("%Y%m%d%H%M")) ) then
    if( tEvent[i].Time[j].nEnd > tonumber(os.date("%Y%m%d%H%M")) ) then
    if( tEvent[i].State == 0 ) then
    tEvent[i].State = 1
    end
    else
    if( tEvent[i].State == 1 ) then
    tEvent[i].State = 0
    end
    end
    end
    end

    if( OldState ~= tEvent[i].State ) then
    tReturn[nCount] = {}
    tReturn[nCount].nId = i
    tReturn[nCount].State = tEvent[i].State
    nCount = nCount + 1
    end
    end

    return tReturn
    end

    -- WORLDSERVER?? ??? ???? ???? ??? state? ???? ?? ??
    function SetState( nId, nState )
    if( tEvent[nId] == nil ) then
    TRACE( string.format( "Pas d'evenement ayant l'id : %d", nId ) )
    ERROR( string.format( "Pas d'evenement ayant l'id : %d", nId ) )
    return false;
    end
    tEvent[nId].State = nState
    TRACE( string.format( "ID de l'evenement : %d, Nom : %s, Etat : %d", nId, tEvent[nId].Desc, tEvent[nId].State ) )
    ERROR( string.format( "ID de l'evenement : %d, Nom : %s, Etat : %d", nId, tEvent[nId].Desc, tEvent[nId].State ) )
    return true;
    end

    -- ???? ??? ???
    function GetEventList()
    local tList = {}
    local nCount = 1
    for i in pairs(tEvent) do
    if( tEvent[i].State == 1 ) then
    tList[nCount] = i
    nCount = nCount + 1
    end
    end

    return tList
    end

    -- ??? ???? ?? ?? ???
    function GetAllEventList()
    local tAllList = {}
    local nCount = 1
    for i in pairs(tEvent) do
    tAllList[nCount] = {}
    tAllList[nCount].nId = i
    tAllList[nCount].strTitle = tEvent[i].Desc
    tAllList[nCount].nState = tEvent[i].State
    nCount = nCount + 1
    end

    return tAllList
    end

    -- ??? ?? ?? ???? ??
    function GetEventInfo( nId )
    local tEventInfo = {}
    if( tEvent[nId] == nil ) then
    tEventInfo[1] = "Pas d'infos sur l'evenement ayant l'id : "..nId
    return tEventInfo
    end

    local nCount = 3
    tEventInfo[1] = "Nom = " .. tEvent[nId].Desc
    tEventInfo[2] = "Etat = " .. tEvent[nId].State
    for i in pairs(tEvent[nId].Time) do
    local strTime = tEvent[nId].Time[i].nStart .. ", " ..tEvent[nId].Time[i].nEnd
    tEventInfo[nCount] = "Time["..i.."] = " .. strTime
    nCount = nCount + 1
    end

    for i in pairs(tEvent[nId].Item) do
    local strItem = tEvent[nId].Item[i].ItemId ..", ".. tEvent[nId].Item[i].ItemMaxNum ..", ".. tEvent[nId].Item[i].ItemNum ..", ".. tEvent[nId].Item[i].nLevel
    tEventInfo[nCount] = "Objet["..i.."] = " .. strItem
    nCount = nCount + 1
    end

    if( tEvent[nId].fExpFactor ~= 5 ) then
    tEventInfo[nCount] = "Experience multiplie par : " .. tEvent[nId].fExpFactor
    nCount = nCount + 1
    end

    if( tEvent[nId].fItemDropRate ~= 5 ) then
    tEventInfo[nCount] = "Drop multiplie par : " .. tEvent[nId].fItemDropRate
    nCount = nCount + 1
    end

    if( tEvent[nId].fPieceItemDropRate ~= 5 ) then
    tEventInfo[nCount] = "Nombre d'objets multiplie par : " .. tEvent[nId].fPieceItemDropRate
    nCount = nCount + 1
    end

    if( tEvent[nId].fGoldDropFactor ~= 5 ) then
    tEventInfo[nCount] = "Penyas multiplie par : " .. tEvent[nId].fGoldDropFactor
    nCount = nCount + 1
    end

    if( tEvent[nId].nAttackPower ~= 0 ) then
    tEventInfo[nCount] = "Attaque augmentee de : " .. tEvent[nId].nAttackPower
    nCount = nCount + 1
    end

    if( tEvent[nId].nDefensePower ~= 0 ) then
    tEventInfo[nCount] = "Defense augmentee de : " .. tEvent[nId].nDefensePower
    nCount = nCount + 1
    end

    if( tEvent[nId].nCouponEvent ~= 0 ) then
    if( tEvent[nId].nCouponEvent < MIN(1) ) then
    tEventInfo[nCount] = "Duree des coupons evenement : " .. tEvent[nId].nCouponEvent / SEC(1) .. "Secondes"
    else
    tEventInfo[nCount] = "Duree des coupons evenement : " .. tEvent[nId].nCouponEvent / MIN(1) .. "Minutes"
    end
    nCount = nCount + 1
    end

    for i in pairs(tEvent[nId].Gift) do
    local strGift = tEvent[nId].Gift[i].nLevel ..", ".. tEvent[nId].Gift[i].strAccount ..", ".. tEvent[nId].Gift[i].strItemId ..", ".. tEvent[nId].Gift[i].nItemNum
    tEventInfo[nCount] = "Cadeaux n¡Æ["..i.."] : " .. strGift
    nCount = nCount + 1
    end

    if( tEvent[nId].fCheerExpFactor ~= 1 ) then
    tEventInfo[nCount] = "fCheerExpFactor = " .. tEvent[nId].fCheerExpFactor
    nCount = nCount + 1
    end


    return tEventInfo
    end

    -- ??? ??
    function GetDesc( nId )
    local strDesc = tEvent[nId].Desc

    return strDesc
    end

    -- ??? ??? ???? ??
    function GetTimeToNumber( strTime )
    local strTemp = ""
    local j = 0
    for i in string.gfind( strTime, "%d+" ) do
    j = j + 1
    if( (j~=1) and (tonumber(i)<10) ) then
    i = "0"..tonumber(i)
    end
    strTemp = strTemp..i
    end
    return tonumber( strTemp )
    end

    ---------------------------------------------------------------------------
    ------ ??? ?? ?? ---------------------------------------------------
    ---------------------------------------------------------------------------

    -- ??? ??? ??
    function AddEvent( strDesc )
    local nEventId = table.getn(tEvent) + 1

    tEvent[nEventId] = {}
    tEvent[nEventId].Item = {}
    tEvent[nEventId].Time = {}
    tEvent[nEventId].Desc = strDesc
    tEvent[nEventId].fExpFactor = 1
    tEvent[nEventId].fItemDropRate = 1
    tEvent[nEventId].fPieceItemDropRate = 1
    tEvent[nEventId].fGoldDropFactor = 1
    tEvent[nEventId].State = 0
    tEvent[nEventId].nAttackPower = 0
    tEvent[nEventId].nDefensePower = 0
    tEvent[nEventId].nCouponEvent = 0
    tEvent[nEventId].Gift = {}
    tEvent[nEventId].fCheerExpFactor = 1
    end

    -- ????, ???
    function SetTime( strStart, strEnd )
    local nEventId = table.getn(tEvent)
    local nSize = table.getn( tEvent[nEventId].Time ) + 1

    tEvent[nEventId].Time[nSize] = {}
    tEvent[nEventId].Time[nSize].nStart = GetTimeToNumber( strStart )
    tEvent[nEventId].Time[nSize].nEnd = GetTimeToNumber( strEnd )
    end

    -- ???
    function SetItem( ItemId, nItemMaxNum, nItemNum, nLevel )
    local nEventId = table.getn(tEvent)
    local nSize = table.getn(tEvent[nEventId].Item)

    tEvent[nEventId].Item[nSize+1] = {}
    tEvent[nEventId].Item[nSize+1].ItemId = ItemId
    tEvent[nEventId].Item[nSize+1].ItemMaxNum = nItemMaxNum
    tEvent[nEventId].Item[nSize+1].ItemNum = nItemNum
    tEvent[nEventId].Item[nSize+1].nLevel = nLevel
    tEvent[nEventId].Item[nSize+1].TimeOut = 0
    tEvent[nEventId].Item[nSize+1].Skip = 0

    local tInterval = {}
    local nTotal = 0
    for i in pairs(tHour) do
    nTotal = nTotal + tHour[i]
    end
    for i in pairs(tHour) do
    tInterval[i] = 3600000 / ( nItemMaxNum * tHour[i] / nTotal )
    tInterval[i] = math.floor(tInterval[i])
    end
    tEvent[nEventId].Item[nSize+1].tInterval = tInterval
    end

    -- ??? ??? ??
    function GetItem( nTickCount, nLevel )
    local nHour = tonumber(os.date("%H")) + 1
    local tList = GetEventList()
    local tReturn = {}
    local nCount = 1
    for i in pairs(tList) do
    local tItem = tEvent[tList[i]].Item
    for j in pairs(tItem) do
    local nRandom = math.random(0, tItem[j].ItemNum)
    if( (nRandom > 0) and (nTickCount >= tItem[j].TimeOut) and (tItem[j].nLevel <= nLevel) ) then
    tItem[j].TimeOut = tItem[j].tInterval[nHour] + nTickCount
    if( tItem[j].Skip == 0 ) then
    tReturn[nCount] = {}
    tReturn[nCount].ItemId = tItem[j].ItemId
    tReturn[nCount].ItemNum = nRandom
    tItem[j].Skip = nRandom - 1
    nCount = nCount + 1
    TRACE( "Event.lua : GetItem() - Drop - "..tItem[j].ItemId..", "..nRandom.."?, Skip:"..tItem[j].Skip.." ???:"..(nHour-1).." ~ "..nHour )
    else
    tItem[j].Skip = tItem[j].Skip - 1
    TRACE( "Event.lua : GetItem() - Skip - "..tItem[j].ItemId..", ?? Skip:"..tItem[j].Skip.." ???:"..(nHour-1).." ~ "..nHour )
    end
    end
    end
    end
    return tReturn
    end
    -- ??? ??
    function SetExpFactor( fExpFactor )
    local nEventId = table.getn(tEvent)
    tEvent[nEventId].fExpFactor = fExpFactor
    end

    function GetExpFactor()
    local tList = GetEventList()
    local fExpFactor = 20
    for i in pairs(tList) do
    if( tEvent[tList[i]].fExpFactor ~= nil ) then
    fExpFactor = fExpFactor * tEvent[tList[i]].fExpFactor
    end
    end

    return fExpFactor
    end

    -- ??? ??? ??
    function SetItemDropRate( fItemDropRate )
    local nEventId = table.getn(tEvent)
    tEvent[nEventId].fItemDropRate = fItemDropRate
    end

    function GetItemDropRate()
    local tList = GetEventList()
    local fItemDropRate = 20
    for i in pairs(tList) do
    if( tEvent[tList[i]].fItemDropRate ~= nil ) then
    fItemDropRate = fItemDropRate * tEvent[tList[i]].fItemDropRate
    end
    end

    return fItemDropRate
    end

    -- ?? ??? ??? ??
    function SetPieceItemDropRate( fPieceItemDropRate )
    local nEventId = table.getn(tEvent)
    tEvent[nEventId].fPieceItemDropRate = fPieceItemDropRate
    end

    function GetPieceItemDropRate()
    local tList = GetEventList()
    local fPieceItemDropRate = 20
    for i in pairs(tList) do
    if( tEvent[tList[i]].fPieceItemDropRate ~= nil ) then
    fPieceItemDropRate = fPieceItemDropRate * tEvent[tList[i]].fPieceItemDropRate
    end
    end

    return fPieceItemDropRate
    end

    -- ?? ?? ??
    function SetGoldDropFactor( fGoldDropFactor )
    local nEventId = table.getn(tEvent)
    tEvent[nEventId].fGoldDropFactor = fGoldDropFactor
    end

    function GetGoldDropFactor()
    local tList = GetEventList()
    local fGoldDropFactor = 100
    for i in pairs(tList) do
    if( tEvent[tList[i]].fGoldDropFactor ~= nil ) then
    fGoldDropFactor = fGoldDropFactor * tEvent[tList[i]].fGoldDropFactor
    end
    end

    return fGoldDropFactor
    end


    -- ??? ??
    function SetAttackPower( nAttackPower )
    local nEventId = table.getn(tEvent)
    tEvent[nEventId].nAttackPower = nAttackPower
    end

    function GetAttackPower()
    local tList = GetEventList()
    local nAttackPower = 0
    for i in pairs(tList) do
    if( tEvent[tList[i]].nAttackPower ~= nil ) then
    nAttackPower = nAttackPower + tEvent[tList[i]].nAttackPower
    end
    end

    return nAttackPower
    end


    -- ??? ??
    function SetDefensePower( nDefensePower )
    local nEventId = table.getn(tEvent)
    tEvent[nEventId].nDefensePower = nDefensePower
    end

    function GetDefensePower()
    local tList = GetEventList()
    local nDefensePower = 0
    for i in pairs(tList) do
    if( tEvent[tList[i]].nDefensePower ~= nil ) then
    nDefensePower = nDefensePower + tEvent[tList[i]].nDefensePower
    end
    end

    return nDefensePower
    end

    -- ?? ???
    function SetCouponEvent( nTime )
    local nEventId = table.getn(tEvent)
    tEvent[nEventId].nCouponEvent = nTime
    end

    function GetCouponEvent()
    local tList = GetEventList()
    for i in pairs(tList) do
    if( tEvent[tList[i]].nCouponEvent ~= 0 ) then
    return tEvent[tList[i]].nCouponEvent
    end
    end

    return 0
    end

    function SetLevelUpGift( nLevel, strAccount, strItemId, nItemNum, byFlag )
    local nEventId = table.getn(tEvent)
    local nSize = table.getn(tEvent[nEventId].Gift)

    tEvent[nEventId].Gift[nSize+1] = {}
    tEvent[nEventId].Gift[nSize+1].nLevel = nLevel
    tEvent[nEventId].Gift[nSize+1].strAccount = strAccount
    tEvent[nEventId].Gift[nSize+1].strItemId = strItemId
    tEvent[nEventId].Gift[nSize+1].nItemNum = nItemNum
    tEvent[nEventId].Gift[nSize+1].byFlag = byFlag
    end

    function GetLevelUpGift( nLevel, strAccount )
    local nCount = 1
    local tGiftList = {}
    local tList = GetEventList()
    for i in pairs(tList) do
    local tGift = tEvent[tList[i]].Gift
    for j in pairs(tGift) do
    local nTemp = string.find( strAccount, tGift[j].strAccount )
    if( (tGift[j].strAccount == "all") or (nTemp ~= nil) ) then
    if( tGift[j].nLevel == nLevel ) then
    tGiftList[nCount] = {}
    tGiftList[nCount].strItemId = tGift[j].strItemId
    tGiftList[nCount].nItemNum = tGift[j].nItemNum
    tGiftList[nCount].byFlag = tGift[j].byFlag
    nCount = nCount + 1
    end
    end
    end
    end

    return tGiftList
    end

    function SetCheerExpFactor( fCheerExpFactor )
    local nEventId = table.getn(tEvent)
    tEvent[nEventId].fCheerExpFactor = fCheerExpFactor
    end

    function GetCheerExpFactor()
    local tList = GetEventList()
    local fCheerExpFactor = 1
    for i in pairs(tList) do
    if( tEvent[tList[i]].fCheerExpFactor ~= nil ) then
    fCheerExpFactor = fCheerExpFactor * tEvent[tList[i]].fCheerExpFactor
    end
    end

    return fCheerExpFactor
    end


    Was für Events sind das denn?