Module:Item/ModList

From Growtopia
Revision as of 20:47, 29 March 2025 by >HashJona (fix XP Buff)
Jump to navigationJump to search

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['label'] .. ' Mod Items'),
        mod_category = options['mod_category'] or ('Mods/' ..  options['label']),
		description = options['description'],
		notes = options['notes'] or '',
        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 action_custom = args['action_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 successfully completing a [[WOLFWORLD|wolf world]]',
			 Surgery = 'when successfully completing a [[Guide:Surgery|surgery]]',
			 Growganoth = 'when consuming a [[Dark Ticket]]',
		}

		
		if XP ~= ''  then
			message = 'an extra ' .. XP .. ' XP'
		elseif XP_chance ~= '' then
			message = 'a ' .. XP_chance .. '% chance'
		elseif XP_custom ~= '' then
			message = XP_custom
		else 
			return default_message
		end
		
		if action ~= '' and actions[action] ~= nil then
			action = actions[action]
		elseif action_custom ~= '' then
			action = action_custom	
		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