• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Database.ItemTemplate类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ScriptLoaded

        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
                return;
            if (log.IsInfoEnabled)
                log.Info("Quest \"" + questTitle + "\" initializing ...");
            /* First thing we do in here is to search for the NPCs inside
            * the world who comes from the certain Realm. If we find a the players,
            * this means we don't have to create a new one.
            *
            * NOTE: You can do anything you want in this method, you don't have
            * to search for NPC's ... you could create a custom item, place it
            * on the ground and if a player picks it up, he will get the quest!
            * Just examples, do anything you like and feel comfortable with :)
            */

            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Godeleva Dowden", eRealm.Albion);

            /* Whops, if the npcs array length is 0 then no npc exists in
                * this users Mob Database, so we simply create one ;-)
                * else we take the existing one. And if more than one exist, we take
                * the first ...
                */
            if (npcs.Length == 0)
            {
                godelevaDowden = new GameNPC();
                godelevaDowden.Model = 7;
                godelevaDowden.Name = "Godeleva Dowden";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + godelevaDowden.Name + ", creating him ...");
                godelevaDowden.GuildName = "Part of " + questTitle + " Quest";
                godelevaDowden.Realm = eRealm.Albion;
                godelevaDowden.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 138);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 134);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 135);
                godelevaDowden.Inventory = template.CloseTemplate();
                godelevaDowden.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                godelevaDowden.Size = 48;
                godelevaDowden.Level = 40;
                godelevaDowden.X = 559528;
                godelevaDowden.Y = 510953;
                godelevaDowden.Z = 2488;
                godelevaDowden.Heading = 1217;

                //You don't have to store the created mob in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database

                if (SAVE_INTO_DATABASE)
                    godelevaDowden.SaveIntoDatabase();

                godelevaDowden.AddToWorld();
            }
            else
                godelevaDowden = npcs[0];

            #endregion

            #region defineItems

            // item db check
            woodenBucket = GameServer.Database.FindObjectByKey<ItemTemplate>("wooden_bucket");
            if (woodenBucket == null)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Wooden Bucket, creating it ...");
                woodenBucket = new ItemTemplate();
                woodenBucket.Name = "Wooden Bucket";
                woodenBucket.Level = 1;
                woodenBucket.Weight = 10;
                woodenBucket.Model = 1610;

                woodenBucket.Object_Type = (int)eObjectType.GenericItem;
                woodenBucket.Id_nb = "wooden_bucket";
                woodenBucket.Price = 0;
                woodenBucket.IsPickable = false;
                woodenBucket.IsDropable = false;

                woodenBucket.Quality = 100;
                woodenBucket.Condition = 1000;
                woodenBucket.MaxCondition = 1000;
                woodenBucket.Durability = 1000;
                woodenBucket.MaxDurability = 1000;

                //You don't have to store the created item in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database

                    GameServer.Database.AddObject(woodenBucket);
            }

            // item db check
            fullWoodenBucket = GameServer.Database.FindObjectByKey<ItemTemplate>("full_wooden_bucket");
            if (fullWoodenBucket == null)
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DAoC,代码行数:101,代码来源:GodelevasNeed.cs


示例17: ScriptLoaded


//.........这里部分代码省略.........
            GameObject[] objects = WorldMgr.GetObjectsByName("Truichon", eRealm.Hibernia,typeof(GameStableMaster));
            if (npcs.Length == 0)
            {
                truichon = new GameStableMaster();
                truichon.Model = 361;
                truichon.Name = "Truichon";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + truichon.Name + ", creating ...");
                truichon.GuildName = "Stable Master";
                truichon.Realm = eRealm.Hibernia;
                truichon.CurrentRegionID = 1;
                truichon.Size = 50;
                truichon.Level = 33;
                truichon.X = 343464;
                truichon.Y = 526708;
                truichon.Z = 5448;
                truichon.Heading = 68;
                //truichon.EquipmentTemplateID = "5448";

                //You don't have to store the created mob in the db if you don't want,
                //it will be recreated each time it is not found, just comment the following
                //line if you rather not modify your database
                if (SAVE_INTO_DATABASE)
                    truichon.SaveIntoDatabase();
                truichon.AddToWorld();
            }
            else
                truichon = npcs[0] as GameStableMaster;

            #endregion

            #region defineItems

            ticketToTirnamBeo = GameServer.Database.FindObjectByKey<ItemTemplate>("hs_magmell_tirnambeo");
            if (ticketToTirnamBeo == null)
                ticketToTirnamBeo = CreateTicketTo("Tir na mBeo", "hs_magmell_tirnambeo");
            ticketToArdee = GameServer.Database.FindObjectByKey<ItemTemplate>("hs_tirnambeo_ardee");
            if (ticketToArdee == null)
                ticketToArdee = CreateTicketTo("Ardee", "hs_tirnambeo_ardee");

            recruitsDiary = GameServer.Database.FindObjectByKey<ItemTemplate>("recruits_diary");
            if (recruitsDiary == null)
            {
                recruitsDiary = new ItemTemplate();
                recruitsDiary.Name = "Recruits Diary";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + recruitsDiary.Name + " , creating it ...");
                recruitsDiary.Weight = 3;
                recruitsDiary.Model = 500;
                recruitsDiary.Object_Type = (int)eObjectType.GenericItem;
                recruitsDiary.Id_nb = "recruits_diary";
                recruitsDiary.IsPickable = true;
                recruitsDiary.IsDropable = false;

                if (SAVE_INTO_DATABASE)
                    GameServer.Database.AddObject(recruitsDiary);
            }

            sackOfSupplies = GameServer.Database.FindObjectByKey<ItemTemplate>("sack_of_supplies");
            if (sackOfSupplies == null)
            {
                sackOfSupplies = new ItemTemplate();
                sackOfSupplies.Name = "Sack of Supplies";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + sackOfSupplies.Name + " , creating it ...");
开发者ID:mynew4,项目名称:DOLSharp,代码行数:66,代码来源:ImportantDelivery.cs


示例18: ScriptLoaded

		public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
		{
			if (!ServerProperties.Properties.LOAD_QUESTS)
				return;

			if (log.IsInfoEnabled)
				log.Info("Quest \"" + questTitle + "\" initializing ...");

			/* First thing we do in here is to search for the NPCs inside
			* the world who comes from the certain Realm. If we find the npc
			* this means we don't have to create a new one.
			* 
			* NOTE: You can do anything you want in this method, you don't have
			* to search for NPC's ... you could create a custom item, place it
			* on the ground and if a player picks it up, he will get the quest!
			* Just examples, do anything you like and feel comfortable with :)
			*/

			#region defineNPCS

			GameNPC[] npcs = WorldMgr.GetNPCsByName("Baeth", eRealm.Hibernia);

			/*  If the npcs array length is 0 then no npc exists in
				* this users Mob Database, so we simply create one ;-)
				* else we take the existing one. And if more than one exist, we take
				* the first ...
				*/
			if (npcs.Length == 0)
			{
				npcBaeth = new GameNPC();
				npcBaeth.Model = 361;
				npcBaeth.Name = "Baeth";
				if (log.IsWarnEnabled)
				{
					log.Warn("Could not find " + npcBaeth.Name + ", creating him ...");
				}
				npcBaeth.GuildName = "Part of " + questTitle + " Quest";
				npcBaeth.Realm = eRealm.Hibernia;
				npcBaeth.CurrentRegionID = 27;

				npcBaeth.Size = 52;
				npcBaeth.Level = 30;
				npcBaeth.X = 356650;
				npcBaeth.Y = 355078;
				npcBaeth.Z = 5015;
				npcBaeth.Heading = 2959;

				if (SAVE_INTO_DATABASE)
				{
					npcBaeth.SaveIntoDatabase();
				}

				npcBaeth.AddToWorld();
			}
			else
			{
				npcBaeth = npcs[0];
			}

			npcs = WorldMgr.GetNPCsByName("Jessica", eRealm.Hibernia);

			if (npcs.Length == 0)
			{
				npcJessica = new GameNPC();
				npcJessica.Model = 366;
				npcJessica.Name = "Jessica";
				if (log.IsWarnEnabled)
				{
					log.Warn("Could not find " + npcJessica.Name + ", creating him ...");
				}
				npcJessica.GuildName = "Part of " + questTitle + " Quest";
				npcJessica.Realm = eRealm.Hibernia;
				npcJessica.CurrentRegionID = 27;

				npcJessica.Size = 38;
				npcJessica.Level = 1;
				npcJessica.X = 358068;
				npcJessica.Y = 347553;
				npcJessica.Z = 5491;
				npcJessica.Heading = 49;

				if (SAVE_INTO_DATABASE)
				{
					npcJessica.SaveIntoDatabase();
				}

				npcJessica.AddToWorld();
			}
			else
			{
				npcJessica = npcs[0];
			}


			#endregion

			#region defineItems

			// item db check
			reedFlute = GameServer.Database.FindObjectByKey<ItemTemplate>("quest_reed_flute");
//.........这里部分代码省略.........
开发者ID:boscorillium,项目名称:dol,代码行数:101,代码来源:WingsOfTheIsleHibernia.cs


示例19: 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);
			
			try
			{
				GamePlayer player = killer as GamePlayer;
				if (killer is GameNPC && ((GameNPC)killer).Brain is IControlledBrain)
					player = ((ControlledNpcBrain)((GameNPC)killer).Brain).GetPlayerOwner();
				if (player == null)
					return loot;			
			
				
				ItemTemplate atlanteanGlass = new ItemTemplate(m_atlanteanglass);

				int killedcon = (int)player.GetConLevel(mob)+3;
				
				if(killedcon <= 0)
					return loot;
								
				int lvl = mob.Level + 1;
				if (lvl < 1) lvl = 1;
				int maxcount = 1;
				
				//Switch pack size
				if (lvl > 0 && lvl < 10) 
				{
					//Single AtlanteanGlass
					maxcount = (int)Math.Floor((double)(lvl/2))+1;
				}
				else if (lvl >= 10 && lvl < 20)
				{
					//Double
					atlanteanGlass.PackSize = 2;
					maxcount = (int)Math.Floor((double)((lvl-10)/2))+1;
				}
				else if (lvl >= 20 && lvl < 30)
				{
					//Triple
					atlanteanGlass.PackSize = 3;
					maxcount = (int)Math.Floor((double)((lvl-20)/2))+1;
					
				}
				else if (lvl >=30 && lvl < 40) 
				{
					//Quad
					atlanteanGlass.PackSize = 4;
					maxcount = (int)Math.Floor((double)((lvl-30)/2))+1;
				}
				else if (lvl >= 40 && lvl < 50)
				{
					//Quint
					atlanteanGlass.PackSize = 5;
					maxcount = (int)Math.Floor((double)((lvl-40)/2))+1;
				}
				else 
				{
					//Cache (x10)
					atlanteanGlass.PackSize = 10;
					maxcount = (int)Math.Round((double)(lvl/10));
				}
				
				if (!mob.Name.ToLower().Equals(mob.Name))
				{
					//Named mob, more cash !
					maxcount = (int)Math.Round(maxcount*ServerProperties.Properties.LOOTGENERATOR_ATLANTEANGLASS_NAMED_COUNT);
				}
				
				if(maxcount > 0 && Util.Chance(ServerProperties.Properties.LOOTGENERATOR_ATLANTEANGLASS_BASE_CHANCE+Math.Max(10, killedcon)))
				{
					loot.AddFixed(atlanteanGlass, maxcount);
				}
					
			}
			catch
			{
				return loot;
			}
			
			return loot;
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:87,代码来源:LootGeneratorAtlanteanGlass.cs


示例20: ScriptLoaded

        public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_QUESTS)
                return;

            if (log.IsInfoEnabled)
                log.Info("Quest \"" + questTitle + "\" initializing ...");

            #region defineNPCS
            GameNPC[] npcs = WorldMgr.GetNPCsByName(questGiverName, eRealm.Hibernia);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + questGiverName + ", creating her ...");

                questGiver = new GameNPC();
                questGiver.Name = questGiverName;
                questGiver.Realm = eRealm.Hibernia;
                questGiver.CurrentRegionID = 200;

                // select * from NPCEquipment where TemplateID in (select EquipmentTemplateID from Mob where name = ?)
                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 448, 0);		// Slot 12
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 427, 0);			// Slot 23
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 423, 0);		// Slot 25
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 424, 0);			// Slot 27
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 425, 0);			// Slot 28
                questGiver.Inventory = template.CloseTemplate();
                questGiver.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                questGiver.Model = 388;
                questGiver.Size = 51;
                questGiver.Level = 35;
                questGiver.X = 346768;
                questGiver.Y = 489521;
                questGiver.Z = 5200;
                questGiver.Heading = 2594;

                if (SAVE_INTO_DATABASE)
                    questGiver.SaveIntoDatabase();

                questGiver.AddToWorld();
            }
            else
                questGiver = npcs[0];

            npcs = WorldMgr.GetNPCsByName(questTargetName, eRealm.Hibernia);

            if (npcs.Length == 0)
            {
                questTarget = new GameNPC();
                questTarget.Name = questTargetName;
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + questTarget.Name + ", creating him ...");
                questTarget.Realm = eRealm.Hibernia;
                questTarget.CurrentRegionID = 200;

                // select * from NPCEquipment where TemplateID in (select EquipmentTemplateID from Mob where name = ?)
                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 411, 0);		// Slot 22
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 412, 0);		// Slot 23
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 408, 0);		// Slot 25
                template.AddNPCEquipment(eInventorySlot.Cloak, 57, 34);				// Slot 26
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 409, 0);		// Slot 27
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 410, 0);		// Slot 28
                questTarget.Inventory = template.CloseTemplate();
                questTarget.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                questTarget.Model = 381;
                questTarget.Size = 50;
                questTarget.Level = 12;
                questTarget.X = 347327;
                questTarget.Y = 492700;
                questTarget.Z = 5199;
                questTarget.Heading = 2468;

                if (SAVE_INTO_DATABASE)
                    questTarget.SaveIntoDatabase();

                questTarget.AddToWorld();
            }
            else
                questTarget = npcs[0];
            #endregion

            /*
            #region defineAreas
            targetArea = WorldMgr.GetRegion(targetLocation.RegionID).AddArea(new Area.Circle("", targetLocation.X, targetLocation.Y, targetLocation.Z, 200));
            #endregion
            */

            #region defineItems
            armBone = GameServer.Database.FindObjectByKey<ItemTemplate>("BonesToBlades-armbone");
            if (armBone == null) {
                armBone = new ItemTemplate();
                armBone.Name = "Arm Bone";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + armBone.Name + ", creating it ...");
                armBone.Level = 1;
                armBone.Weight = 1;
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DAoC,代码行数:101,代码来源:BonesToBlades.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Events.DOLEvent类代码示例发布时间:2022-05-24
下一篇:
C# Database.InventoryItem类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap