command.register("item", "Get item information", function(ctx) if #ctx.args < 1 then ctx:reply("`4Usage: ``/item <item_id>") return false end local item_id = tonumber(ctx.args[1]) if not item_id then ctx:reply("`4Error: ``Invalid item ID") return false end local item = item_database:get_item(item_id) if not item then ctx:reply("`4Error: ``Item not found") return false end ctx:reply("`2Item {}: ``{}", item.item_id, item.item_name) ctx:reply("`2Type: ``{}, `2Rarity: ``{}", item.item_type, item.rarity) ctx:reply("`2Max Amount: ``{}", item.max_amount) return trueend)
command.register("rare", "List rare items", function(ctx) if #ctx.args < 1 then ctx:reply("`4Usage: ``/rare <min_rarity>") return false end local min_rarity = tonumber(ctx.args[1]) if not min_rarity then ctx:reply("`4Error: ``Invalid rarity") return false end local found = {} local total = item_database:get_count() for i = 0, total - 1 do local item = item_database:get_item(i) if item and item.rarity >= min_rarity then table.insert(found, item) end end ctx:reply("`2Found {} items with rarity >= {}", #found, min_rarity) for i, item in ipairs(found) do if i <= 10 then -- Limit to 10 items ctx:reply(" [{}] {} (Rarity: {})", item.item_id, item.item_name, item.rarity) end end if #found > 10 then ctx:reply("`2... and {} more", #found - 10) end return trueend)
command.register("hats", "List all hats", function(ctx) local found = {} local total = item_database:get_count() for i = 0, total - 1 do local item = item_database:get_item(i) if item and item.clothing_type == item.ClothingType.Hat then table.insert(found, item) end end ctx:reply("`2Found {} hats", #found) for i, item in ipairs(found) do if i <= 20 then ctx:reply(" [{}] {}", item.item_id, item.item_name) end end return trueend)
command.register("blockhealth", "Check block health", function(ctx) if #ctx.args < 1 then ctx:reply("`4Usage: ``/blockhealth <item_id>") return false end local item_id = tonumber(ctx.args[1]) if not item_id then ctx:reply("`4Error: ``Invalid item ID") return false end local item = item_database:get_item(item_id) if not item then ctx:reply("`4Error: ``Item not found") return false end ctx:reply("`2{} ``health: `2{}", item.item_name, item.health) return trueend)
command.register("solid", "List solid blocks", function(ctx) local found = 0 local total = item_database:get_count() ctx:reply("`2Scanning {} items...", total) for i = 0, total - 1 do local item = item_database:get_item(i) if item and item.collision_type == item.CollisionType.Solid then found = found + 1 end end ctx:reply("`2Found {} solid blocks", found) return trueend)
command.register("random", "Get a random item", function(ctx) local total = item_database:get_count() local random_id = math.random(0, total - 1) local item = item_database:get_item(random_id) if item then ctx:reply("`2Random Item: ``{}" .. item.item_name) ctx:reply("`2ID: ``{}, `2Rarity: ``{}", item.item_id, item.rarity) else ctx:reply("`4Error: ``Failed to get random item") end return trueend)
event.on("server:SendMapData", function(ctx) if ctx:has_packet() then local object_map = world:get_object_map() local objects = object_map:get_objects() logger.info("Validating {} objects...", #objects) for i, obj in ipairs(objects) do local item = item_database:get_item(obj.item_id) if item then logger.info("Object {}: {} x{}", i, item.item_name, obj.amount) else logger.warn("Unknown item ID: {}", obj.item_id) end end endend)