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


C# Events.DOLEvent类代码示例

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


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

示例1: PlayerQuit

		public void PlayerQuit(DOLEvent e, object sender, EventArgs arguments)
		{
			GamePlayer player = sender as GamePlayer;
			if (player == null) return;		
			lock(player.Inventory)
			{
                InventoryItem item = player.Inventory.GetFirstItemByID("arrow_summoning1", eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack);
				while (item != null)
				{
					player.Inventory.RemoveItem(item);
                    item = player.Inventory.GetFirstItemByID("arrow_summoning1", eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack);
				}
                item = player.Inventory.GetFirstItemByID("arrow_summoning2", eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack);
				while (item != null)
				{
					player.Inventory.RemoveItem(item);
                    item = player.Inventory.GetFirstItemByID("arrow_summoning2", eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack);
				}
                item = player.Inventory.GetFirstItemByID("arrow_summoning3", eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack);
				while (item != null)
				{
					player.Inventory.RemoveItem(item);
                    item = player.Inventory.GetFirstItemByID("arrow_summoning3", eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack);
				}
			}
		}
开发者ID:boscorillium,项目名称:dol,代码行数:26,代码来源:ArrowSummoningAbility.cs

示例2: OnScriptUnloaded

 public static void OnScriptUnloaded(DOLEvent e, object sender, EventArgs args)
 {
     if (!ServerProperties.Properties.LOAD_EXAMPLES)
         return;
     GameEventMgr.RemoveHandler(DatabaseEvent.CharacterCreated, new DOLEventHandler(DOLTestCharacterCreation));
     GameEventMgr.RemoveHandler(GamePlayerEvent.GameEntered, new DOLEventHandler(DOLTestPlayerEnterWorld));
 }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:7,代码来源:DOLTestServer.cs

示例3: OnAttack

        private void OnAttack(DOLEvent e, object sender, EventArgs arguments)
        {
            GameLiving living = sender as GameLiving;
            if (living == null) return;
            InventoryItem shield = living.Inventory.GetItem(eInventorySlot.LeftHandWeapon);
            if (shield == null)
                return;
            if (shield.Object_Type != (int)eObjectType.Shield)
                return;
            if (living.TargetObject == null)
                return;
            if (living.ActiveWeaponSlot == GameLiving.eActiveWeaponSlot.Distance)
                return;
            if (living.AttackWeapon.Hand == 1)
                return;
            AttackedByEnemyEventArgs attackedByEnemy = arguments as AttackedByEnemyEventArgs;
            AttackData ad = null;
            if (attackedByEnemy != null)
                ad = attackedByEnemy.AttackData;
            if (ad.Attacker.Realm == 0)
                return;

            if (ad.Damage < 1)
                return;

            int absorb = (int)(ad.Damage * 0.9);
            int critic = (int)(ad.CriticalDamage * 0.9);
            ad.Damage -= absorb;
            ad.CriticalDamage -= critic;
            if (living is GamePlayer)
                ((GamePlayer)living).Out.SendMessage("Your Testudo Stance reduces the damage by " + (absorb + critic) + " points", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
            if (ad.Attacker is GamePlayer)
                ((GamePlayer)ad.Attacker).Out.SendMessage(living.Name + "'s Testudo Stance reducec your damage by " + (absorb + critic) + " points", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:34,代码来源:TestudoEffect.cs

示例4: OnScriptCompiled

        public static void OnScriptCompiled(DOLEvent e, object sender, EventArgs args)
        {
            if (!ServerProperties.Properties.LOAD_EXAMPLES)
                return;
            //We want to be notified whenever a new character is created
            GameEventMgr.AddHandler(DatabaseEvent.CharacterCreated, new DOLEventHandler(DOLTestCharacterCreation));
            //We want to be notified whenever a player enters the world
            GameEventMgr.AddHandler(GamePlayerEvent.GameEntered, new DOLEventHandler(DOLTestPlayerEnterWorld));

            /* Not yet ;-)
            NonEnterableArea area1 = new NonEnterableArea("Teleport Area", 535405, 479515, 0, 2000);
            area1.Mode = eNonEnterableAreaMode.Teleport;
            NonEnterableArea area2 = new NonEnterableArea("Damage Area", 538405, 479515, 0, 2000);
            area2.Mode = eNonEnterableAreaMode.Damage;
            NonEnterableArea area3 = new NonEnterableArea("Instant Kill Area", 540405, 479515, 0, 2000);
            area3.Mode = eNonEnterableAreaMode.InstantKill;

            WorldMgr.GetRegion(1).AddArea(area1);
            WorldMgr.GetRegion(1).AddArea(area2);
            WorldMgr.GetRegion(1).AddArea(area3);
            */
            //Output success message
            if (log.IsInfoEnabled)
                log.Info("DOLTestServer initialized");
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:25,代码来源:DOLTestServer.cs

示例5: OnAttack

		private void OnAttack(DOLEvent e, object sender, EventArgs arguments)
		{
			GameLiving living = sender as GameLiving;
			if (living == null) return;
			AttackedByEnemyEventArgs attackedByEnemy = arguments as AttackedByEnemyEventArgs;
			AttackData ad = null;
			if (attackedByEnemy != null)
				ad = attackedByEnemy.AttackData;

			if (ad.Damage + ad.CriticalDamage < 1)
				return;

			int heal = ad.Damage + ad.CriticalDamage;
			ad.Damage = 0;
			ad.CriticalDamage = 0;
			GamePlayer player = living as GamePlayer;
			GamePlayer attackplayer = ad.Attacker as GamePlayer;
			if (attackplayer != null)
				attackplayer.Out.SendMessage(living.Name + "'s druidic powers absorb your attack!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
			int modheal = living.MaxHealth - living.Health;
			if (modheal > heal)
				modheal = heal;
			living.Health += modheal;
			if (player != null)
				player.Out.SendMessage("Your druidic powers convert your enemies attack and heal you for " + modheal + "!", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);

		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:27,代码来源:NaturesWombEffect.cs

示例6: EventHandler

        /// <summary>
        /// Handler fired on every melee attack by effect target
        /// </summary>
        /// <param name="e"></param>
        /// <param name="sender"></param>
        /// <param name="arguments"></param>
        protected void EventHandler(DOLEvent e, object sender, EventArgs arguments)
        {
            AttackFinishedEventArgs atkArgs = arguments as AttackFinishedEventArgs;
            if (atkArgs == null) return;
            if (atkArgs.AttackData.AttackResult != GameLiving.eAttackResult.HitUnstyled
                && atkArgs.AttackData.AttackResult != GameLiving.eAttackResult.HitStyle) return;
            if (atkArgs.AttackData.Target == null) return;
            GameLiving target = atkArgs.AttackData.Target;
            if (target == null) return;
            if (target.ObjectState != GameObject.eObjectState.Active) return;
            if (target.IsAlive == false) return;
            GameLiving attacker = sender as GameLiving;
            if (attacker == null) return;
            if (attacker.ObjectState != GameObject.eObjectState.Active) return;
            if (attacker.IsAlive == false) return;
            if (atkArgs.AttackData.IsOffHand) return; // only react to main hand
            if (atkArgs.AttackData.Weapon == null) return; // no weapon attack

            int modifier = 100;
            //double dpsCap = (1.2 + 0.3 * attacker.Level) * 0.7;
            //double dps = Math.Min(atkArgs.AttackData.Weapon.DPS_AF/10.0, dpsCap);
            double baseDamage = atkArgs.AttackData.Weapon.DPS_AF / 10.0 *
                                atkArgs.AttackData.WeaponSpeed;

            modifier += (int)(25 * atkArgs.AttackData.Target.GetConLevel(atkArgs.AttackData.Attacker));
            modifier = Math.Min(300, modifier);
            modifier = Math.Max(75, modifier);

            double damage = baseDamage * modifier * 0.001; // attack speed is 10 times higher (2.5spd=25)
            double damageResisted = damage * target.GetResist(eDamageType.Body) * -0.01;

            AttackData ad = new AttackData();
            ad.Attacker = attacker;
            ad.Target = target;
            ad.Damage = (int)(damage + damageResisted);
            ad.Modifier = (int)damageResisted;
            ad.DamageType = eDamageType.Body;
            ad.AttackType = AttackData.eAttackType.MeleeOneHand;
            ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
            ad.WeaponSpeed = atkArgs.AttackData.WeaponSpeed;

            GamePlayer owner = attacker as GamePlayer;
            if (owner != null)
            {
                owner.Out.SendMessage(LanguageMgr.GetTranslation(owner.Client, "Effects.TripleWieldEffect.MBHitsExtraDamage", target.GetName(0, false), ad.Damage), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                GamePlayer playerTarget = target as GamePlayer;
                if (playerTarget != null)
                {
                    owner.Out.SendMessage(LanguageMgr.GetTranslation(owner.Client, "Effects.TripleWieldEffect.XMBExtraDamageToYou", attacker.GetName(0, false), ad.Damage), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                }
            }

            target.OnAttackedByEnemy(ad);
            attacker.DealDamage(ad);

            foreach (GamePlayer player in ad.Attacker.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                player.Out.SendCombatAnimation(null, target, 0, 0, 0, 0, 0x0A, target.HealthPercent);
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:66,代码来源:TripleWieldEffect.cs

示例7: OnScriptLoaded

 public static void OnScriptLoaded(DOLEvent e, object sender, EventArgs args)
 {
     GameEventMgr.AddHandler(DatabaseEvent.CharacterCreated, new DOLEventHandler(CharacterCreation));
     InitOldStartLocations();
     if (log.IsInfoEnabled)
         log.Info("StartupLocations initialized");
 }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:7,代码来源:StartupLocations.cs

示例8: PlayerQuit

		private static void PlayerQuit(DOLEvent e, object sender, EventArgs arguments)
		{
			GamePlayer player = sender as GamePlayer;
			if (player == null) return;

			player.Out.SendXFireInfo(0);
		}
开发者ID:boscorillium,项目名称:dol,代码行数:7,代码来源:XFireSupport.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 ...");

            #region defineNPCS

            GameNPC[] npcs = WorldMgr.GetNPCsByName("Sir Dorian", eRealm.Albion);

            if (npcs.Length == 0)
            {
                sirDorian = new GameNPC();
                sirDorian.Model = 28;
                sirDorian.Name = "Sir Dorian";
                if (log.IsWarnEnabled)
                    log.Warn("Could not find " + sirDorian.Name + ", creating him ...");
                //k109: My preference, no guildname for quest NPCs.  Uncomment if you like that...
                //sirDorian.GuildName = "Part of " + questTitle + " Quest";
                sirDorian.Realm = eRealm.Albion;
                sirDorian.CurrentRegionID = 1;

                GameNpcInventoryTemplate template = new GameNpcInventoryTemplate();
                template.AddNPCEquipment(eInventorySlot.HandsArmor, 49);
                template.AddNPCEquipment(eInventorySlot.FeetArmor, 50);
                template.AddNPCEquipment(eInventorySlot.TorsoArmor, 46);
                template.AddNPCEquipment(eInventorySlot.LegsArmor, 47);
                template.AddNPCEquipment(eInventorySlot.ArmsArmor, 48);
                sirDorian.Inventory = template.CloseTemplate();
                sirDorian.SwitchWeapon(GameLiving.eActiveWeaponSlot.Standard);

                sirDorian.Size = 52;
                sirDorian.Level = 40;
                sirDorian.X = 560869;
                sirDorian.Y = 511737;
                sirDorian.Z = 2344;
                sirDorian.Heading = 2930;

                if (SAVE_INTO_DATABASE)
                    sirDorian.SaveIntoDatabase();

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

            #endregion defineNPCS

            GameEventMgr.AddHandler(GamePlayerEvent.AcceptQuest, new DOLEventHandler(SubscribeQuest));
            GameEventMgr.AddHandler(GamePlayerEvent.DeclineQuest, new DOLEventHandler(SubscribeQuest));

            GameEventMgr.AddHandler(sirDorian, GameLivingEvent.Interact, new DOLEventHandler(TalkTosirDorian));
            GameEventMgr.AddHandler(sirDorian, GameLivingEvent.WhisperReceive, new DOLEventHandler(TalkTosirDorian));

            sirDorian.AddQuestToGive(typeof(DredgeUpAPledge));

            if (log.IsInfoEnabled)
                log.Info("Quest \"" + questTitle + "\" initialized");
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:60,代码来源:DredgeUpAPledge.cs

示例10: OnAttack

        private void OnAttack(DOLEvent e, object sender, EventArgs arguments)
        {
            GameLiving living = sender as GameLiving;
            if (living == null) return;
            AttackedByEnemyEventArgs attackedByEnemy = arguments as AttackedByEnemyEventArgs;
            AttackData ad = null;
            if (attackedByEnemy != null)
                ad = attackedByEnemy.AttackData;

            //			Log.DebugFormat("sender:{0} res:{1} IsMelee:{2} Type:{3}", living.Name, ad.AttackResult, ad.IsMeleeAttack, ad.AttackType);

            if (ad == null || (ad.AttackResult != GameLiving.eAttackResult.HitStyle && ad.AttackResult != GameLiving.eAttackResult.HitUnstyled))
                return;
            if (!ad.IsMeleeAttack && ad.AttackType != AttackData.eAttackType.Ranged)
                return;

            //default is 50%
            double absorbPercent = 50;
            //But if the buff has a specified spell damage, use that as the percent.
            if (Spell.Damage > 0)
                absorbPercent = Spell.Damage;

            if (absorbPercent > 100)
                absorbPercent = 100;
            //This only absorbs style damage.
            int damageAbsorbed = (int)(0.01 * absorbPercent * (ad.StyleDamage));

            ad.Damage -= damageAbsorbed;

            OnDamageAbsorbed(ad, damageAbsorbed);

            //TODO correct messages
            MessageToLiving(ad.Target, string.Format("Your style absorbtion absorbs {0} damage!", damageAbsorbed), eChatType.CT_Spell);
            MessageToLiving(ad.Attacker, string.Format("A barrier absorbs {0} damage of your attack!", damageAbsorbed), eChatType.CT_Spell);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:35,代码来源:StyleDmgAbs.cs

示例11: GetEventDelegate

		public WeakMulticastDelegate GetEventDelegate(DOLEvent e)
		{
			if (_events.ContainsKey(e))
				return _events[e];

			return null;
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:7,代码来源:DOLEventHandlerCollection.cs

示例12: OnServerStarted

		public static void OnServerStarted(DOLEvent e, object sender, EventArgs args)
		{
			if (ServerProperties.Properties.LOAD_HOOKPOINTS)
			{
				/*string name,byte gold,byte silver,byte copper,ushort icon,string objectType,ushort flag*/
				HookPointInventory.RedHPInventory.AddFirstFreeSlot(new HookPointItem("Melee Guard", 67, 2624, "DOL.GS.Keeps.GuardFighter", 0));
				HookPointInventory.RedHPInventory.AddFirstFreeSlot(new HookPointItem("Ranged Guard", 67, 2623, "DOL.GS.Keeps.GuardStaticArcher", 0));
				HookPointInventory.RedHPInventory.AddFirstFreeSlot(new HookPointItem("Healer Guard", 67, 2628, "DOL.GS.Keeps.GuardHealer", 0));
				HookPointInventory.RedHPInventory.AddFirstFreeSlot(new HookPointItem("Caster Guard", 67, 2625, "DOL.GS.Keeps.GuardStaticCaster", 0));
				HookPointInventory.RedHPInventory.AddFirstFreeSlot(new HookPointItem("Stealther Guard", 67, 2627, "DOL.GS.Keeps.GuardStealther", 0));

				HookPointInventory.GreenHPInventory.AddFirstFreeSlot(new HookPointItem("Palintone", 50, 0x0A2C, "DOL.GS.GameSiegeCatapult", 0x4100));
				HookPointInventory.GreenHPInventory.AddFirstFreeSlot(new HookPointItem("Trebuchet", 20, 0x0A22, "DOL.GS.GameSiegeTrebuchet", 0x4B00));

				HookPointInventory.LightGreenHPInventory.AddFirstFreeSlot(new HookPointItem("Ballista", 20, 0x0A2C, "DOL.GS.GameSiegeBallista", 0x4b00));

				HookPointInventory.YellowHPInventory.AddFirstFreeSlot(new HookPointItem("Boiling Oil", 70, 0x0A40, "DOL.GS.GameSiegeCauldron", 0x2800));

				/*
				HookPointInventory.BlueHPInventory.AddFirstFreeSlot(new HookPointItem("Healer", 10, 0x0A40, "DOL.GS.GameHealer", 0));
				HookPointInventory.BlueHPInventory.AddFirstFreeSlot(new HookPointItem("Hastener", 10, 0x0A40, "DOL.GS.GameHastener", 0));
				HookPointInventory.BlueHPInventory.AddFirstFreeSlot(new HookPointItem("BlackSmith", 1, 0x0A40, "DOL.GS.Blacksmith", 0));
				HookPointInventory.BlueHPInventory.AddFirstFreeSlot(new HookPointItem("Dye Master", 1, 0x0A40, "DOL.GS.GameKeepGuard", 0));
				HookPointInventory.BlueHPInventory.AddFirstFreeSlot(new HookPointItem("Arrow Merchant", 1, 0x0A40, "DOL.GS.GameKeepGuard", 0));
				HookPointInventory.BlueHPInventory.AddFirstFreeSlot(new HookPointItem("Poison Merchant", 1, 0x0A40, "DOL.GS.GameKeepGuard", 0));
				*/
			}
		}
开发者ID:boscorillium,项目名称:dol,代码行数:28,代码来源:HookPointInventory.cs

示例13: OnCharacterCreation

        /// <summary>
        /// Triggered When New Character is Created.
        /// </summary>
        /// <param name="e"></param>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public static void OnCharacterCreation(DOLEvent e, object sender, EventArgs args)
        {
            // Check Args
            var chArgs = args as CharacterEventArgs;

            if (chArgs == null)
                return;

            DOLCharacters ch = chArgs.Character;

            // Add all Crafting skills at level 1
            var collectionAllCraftingSkills = new List<string>();
            foreach (int craftingSkillId in Enum.GetValues(typeof(eCraftingSkill)))
            {
                if (craftingSkillId > 0)
                {
                    collectionAllCraftingSkills.Add(string.Format("{0}|1", craftingSkillId));
                    if (craftingSkillId == (int)eCraftingSkill._Last)
                        break;
                }
            }

            // Set Primary Skill to Basic.
            ch.SerializedCraftingSkills = string.Join(";", collectionAllCraftingSkills);
            ch.CraftingPrimarySkill = (int)eCraftingSkill.BasicCrafting;
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:32,代码来源:CharacterCreationCraft.cs

示例14: OnScriptCompiled

		public static void OnScriptCompiled(DOLEvent e, object sender, EventArgs args)
		{
			// Desactivated
			if (ServerProperties.Properties.STATSAVE_INTERVAL == -1)
				return;
			
			try
			{
				m_systemCpuUsedCounter = new PerformanceCounter("Processor", "% processor time", "_total");
				m_systemCpuUsedCounter.NextValue();
			}
			catch (Exception ex)
			{
				m_systemCpuUsedCounter = null;
				if (log.IsWarnEnabled)
					log.Warn(ex.GetType().Name + " SystemCpuUsedCounter won't be available: " + ex.Message);
			}
			try
			{
				m_processCpuUsedCounter = new PerformanceCounter("Process", "% processor time", GetProcessCounterName());
				m_processCpuUsedCounter.NextValue();
			}
			catch (Exception ex)
			{
				m_processCpuUsedCounter = null;
				if (log.IsWarnEnabled)
					log.Warn(ex.GetType().Name + " ProcessCpuUsedCounter won't be available: " + ex.Message);
			}
			// 1 min * INTERVAL
			m_statFrequency *= ServerProperties.Properties.STATSAVE_INTERVAL;
			lock (typeof(StatSave))
			{
				m_timer = new Timer(new TimerCallback(SaveStats), null, INITIAL_DELAY, Timeout.Infinite);
			}
		}
开发者ID:mynew4,项目名称:DOLSharp,代码行数:35,代码来源:StatSave.cs

示例15: Notify

        public override void Notify(DOLEvent e, object sender, EventArgs args)
        {
            if (e == AreaEvent.PlayerEnter)
            {
                AreaEventArgs kargs = args as AreaEventArgs;

                if (m_owner is GamePlayer && kargs.GameObject != m_owner)
                    return;

                foreach (AbstractArea area in kargs.GameObject.CurrentAreas)
                {
                    if (area is KeepArea && (area as KeepArea).Keep == m_keep)
                    {
                        FinishMission();
                        break;
                    }
                }
            }
            else if (e == KeepEvent.KeepTaken)
            {
                KeepEventArgs kargs = args as KeepEventArgs;

                if (kargs.Keep != m_keep)
                    return;

                ExpireMission();
            }
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:28,代码来源:ScoutMission.cs


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