<commit_before>﻿// Original Work Copyright (c) <NAME> 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file

namespace EndlessClient.Rendering.Sprites
{
	public class CharacterSpriteCalculator : ICharacterSpriteCalculator
	{
		public ISpriteSheet GetBootsTexture(bool isBow)
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetArmorTexture(bool isBow)
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetHatTexture()
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetShieldTexture(bool shieldIsOnBack)
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetWeaponTexture(bool isBow)
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetSkinTexture(bool isBow)
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetHairTexture()
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetFaceTexture()
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetEmoteTexture()
		{
			throw new System.NotImplementedException();
		}
	}
}<commit_msg>Boots logic -> CharacterSpriteCalculator<commit_after>﻿// Original Work Copyright (c) <NAME> 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file

using EOLib;
using EOLib.Data.BLL;
using EOLib.Graphics;
using EOLib.Net.API;

namespace EndlessClient.Rendering.Sprites
{
	public class CharacterSpriteCalculator : ICharacterSpriteCalculator
	{
		private readonly INativeGraphicsManager _gfxManager;
		private readonly ICharacterRenderProperties _characterRenderProperties;

		public CharacterSpriteCalculator(INativeGraphicsManager gfxManager,
										 ICharacterRenderProperties characterRenderProperties)
		{
			_gfxManager = gfxManager;
			_characterRenderProperties = characterRenderProperties;
		}

		public ISpriteSheet GetBootsTexture(bool isBow)
		{
			BootsSpriteType type = BootsSpriteType.Standing;
			switch (_characterRenderProperties.CurrentAction)
			{
				case CharacterActionState.Walking:
					switch (_characterRenderProperties.WalkFrame)
					{
						case 1: type = BootsSpriteType.WalkFrame1; break;
						case 2: type = BootsSpriteType.WalkFrame2; break;
						case 3: type = BootsSpriteType.WalkFrame3; break;
						case 4: type = BootsSpriteType.WalkFrame4; break;
					}
					break;
				case CharacterActionState.Attacking:
					if (!isBow && _characterRenderProperties.AttackFrame == 2 ||
						isBow && _characterRenderProperties.AttackFrame == 1)
						type = BootsSpriteType.Attack;
					break;
				case CharacterActionState.Sitting:
					switch (_characterRenderProperties.SitState)
					{
						case SitState.Chair: type = BootsSpriteType.SitChair; break;
						case SitState.Floor: type = BootsSpriteType.SitGround; break;
					}
					break;
			}

			var gfxFile = _characterRenderProperties.Gender == 0 ? GFXTypes.FemaleShoes : GFXTypes.MaleShoes;

			var offset = GetOffsetBasedOnState(type) * GetBaseFactorFromDirection();
			var baseBootGraphic = GetBaseBootGraphic();
			var gfxNumber = baseBootGraphic + (int)type + offset;

			return new SpriteSheet(_gfxManager.TextureFromResource(gfxFile, gfxNumber, true));
		}

		public ISpriteSheet GetArmorTexture(bool isBow)
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetHatTexture()
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetShieldTexture(bool shieldIsOnBack)
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetWeaponTexture(bool isBow)
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetSkinTexture(bool isBow)
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetHairTexture()
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetFaceTexture()
		{
			throw new System.NotImplementedException();
		}

		public ISpriteSheet GetEmoteTexture()
		{
			throw new System.NotImplementedException();
		}

		private short GetBaseBootGraphic()
		{
			return (short)((_characterRenderProperties.BootsGraphic - 1) * 40);
		}

		private int GetBaseFactorFromDirection()
		{
			return _characterRenderProperties.Direction == EODirection.Down ||
				   _characterRenderProperties.Direction  == EODirection.Right ? 0 : 1;
		}

		private int GetOffsetBasedOnState(BootsSpriteType type)
		{
			switch (type)
			{
				case BootsSpriteType.WalkFrame1:
				case BootsSpriteType.WalkFrame2:
				case BootsSpriteType.WalkFrame3:
				case BootsSpriteType.WalkFrame4:
					return 4;
			}
			return 1;
		}
	}
}
{'fraction_non_alphanumeric': 0.07803223070398643, 'fraction_numerical': 0.008481764206955046, 'mean_word_length': 4.200661521499449, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '2012494', 'n_tokens_mistral': 1711, 'n_tokens_neox': 1418, 'n_words': 315}