Oskar1121

Untitled

Oct 4th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.17 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <mod name="Gaiden System" version="0.4.0" author="Oskar" contact="[email protected]" enabled="yes">
  3. <config name="gaidens_conf"><![CDATA[
  4. TYPE_ITEMBACK = 0 -- taski na itemki
  5. TYPE_KILL = 1 -- taski na zabojstwa
  6.  
  7. REWARD_ITEM = 0
  8. REWARD_EXP = 1
  9. REWARD_MONEY = 2
  10. REWARD_ADDON = 3
  11. REWARD_SKILL = 4
  12. REWARD_STORAGE = 5
  13. REWARD_LEVEL = 6
  14.  
  15. CHECKING_STORAGE_DO_NOT_CHANGE = 4999
  16.  
  17. --[[
  18. Naruto Gaiden - Protection All na stale + 10% -- DONE
  19. Kimimaro Gaiden - Skill x 2 -- DONE
  20. Sasuke Gaiden - Dmg ze spelli + 20% -- DONE
  21. Obito Gaiden - +50 000 HP i many -- DONE
  22. Itachi Gaiden - +25 000 HP i many i 5% protection all -- DONE
  23. Hospital Missions - Potiony leczÄ? +10% HP/mana wiÄ?cej -- DONE
  24. Minato Gaiden - Drop x 2 -- DONE
  25. Lee Gaiden - Dmg z Ĺ?apy 20% -- DONE
  26. Gaara Gaiden - +10% dmg z Ĺ?apy i spelli + 5% protection all -- DONE
  27. Sakura Gaiden - ZwiÄ?kszenie leczenia ze spelli [ mam procentowe ] o 10% -- DONE
  28. Kakashi Gaiden - Exp x 2 -- DONE
  29. ]]
  30.  
  31. superUberDuperTaskList = {
  32. ['Naruto Gaiden'] = {
  33. id = 1,
  34. storage = 5000,
  35. [1] = { var = TYPE_KILL,
  36. details = {'[Gaiden] Mizuki', 1},
  37. rewards = {REWARD_EXP, 0, 2500} },
  38. [2] = { var = TYPE_KILL,
  39. details = {'[Gaiden] Kakashi Sensei', 1},
  40. rewards = {REWARD_EXP, 0, 5000} },
  41. },
  42. ['Sasuke Gaiden'] = {
  43. id = 2,
  44. storage = 5001,
  45. [1] = { var = TYPE_KILL,
  46. details = {'bear', 20},
  47. rewards = {REWARD_EXP, 0, 2500} },
  48. [2] = { var = TYPE_KILL,
  49. details = {'[Gaiden] Naruto', 1},
  50. rewards = {REWARD_EXP, 0, 5000} },
  51. },
  52. ['Sakura Gaiden'] = {
  53. id = 3,
  54. storage = 5002,
  55. [1] = { var = TYPE_ITEMBACK,
  56. details = {5881, 20}, -- Leaf
  57. rewards = {REWARD_EXP, 0, 10000} },
  58. [2] = { var = TYPE_KILL,
  59. details = {'[Gaiden] Kakashi Sensei', 1},
  60. rewards = {REWARD_EXP, 0, 5000} },
  61. [3] = { var = TYPE_ITEMBACK,
  62. details = {5809, 1}, -- Kakashi Training Bell
  63. rewards = {REWARD_EXP, 0, 10000} },
  64. },
  65. ['Kakashi Gaiden'] = {
  66. id = 4,
  67. storage = 5003,
  68. [1] = { var = TYPE_KILL,
  69. details = {'bear', 20},
  70. rewards = {REWARD_EXP, 0, 2500} },
  71. [2] = { var = TYPE_KILL,
  72. details = {'bandit', 50},
  73. rewards = {REWARD_EXP, 0, 5000} },
  74. [3] = { var = TYPE_KILL,
  75. details = {'shinobazu', 100},
  76. rewards = {REWARD_EXP, 0, 10000} },
  77. },
  78. ['Kimimaro Gaiden'] = {
  79. id = 5,
  80. storage = 5004,
  81. [1] = { var = TYPE_KILL,
  82. details = {'prisoner', 50},
  83. rewards = {REWARD_EXP, 0, 25000} },
  84. [2] = { var = TYPE_KILL,
  85. details = {'sound shinobi', 100},
  86. rewards = {REWARD_EXP, 0, 50000} },
  87. },
  88. ['Obito Gaiden'] = {
  89. id = 6,
  90. storage = 5005,
  91. [1] = { var = TYPE_KILL,
  92. details = {'bear', 2},
  93. rewards = {REWARD_EXP, 0, 2500} },
  94. [2] = { var = TYPE_KILL,
  95. details = {'bandit', 5},
  96. rewards = {REWARD_EXP, 0, 5000} },
  97. [3] = { var = TYPE_KILL,
  98. details = {'shinobazu', 10},
  99. rewards = {REWARD_EXP, 0, 10000} },
  100. },
  101. ['Minato Gaiden'] = {
  102. id = 7,
  103. storage = 5006,
  104. [1] = { var = TYPE_KILL,
  105. details = {'wolf', 50},
  106. rewards = {REWARD_EXP, 0, 2500} },
  107. [2] = { var = TYPE_KILL,
  108. details = {'farmer', 100},
  109. rewards = {REWARD_EXP, 0, 5000} },
  110. [3] = { var = TYPE_KILL,
  111. details = {'bandit', 200},
  112. rewards = {REWARD_EXP, 0, 10000} },
  113. },
  114. ['Gaara Gaiden'] = {
  115. id = 8,
  116. storage = 5007,
  117. [1] = { var = TYPE_KILL,
  118. details = {'bandit', 25},
  119. rewards = {REWARD_EXP, 0, 5000} },
  120. [2] = { var = TYPE_KILL,
  121. details = {'sand shinobi', 50},
  122. rewards = {REWARD_EXP, 0, 10000} },
  123. [3] = { var = TYPE_ITEMBACK,
  124. details = {2515, 1}, -- Benihisago
  125. rewards = {REWARD_EXP, 0, 20000} },
  126. },
  127. ['Lee Gaiden'] = {
  128. id = 9,
  129. storage = 5008,
  130. [1] = { var = TYPE_KILL,
  131. details = {'[Gaiden] Trainer', 1},
  132. rewards = {REWARD_EXP, 0, 10000} },
  133. [2] = { var = TYPE_KILL,
  134. details = {'[Gaiden] Neji', 1},
  135. rewards = {REWARD_EXP, 0, 20000} },
  136. },
  137. ['Itachi Gaiden'] = {
  138. id = 10,
  139. storage = 5009,
  140. [1] = { var = TYPE_KILL,
  141. details = {'wolf', 25},
  142. rewards = {REWARD_EXP, 0, 2500} },
  143. [2] = { var = TYPE_KILL,
  144. details = {'bandit', 50},
  145. rewards = {REWARD_EXP, 0, 5000} },
  146. [3] = { var = TYPE_KILL,
  147. details = {'[Gaiden] Trainer', 5},
  148. rewards = {REWARD_EXP, 0, 10000} },
  149. },
  150. ['Hospital Missions'] = {
  151. id = 11,
  152. storage = 5010,
  153. [1] = { var = TYPE_ITEMBACK,
  154. details = {5881, 10}, -- Leaf
  155. rewards = {REWARD_LEVEL, 0, 5} },
  156. [2] = { var = TYPE_ITEMBACK,
  157. details = {5877, 15}, -- Rotten Animal Leather
  158. rewards = {REWARD_LEVEL, 0, 5} },
  159. }
  160. }
  161.  
  162. CHECKING_LAST_ID = 0
  163. for _, v in pairs(superUberDuperTaskList) do
  164. CHECKING_LAST_ID = math.max(CHECKING_LAST_ID, v.id)
  165. end
  166.  
  167. function getVariable(cid, variable)
  168. local var = tonumber(getCreatureStorage(cid, CHECKING_STORAGE_DO_NOT_CHANGE))
  169. if var < 2 ^ variable then
  170. return true
  171. end
  172.  
  173. for i = CHECKING_LAST_ID, variable, -1 do
  174. if var >= 2 ^ i then
  175. if i == variable then
  176. return false
  177. end
  178.  
  179. var = var - (2 ^ i)
  180. end
  181. end
  182.  
  183. return true
  184. end
  185.  
  186. function updateRewards(cid, v)
  187. local storage = getCreatureStorage(cid, v.storage)
  188. if storage > #v then
  189. doCreatureSetStorage(cid, CHECKING_STORAGE_DO_NOT_CHANGE, math.max(0, getCreatureStorage(cid, CHECKING_STORAGE_DO_NOT_CHANGE)) + (2 ^ (v.id - 1)))
  190.  
  191. if v.id == 6 then
  192. setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 50000)
  193. setCreatureMaxMana(cid, getCreatureMaxMana(cid) + 50000)
  194. elseif v.id == 7 then
  195. setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + 25000)
  196. setCreatureMaxMana(cid, getCreatureMaxMana(cid) + 25000)
  197. end
  198. end
  199. end
  200.  
  201. function getDetails(cid, status, storage, basicCount)
  202. local count, detail, complete = #status.details / 2, '', true
  203.  
  204. local killsCount = {}
  205. if status.var == TYPE_KILL then
  206. local subStorage = getCreatureStorage(cid, storage)
  207. if subStorage == -1 then
  208. for i = 1, #status.details / 2 do
  209. killsCount[i + 1] = 0
  210. end
  211. else
  212. killsCount = tostring(subStorage):explode('_')
  213. end
  214. end
  215.  
  216. for i = 1, count do
  217. if status.var == TYPE_KILL and (not killsCount or ((tonumber(killsCount[i + 1]) or 0) < status.details[i * 2])) then
  218. complete = false
  219. elseif status.var == TYPE_ITEMBACK and getPlayerItemCount(cid, status.details[i * 2 - 1]) < status.details[i * 2] then
  220. complete = false
  221. end
  222.  
  223. if status.var == TYPE_KILL then
  224. detail = detail .. math.max(0, (basicCount and status.details[i * 2] or tonumber(killsCount[i + 1]))) .. 'x of ' .. status.details[i * 2 - 1]
  225. elseif status.var == TYPE_ITEMBACK then
  226. detail = detail .. status.details[i * 2] .. 'x of ' .. getItemNameById(status.details[i * 2 - 1])
  227. end
  228.  
  229. if i < count - 1 and count > 2 then
  230. detail = detail .. ', '
  231. elseif i == count - 1 and count > 1 then
  232. detail = detail .. ' and '
  233. end
  234. end
  235.  
  236. return detail, complete
  237. end
  238.  
  239. function getDescription(status, killsCount, target)
  240. local killedMessage, detail = '', ''
  241. local count = #status.details / 2
  242. local complete = true
  243. local total = {0, 0}
  244. local found = false
  245. for i = 1, count do
  246. if target and getCreatureName(target):lower() == status.details[i * 2 - 1]:lower() then
  247. killsCount[i + 1] = (tonumber(killsCount[i + 1]) or 0) + 1
  248. found = true
  249. end
  250.  
  251. total[1] = total[1] + status.details[i * 2]
  252. total[2] = total[2] + tonumber(killsCount[i + 1])
  253.  
  254. detail = detail .. '_' .. killsCount[i + 1]
  255. killedMessage = killedMessage .. killsCount[i + 1] .. 'x of ' .. status.details[i * 2 - 1]
  256. if i < count - 1 and count > 2 then
  257. killedMessage = killedMessage .. ', '
  258. elseif i == count - 1 and count > 1 then
  259. killedMessage = killedMessage .. ' and '
  260. end
  261.  
  262. if complete and tonumber(killsCount[i + 1]) < status.details[i * 2] then
  263. complete = false
  264. end
  265. end
  266.  
  267. return killedMessage, total, detail, complete, found
  268. end
  269.  
  270. ]]></config>
  271.  
  272. <event type="kill" name="newTasksKilling" event="script"><![CDATA[
  273. domodlib('gaidens_conf')
  274.  
  275. function onKill(cid, target)
  276. if isMonster(target) and isPlayer(cid) then
  277. for _, v in pairs(superUberDuperTaskList) do
  278. local value = tonumber(getCreatureStorage(cid, v.storage))
  279. local status = v[value]
  280. if status and status.var == TYPE_KILL then
  281. local subStorage, killsCount = getCreatureStorage(cid, v.storage + 100), {}
  282. if subStorage == -1 then
  283. for i = 1, #status.details / 2 do
  284. killsCount[i + 1] = 0
  285. end
  286. else
  287. killsCount = tostring(subStorage):explode('_')
  288. end
  289.  
  290. local killedMessage, total, detail, complete, found = getDescription(status, killsCount, target)
  291. if detail ~= '' and found then
  292. doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You killed ' .. killedMessage .. ' [' .. total[2] .. ' / ' .. total[1] .. '].')
  293.  
  294. if complete then
  295. status = v[value + 1]
  296. doCreatureSetStorage(cid, v.storage + 100, -1)
  297. doCreatureSetStorage(cid, v.storage, value + 1)
  298.  
  299. updateRewards(cid, v)
  300.  
  301. if status then
  302. local detail, complete = getDetails(cid, status, v.storage + 100, true)
  303. if status.var == TYPE_KILL then
  304. doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have already started a mission where you must kill ' .. detail .. '.')
  305. elseif status.var == TYPE_ITEMBACK then
  306. doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have already started a mission where you must gather ' .. detail .. '. Come back to ' .. _ .. ' when you get it all.')
  307. end
  308. end
  309. else
  310. doCreatureSetStorage(cid, v.storage + 100, detail)
  311. end
  312. end
  313. end
  314. end
  315. end
  316.  
  317. return true
  318. end
  319. ]]></event>
  320.  
  321. <talkaction words='!mission' event='script'><![CDATA[
  322. domodlib('gaidens_conf')
  323.  
  324. function onSay(cid, words, param, channel)
  325. local message = ''
  326. for name, v in pairs(superUberDuperTaskList) do
  327. local value = tonumber(getCreatureStorage(cid, v.storage))
  328. local status = v[value]
  329. local started = true
  330. local finished = false
  331. if not status then
  332. if value > 0 then
  333. finished = true
  334. else
  335. status = v[1]
  336. started = false
  337. end
  338. end
  339.  
  340. if message ~= '' then
  341. message = message .. '\n\n'
  342. end
  343.  
  344. message = message .. name .. ' [' .. math.min(#v, (started and value or 0)) .. ' / ' .. #v .. ']\n'
  345. if finished then
  346. message = message .. 'Finished.'
  347. elseif status.var == TYPE_KILL then
  348. local subStorage, killsCount = getCreatureStorage(cid, v.storage + 100), {}
  349. if subStorage == -1 then
  350. for i = 1, #status.details / 2 do
  351. killsCount[i + 1] = 0
  352. end
  353. else
  354. killsCount = tostring(subStorage):explode('_')
  355. end
  356.  
  357. local killedMessage, total, description, complete, found = getDescription(status, killsCount)
  358. if complete then
  359. message = message .. 'You finished ' .. name .. '.'
  360. else
  361. message = message .. 'You killed ' .. killedMessage .. ' [' .. total[2] .. ' / ' .. total[1] .. ']'
  362. end
  363. elseif status.var == TYPE_ITEMBACK then
  364. local detail, complete = getDetails(cid, status)
  365. message = message .. 'Bring ' .. detail
  366. end
  367.  
  368. message = message .. '.'
  369.  
  370. if not started then
  371. message = message .. ' [not started yet]'
  372. end
  373. end
  374.  
  375. doPlayerPopupFYI(cid, message)
  376. return true
  377. end
  378.  
  379. ]]></talkaction>
  380.  
  381. <event type="login" name="newtaskLogin" event="script"><![CDATA[
  382.  
  383. function onLogin(cid)
  384. registerCreatureEvent(cid, 'newTasksKilling')
  385. return true
  386. end
  387. ]]></event>
  388. </mod>
Add Comment
Please, Sign In to add comment