当前位置: 首页>>代码示例>>C#>>正文


C# DBCraftedItem类代码示例

本文整理汇总了C#中DBCraftedItem的典型用法代码示例。如果您正苦于以下问题:C# DBCraftedItem类的具体用法?C# DBCraftedItem怎么用?C# DBCraftedItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DBCraftedItem类属于命名空间,在下文中一共展示了DBCraftedItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSecondaryCraftingSkillMinimumLevel

		/// <summary>
		/// Calculate the minumum needed secondary crafting skill level to make the item
		/// </summary>
		public override int GetSecondaryCraftingSkillMinimumLevel(DBCraftedItem recipe, ItemTemplate itemToCraft)
		{
			switch (itemToCraft.Object_Type)
			{
				case (int)eObjectType.CrushingWeapon:
				case (int)eObjectType.SlashingWeapon:
				case (int)eObjectType.ThrustWeapon:
				case (int)eObjectType.TwoHandedWeapon:
				case (int)eObjectType.PolearmWeapon:
				case (int)eObjectType.Flexible:
				case (int)eObjectType.Sword:
				case (int)eObjectType.Hammer:
				case (int)eObjectType.Axe:
				case (int)eObjectType.Spear:
				case (int)eObjectType.HandToHand:
				case (int)eObjectType.Blades:
				case (int)eObjectType.Blunt:
				case (int)eObjectType.Piercing:
				case (int)eObjectType.LargeWeapons:
				case (int)eObjectType.CelticSpear:
				case (int)eObjectType.Scythe:
					return recipe.CraftingLevel - 60;
			}

			return base.GetSecondaryCraftingSkillMinimumLevel(recipe, itemToCraft);
		}
开发者ID:dudemanvox,项目名称:Dawn-of-Light-Server,代码行数:29,代码来源:WeaponCrafting.cs

示例2: CheckForTools

		/// <summary>
		/// Check if the player is near the needed tools (forge, lathe, etc)
		/// </summary>
		/// <param name="player">the crafting player</param>
		/// <param name="recipe">the recipe being used</param>
		/// <param name="itemToCraft">the item to make</param>
		/// <param name="rawMaterials">a list of raw materials needed to create this item</param>
		/// <returns>true if required tools are found</returns>
		protected override bool CheckForTools(GamePlayer player, DBCraftedItem recipe, ItemTemplate itemToCraft, IList<DBCraftedXItem> rawMaterials)
		{
            bool needForge = false;

            foreach (DBCraftedXItem material in rawMaterials)
            {
				ItemTemplate template = GameServer.Database.FindObjectByKey<ItemTemplate>(material.IngredientId_nb);
                if (template != null && template.Model == 519) // metal bar
                {
                    needForge = true;
                    break;
                }
            }

            if (needForge)
            {
                foreach (GameStaticItem item in player.GetItemsInRadius(CRAFT_DISTANCE))
                {
                    if (item.Name == "forge" || item.Model == 478) // Forge
                        return true;
                }

                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "Crafting.CheckTool.NotHaveTools", itemToCraft.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                player.Out.SendMessage(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Crafting.CheckTool.FindForge"), eChatType.CT_System, eChatLoc.CL_SystemWindow);

				if (player.Client.Account.PrivLevel > 1)
					return true;

				return false;
            }

            return true;
        }
开发者ID:boscorillium,项目名称:dol,代码行数:41,代码来源:Tailoring.cs

示例3: GainCraftingSkillPoints

		/// <summary>
		/// Gain a point in the appropriate skills for a recipe and materials
		/// </summary>
		public override void GainCraftingSkillPoints(GamePlayer player, DBCraftedItem recipe, IList<DBCraftedXItem> rawMaterials)
		{
			if (Util.Chance(CalculateChanceToGainPoint(player, recipe)))
			{
				player.GainCraftingSkill(eCraftingSkill.SiegeCrafting, 1);
				player.Out.SendUpdateCraftingSkills();
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:11,代码来源:SiegeCrafting.cs

示例4: GainCraftingSkillPoints

		/// <summary>
		/// Gain a point in the appropriate skills for a recipe and materials
		/// </summary>
		public override void GainCraftingSkillPoints(GamePlayer player, DBCraftedItem recipe, IList<DBCraftedXItem> rawMaterials)
		{
			if (Util.Chance(CalculateChanceToGainPoint(player, recipe)))
			{
                if (player.GetCraftingSkillValue(eCraftingSkill.MetalWorking) < subSkillCap)
                    player.GainCraftingSkill(eCraftingSkill.MetalWorking, 1);

				player.Out.SendUpdateCraftingSkills();
			}
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:13,代码来源:MetalWorking.cs

示例5: GetSecondaryCraftingSkillMinimumLevel

		/// <summary>
		/// Calculate the minumum needed secondary crafting skill level to make the item
		/// </summary>
		public override int GetSecondaryCraftingSkillMinimumLevel(DBCraftedItem recipe, ItemTemplate itemToCraft)
		{
			switch(itemToCraft.Object_Type)
			{
				case (int)eObjectType.Studded:
				case (int)eObjectType.Chain:
				case (int)eObjectType.Plate:
				case (int)eObjectType.Reinforced:
				case (int)eObjectType.Scale:
					return recipe.CraftingLevel - 60;
			}

			return base.GetSecondaryCraftingSkillMinimumLevel(recipe, itemToCraft);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:17,代码来源:ArmorCrafting.cs

示例6: BuildCraftedItem

		protected override void BuildCraftedItem(GamePlayer player, DBCraftedItem recipe, ItemTemplate itemToCraft)
		{
			GameSiegeWeapon siegeweapon = null;
			switch ((eObjectType)itemToCraft.Object_Type)
			{
				case eObjectType.SiegeBalista:
					{
						siegeweapon = new GameSiegeBallista();
					}
					break;
				case eObjectType.SiegeCatapult:
					{
						siegeweapon = new GameSiegeCatapult();
					}
					break;
				case eObjectType.SiegeCauldron:
					{
						siegeweapon = new GameSiegeCauldron();
					}
					break;
				case eObjectType.SiegeRam:
					{
						siegeweapon = new GameSiegeRam();
					}
					break;
				case eObjectType.SiegeTrebuchet:
					{
						siegeweapon = new GameSiegeTrebuchet();
					}
					break;
				default:
					{
						base.BuildCraftedItem(player, recipe, itemToCraft);
						return;
					}
			}

			//actually stores the Id_nb of the siegeweapon
			siegeweapon.ItemId = itemToCraft.Id_nb;

			siegeweapon.LoadFromDatabase(itemToCraft);
			siegeweapon.CurrentRegion = player.CurrentRegion;
			siegeweapon.Heading = player.Heading;
			siegeweapon.X = player.X;
			siegeweapon.Y = player.Y;
			siegeweapon.Z = player.Z;
			siegeweapon.Realm = player.Realm;
			siegeweapon.AddToWorld();
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:49,代码来源:SiegeCrafting.cs

示例7: CheckForTools

		/// <summary>
		/// Check if the player is near the needed tools (forge, lathe, etc)
		/// </summary>
		/// <param name="player">the crafting player</param>
		/// <param name="recipe">the recipe being used</param>
		/// <param name="itemToCraft">the item to make</param>
		/// <param name="rawMaterials">a list of raw materials needed to create this item</param>
		/// <returns>true if required tools are found</returns>
		protected override bool CheckForTools(GamePlayer player, DBCraftedItem recipe, ItemTemplate itemToCraft, IList<DBCraftedXItem> rawMaterials)
		{
			foreach (GameStaticItem item in player.GetItemsInRadius(CRAFT_DISTANCE))
			{
				if (item.Name.ToLower() == "forge" || item.Model == 478) // Forge
					return true;
			}

			player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Crafting.CheckTool.NotHaveTools", itemToCraft.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
			player.Out.SendMessage(LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Crafting.CheckTool.FindForge"), eChatType.CT_System, eChatLoc.CL_SystemWindow);

			if (player.Client.Account.PrivLevel > 1)
				return true;

			return false;
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:24,代码来源:MetalWorking.cs

示例8: GetSecondaryCraftingSkillMinimumLevel

		public override int GetSecondaryCraftingSkillMinimumLevel(DBCraftedItem recipe, ItemTemplate itemToCraft)
		{
			switch (itemToCraft.Object_Type)
			{
				case (int)eObjectType.Fired:  //tested
				case (int)eObjectType.Longbow: //tested
				case (int)eObjectType.Crossbow: //tested
				case (int)eObjectType.Instrument: //tested
				case (int)eObjectType.RecurvedBow:
				case (int)eObjectType.CompositeBow:
					return recipe.CraftingLevel - 20;

				case (int)eObjectType.Arrow: //tested
				case (int)eObjectType.Bolt: //tested
				case (int)eObjectType.Thrown:
					return recipe.CraftingLevel - 15;

				case (int)eObjectType.Staff: //tested
					return recipe.CraftingLevel - 35;
			}

			return base.GetSecondaryCraftingSkillMinimumLevel(recipe, itemToCraft);
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:23,代码来源:Fletching.cs

示例9: RemoveUsedMaterials

		/// <summary>
		/// Remove used raw material from player inventory
		/// </summary>
		/// <param name="player"></param>
		/// <param name="recipe"></param>
		/// <returns></returns>
		public virtual bool RemoveUsedMaterials(GamePlayer player, DBCraftedItem recipe, IList<DBCraftedXItem> rawMaterials)
		{
			Dictionary<int, int?> dataSlots = new Dictionary<int, int?>(10);

			lock (player.Inventory)
			{
				foreach (DBCraftedXItem material in rawMaterials)
				{
					ItemTemplate template = GameServer.Database.FindObjectByKey<ItemTemplate>(material.IngredientId_nb);

					if (template == null)
					{
						player.Out.SendMessage("Can't find a material (" + material.IngredientId_nb + ") needed for this recipe.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
						log.Error("RemoveUsedMaterials: Cannot find raw material ItemTemplate: " + material.IngredientId_nb + " needed for recipe: " + recipe.CraftedItemID);
						return false;
					}

					bool result = false;
					int count = material.Count;

					foreach (InventoryItem item in player.Inventory.GetItemRange(eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack))
					{
						if (item != null && item.Name == template.Name)
						{
							if (item.Count >= count)
							{
								if (item.Count == count)
								{
									dataSlots.Add(item.SlotPosition, null);
								}
								else
								{
									dataSlots.Add(item.SlotPosition, count);
								}
								result = true;
								break;
							}
							else
							{
								dataSlots.Add(item.SlotPosition, null);
								count -= item.Count;
							}
						}
					}
					if (result == false)
					{
						return false;
					}
				}
			}

			player.Inventory.BeginChanges();
			Dictionary<int, int?>.Enumerator enumerator = dataSlots.GetEnumerator();
			while (enumerator.MoveNext())
			{
				KeyValuePair<int, int?> de = enumerator.Current;
				InventoryItem item = player.Inventory.GetItem((eInventorySlot)de.Key);
				if (item != null)
				{
					if (!de.Value.HasValue)
					{
						player.Inventory.RemoveItem(item);
					}
					else
					{
						player.Inventory.RemoveCountFromStack(item, de.Value.Value);
					}
					InventoryLogging.LogInventoryAction(player, "(craft)", eInventoryActionType.Craft, item.Template, de.Value.HasValue ? de.Value.Value : item.Count);
				}
			}
			player.Inventory.CommitChanges();

			return true;//all raw material removed and item created
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:80,代码来源:AbstractCraftingSkill.cs

示例10: CraftItem

		/// <summary>
		/// Called when player tries to begin crafting an item
		/// </summary>
		public virtual void CraftItem(GamePlayer player, DBCraftedItem recipe, ItemTemplate itemToCraft, IList<DBCraftedXItem> rawMaterials)
		{
			if (!CanPlayerStartToCraftItem(player, recipe, itemToCraft, rawMaterials))
			{
				return;
			}

			if (player.IsCrafting)
			{
				StopCraftingCurrentItem(player, itemToCraft);
				return;
			}

			int craftingTime = GetCraftingTime(player, recipe, rawMaterials);

			player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "AbstractCraftingSkill.CraftItem.BeginWork", itemToCraft.Name, CalculateChanceToMakeItem(player, recipe).ToString()), eChatType.CT_Missed, eChatLoc.CL_SystemWindow);
			player.Out.SendTimerWindow(LanguageMgr.GetTranslation(player.Client.Account.Language, "AbstractCraftingSkill.CraftItem.CurrentlyMaking", itemToCraft.Name), craftingTime);

			player.Stealth(false);
			
			StartCraftingTimerAndSetCallBackMethod(player, recipe, rawMaterials, craftingTime);
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:25,代码来源:AbstractCraftingSkill.cs

示例11: StartCraftingTimerAndSetCallBackMethod

		protected virtual void StartCraftingTimerAndSetCallBackMethod(GamePlayer player, DBCraftedItem recipe, IList<DBCraftedXItem> rawMaterials, int craftingTime)
		{
			player.CraftTimer = new RegionTimer(player);
			player.CraftTimer.Callback = new RegionTimerCallback(MakeItem);
			player.CraftTimer.Properties.setProperty(PLAYER_CRAFTER, player);
			player.CraftTimer.Properties.setProperty(RECIPE_BEING_CRAFTED, recipe);
			player.CraftTimer.Properties.setProperty(RECIPE_RAW_MATERIAL_LIST, rawMaterials);
			player.CraftTimer.Start(craftingTime * 1000);
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:9,代码来源:AbstractCraftingSkill.cs

示例12: GetQuality

		/// <summary>
		/// Calculate crafted item quality
		/// </summary>
		private int GetQuality(GamePlayer player, DBCraftedItem item)
		{
			// 2% chance to get masterpiece, 1:6 chance to get 94-99%, if legendary or if grey con
			// otherwise moving the most load towards 94%, the higher the item con to the crafter skill
			//1.87 patch raises min quality to 96%

			// legendary
			if (player.GetCraftingSkillValue(m_eskill) >= 1000)
			{
				if (Util.Chance(2))
				{
					return 100;	// 2% chance for master piece
				}
				return 96 + Util.Random(3);
			}

			int delta = GetItemCon(player.GetCraftingSkillValue(m_eskill), item.CraftingLevel);
			if (delta < -2)
			{
				if (Util.Chance(2))
					return 100; // grey items get 2% chance to be master piece
				return 96 + Util.Random(3); // handle grey items like legendary
			}

			// this is a type of roulette selection, imagine a roulette wheel where all chances get different sized
			// fields where the ball can drop, the bigger the field, the bigger the chance
			// field size is modulated by item con and can be also 0

			// possible chance allocation scheme for yellow item
			// 99:
			// 98:
			// 97: o
			// 96: oo
			// where one 'o' marks 100 size, this example results in 10% chance for yellow items to be 97% quality

			delta = delta * 100;

			int[] chancePart = new int[4]; // index ranges from 96%(0) to 99%(5)
			int sum = 0;
			for (int i = 0; i < 4; i++)
			{
				chancePart[i] = Math.Max((4 - i) * 100 - delta, 0);	// 0 minimum
				sum += chancePart[i];
			}

			// selection
			int rand = Util.Random(sum);
			for (int i = 3; i >= 0; i--)
			{
				if (rand < chancePart[i])
					return 96 + i;
				rand -= chancePart[i];
			}

			// if something still not clear contact Thrydon/Blue

			return 96;
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:61,代码来源:AbstractCraftingSkill.cs

示例13: GetSecondaryCraftingSkillMinimumLevel

		/// <summary>
		/// Calculate the minumum needed secondary crafting skill level to make the item
		/// </summary>
		public virtual int GetSecondaryCraftingSkillMinimumLevel(DBCraftedItem recipe, ItemTemplate itemToCraft)
		{
			return 0;
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:7,代码来源:AbstractCraftingSkill.cs

示例14: GetCraftingTime

		/// <summary>
		/// Calculate crafting time
		/// </summary>
		public virtual int GetCraftingTime(GamePlayer player, DBCraftedItem recipe, IList<DBCraftedXItem> rawMaterials)
		{
			double baseMultiplier = (recipe.CraftingLevel / 100) + 1;

			ushort materialsCount = 0;
			foreach (DBCraftedXItem material in rawMaterials)
			{
				materialsCount += (ushort)material.Count;
			}

			int craftingTime = (int)(baseMultiplier * materialsCount / 4);

			// Player does check for capital city bonus as well
			craftingTime = (int)(craftingTime / player.CraftingSpeed);

			//keep bonuses reduction in crafting time
			if (Keeps.KeepBonusMgr.RealmHasBonus(DOL.GS.Keeps.eKeepBonusType.Craft_Timers_5, (eRealm)player.Realm))
				craftingTime = (int)(craftingTime / 1.05);
			else if (Keeps.KeepBonusMgr.RealmHasBonus(DOL.GS.Keeps.eKeepBonusType.Craft_Timers_3, (eRealm)player.Realm))
				craftingTime = (int)(craftingTime / 1.03);

			int con = GetItemCon(player.GetCraftingSkillValue(m_eskill), recipe.CraftingLevel);
			double mod = 1.0;
			switch (con)
			{
				case -3:
					mod = 0.4;
					break;
				case -2:
					mod = 0.6;
					break;
				case -1:
					mod = 0.8;
					break;
				case 0:
					mod = 1.0;
					break;
				case 1:
					mod = 1.0;
					break;
				case 2:
					mod = 1.0;
					break;
				case 3:
					mod = 1.0;
					break;
			}

			craftingTime = (int)(craftingTime * mod);

			if (craftingTime < 1)
				craftingTime = 1;
			return craftingTime;
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:57,代码来源:AbstractCraftingSkill.cs

示例15: CanPlayerStartToCraftItem

		protected virtual bool CanPlayerStartToCraftItem(GamePlayer player, DBCraftedItem recipe, ItemTemplate itemToCraft, IList<DBCraftedXItem> rawMaterials)
		{
			if (!GameServer.ServerRules.IsAllowedToCraft(player, itemToCraft))
			{
				return false;
			}

			if (!CheckForTools(player, recipe, itemToCraft, rawMaterials))
			{
				return false;
			}

			if (!CheckSecondCraftingSkillRequirement(player, recipe, itemToCraft, rawMaterials))
			{
				return false;
			}

			if (!CheckRawMaterials(player, recipe, itemToCraft, rawMaterials))
			{
				return false;
			}

			if (player.IsMoving || player.IsStrafing)
			{
				player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "AbstractCraftingSkill.CraftItem.MoveAndInterrupt"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return false;
			}

			if (player.InCombat)
			{
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "AbstractCraftingSkill.CraftItem.CantCraftInCombat"), eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return false;
			}

			return true;
		}
开发者ID:Refizul,项目名称:DOL-Kheldron,代码行数:36,代码来源:AbstractCraftingSkill.cs


注:本文中的DBCraftedItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。