⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ore.cs

📁 网络游戏征服的服务端部分完整源码 VC编译 绝少的源码 有兴趣的可以
💻 CS
字号:
using System;

namespace CO_Full_Server
{
	/// <summary>
	/// An enum representing the type of ore
	/// </summary>
	public enum OreType : int
	{
		/// <summary>
		/// Iron ore
		/// </summary>
		Iron = 0,
		/// <summary>
		/// Copper ore
		/// </summary>
		Copper,
		/// <summary>
		/// Silver ore
		/// </summary>
		Silver,
		/// <summary>
		/// Gold ore
		/// </summary>
		Gold,
		/// <summary>
		/// Euxenite ore
		/// </summary>
		Euxenite
	}
	/// <summary>
	/// Represents an ore of any type.
	/// </summary>
	public class Ore : ItemBase
	{
		private OreType m_Type;
		private int m_Rate;
		/// <summary>
		/// Default constructor
		/// </summary>
		/// <param name="UID">Unique ID of the ore</param>
		/// <param name="Type">Item ID of the ore</param>
		public Ore(int UID, int Type) : base(UID, Type)
		{
			int Temp = Type;
			//Temp = Temp << 24 | ((Temp >> 8) << 16) | ((Temp >> 16) << 8) | Temp >> 24;

			if (Temp >= 0x00105b94 && Temp <= 0x00105b9d)
			{
				m_Type = OreType.Copper;
				Temp = Temp - 0x00105b93;
			}
			else if (Temp >= 0x00105bb2 && Temp <= 0x00105bbb)
			{
				m_Type = OreType.Gold;
				Temp = Temp - 0x00105bb1;
			}
			else if (Temp >= 0x00105b8a && Temp <= 0x00105b93)
			{
				m_Type = OreType.Iron;
				Temp = Temp - 0x00105b89;
			}
			else if (Temp >= 0x00105ba8 && Temp <= 0x00105bb1)
			{
				m_Type = OreType.Silver;
				Temp = Temp - 0x00105ba7;
			}
			else if (Temp == 0x00105b9f)
			{
				m_Type = OreType.Euxenite;
				Temp = Temp - 0x00105b9f; //Not really Rate 0, but it will work
			}
			else	//Item was not really an ore
			{
				m_Type = (OreType)(-1);
				m_Rate = -1;
				return;
			}

			m_Rate = Temp % 11;
			return;			
		}
		/// <summary>
		/// Returns the type of the ore
		/// </summary>
		/// <returns>The type of the ore as an OreType</returns>
		public OreType Type()
		{
			return m_Type;
		}
		/// <summary>
		/// Returns the rate of the ore
		/// </summary>
		/// <returns>The rate of the ore as an integer 1 through 10 or -1 if the ore is invalid</returns>
		public int Rate()
		{
			return m_Rate;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -