Module:Item/ModList: Difference between revisions

From Growtopia
Jump to navigationJump to search
>HashJona
m fix default nil value
>HashJona
m fix param name
Line 2: Line 2:
options = options or {}
options = options or {}
return {
return {
mod = options['mod'],
label = options['label'],
category = options['category'] or ('Category:' .. options['mod'] .. ' Mod Items'),
category = options['category'] or ('Category:' .. options['mod'] .. ' Mod Items'),
         mod_category = options['mod_category'] or ('Mods/' .. options['mod']),
         mod_category = options['mod_category'] or ('Mods/' .. options['mod']),
description = options['description'],
description = options['description'],
notes = options['notes'] or '',
notes = options['notes'],
         hide_mod_category = options['hide_mod_category'] or false,
         hide_mod_category = options['hide_mod_category'] or false,
}
}
Line 13: Line 13:
local mods = {
local mods = {
['Double Jump'] = toModObject({
['Double Jump'] = toModObject({
mod = 'Double Jump',
label = 'Double Jump',
description = 'jump a second time in mid-air'
description = 'jump a second time in mid-air'
}),
}),
['Speedy'] = toModObject({
['Speedy'] = toModObject({
mod = 'Speedy',
label = 'Speedy',
description = 'move faster on land',
description = 'move faster on land',
}),
}),
['Punch Damage'] = toModObject({
['Punch Damage'] = toModObject({
mod = 'Punch Damage',
label = 'Punch Damage',
description = 'break blocks faster',
description = 'break blocks faster',
}),
}),
['Punch Range'] = function(args)
['Punch Range'] = function(args)
return toModObject({
return toModObject({
mod = 'Punch Range',
label = 'Punch Range',
description = args['punch_range_custom'] or 'punch one tile further',
description = args['punch_range_custom'] or 'punch one tile further',
});
});
end,
end,
['Punch Power'] = toModObject({
['Punch Power'] = toModObject({
mod = 'Punch Power',
label = 'Punch Power',
description = 'knock back other players further',
description = 'knock back other players further',
}),
}),
Line 37: Line 37:
local skin = args['skin'] or 'a specific tone'
local skin = args['skin'] or 'a specific tone'
return toModObject({
return toModObject({
mod = 'Skin Color',
label = 'Skin Color',
description = 'change their skin color to ' .. skin
description = 'change their skin color to ' .. skin
});  
});  
Line 43: Line 43:
['Miscellaneous'] = function(args)
['Miscellaneous'] = function(args)
return toModObject({
return toModObject({
mod = 'Miscellaneous',
label = 'Miscellaneous',
description = args['misc'] or '',
description = args['misc'] or '',
             hide_mod_category = true,
             hide_mod_category = true,
Line 49: Line 49:
end,
end,
['Light Source'] = toModObject({
['Light Source'] = toModObject({
mod = 'Light Source',
label = 'Light Source',
description = 'emit light in [[Dark Background Block (block category)|dark areas]]',
description = 'emit light in [[Dark Background Block (block category)|dark areas]]',
}),
}),
['Build Range'] = function(args)
['Build Range'] = function(args)
         return toModObject({
         return toModObject({
mod = 'Build Range',
label = 'Build Range',
description = args['build_range_custom'] or 'build one tile further'
description = args['build_range_custom'] or 'build one tile further'
});
});
end,
end,
['Punch Pull'] = toModObject({
['Punch Pull'] = toModObject({
         mod = 'Punch Pull',
         label = 'Punch Pull',
         description = 'pull other players towards them upon punching them',
         description = 'pull other players towards them upon punching them',
     }),
     }),
['High Jump'] = toModObject({
['High Jump'] = toModObject({
         mod = 'High Jump',
         label = 'High Jump',
         description = 'jump one tile higher',
         description = 'jump one tile higher',
     }),
     }),
['Slow Fall'] = toModObject({
['Slow Fall'] = toModObject({
         mod = 'Slow Fall',
         label = 'Slow Fall',
         description = 'glide slowly to the ground when holding the jump button',
         description = 'glide slowly to the ground when holding the jump button',
     }),
     }),
['Wall Climbing'] = toModObject({
['Wall Climbing'] = toModObject({
         mod = 'Wall Climbing',
         label = 'Wall Climbing',
         description = 'cling onto [[Climbing Wall|Climbing Walls]] by pressing the jump button',
         description = 'cling onto [[Climbing Wall|Climbing Walls]] by pressing the jump button',
     }),
     }),
['Fire Hose'] = toModObject({
['Fire Hose'] = toModObject({
         mod = 'Fire Hose',
         label = 'Fire Hose',
         description = 'extinguish [[Fire|fires]]',
         description = 'extinguish [[Fire|fires]]',
     }),
     }),
['Fireproof'] = toModObject({
['Fireproof'] = toModObject({
         mod = 'Fireproof',
         label = 'Fireproof',
         description = 'take 50% less damage from [[Lava Pain Block (block category)|lava pain blocks]]',
         description = 'take 50% less damage from [[Lava Pain Block (block category)|lava pain blocks]]',
     }),
     }),
Line 85: Line 85:
local ghost = args['ghost'] or 'all types of [[Ghost|ghosts]]'
local ghost = args['ghost'] or 'all types of [[Ghost|ghosts]]'
         return toModObject({
         return toModObject({
mod = 'Ghost Immunity',
label = 'Ghost Immunity',
description = 'be immune from ' .. ghost
description = 'be immune from ' .. ghost
});
});
end,
end,
['Healing'] = toModObject({
['Healing'] = toModObject({
         mod = 'Healing',
         label = 'Healing',
         description = 'heal faster than usual after receiving damage from hitting a [[Pain Block (block category)|pain block]]',
         description = 'heal faster than usual after receiving damage from hitting a [[Pain Block (block category)|pain block]]',
     }),
     }),
['XP Buff'] = function(args)
['XP Buff'] = function(args)
local default_message = toModObject({
local default_message = toModObject({
             mod = 'XP Buff',
             label = 'XP Buff',
             description = 'gain more [[Leveling|XP]]'
             description = 'gain more [[Leveling|XP]]'
         })
         })
Line 134: Line 134:
return toModObject({
return toModObject({
             mod = 'XP Buff',
             label = 'XP Buff',
             description = 'earn ' .. message .. ' ' .. action,
             description = 'earn ' .. message .. ' ' .. action,
             notes = 'Grants ' .. message .. ' ' .. action
             notes = 'Grants ' .. message .. ' ' .. action
Line 140: Line 140:
end,
end,
['Slippery'] = toModObject({
['Slippery'] = toModObject({
         mod = 'Slippery',
         label = 'Slippery',
         description = 'glide on any surface as if it is [[Slippery Block (block category)|slippery]]',
         description = 'glide on any surface as if it is [[Slippery Block (block category)|slippery]]',
     }),
     }),
['Putt Putt Putt'] = toModObject({
['Putt Putt Putt'] = toModObject({
         mod = 'Putt Putt Putt',
         label = 'Putt Putt Putt',
         description = 'move slower, but allows the player to harvest trees by walking through them',
         description = 'move slower, but allows the player to harvest trees by walking through them',
     }),
     }),
['Damage Reduction'] = toModObject({
['Damage Reduction'] = toModObject({
         mod = 'Damage Reduction',
         label = 'Damage Reduction',
         description = 'break blocks more slowly',
         description = 'break blocks more slowly',
     }),
     }),
['Knock Back Reduction'] = toModObject({
['Knock Back Reduction'] = toModObject({
         mod = 'Knock Back Reduction',
         label = 'Knock Back Reduction',
         description = 'resist a percentage of knockback when [[Punching|punched]] by other players',
         description = 'resist a percentage of knockback when [[Punching|punched]] by other players',
     }),
     }),
['Speedy in Water'] = toModObject({
['Speedy in Water'] = toModObject({
         mod = 'Speedy in Water',
         label = 'Speedy in Water',
         description = 'move faster in water',
         description = 'move faster in water',
     }),
     }),
['Float on Water'] = toModObject({
['Float on Water'] = toModObject({
         mod = 'Float on Water',
         label = 'Float on Water',
         description = 'float on [[Water Bucket|water]]',
         description = 'float on [[Water Bucket|water]]',
     }),
     }),
['Grow Effect'] = toModObject({
['Grow Effect'] = toModObject({
         mod = 'Grow Effect',
         label = 'Grow Effect',
         description = 'expand in size',
         description = 'expand in size',
     }),
     }),
['Zombie Weapon'] = toModObject({
['Zombie Weapon'] = toModObject({
         mod = 'Zombie Weapon',
         label = 'Zombie Weapon',
         description = 'kill [[G-Virus|zombies]] during a Pandemic',
         description = 'kill [[G-Virus|zombies]] during a Pandemic',
     }),
     }),
['Low Jump'] = toModObject({
['Low Jump'] = toModObject({
         mod = 'Low Jump',
         label = 'Low Jump',
         description = 'decrease the player\'s jump height',
         description = 'decrease the player\'s jump height',
     }),
     }),
['Card Battle Health'] = toModObject({
['Card Battle Health'] = toModObject({
         mod = 'Card Battle Health',
         label = 'Card Battle Health',
         description = 'add 2 additional health to the player during card battles against a [[Villains|villain]] or another player',
         description = 'add 2 additional health to the player during card battles against a [[Villains|villain]] or another player',
     }),
     }),
['Card Battle Strength'] = toModObject({
['Card Battle Strength'] = toModObject({
         mod = 'Card Battle Strength',
         label = 'Card Battle Strength',
         description = 'reduce 2 health from the [[Villains|villain]] or another player',
         description = 'reduce 2 health from the [[Villains|villain]] or another player',
     }),
     }),
['Cookie Hunter'] = toModObject({
['Cookie Hunter'] = toModObject({
         mod = 'Cookie Hunter',
         label = 'Cookie Hunter',
         description = 'provides a significant chance of doubling fruit drops from [[Fortune Cookie]] and [[Lucky Fortune Cookie|Lucky Fortune Cookie Trees]]',
         description = 'provides a significant chance of doubling fruit drops from [[Fortune Cookie]] and [[Lucky Fortune Cookie|Lucky Fortune Cookie Trees]]',
     }),
     }),
['Night Vision'] = toModObject({
['Night Vision'] = toModObject({
         mod = 'Night Vision',
         label = 'Night Vision',
         description = 'eliminate the darkness effect created by [[Dark Background Block (block category)|dark background blocks]]',
         description = 'eliminate the darkness effect created by [[Dark Background Block (block category)|dark background blocks]]',
     }),
     }),
Line 197: Line 197:
end
end
return toModObject({
return toModObject({
mod = 'Extra Gems',
label = 'Extra Gems',
description = 'get extra ' .. chance .. 'gems from breaking blocks'
description = 'get extra ' .. chance .. 'gems from breaking blocks'
});
});
Line 207: Line 207:
end
end
return toModObject({
return toModObject({
mod = 'Extra Blocks',
label = 'Extra Blocks',
description = 'get an extra ' .. chance .. 'chance for a block broken to drop itself'
description = 'get an extra ' .. chance .. 'chance for a block broken to drop itself'
});  
});  

Revision as of 16:11, 29 March 2025

Documentation for this module may be created at Module:Item/ModList/doc

function toModObject(options)
	options = options or {}
	return {
		label = options['label'],
		category = options['category'] or ('Category:' .. options['mod'] .. ' Mod Items'),
        mod_category = options['mod_category'] or ('Mods/' ..  options['mod']),
		description = options['description'],
		notes = options['notes'],
        hide_mod_category = options['hide_mod_category'] or false,
	}
end

local mods = {
	['Double Jump'] = toModObject({
		label = 'Double Jump',
		description = 'jump a second time in mid-air'
	}),
	['Speedy'] = toModObject({
		label = 'Speedy',
		description = 'move faster on land',
	}),
	['Punch Damage'] = toModObject({
		label = 'Punch Damage',
		description = 'break blocks faster',
	}),
	['Punch Range'] = function(args)
		return toModObject({
			label = 'Punch Range',
			description = args['punch_range_custom'] or 'punch one tile further',
		});
	end,
	['Punch Power'] = toModObject({
		label = 'Punch Power',
		description = 'knock back other players further',
	}),
	['Skin Color'] = function(args)
		local skin = args['skin'] or 'a specific tone'
		return toModObject({
			label = 'Skin Color',
			description = 'change their skin color to ' .. skin
		}); 
	end,
	['Miscellaneous'] = function(args)
		return toModObject({
			label = 'Miscellaneous',
			description = args['misc'] or '',
            hide_mod_category = true,
		});
	end,
	['Light Source'] = toModObject({
		label = 'Light Source',
		description = 'emit light in [[Dark Background Block (block category)|dark areas]]',
	}),
	['Build Range'] = function(args)
        return toModObject({
			label = 'Build Range',
			description = args['build_range_custom'] or 'build one tile further'
		});
	end,
	['Punch Pull'] = toModObject({
        label = 'Punch Pull',
        description = 'pull other players towards them upon punching them',
    }),
	['High Jump'] = toModObject({
        label = 'High Jump',
        description = 'jump one tile higher',
    }),
	['Slow Fall'] = toModObject({
        label = 'Slow Fall',
        description = 'glide slowly to the ground when holding the jump button',
    }),
	['Wall Climbing'] = toModObject({
        label = 'Wall Climbing',
        description = 'cling onto [[Climbing Wall|Climbing Walls]] by pressing the jump button',
    }),
	['Fire Hose'] = toModObject({
        label = 'Fire Hose',
        description = 'extinguish [[Fire|fires]]',
    }),
	['Fireproof'] = toModObject({
        label = 'Fireproof',
        description = 'take 50% less damage from [[Lava Pain Block (block category)|lava pain blocks]]',
    }),
	['Ghost Immunity'] = function(args)
		local ghost = args['ghost'] or 'all types of [[Ghost|ghosts]]'
        return toModObject({
			label = 'Ghost Immunity',
			description = 'be immune from ' .. ghost
		});
	end,
	['Healing'] = toModObject({
        label = 'Healing',
        description = 'heal faster than usual after receiving damage from hitting a [[Pain Block (block category)|pain block]]',
    }),
	['XP Buff'] = function(args)
		local default_message = toModObject({
            label = 'XP Buff',
            description = 'gain more [[Leveling|XP]]'
        })

		local message = ''
		local action = args['action'] or ''
		local XP = args['XP'] or ''
		local XP_chance = args['XP_chance'] or ''
		local XP_custom = args['XP_custom'] or ''
		
		local actions = {
			 Providers = 'when harvesting [[Provider (block category)|providers]]',
			 Fishing = 'when [[Guide:Fishing|fishing]]',
			 Ghost = 'when catching a [[Ghost|ghost]]',
			 Crime = 'when defeating a [[Guide:Villains|villain]]',
			 Startopia = 'when successfully completing a [[Guide:Startopia|star voyage]]',
			 Wolf = 'when reaching a [[Great Wolf Totem|great wolf totem]]',
			 Surgery = 'when successfully completing a [[Guide:Surgery|surgery]]',
			 Growganoth = 'when consuming a [[Dark Ticket]]',
			 Custom = args['action_custom'] or ''
		}
		
		if XP ~= ''  then
			message = 'an extra ' .. XP .. ' XP'
		elseif XP_chance ~= '' then
			message = 'a ' .. XP_chance .. '% chance'
		elseif XP_custom ~= '' then
			message = XP_custom .. ' XP'
		else 
			return default_message
		end
		
		if action ~= '' and actions[action] ~= nil then
				action = actions[action]
		else 
			return default_message
		end
		
		return toModObject({
            label = 'XP Buff',
            description = 'earn ' .. message .. ' ' .. action,
            notes = 'Grants ' .. message .. ' ' .. action
        })
	end,
	['Slippery'] = toModObject({
        label = 'Slippery',
        description = 'glide on any surface as if it is [[Slippery Block (block category)|slippery]]',
    }),
	['Putt Putt Putt'] = toModObject({
        label = 'Putt Putt Putt',
        description = 'move slower, but allows the player to harvest trees by walking through them',
    }),
	['Damage Reduction'] = toModObject({
        label = 'Damage Reduction',
        description = 'break blocks more slowly',
    }),
	['Knock Back Reduction'] = toModObject({
        label = 'Knock Back Reduction',
        description = 'resist a percentage of knockback when [[Punching|punched]] by other players',
    }),
	['Speedy in Water'] = toModObject({
        label = 'Speedy in Water',
        description = 'move faster in water',
    }),
	['Float on Water'] = toModObject({
        label = 'Float on Water',
        description = 'float on [[Water Bucket|water]]',
    }),
	['Grow Effect'] = toModObject({
        label = 'Grow Effect',
        description = 'expand in size',
    }),
	['Zombie Weapon'] = toModObject({
        label = 'Zombie Weapon',
        description = 'kill [[G-Virus|zombies]] during a Pandemic',
    }),
	['Low Jump'] = toModObject({
        label = 'Low Jump',
        description = 'decrease the player\'s jump height',
    }),
	['Card Battle Health'] = toModObject({
        label = 'Card Battle Health',
        description = 'add 2 additional health to the player during card battles against a [[Villains|villain]] or another player',
    }),
	['Card Battle Strength'] = toModObject({
        label = 'Card Battle Strength',
        description = 'reduce 2 health from the [[Villains|villain]] or another player',
    }),
	['Cookie Hunter'] = toModObject({
        label = 'Cookie Hunter',
        description = 'provides a significant chance of doubling fruit drops from [[Fortune Cookie]] and [[Lucky Fortune Cookie|Lucky Fortune Cookie Trees]]',
    }),
	['Night Vision'] = toModObject({
        label = 'Night Vision',
        description = 'eliminate the darkness effect created by [[Dark Background Block (block category)|dark background blocks]]',
    }),
	['Extra Gems'] = function (args)
		local chance = args['gem_chance'] or ''
		if chance ~= '' then
			chance = chance .. ' '	
		end
		return toModObject({
			label = 'Extra Gems',
			description = 'get extra ' .. chance .. 'gems from breaking blocks'
		});
	end,
	['Extra Blocks'] = function (args)
		local chance = args['block_chance'] or ''
		if chance ~= '' then
			chance = chance .. ' '	
		end
		return toModObject({
			label = 'Extra Blocks',
			description = 'get an extra ' .. chance .. 'chance for a block broken to drop itself'
		}); 
	end,
}

return mods