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


C# Database.ItemTemplate类代码示例

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


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

示例1: 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

示例2: 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

示例3: Init

        private void Init()
        {
            #region defineItems

            // item db check
            RecruitsCloak = GameServer.Database.FindObjectByKey<ItemTemplate>("k109_recruits_cloak");
            if (RecruitsCloak == null)
            {
                RecruitsCloak = new ItemTemplate();
                RecruitsCloak.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.ANewHeroesWelcome.Init.Text1");
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + RecruitsCloak.Name + ", creating it ...");

                RecruitsCloak.Level = 5;
                RecruitsCloak.Weight = 3;
                RecruitsCloak.Model = 443;
                RecruitsCloak.Color = 36;

                RecruitsCloak.Object_Type = (int)eObjectType.Magical;
                RecruitsCloak.Item_Type = (int)eEquipmentItems.CLOAK;
                RecruitsCloak.Id_nb = "k109_recruits_cloak";
                RecruitsCloak.Price = 0;
                RecruitsCloak.IsPickable = true;
                RecruitsCloak.IsDropable = false; // can't be sold to merchand

                RecruitsCloak.Bonus1 = 6;
                RecruitsCloak.Bonus1Type = (int)eProperty.MaxHealth;

                RecruitsCloak.Quality = 100;
                RecruitsCloak.Condition = 50000;
                RecruitsCloak.MaxCondition = 50000;
                RecruitsCloak.Durability = 50000;
                RecruitsCloak.MaxDurability = 50000;
                GameServer.Database.AddObject(RecruitsCloak);
            }
            LetterToPompin = GameServer.Database.FindObjectByKey<ItemTemplate>("letter_to_pompin");
            if (LetterToPompin == null)
            {
                LetterToPompin = new ItemTemplate();
                LetterToPompin.Weight = 0;
                LetterToPompin.Condition = 50000;
                LetterToPompin.MaxCondition = 50000;
                LetterToPompin.Model = 499;
                LetterToPompin.Extension = 1;
                LetterToPompin.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.ANewHeroesWelcome.Init.Text2");
                LetterToPompin.Id_nb = "letter_to_pompin";
                GameServer.Database.AddObject(LetterToPompin);
            }

            #endregion defineItems

            Level = 1;
            QuestGiver = MasterClaistan;
            Rewards.Experience = 22;
            Rewards.MoneyPercent = 100;
            Rewards.AddBasicItem(RecruitsCloak);
            Rewards.ChoiceOf = 1;

            pompinsletter = AddGoal(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Alb.ANewHeroesWelcome.Init.Text3"), QuestGoal.GoalType.ScoutMission, 1, LetterToPompin);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:60,代码来源:ANewHeroesWelcome.cs

示例4: TestAddTemplate

		public void TestAddTemplate()
		{
			GameLivingInventory gameLivingInventory = new TestInventory();

			ItemTemplate template = new ItemTemplate();
			Random rand = new Random();
			template.Id_nb = "blankItem" + rand.Next().ToString();
			template.Name = "a blank item";
			template.MaxCount = 10;
			if (template == null)
				Console.WriteLine("template null");
			if (gameLivingInventory.AddTemplate(GameInventoryItem.Create<ItemTemplate>(template), 7, eInventorySlot.RightHandWeapon, eInventorySlot.FourthQuiver))
				Console.WriteLine("addtemplate 7 blank item");
			else
				Console.WriteLine("can not add 7 blank item");
			Console.WriteLine("----PRINT AFTER FIRST ADD 7 TEMPLATE-----");
			PrintInventory(gameLivingInventory);

			if (gameLivingInventory.AddTemplate(GameInventoryItem.Create<ItemTemplate>(template), 4, eInventorySlot.RightHandWeapon, eInventorySlot.FourthQuiver))
				Console.WriteLine("addtemplate 4 blank item");
			else
				Console.WriteLine("can not add 4 blank item");
			Console.WriteLine("----PRINT AFTER SECOND ADD 4 TEMPLATE-----");
			PrintInventory(gameLivingInventory);
			//here must have 10 item in a slot and 1 in another
			
		}
开发者ID:andyhebear,项目名称:DOLSharp,代码行数:27,代码来源:GameLivingInventoryTest.cs

示例5: GameHouseVault

		/// <summary>
		/// Create a new house vault.
		/// </summary>
		/// <param name="vaultIndex"></param>
		public GameHouseVault(ItemTemplate itemTemplate, int vaultIndex)
		{
			if (itemTemplate == null)
				throw new ArgumentNullException();

			Name = itemTemplate.Name;
			Model = (ushort) (itemTemplate.Model);
			_templateID = itemTemplate.Id_nb;
			Index = vaultIndex;
		}
开发者ID:dol-leodagan,项目名称:DOLSharp,代码行数:14,代码来源:GameHouseVault.cs

示例6: InventoryTestCreation

 // the following is not in the constructor because TestFixtureSetup
 // is not initialized at this time, thus we can't connect to server
 public void InventoryTestCreation()
 {
     player = CreateMockGamePlayer();
     Assert.IsNotNull(player, "Player is null !");
     itemt = GameServer.Database.SelectObject<ItemTemplate>("Id_nb = 'championDocharWardenBlade'");
     Assert.IsNotNull(itemt, "ItemTemplate is null !");
     itemu = new ItemUnique();
     itemu.Id_nb = "tunik" + DateTime.Now.Ticks;
     GameServer.Database.AddObject(itemu);
     Assert.IsNotNull(itemu, "ItemUnique is created !");
     itema = GameServer.Database.SelectObject<ItemTemplate>("id_nb= 'traitors_dagger_hib");
 }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:14,代码来源:InventoryTest.cs

示例7: 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

示例8: 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

示例9: 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

示例10: Init

        private void Init()
        {
            ItemTemplate insigniarings = new ItemTemplate();
            insigniarings.Weight = 0;
            insigniarings.Condition = 50000;
            insigniarings.MaxCondition = 50000;
            insigniarings.Model = 103;
            insigniarings.Extension = 1;
            insigniarings.Name = LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "Alb.DredgeUpAPledge.Init.Text1");

            Level = 1;
            QuestGiver = sirDorian;
            Rewards.Experience = 30;
            Rewards.MoneyPercent = 100;
            banditPledgesKilled = AddGoal(LanguageMgr.GetTranslation(ServerProperties.Properties.SERV_LANGUAGE, "Alb.DredgeUpAPledge.Init.Text2"), QuestGoal.GoalType.KillTask, 2, insigniarings);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:16,代码来源:DredgeUpAPledge.cs

示例11: InventoryArtifact

        /// <summary>
        /// Create a new inventory artifact from an item template.
        /// </summary>
        /// <param name="template"></param>
        public InventoryArtifact(ItemTemplate template)
            : base(template)
        {
            ArtifactID = ArtifactMgr.GetArtifactIDFromItemID(template.Id_nb);
            ArtifactLevel = 0;
            m_levelRequirements = ArtifactMgr.GetLevelRequirements(ArtifactID);

            for (ArtifactBonus.ID bonusID = ArtifactBonus.ID.Min; bonusID <= ArtifactBonus.ID.Max; ++bonusID)
            {
                // Clear all bonuses except the base (L0) bonuses.

                if (m_levelRequirements[(int)bonusID] > 0)
                {
                    Template.SetBonusType(bonusID, 0);
                    Template.SetBonusAmount(bonusID, 0);
                }
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:22,代码来源:InventoryArtifact.cs

示例12: AccountVault

        /// <summary>
        /// An account vault that masquerades as a house vault to the game client
        /// </summary>
        /// <param name="player">Player who owns the vault</param>
        /// <param name="vaultNPC">NPC controlling the interaction between player and vault</param>
        /// <param name="vaultOwner">ID of vault owner (can be anything unique, if it's the account name then all toons on account can access the items)</param>
        /// <param name="vaultNumber">Valid vault IDs are 0-3</param>
        /// <param name="dummyTemplate">An ItemTemplate to satisfy the base class's constructor</param>
        public AccountVault(GamePlayer player, GameNPC vaultNPC, string vaultOwner, int vaultNumber, ItemTemplate dummyTemplate)
            : base(dummyTemplate, vaultNumber)
        {
            m_player = player;
            m_vaultNPC = vaultNPC;
            m_vaultOwner = vaultOwner;
            m_vaultNumber = vaultNumber;

            DBHouse dbh = new DBHouse();
            //was allowsave = false but uhh i replaced with allowadd = false
            dbh.AllowAdd = false;
            dbh.GuildHouse = false;
            dbh.HouseNumber = player.ObjectID;
            dbh.Name = player.Name + "'s House";
            dbh.OwnerID = player.DBCharacter.ObjectId;
            dbh.RegionID = player.CurrentRegionID;

            CurrentHouse = new House(dbh);
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:27,代码来源:AccountVaultKeeper.cs

示例13: OnScriptLoaded

        public static void OnScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            int[] prices = new int[] { 0, 1500, 1500, 3750, 3000, 2000, 3250, 2500, 3500, 4000, 5000 };

            for (int i = 1 ; i < 11 ; i++)
            {
                ItemTemplate credit = GameServer.Database.FindObjectByKey<ItemTemplate>(string.Format("master_level_credit_bptoken_{0}", i));
                if (credit == null)
                {
                    credit = new ItemTemplate();
                    credit.AllowAdd = true;
                    credit.Id_nb = string.Format("master_level_credit_bptoken_{0}", i);
                    credit.Weight = 0;
                    credit.Price = prices[i];
                    credit.Condition = 50000;
                    credit.MaxCondition = 50000;
                    credit.Model = 0x01E7;
                    credit.Name = string.Format("Master Level {0} Credit", i);
                    GameServer.Database.AddObject(credit);
                }
                m_offeredItems.AddTradeItem(0, eMerchantWindowSlot.FirstEmptyInPage, credit);
            }

            // Respec
            ItemTemplate resp = GameServer.Database.FindObjectByKey<ItemTemplate>("master_level_respec_bptoken");
            if (resp == null)
            {
                resp = new ItemTemplate();
                resp.AllowAdd = true;
                resp.Id_nb = "master_level_respec_bptoken";
                resp.Weight = 5;
                resp.Price = 5000;
                resp.Condition = 50000;
                resp.MaxCondition = 50000;
                resp.Level = 40;
                resp.Object_Type = 0x29;
                resp.Model = 0x075E;
                resp.Name = "Star of Destiny";
                GameServer.Database.AddObject(resp);
            }
            m_offeredItems.AddTradeItem(0, eMerchantWindowSlot.FirstEmptyInPage, resp);
        }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:42,代码来源:MasterLevelsMerchant.cs

示例14: GenerateLoot

		/// <summary>
        /// Generate loot for given mob
		/// </summary>
		/// <param name="mob"></param>
		/// <param name="killer"></param>
		/// <returns></returns>
		public override LootList GenerateLoot(GameNPC mob, GameObject killer)
		{
			LootList loot = base.GenerateLoot(mob, killer);

			int lvl = mob.Level + 1;
			if (lvl < 1) lvl = 1;
			int minLoot = 2 + ((lvl * lvl * lvl) >> 3);

			long moneyCount = minLoot + Util.Random(minLoot >> 1);
			moneyCount = (long)((double)moneyCount * ServerProperties.Properties.MONEY_DROP);

			ItemTemplate money = new ItemTemplate();
			money.Model = 488;
			money.Name = "bag of coins";
			money.Level = 0;

			money.Price = moneyCount;
			
			loot.AddFixed(money, 1);
			return loot;
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:27,代码来源:LootGeneratorMoney.cs

示例15: 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


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