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

C# GameNPC类代码示例

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

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



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

示例1: SendQuestWindow

		protected override void SendQuestWindow(GameNPC questNPC, GamePlayer player, DataQuest quest, bool offer)
		{
			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Dialog));
			ushort QuestID = quest.ClientQuestID;
			pak.WriteShort((offer) ? (byte)0x22 : (byte)0x21); // Dialog
			pak.WriteShort(QuestID);
			pak.WriteShort((ushort)questNPC.ObjectID);
			pak.WriteByte(0x00); // unknown
			pak.WriteByte(0x00); // unknown
			pak.WriteByte(0x00); // unknown
			pak.WriteByte(0x00); // unknown
			pak.WriteByte((offer) ? (byte)0x02 : (byte)0x01); // Accept/Decline or Finish/Not Yet
			pak.WriteByte(0x01); // Wrap
			pak.WritePascalString(quest.Name);

			String personalizedSummary = BehaviourUtils.GetPersonalizedMessage(quest.Description, player);
			if (personalizedSummary.Length > 255)
			{
				pak.WritePascalString(personalizedSummary.Substring(0, 255)); // Summary is max 255 bytes !
			}
			else
			{
				pak.WritePascalString(personalizedSummary);
			}

			if (offer)
			{
				//String personalizedStory = BehaviourUtils.GetPersonalizedMessage(quest.Story, player);
				pak.WriteShort((ushort)quest.Story.Length);
				pak.WriteStringBytes(quest.Story);
			}
			else
			{
				pak.WriteShort((ushort)quest.FinishText.Length);
				pak.WriteStringBytes(quest.FinishText);
			}
			pak.WriteShort(QuestID);
			pak.WriteByte((byte)quest.StepTexts.Count); // #goals count
			foreach (string text in quest.StepTexts)
			{
				pak.WritePascalString(String.Format("{0}\r", text));
			}
			pak.WriteInt((uint)(0));
			pak.WriteByte((byte)0);
			pak.WriteByte((byte)quest.FinalRewards.Count);
			foreach (ItemTemplate reward in quest.FinalRewards)
			{
				WriteItemData(pak, GameInventoryItem.Create<ItemTemplate>(reward));
			}
			pak.WriteByte((byte)quest.NumOptionalRewardsChoice);
			pak.WriteByte((byte)quest.OptionalRewards.Count);
			foreach (ItemTemplate reward in quest.OptionalRewards)
			{
				WriteItemData(pak, GameInventoryItem.Create<ItemTemplate>(reward));
			}
			SendTCP(pak);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:57,代码来源:PacketLib194.cs


示例2: Start

 public override void Start(GameLiving target)
 {
     base.Start(target);
     if (target is GameNPC)
     {
         pet = target as GameNPC;
         pbaoe = ScriptMgr.CreateSpellHandler(EffectOwner, petSpell, petSpellLine);
         pulseTimer = new RegionTimer(EffectOwner, new RegionTimerCallback(PulseTimer), 1000);
         GameEventMgr.AddHandler(EffectOwner, GamePlayerEvent.Quit, new DOLEventHandler(PlayerLeftWorld));
     }
 }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:11,代码来源:SearingPetEffect.cs


示例3: AbortQuestToPlayer

 /// <summary>
 /// Send the quest dialogue for a classic quest to the player
 /// </summary>
 /// <param name="questType"></param>
 /// <param name="sentence"></param>
 /// <param name="player"></param>
 /// <param name="source"></param>
 /// <returns></returns>
 public static bool AbortQuestToPlayer(Type questType, string sentence, GamePlayer player,GameNPC source )
 {
     if (player.IsDoingQuest(questType) != null)
     {
         player.Out.SendQuestAbortCommand(source, QuestMgr.GetIDForQuestType(questType), sentence);
         return true;
     }
     else
     {
         return false;
     }
 }
开发者ID:mynew4,项目名称:DAoC,代码行数:20,代码来源:QuestMgr.cs


示例4: SendQuestWindow

		protected override void SendQuestWindow(GameNPC questNPC, GamePlayer player, RewardQuest quest,	bool offer)
		{
			GSTCPPacketOut pak = new GSTCPPacketOut(GetPacketCode(eServerPackets.Dialog));
			ushort QuestID = QuestMgr.GetIDForQuestType(quest.GetType());
			pak.WriteShort((offer) ? (byte)0x22 : (byte)0x21); // Dialog
			pak.WriteShort(QuestID);
			pak.WriteShort((ushort)questNPC.ObjectID);
			pak.WriteByte(0x00); // unknown
			pak.WriteByte(0x00); // unknown
			pak.WriteByte(0x00); // unknown
			pak.WriteByte(0x00); // unknown
			pak.WriteByte((offer) ? (byte)0x02 : (byte)0x01); // Accept/Decline or Finish/Not Yet
			pak.WriteByte(0x01); // Wrap
			pak.WritePascalString(quest.Name);
			if (quest.Summary.Length > 255)
				pak.WritePascalString(quest.Summary.Substring(0,255));
			else
				pak.WritePascalString(quest.Summary);
			if (offer)
			{
				pak.WriteShort((ushort)quest.Story.Length);
				pak.WriteStringBytes(quest.Story);
			}
			else
			{
				pak.WriteShort((ushort)quest.Conclusion.Length);
				pak.WriteStringBytes(quest.Conclusion);
			}
			pak.WriteShort(QuestID);
			pak.WriteByte((byte)quest.Goals.Count); // #goals count
			foreach (RewardQuest.QuestGoal goal in quest.Goals)
			{
				pak.WritePascalString(String.Format("{0}\r", goal.Description));
			}
			pak.WriteByte((byte)quest.Level);
			pak.WriteByte((byte)quest.Rewards.MoneyPercent);
			pak.WriteByte((byte)quest.Rewards.ExperiencePercent(player));
			pak.WriteByte((byte)quest.Rewards.BasicItems.Count);
			foreach (ItemTemplate reward in quest.Rewards.BasicItems)
				WriteTemplateData(pak, reward, 1);
			pak.WriteByte((byte)quest.Rewards.ChoiceOf);
			pak.WriteByte((byte)quest.Rewards.OptionalItems.Count);
			foreach (ItemTemplate reward in quest.Rewards.OptionalItems)
				WriteTemplateData(pak, reward, 1);
			SendTCP(pak);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:46,代码来源:PacketLib187.cs


示例5: LockRelic

        public static bool LockRelic()
        {
            //make sure the relic exists before you lock it!
            if (Relic == null)
                return false;

            LockedEffect = new GameNPC();
            LockedEffect.Model = 1583;
            LockedEffect.Name = "LOCKED_RELIC";
            LockedEffect.X = Relic.X;
            LockedEffect.Y = Relic.Y;
            LockedEffect.Z = Relic.Z;
            LockedEffect.Heading = Relic.Heading;
            LockedEffect.CurrentRegionID = Relic.CurrentRegionID;
            LockedEffect.Flags = GameNPC.eFlags.CANTTARGET;
            LockedEffect.AddToWorld();

            return true;
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:19,代码来源:BaseProtector.cs


示例6: StartSpell

        /// <summary>
        /// called when spell effect has to be started and applied to targets
        /// </summary>
        public override bool StartSpell(GameLiving target)
        {
            if (m_charmedNpc == null)
                m_charmedNpc = target as GameNPC; // save target on first start
            else
                target = m_charmedNpc; // reuse for pulsing spells

            if (target == null) return false;
            if (Util.Chance(CalculateSpellResistChance(target)))
            {
                OnSpellResisted(target);
            }
            else
            {
                ApplyEffectOnTarget(target, 1);
            }

            return true;
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:22,代码来源:CharmSpellHandler.cs


示例7: OnScriptsCompiled

		public static void OnScriptsCompiled(DOLEvent e, object sender, EventArgs args)
		{

			// What npctemplate should we use for the zonepoint ?
			ushort model;
			NpcTemplate zp;
			try{
				model = (ushort)ServerProperties.Properties.ZONEPOINT_NPCTEMPLATE;
				zp = new NpcTemplate(GameServer.Database.SelectObjects<DBNpcTemplate>("`TemplateId` = @TemplateId", new QueryParameter("@TemplateId", model)).FirstOrDefault());
				if (model <= 0 || zp == null) throw new ArgumentNullException();
			}
			catch {
				return;
			}
			
			// processing all the ZP
			IList<ZonePoint> zonePoints = GameServer.Database.SelectAllObjects<ZonePoint>();
			foreach (ZonePoint z in zonePoints)
			{
				if (z.SourceRegion == 0) continue;
				
				// find target region for the current zonepoint
				Region r = WorldMgr.GetRegion(z.TargetRegion);
				if (r == null)
				{
					log.Warn("Zonepoint Id (" + z.Id +  ") references an inexistent target region " + z.TargetRegion + " - skipping, ZP not created");
					continue;
				}
				
				GameNPC npc = new GameNPC(zp);

				npc.CurrentRegionID = z.SourceRegion;
				npc.X = z.SourceX;
				npc.Y = z.SourceY;
				npc.Z = z.SourceZ;
				npc.Name = r.Description;
				npc.GuildName = "ZonePoint (Open)";			
				if (r.IsDisabled) npc.GuildName = "ZonePoint (Closed)";
				
				npc.AddToWorld();
			}
		}
开发者ID:dol-leodagan,项目名称:DOLSharp,代码行数:42,代码来源:ZonePointEffects.cs


示例8: OnScriptsCompiled

        public static void OnScriptsCompiled(DOLEvent e, object sender, EventArgs args)
        {
            // What npctemplate should we use for the zonepoint ?
            ushort model;
            NpcTemplate zp;
            try
            {
                model = (ushort)ServerProperties.Properties.ZONEPOINT_NPCTEMPLATE;
                zp = new NpcTemplate(GameServer.Database.SelectObject<DBNpcTemplate>("TemplateId =" + model.ToString()));
                if (model <= 0 || zp == null) throw new ArgumentNullException();
            }
            catch
            {
                return;
            }

            // processing all the ZP
            IList<ZonePoint> zonePoints = GameServer.Database.SelectAllObjects<ZonePoint>();
            foreach (ZonePoint z in zonePoints)
            {
                if (z.SourceRegion == 0)
                    continue;
                //find region
                Region r = WorldMgr.GetRegion(z.TargetRegion);
                GameNPC npc = new GameNPC(zp);

                npc.CurrentRegionID = z.SourceRegion;
                npc.X = z.SourceX;
                npc.Y = z.SourceY;
                npc.Z = z.SourceZ;

                npc.Name = r.Description;
                if (r.IsDisabled)
                    npc.GuildName = "ZonePoint (Closed)";
                else npc.GuildName = "ZonePoint (Open)";
                npc.AddToWorld();
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:38,代码来源:ZonePointEffects.cs


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

            masterFrederick = GetMasterFrederick();

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Queen Tatiana", eRealm.None);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Queen Tatiana, creating ...");
                queenTatiana = new GameNPC();

                queenTatiana.Name = "Queen Tatiana";
                queenTatiana.X = 558500;
                queenTatiana.Y = 533042;
                queenTatiana.Z = 2573;
                queenTatiana.Heading = 174;
                queenTatiana.Model = 603;
                queenTatiana.GuildName = "Part of " + questTitle + " Quest";
                queenTatiana.Realm = eRealm.None;
                queenTatiana.CurrentRegionID = 1;
                queenTatiana.Size = 49;
                queenTatiana.Level = 5;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 30;
                brain.AggroRange = 600;
                queenTatiana.SetOwnBrain(brain);

                if (SAVE_INTO_DATABASE)
                    queenTatiana.SaveIntoDatabase();

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

            int counter = 0;
            foreach (GameNPC npc in queenTatiana.GetNPCsInRadius(500))
            {
                if (npc.Name == "ire fairy sorceress")
                {
                    fairySorceress[counter] = (GameNPC) npc;
                    counter++;
                }
                if (counter == fairySorceress.Length)
                    break;
            }

            for (int i = 0; i < fairySorceress.Length; i++)
            {
                if (fairySorceress[i] == null)
                {
                    if (log.IsWarnEnabled)
                        log.Warn("Could not find ire fairy sorceress, creating ...");
                    fairySorceress[i] = new GameNPC();
                    fairySorceress[i].Model = 603; // //819;
                    fairySorceress[i].Name = "ire fairy sorceress";
                    fairySorceress[i].GuildName = "Part of " + questTitle + " Quest";
                    fairySorceress[i].Realm = eRealm.None;
                    fairySorceress[i].CurrentRegionID = 1;
                    fairySorceress[i].Size = 35;
                    fairySorceress[i].Level = 5;
                    fairySorceress[i].X = queenTatiana.X + Util.Random(30, 150);
                    fairySorceress[i].Y = queenTatiana.Y + Util.Random(30, 150);
                    fairySorceress[i].Z = queenTatiana.Z;

                    StandardMobBrain brain = new StandardMobBrain();
                    brain.AggroLevel = 30;
                    brain.AggroRange = 600;
                    fairySorceress[i].SetOwnBrain(brain);

                    fairySorceress[i].Heading = 93;
                    //fairySorceress[i].EquipmentTemplateID = 200276;

                    //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)
                        fairySorceress[i].SaveIntoDatabase();
                    fairySorceress[i].AddToWorld();
                }
            }
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DOLSharp,代码行数:101,代码来源:Culmination.cs


示例10: 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("Laridia the Minstrel", 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)
            {
                laridiaTheMinstrel = new GameNPC();
                laridiaTheMinstrel.Model = 38;
                laridiaTheMinstrel.Name = "Laridia the Minstrel";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + laridiaTheMinstrel.Name + ", creating him ...");
                laridiaTheMinstrel.GuildName = "Part of " + questTitle + " Quest";
                laridiaTheMinstrel.Realm = eRealm.Albion;
                laridiaTheMinstrel.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 137, 9);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 138, 9);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 134, 9);
                template.AddNPCEquipment(eInventorySlot.Cloak, 96, 72);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 140, 43);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 141, 43);
                laridiaTheMinstrel.Inventory = template.CloseTemplate();
                laridiaTheMinstrel.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                laridiaTheMinstrel.Size = 49;
                laridiaTheMinstrel.Level = 25;
                laridiaTheMinstrel.X = 562280;
                laridiaTheMinstrel.Y = 512243;
                laridiaTheMinstrel.Z = 2448 ;
                laridiaTheMinstrel.Heading = 3049;

                //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)
                    laridiaTheMinstrel.SaveIntoDatabase();

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

            npcs = WorldMgr.GetNPCsByName("Farmer Asma", eRealm.Albion);
            if (npcs.Length == 0)
            {
                farmerAsma = new GameNPC();
                farmerAsma.Model = 82;
                farmerAsma.Name = "Farmer Asma";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + farmerAsma.Name + ", creating him ...");
                farmerAsma.GuildName = "Part of " + questTitle + " Quest";
                farmerAsma.Realm = eRealm.Albion;
                farmerAsma.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 31);
                template.AddNPCEquipment(eInventorySlot.Cloak, 57);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 32);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 33);
                farmerAsma.Inventory = template.CloseTemplate();
                farmerAsma.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                farmerAsma.Size = 50;
                farmerAsma.Level = 35;
                farmerAsma.X = 563939;
                farmerAsma.Y = 509234;
                farmerAsma.Z = 2744 ;
                farmerAsma.Heading = 21;

                //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)
                    farmerAsma.SaveIntoDatabase();

                farmerAsma.AddToWorld();
            }
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DOLSharp,代码行数:101,代码来源:AgainstTheGrain.cs


示例11: 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("Hugh Gallen", 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)
            {
                hughGallen = new GameNPC();
                hughGallen.Model = 40;
                hughGallen.Name = "Hugh Gallen";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + hughGallen.Name + ", creating him ...");
                hughGallen.GuildName = "Part of " + questTitle + " Quest";
                hughGallen.Realm = eRealm.Albion;
                hughGallen.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 39);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 40);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 36);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 37);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 38);
                hughGallen.Inventory = template.CloseTemplate();
                hughGallen.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                hughGallen.Size = 49;
                hughGallen.Level = 38;
                hughGallen.X = 574640;
                hughGallen.Y = 531109;
                hughGallen.Z = 2896;
                hughGallen.Heading = 2275;

                //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)
                    hughGallen.SaveIntoDatabase();

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

            #endregion

            #region defineItems

            // item db check
            beltOfAnimation = GameServer.Database.FindObjectByKey<ItemTemplate>("belt_of_animation");
            if (beltOfAnimation == null)
            {
                beltOfAnimation = new ItemTemplate();
                beltOfAnimation.Name = "Belt of Animation";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find "+beltOfAnimation.Name+", creating it ...");

                beltOfAnimation.Level = 5;
                beltOfAnimation.Weight = 3;
                beltOfAnimation.Model = 597;

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

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

                beltOfAnimation.Quality = 100;
                beltOfAnimation.Condition = 1000;
                beltOfAnimation.MaxCondition = 1000;
                beltOfAnimation.Durability = 1000;
                beltOfAnimation.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
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DAoC,代码行数:101,代码来源:ClericMulgrut.cs


示例12: 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("Elvar Ironhand", 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)
            {
                elvarIronhand = new GameNPC();
                elvarIronhand.Model = 10;
                elvarIronhand.Name = "Elvar Ironhand";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + elvarIronhand.Name + ", creating him ...");
                elvarIronhand.GuildName = "Part of " + questTitle + " Quest";
                elvarIronhand.Realm = eRealm.Albion;
                elvarIronhand.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 12);
                elvarIronhand.Inventory = template.CloseTemplate();
                elvarIronhand.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                elvarIronhand.Size = 54;
                elvarIronhand.Level = 17;
                elvarIronhand.X = 561351;
                elvarIronhand.Y = 510292;
                elvarIronhand.Z = 2400;
                elvarIronhand.Heading = 3982;

                //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)
                    elvarIronhand.SaveIntoDatabase();

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

            #endregion

            #region defineItems

            // item db check
            wellPreservedBones = GameServer.Database.FindObjectByKey<ItemTemplate>("well_preserved_bone");
            if (wellPreservedBones == null)
            {
                wellPreservedBones = new ItemTemplate();
                wellPreservedBones.Name = "Well-Preserved Bone";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find "+wellPreservedBones.Name+", creating it ...");

                wellPreservedBones.Level = 0;
                wellPreservedBones.Weight = 1;
                wellPreservedBones.Model = 497;

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

                wellPreservedBones.Quality = 100;
                wellPreservedBones.Condition = 1000;
                wellPreservedBones.MaxCondition = 1000;
                wellPreservedBones.Durability = 1000;
                wellPreservedBones.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(wellPreservedBones);
            }

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


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

            addrir = GetAddrir();

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Aethic", eRealm.Hibernia);
            if (npcs.Length == 0)
            {
                aethic = new GameNPC();
                aethic.Model = 361;
                aethic.Name = "Aethic";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find" + aethic.Name + " , creating ...");
                aethic.GuildName = "Part of " + questTitle + " Quest";
                aethic.Realm = eRealm.Hibernia;
                aethic.CurrentRegionID = 200;
                aethic.Size = 49;
                aethic.Level = 21;
                aethic.X = GameLocation.ConvertLocalXToGlobalX(23761, 200);
                aethic.Y = GameLocation.ConvertLocalYToGlobalY(45658, 200);
                aethic.Z = 5448;
                aethic.Heading = 320;
                //aethic.EquipmentTemplateID = "1707754";
                //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)
                    aethic.SaveIntoDatabase();
                aethic.AddToWorld();
            }
            else
                aethic = npcs[0] as GameStableMaster;

            npcs = WorldMgr.GetNPCsByName("Freagus", eRealm.Hibernia);
            if (npcs.Length == 0)
            {
                freagus = new GameStableMaster();
                freagus.Model = 361;
                freagus.Name = "Freagus";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + freagus.Name + ", creating ...");
                freagus.GuildName = "Stable Master";
                freagus.Realm = eRealm.Hibernia;
                freagus.CurrentRegionID = 200;
                freagus.Size = 48;
                freagus.Level = 30;
                freagus.X = 341008;
                freagus.Y = 469180;
                freagus.Z = 5200;
                freagus.Heading = 1934;
                freagus.EquipmentTemplateID = "3800664";

                //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)
                    freagus.SaveIntoDatabase();
                freagus.AddToWorld();
            }
            else
                freagus = npcs[0];

            npcs = WorldMgr.GetNPCsByName("Rumdor", eRealm.Hibernia);
            if (npcs.Length == 0)
            {
                if (log.IsWarnEnabled)
                    log.Warn("Could not find Rumdor, creating ...");
                rumdor = new GameStableMaster();
                rumdor.Model = 361;
                rumdor.Name = "Rumdor";
                rumdor.GuildName = "Stable Master";
                rumdor.Realm = eRealm.Hibernia;
                rumdor.CurrentRegionID = 200;
                rumdor.Size = 53;
                rumdor.Level = 33;
                rumdor.X = 347175;
                rumdor.Y = 491836;
                rumdor.Z = 5226;
                rumdor.Heading = 1262;
                rumdor.EquipmentTemplateID = "3800664";

                //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)
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DOLSharp,代码行数:101,代码来源:ImportantDelivery.cs


示例14: QuestBehaviour

 /// <summary>
 /// Creates a QuestPart for the given questtype with the default npc.
 /// </summary>
 /// <param name="questType">type of Quest this QuestPart will belong to.</param>
 /// <param name="npc">NPC associated with his questpart typically NPC talking to or mob killing, etc...</param>
 /// <param name="executions">Maximum number of executions the questpart should be execute during one quest for each player</param>
 public QuestBehaviour(Type questType, GameNPC npc, int executions)
     : base(npc)
 {
     this.questType = questType;
     this.maxNumberOfExecutions = executions;
 }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:12,代码来源:QuestBehaviour.cs


示例15: NPCManipulateDoorRequest

		public void NPCManipulateDoorRequest(GameNPC npc, bool open)
		{ }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:2,代码来源:GameRelicDoor.cs


示例16: CreateDunwynClone

        protected void CreateDunwynClone()
        {
            GameNpcInventoryTemplate template;
            if (dunwynClone == null)
            {
                dunwynClone = new GameNPC();
                dunwynClone.Name = "Master Dunwyn";
                dunwynClone.Model = 9;
                dunwynClone.GuildName = "Part of " + questTitle + " Quest";
                dunwynClone.Realm = eRealm.Albion;
                dunwynClone.CurrentRegionID = 1;
                dunwynClone.Size = 50;
                dunwynClone.Level = 14;

                dunwynClone.X = GameLocation.ConvertLocalXToGlobalX(8602, 0) + Util.Random(-150, 150);
                dunwynClone.Y = GameLocation.ConvertLocalYToGlobalY(47193, 0) + Util.Random(-150, 150);
                dunwynClone.Z = 2409;
                dunwynClone.Heading = 342;

                template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 798);
                template.AddNPCEquipment(eInventorySlot.RightHandWeapon, 19);
                dunwynClone.Inventory = template.CloseTemplate();
                dunwynClone.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

            //				dunwynClone.AddNPCEquipment((byte) eEquipmentItems.TORSO, 798, 0, 0, 0);
            //				dunwynClone.AddNPCEquipment((byte) eEquipmentItems.RIGHT_HAND, 19, 0, 0, 0);

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                dunwynClone.SetOwnBrain(brain);

                dunwynClone.AddToWorld();

                GameEventMgr.AddHandler(dunwynClone, GameLivingEvent.Interact, new DOLEventHandler(TalkToMasterDunwyn));
                GameEventMgr.AddHandler(dunwynClone, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkToMasterDunwyn));
            }
            else
            {
                dunwynClone.MoveTo(1, 567604, 509619, 2813, 3292);
            }

            foreach (GamePlayer visPlayer in dunwynClone.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                visPlayer.Out.SendEmoteAnimation(dunwynClone, eEmote.Bind);
            }

            for (int i = 0; i < recruits.Length; i++)
            {
                recruits[i] = new GameNPC();

                recruits[i].Name = "Recruit";

                recruits[i].GuildName = "Part of " + questTitle + " Quest";
                recruits[i].Realm = eRealm.Albion;
                recruits[i].CurrentRegionID = 1;

                recruits[i].Size = 50;
                recruits[i].Level = 6;
                recruits[i].X = GameLocation.ConvertLocalXToGlobalX(8602, 0) + Util.Random(-150, 150);
                recruits[i].Y = GameLocation.ConvertLocalYToGlobalY(47193, 0) + Util.Random(-150, 150);

                recruits[i].Z = 2409;
                recruits[i].Heading = 187;

                StandardMobBrain brain = new StandardMobBrain();
                brain.AggroLevel = 0;
                brain.AggroRange = 0;
                recruits[i].SetOwnBrain(brain);

            }

            recruits[0].Name = "Recruit Armsman McTavish";
            recruits[0].Model = 40;
            template = new GameNpcInventoryTemplate();
            template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 69);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 46);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 47);
            template.AddNPCEquipment(eInventorySlot.FeetArmor, 50);
            template.AddNPCEquipment(eInventorySlot.ArmsArmor, 48);
            template.AddNPCEquipment(eInventorySlot.HandsArmor, 49);
            recruits[0].Inventory = template.CloseTemplate();
            recruits[0].SwitchWeapon(GameLiving.eActiveWeaponSlot.TwoHanded);

            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.TWO_HANDED, 69, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.TORSO, 46, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.LEGS, 47, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.FEET, 50, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.ARMS, 48, 0, 0, 0);
            //			recruits[0].AddNPCEquipment((byte) eEquipmentItems.HAND, 49, 0, 0, 0);

            recruits[1].Name = "Recruit Paladin Andral";
            recruits[1].Model = 41;
            template = new GameNpcInventoryTemplate();
            template.AddNPCEquipment(eInventorySlot.TwoHandWeapon, 6);
            template.AddNPCEquipment(eInventorySlot.TorsoArmor, 41);
            template.AddNPCEquipment(eInventorySlot.LegsArmor, 42);
            template.AddNPCEquipment(eInventorySlot.FeetArmor, 45);
            template.AddNPCEquipment(eInventorySlot.ArmsArmor, 43);
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DOLSharp,代码行数:101,代码来源:Culmination.cs


示例17: 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;
                qu 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# GameObject类代码示例发布时间:2022-05-24
下一篇:
C# GameModel类代码示例发布时间: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