init.lua 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. -- AWARDS
  2. --
  3. -- Copyright (C) 2013-2015 rubenwardy
  4. -- This program is free software; you can redistribute it and/or modify
  5. -- it under the terms of the GNU Lesser General Public License as published by
  6. -- the Free Software Foundation; either version 2.1 of the License, or
  7. -- (at your option) any later version.
  8. -- This program is distributed in the hope that it will be useful,
  9. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. -- GNU Lesser General Public License for more details.
  12. -- You should have received a copy of the GNU Lesser General Public License along
  13. -- with this program; if not, write to the Free Software Foundation, Inc.,
  14. -- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. --
  16. -- The global award namespace
  17. lottachievements = {
  18. show_mode = "hud"
  19. }
  20. -- Internationalization support.
  21. local S, NS = dofile(minetest.get_modpath("lottachievements").."/intllib.lua")
  22. lottachievements.gettext, lottachievements.ngettext = S, NS
  23. dofile(minetest.get_modpath("lottachievements").."/api.lua")
  24. dofile(minetest.get_modpath("lottachievements").."/chat_commands.lua")
  25. dofile(minetest.get_modpath("lottachievements").."/triggers.lua")
  26. -- To add achievements in the middle of ids (e.g. between 29 and 30),
  27. -- use the script at the bottom of the file, changing the variables as needed.
  28. minetest.register_craftitem("lottachievements:achievement_book", {
  29. description = "Achievement Book",
  30. inventory_image = "lottachievements_achievement_book.png",
  31. groups = {book=1},
  32. on_place = function(_, player)
  33. local name = player:get_player_name()
  34. lottachievements.show_to(name, name)
  35. end,
  36. on_use = function(_, player)
  37. local name = player:get_player_name()
  38. lottachievements.show_to(name, name)
  39. end,
  40. })
  41. -- Random Achievements!
  42. lottachievements.register_achievement("smoke_rings", {
  43. title = "Smoke Rings",
  44. description = "Blow a smoke ring with a pipe",
  45. icon = "lottfarming_smoke_ring.png",
  46. id = 1,
  47. })
  48. lottachievements.register_achievement("a_long_path_to_mushrooms", {
  49. title = "A Long Path to Mushrooms",
  50. description = "Show a hobbitish love of mushrooms by eating 99!",
  51. icon = "lottplants_mushroom_wild.png",
  52. id = 2,
  53. trigger = {
  54. type = "eat",
  55. item = "lottfarming:brown_mushroom",
  56. target = 99
  57. }
  58. })
  59. lottachievements.register_achievement("tasty_taters", {
  60. title = "Tasty Taters",
  61. description = "Fill your belly with the good ballast of 9 potatoes",
  62. icon = "lottfarming_potato_cooked.png",
  63. id = 3,
  64. trigger = {
  65. type = "eat",
  66. item = "lottfarming:potato_cooked",
  67. target = 9
  68. }
  69. })
  70. lottachievements.register_achievement("thief", {
  71. title = "Thief!",
  72. description = "Use a lockpick to break into a chest of a different race",
  73. icon = "lottblocks_steel_lockpick.png",
  74. id = 4,
  75. })
  76. lottachievements.register_achievement("rope_is_useful", {
  77. title = "Rope is useful!",
  78. description = "Craft 100 meters of elven rope",
  79. icon = "lottblocks_elven_rope.png",
  80. id = 5,
  81. trigger = {
  82. type = "craft",
  83. item = "lottblocks:elven_rope",
  84. target = 100,
  85. }
  86. })
  87. lottachievements.register_achievement("silver_stringed_music", {
  88. title = "Silver Stringed Music",
  89. description = "Craft a dwarvern harp",
  90. icon = "lottblocks_harp_strings.png",
  91. id = 6,
  92. trigger = {
  93. type = "craft",
  94. item = "lottblocks:dwarf_harp",
  95. target = 1,
  96. }
  97. })
  98. lottachievements.register_achievement("dungeons_deep_and_caverns_old", {
  99. title = "Dungeons Deep and Caverns Old",
  100. description = "Find an underground dungeon",
  101. icon = "default_mossycobble.png",
  102. id = 7,
  103. trigger = {
  104. type = "dig",
  105. node = "default:mossycobble",
  106. target = 1,
  107. }
  108. })
  109. lottachievements.register_achievement("dwarvern_tomb", {
  110. title = "Dwarvern Tomb",
  111. description = "Find (and loot!) a dwarvern tomb, deep underground...",
  112. icon = "lottblocks_dh_top.png",
  113. id = 8,
  114. trigger = {
  115. type = "dig",
  116. node = "lottblocks:dwarf_tomb_top",
  117. target = 1,
  118. }
  119. })
  120. lottachievements.register_achievement("express_miner", {
  121. title = "Express Miner",
  122. description = "Craft a mithril pickaxe",
  123. icon = "lottores_mithrilpick.png",
  124. id = 9,
  125. trigger = {
  126. type = "craft",
  127. item = "lottores:mithrilpick",
  128. target = 1,
  129. }
  130. })
  131. lottachievements.register_achievement("elf_and_dwarf_cooperation", {
  132. title = "Elf and Dwarf Cooperation",
  133. description = "Place at least 6 ithildin stone",
  134. icon = "default_stone.png^ithildin_1.png",
  135. id = 10,
  136. trigger = {
  137. type = "place",
  138. node = "lottores:ithildin_stone_1",
  139. target = 6,
  140. }
  141. })
  142. lottachievements.register_achievement("chains_of_melkor", {
  143. title = "Chains of Melkor",
  144. description = "Craft a tilkal ingot",
  145. icon = "lottores_tilkal_ingot.png",
  146. id = 11,
  147. trigger = {
  148. type = "craft",
  149. item = "lottores:tilkal_ingot",
  150. target = 1
  151. }
  152. })
  153. lottachievements.register_achievement("master_craftsman", {
  154. title = "Master Craftsman",
  155. description = "Craft a Master Book of Crafts",
  156. icon = "lottinventory_master_book.png",
  157. id = 12,
  158. trigger = {
  159. type = "craft",
  160. item = "lottinventory:master_book",
  161. target = 1,
  162. }
  163. })
  164. -- Mithril Achievements
  165. lottachievements.register_achievement("first_truesilver", {
  166. title = "First Truesilver",
  167. description = "Mine 1 mithril ore",
  168. icon = "default_stone.png^lottores_mithril_ore.png^lottachievements_level1.png",
  169. id = 32,
  170. trigger = {
  171. type = "dig",
  172. node = "lottores:mithril_ore",
  173. target = 1
  174. }
  175. })
  176. lottachievements.register_achievement("dwarvern_miner", {
  177. title = "Dwarven Miner",
  178. description = "Mine 99 mithril ore",
  179. icon = "default_stone.png^lottores_mithril_ore.png^lottachievements_level2.png",
  180. requires = "first_truesilver",
  181. id = 33,
  182. trigger = {
  183. type = "dig",
  184. node = "lottores:mithril_ore",
  185. target = 99
  186. }
  187. })
  188. lottachievements.register_achievement("ammassing_fortune", {
  189. title = "Amassing Fortune",
  190. description = "Mine 500 mithril ore",
  191. icon = "default_stone.png^lottores_mithril_ore.png^lottachievements_level3.png",
  192. requires = "dwarvern_miner",
  193. id = 34,
  194. trigger = {
  195. type = "dig",
  196. node = "lottores:mithril_ore",
  197. target = 500
  198. }
  199. })
  200. lottachievements.register_achievement("truly_rich", {
  201. title = "Truly Rich",
  202. description = "Mine 1000 mithril ore",
  203. icon = "default_stone.png^lottores_mithril_ore.png^lottachievements_level4.png",
  204. requires = "ammassing_fortune",
  205. id = 35,
  206. trigger = {
  207. type = "dig",
  208. node = "lottores:mithril_ore",
  209. target = 1000
  210. }
  211. })
  212. lottachievements.register_achievement("lord_of_moria", {
  213. title = "Lord of Moria",
  214. description = "Mine 5000 mithril ore",
  215. icon = "default_stone.png^lottores_mithril_ore.png^lottachievements_level5.png",
  216. requires = "truly_rich",
  217. id = 36,
  218. trigger = {
  219. type = "dig",
  220. node = "lottores:mithril_ore",
  221. target = 5000
  222. }
  223. })
  224. -- Armour Achievements
  225. lottachievements.register_achievement("foot_soldier", {
  226. title = "Foot Soldier",
  227. description = "Equip a full set of steel armor",
  228. icon = "lottarmor_inv_chestplate_steel.png",
  229. id = 30,
  230. trigger = {
  231. type = "equip",
  232. item = "lottarmor:chestplate_steel",
  233. }
  234. })
  235. lottachievements.register_achievement("dwarvern_lord", {
  236. title = "Dwarven Lord",
  237. description = "Equip a full set of mithril armor",
  238. icon = "lottarmor_inv_chestplate_mithril.png",
  239. id = 31,
  240. trigger = {
  241. type = "equip",
  242. item = "lottarmor:chestplate_mithril",
  243. }
  244. })
  245. lottachievements.register_achievement("elven_lord", {
  246. title = "Elven Lord",
  247. description = "Equip a full set of galvorn armor",
  248. icon = "lottarmor_inv_chestplate_galvorn.png",
  249. id = 29,
  250. trigger = {
  251. type = "equip",
  252. item = "lottarmor:chestplate_galvorn",
  253. }
  254. })
  255. lottachievements.register_achievement("rohirric_king", {
  256. title = "Rohirric King",
  257. description = "Equip a full set of gold armor",
  258. icon = "lottarmor_inv_chestplate_gold.png",
  259. id = 28,
  260. trigger = {
  261. type = "equip",
  262. item = "lottarmor:chestplate_gold",
  263. }
  264. })
  265. -- Various biome awards
  266. lottachievements.register_achievement("in_the_land_of_mordor", {
  267. title = "In the Land of Mordor...",
  268. description = "Visit Mordor and mine some Mordor Stone as proof",
  269. icon = "lottmapgen_mordor_stone.png",
  270. id = 13,
  271. trigger = {
  272. type = "dig",
  273. node = "lottmapgen:mordor_stone",
  274. target = 1,
  275. }
  276. })
  277. lottachievements.register_achievement("the_frozen_wastes", {
  278. title = "The Frozen Wastes",
  279. description = "Visit a frozen biome, and collect some snow",
  280. icon = "default_snow.png",
  281. id = 14,
  282. trigger = {
  283. type = "dig",
  284. node = "default:snowblock",
  285. target = 1,
  286. }
  287. })
  288. lottachievements.register_achievement("iron_galore", {
  289. title = "Iron Galore",
  290. description = "Visit the Iron Hills and start a mine there",
  291. icon = "default_stone.png^default_mineral_iron.png",
  292. id = 15,
  293. trigger = {
  294. type = "dig",
  295. node = "lottmapgen:ironhill_grass",
  296. target = 1,
  297. }
  298. })
  299. lottachievements.register_achievement("the_merry_shire", {
  300. title = "The Merry Shire",
  301. description = "Visit the Shire, and examine its soil",
  302. icon = "lottplants_plum.png",
  303. id = 16,
  304. trigger = {
  305. type = "dig",
  306. node = "lottmapgen:shire_grass",
  307. target = 1,
  308. }
  309. })
  310. lottachievements.register_achievement("lorien_the_golden", {
  311. title = "Lorien the Golden",
  312. description = "Visit the golden forest of Lorien",
  313. icon = "lottplants_mallornleaf.png",
  314. id = 17,
  315. trigger = {
  316. type = "dig",
  317. node = "lottmapgen:lorien_grass",
  318. target = 1,
  319. }
  320. })
  321. lottachievements.register_achievement("a_small_patch_of_lorien", {
  322. title = "A Small Patch of Lorien",
  323. description = "Place 7 Mallorn Saplings",
  324. icon = "lottplants_mallornsapling.png",
  325. id = 19,
  326. trigger = {
  327. type = "place",
  328. node = "lottplants:mallornsapling",
  329. target = 7
  330. }
  331. })
  332. lottachievements.register_achievement("the_corrupted_greenwood", {
  333. title = "The Corrupted Greenwood",
  334. description = "Chop down a tree in Mirkwood",
  335. icon = "lottplants_mirkleaf.png",
  336. id = 18,
  337. trigger = {
  338. type = "dig",
  339. node = "default:jungletree",
  340. target = 1,
  341. }
  342. })
  343. -- Mob Killings!
  344. lottachievements.register_achievement("his_arm_has_grown_long", {
  345. title = "His arm has grown long indeed",
  346. description = "Craft a mithril spear",
  347. icon = "lottweapons_mithril_spear.png",
  348. id = 20,
  349. trigger = {
  350. type = "craft",
  351. item = "lottweapons:mithril_spear",
  352. target = 1
  353. }
  354. })
  355. lottachievements.register_achievement("marksman_of_lorien", {
  356. title = "Marksman of Lorien",
  357. description = "Craft a mallorn bow",
  358. icon = "lottthrowing_bow_wood_mallorn.png",
  359. id = 21,
  360. trigger = {
  361. type = "craft",
  362. item = "lottthrowing:bow_wood_mallorn",
  363. target = 1
  364. }
  365. })
  366. lottachievements.register_achievement("durins_bane", {
  367. title = "Durin's Bane",
  368. description = "Kill a Balrog",
  369. icon = "fire_basic_flame.png",
  370. id = 27,
  371. trigger = {
  372. type = "kill",
  373. mob = "lottmobs:balrog",
  374. target = 1,
  375. }
  376. })
  377. lottachievements.register_achievement("begone_foul_dwimmerlaik", {
  378. title = "Begone, foul dwimmerlaik",
  379. description = "Kill the king of the Nazgul",
  380. icon = "lottachievements_witch_king.png",
  381. id = 26,
  382. trigger = {
  383. type = "kill",
  384. mob = "lottmobs:witch_king",
  385. target = 1,
  386. }
  387. })
  388. lottachievements.register_achievement("living_wood", {
  389. title = "Living Wood",
  390. description = "Kill an ent",
  391. icon = "default_jungletree.png",
  392. id = 25,
  393. trigger = {
  394. type = "kill",
  395. mob = "lottmobs:ent",
  396. target = 1,
  397. }
  398. })
  399. lottachievements.register_achievement("elven_champion", {
  400. title = "Elven Champion",
  401. description = "Kill 25 Mordor orcs",
  402. icon = "lottweapons_elven_sword.png",
  403. id = 22,
  404. trigger = {
  405. type = "kill",
  406. mob = "lottmobs:orc",
  407. target = 25,
  408. }
  409. })
  410. lottachievements.register_achievement("orcish_warlord", {
  411. title = "Orcish Warlord",
  412. description = "Kill 25 elves",
  413. icon = "lottweapons_orc_sword.png",
  414. id = 23,
  415. trigger = {
  416. type = "kill",
  417. mob = "lottmobs:elf",
  418. target = 25,
  419. }
  420. })
  421. lottachievements.register_achievement("spider_hunter", {
  422. title = "Spider Hunter",
  423. description = "Kill 25 spiders",
  424. icon = "lottplants_mirkleaf.png",
  425. id = 24,
  426. trigger = {
  427. type = "kill",
  428. mob = "lottmobs:spider",
  429. target = 25,
  430. }
  431. })
  432. -- Advanced Achievements
  433. lottachievements.register_achievement("abandoned_workshop", {
  434. title = "Abandoned Workshop",
  435. description = "Discover a secret Elven Workshop underground",
  436. icon = "default_cracked_stone_brick.png",
  437. id = 37,
  438. trigger = {
  439. type = "dig",
  440. node = "default:cracked_stonebrick",
  441. target = 1
  442. }
  443. })
  444. lottachievements.register_achievement("ringsilver_crafter", {
  445. title = "Ringsilver crafter",
  446. description = "Form your first ingot of ringsilver!",
  447. icon = "lottother_ringsilver_ingot.png",
  448. requires = "abandoned_workshop",
  449. id = 38,
  450. })
  451. lottachievements.register_achievement("the_ring_is_prepared", {
  452. title = "The Ring is Prepared...",
  453. description = "Make a ring ready to have a gem fitted to it",
  454. icon = "lottother_prepared_ring.png",
  455. requires = "ringsilver_crafter",
  456. id = 39,
  457. trigger = {
  458. type = "craft",
  459. item = "lottother:prepared_ring",
  460. target = 1,
  461. }
  462. })
  463. lottachievements.register_achievement("a_pickaxe_fit_for_a_king", {
  464. title = "A pickaxe fit for a king",
  465. description = "Craft a gem pickaxe",
  466. icon = "lottother_gempick.png",
  467. requires = "abandoned_workshop",
  468. id = 40,
  469. trigger = {
  470. type = "craft",
  471. item = "lottother:gem_pick",
  472. target = 1,
  473. }
  474. })
  475. lottachievements.register_achievement("polisher", {
  476. title = "Polisher",
  477. description = "Polish a gem",
  478. icon = "lottother_redgem.png",
  479. requires = "a_pickaxe_fit_for_a_king",
  480. id = 41,
  481. })
  482. lottachievements.register_achievement("ring_smith", {
  483. title = "Ring Smith",
  484. description = "Forge a ring of power",
  485. requires = "polisher",
  486. icon = "lottother_narya.png",
  487. id = 42,
  488. })
  489. lottachievements.register_achievement("supersonic_speed", {
  490. title = "Supersonic Speed",
  491. description = "Craft a palantir",
  492. icon = "default_obsidian.png",
  493. secret = true,
  494. id = 43,
  495. trigger = {
  496. type = "craft",
  497. item = "lottblocks:palantir",
  498. target = 1,
  499. }
  500. })
  501. --Death awards :P
  502. lottachievements.register_achievement("first_time_for_everything", {
  503. title = "First Time for Everything",
  504. description = "Die once!",
  505. id = 44,
  506. icon = "lottachievements_skull.png^lottachievements_level1.png",
  507. trigger = {
  508. type = "death",
  509. target = 1,
  510. }
  511. })
  512. lottachievements.register_achievement("not_again", {
  513. title = "Not Again!",
  514. description = "Die a second time",
  515. icon = "lottachievements_skull.png^lottachievements_level2.png",
  516. requires = "first_time_for_everything",
  517. id = 45,
  518. trigger = {
  519. type = "death",
  520. target = 2,
  521. }
  522. })
  523. lottachievements.register_achievement("this_is_becoming_a_habit", {
  524. title = "This is becoming a habit...",
  525. description = "Die 10 times!",
  526. icon = "lottachievements_skull.png^lottachievements_level3.png",
  527. requires = "not_again",
  528. id = 46,
  529. trigger = {
  530. type = "death",
  531. target = 10,
  532. }
  533. })
  534. lottachievements.register_achievement("im_getting_good_at_this", {
  535. title = "I'm getting good at this!",
  536. description = "Die 20 times, then 5 more.",
  537. icon = "lottachievements_skull.png^lottachievements_level4.png",
  538. requires = "this_is_becoming_a_habit",
  539. id = 47,
  540. trigger = {
  541. type = "death",
  542. target = 25,
  543. }
  544. })
  545. lottachievements.register_achievement("this_is_really_too_much", {
  546. title = "This is really too much...",
  547. description = "Die a grand total of 100 times!",
  548. icon = "lottachievements_skull.png^lottachievements_level5.png",
  549. requires = "im_getting_good_at_this",
  550. id = 48,
  551. trigger = {
  552. type = "death",
  553. target = 100,
  554. }
  555. })
  556. lottachievements.register_achievement("king_of_dying", {
  557. title = "King of Dying",
  558. description = "Have 500 deaths to your name!",
  559. icon = "lottachievements_crowned_skull.png^lottachievements_level6.png",
  560. requires = "this_is_really_too_much",
  561. id = 49,
  562. trigger = {
  563. type = "death",
  564. target = 500,
  565. }
  566. })
  567. lottachievements.register_achievement("so_dead_im_immortal", {
  568. title = "So dead, I'm immortal!",
  569. description = "1000 deaths. Yes, 1000.",
  570. icon = "lottachievements_skull.png^lottachievements_level7.png",
  571. requires = "king_of_dying",
  572. id = 50,
  573. trigger = {
  574. type = "death",
  575. target = 1000,
  576. }
  577. })
  578. --[[
  579. --Code to increase award numbers:
  580. local file = io.open("init.lua")
  581. local string = ""
  582. local increase_from = 5 -- The number you want the new award to be.
  583. local increase_amount = 1 -- How many awards you want to add.
  584. for i in file:lines() do
  585. if i:find("id = %d+,") then
  586. local pos1, pos2 = i:find("id = %d+,")
  587. local d = tonumber(i:sub(pos1 + 5, pos2 - 1))
  588. if d >= increase_from then
  589. d = d + increase_amount
  590. i = i:gsub("id = %d+,", "id = " .. d .. ",")
  591. end
  592. end
  593. string = string .. i .. "\n"
  594. end
  595. file:close()
  596. file = io.open("init.lua", "w+")
  597. file:write(string)
  598. file:close()
  599. --Yes, this should be done with sed or awk, but I have no idea how to use them!
  600. ]]--