<commit_before>-- This script is the central item lookat.

module("server.itemlookat", package.seeall)

--- Item Lookat
-- The task of this function is to generate the lookat on a item.
-- This function is called by the server.
--
-- @param[in] player 	the player that is supposed to receive the inform
-- @param[in] item      the item the player is looking at
-- @return TRUE in case the script generated the lookat
function lookAtItem(player, item)
	local itemCommon = world:getItemStatsFromId(item.id);
	local lookAt = ItemLookAt();
	lookAt.name     = world:getItemName(item.id, player:getPlayerLanguage());
	
	local rarenessData = item:getData("rareness");
	if (rarenessData == nil) then
		lookAt.rareness = ItemLookAt.commonItem;
	else
		-- Valid values:
		--  ItemLookAt.commonItem
		--  ItemLookAt.uncommonItem
		--  ItemLookAt.rarecommonItem
		--  ItemLookAt.epiccommonItem
		local value = tonumber(rarenessData);
		if (value ~= nil) then
			lookAt.rareness = value;
	    end;
	end;
	
	local descriptionData = item:getData("itemDescription");
	if (descriptionData ~= nil) then
		lookAt.description = descriptionData;
	end;
	
	if (itemCommon.AgeingSpeed < 255) then
		local craftedByData = item:getData("craftedBy");
		if (craftedByData ~= nil) then
			lookAt.craftedBy = craftedByData;
		end;
		
		lookAt.weight = itemCommon.Weight;
		lookAt.worth = itemCommon.Worth;
		
		-- lookAt.qualityText (string)
		-- lookAt.durabilityText (string)
		-- lookAt.durabilityValue (int: 1 - 100)
		
		-- lookAt.diamondLevel (int: 0 - 10)
		-- lookAt.emeraldLevel (int: 0 - 10)
		-- lookAt.rubyLevel (int: 0 - 10)
		-- lookAt.sapphireLevel (int: 0 - 10)
		-- lookAt.amethystLevel (int: 0 - 10)
		-- lookAt.obsidianLevel (int: 0 - 10)<commit_msg>Fixed stupid typo<commit_after>-- This script is the central item lookat.

module("server.itemlookat", package.seeall)

--- Item Lookat
-- The task of this function is to generate the lookat on a item.
-- This function is called by the server.
--
-- @param[in] player 	the player that is supposed to receive the inform
-- @param[in] item      the item the player is looking at
-- @return TRUE in case the script generated the lookat
function lookAtItem(player, item)
	local itemCommon = world:getItemStatsFromId(item.id);
	local lookAt = ItemLookAt();
	lookAt.name     = world:getItemName(item.id, player:getPlayerLanguage());
	
	local rarenessData = item:getData("rareness");
	if (rarenessData == nil) then
		lookAt.rareness = ItemLookAt.commonItem;
	else
		-- Valid values:
		--  ItemLookAt.commonItem
		--  ItemLookAt.uncommonItem
		--  ItemLookAt.rarecommonItem
		--  ItemLookAt.epiccommonItem
		local value = tonumber(rarenessData);
		if (value ~= nil) then
			lookAt.rareness = value;
	    end;
	end;
	
	local descriptionData = item:getData("itemDescription");
	if (descriptionData ~= nil) then
		lookAt.description = descriptionData;
	end;
	
	if (itemCommon.AgingSpeed < 255) then
		local craftedByData = item:getData("craftedBy");
		if (craftedByData ~= nil) then
			lookAt.craftedBy = craftedByData;
		end;
		
		lookAt.weight = itemCommon.Weight;
		lookAt.worth = itemCommon.Worth;
		
		-- lookAt.qualityText (string)
		-- lookAt.durabilityText (string)
		-- lookAt.durabilityValue (int: 1 - 100)
		
		-- lookAt.diamondLevel (int: 0 - 10)
		-- lookAt.emeraldLevel (int: 0 - 10)
		-- lookAt.rubyLevel (int: 0 - 10)
		-- lookAt.sapphireLevel (int: 0 - 10)
		-- lookAt.amethystLevel (int: 0 - 10)
		-- lookAt.obsidianLevel (int: 0 - 10)
{'fraction_non_alphanumeric': 0.11778224648089629, 'fraction_numerical': 0.014363688595231256, 'mean_word_length': 3.481338481338481, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5485629', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1160, 'n_words': 321}