Browse Source

no return false

valkyr1e 8 years ago
parent
commit
c71cdcbf99
2 changed files with 17 additions and 9 deletions
  1. 16 8
      index.js
  2. 1 1
      manifest.json

+ 16 - 8
index.js

@@ -1,9 +1,6 @@
 'use strict'
 
 module.exports = function Loot(mod) {
-	const motes = [...Array(26).keys()].map(i => i + 8000)
-	const blacklist = mod.settings.blacklist.concat(motes)
-
 	let location = null
 	let lootTimeout = null
 	let items = new Map()
@@ -19,14 +16,23 @@ module.exports = function Loot(mod) {
 		}
 	})
 
-	mod.game.me.on('change_zone', () => items.clear())
+	mod.game.me.on('change_zone', () => {
+		items.clear()
+	})
 
-	mod.hook('S_RETURN_TO_LOBBY', 1, () => items.clear())
+	mod.hook('S_RETURN_TO_LOBBY', 1, () => {
+		items.clear()
+	})
 
-	mod.hook('C_PLAYER_LOCATION', 5, event => location = event.loc)
+	mod.hook('C_PLAYER_LOCATION', 5, event => {
+		location = event.loc
+	})
 
 	mod.hook('S_SPAWN_DROPITEM', 6, event => {
-		if (blacklist.includes(event.item))
+		if (mod.settings.blacklist.includes(event.item))
+			return
+		// is motes?
+		if (8000 <= event.item && event.item <= 8025)
 			return
 
 		if (event.owners.some(owner => owner.playerId === mod.game.me.playerId)) {
@@ -42,7 +48,9 @@ module.exports = function Loot(mod) {
 			lootTimeout = setTimeout(tryLoot, mod.settings.interval)
 	})
 
-	mod.hook('S_DESPAWN_DROPITEM', 4, event => items.delete(event.gameId))
+	mod.hook('S_DESPAWN_DROPITEM', 4, event => {
+		items.delete(event.gameId)
+	})
 
 	function tryLoot() {
 		clearTimeout(lootTimeout)

+ 1 - 1
manifest.json

@@ -1,6 +1,6 @@
 {
 	"files": {
-		"index.js": "320e3dc2880359611dd70080b09042ded5af9e27d18b2cdc89941777ed149de4",
+		"index.js": "04e9791028af0cb91f75add22817dfbc0384653732c4ccd222df2f316539bdd4",
 		"module.json": "3b7b75938bcb79d8c2ed6d44327c5ecbe4f8cc9e23ac805a3e820174ea91f64a",
 		"settings_migrator.js": "42f45f74fd28d3b3a07b180eb0f695294eadc7bcd7f453cc6b57bbc7b7e508a0"
 	},