示例#1
0
		private void startTimer()
		{
			m_tickTimer = new RegionTimer(m_playerOwner);
			m_tickTimer.Callback = new RegionTimerCallback(onTick);
			m_tickTimer.Start(3000);

		}
示例#2
0
        /// <summary>
        /// when the relic is lost and ReturnRelicInterval is elapsed
        /// </summary>
        protected virtual int ReturnRelicTick(RegionTimer timer)
        {
            if (CurrentRegion.Time - m_timeRelicOnGround < ReturnRelicInterval)
            {
                // Note: This does not show up, possible issue with SendSpellEffect
                ushort effectID = (ushort)Util.Random(5811, 5815);
                foreach (GamePlayer ppl in GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    ppl.Out.SendSpellEffectAnimation(this, this, effectID, 0, false, 0x01);
                }

                return(RelicEffectInterval);
            }

            if (ReturnRelicPad != null)
            {
                log.Debug("Relic " + Name + " is lost and returns to " + ReturnRelicPad.ToString());
                RemoveFromWorld();
                RelicPadTakesOver(ReturnRelicPad, true);
                SaveIntoDatabase();
                AddToWorld();
            }
            else
            {
                log.Error("Relic " + Name + " is lost and ReturnRelicPad is null!");
            }

            m_returnRelicTimer.Stop();
            m_returnRelicTimer = null;
            return(0);
        }
示例#3
0
        /// <summary>
        /// Called when craft time is finished
        /// </summary>
        /// <param name="timer"></param>
        /// <returns></returns>
        protected static int ProceedSiegeWeapon(RegionTimer timer)
        {
            GamePlayer      player      = (GamePlayer)timer.Properties.getProperty <object>(AbstractCraftingSkill.PLAYER_CRAFTER, null);
            GameSiegeWeapon siegeWeapon = (GameSiegeWeapon)timer.Properties.getProperty <object>(AbstractCraftingSkill.RECIPE_BEING_CRAFTED, null);

            if (player == null || siegeWeapon == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("There was a problem getting back the item to the player in the secondary craft system.");
                }
                return(0);
            }
            if (!Util.Chance(CalculateSuccessChances(player, siegeWeapon)))
            {
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Repair.ProceedSiegeWeapon.FailRepair", siegeWeapon.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                return(0);
            }
            siegeWeapon.Health = siegeWeapon.MaxHealth;
            player.CraftTimer.Stop();
            player.Out.SendCloseTimerWindow();
            player.Out.SendObjectUpdate(siegeWeapon);            //not sure if good packet for update
            player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Repair.Proceed.FullyRepaired1", siegeWeapon.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
            return(0);
        }
示例#4
0
        /// <summary>
        /// The callback for the pulsing spelleffect
        /// </summary>
        /// <param name="timer">The ObjectTimerCallback object</param>
        private int CarrierTimerTick(RegionTimer timer)
        {
            // update the relic position
            Update();

            // check to make sure relic is in a legal region and still in the players backpack
            if (GameServer.KeepManager.FrontierRegionsList.Contains(CurrentRegionID) == false)
            {
                log.DebugFormat("{0} taken out of frontiers, relic returned to previous pad.", Name);
                RelicPadTakesOver(ReturnRelicPad, true);
                SaveIntoDatabase();
                AddToWorld();
                return(0);
            }

            if (CurrentCarrier != null && CurrentCarrier.Inventory.GetFirstItemByID(m_item.Id_nb, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack) == null)
            {
                log.DebugFormat("{0} not found in carriers backpack, relic returned to previous pad.", Name);
                RelicPadTakesOver(ReturnRelicPad, true);
                SaveIntoDatabase();
                AddToWorld();
                return(0);
            }

            // fireworks spells temp
            ushort effectID = (ushort)Util.Random(5811, 5815);

            foreach (GamePlayer ppl in m_currentCarrier.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                ppl.Out.SendSpellEffectAnimation(m_currentCarrier, m_currentCarrier, effectID, 0, false, 0x01);
            }

            return(RelicEffectInterval);
        }
        private int TimerTick(RegionTimer timer)
        {
            foreach (GamePlayer player in m_player.GetPlayersInRadius(1500))
            {
                if (player.Group != null && m_player.Group != null && m_player.Group.IsInTheGroup(player))
                {
                    if (GameServer.ServerRules.IsAllowedToAttack(m_player, player, true) == false)
                    {
                        GuildBannerEffect effect = GuildBannerEffect.CreateEffectOfClass(m_player, player);

                        if (effect != null)
                        {
                            GuildBannerEffect oldEffect = player.EffectList.GetOfType(effect.GetType()) as GuildBannerEffect;
                            if (oldEffect == null)
                            {
                                effect.Start(player);
                            }
                            else
                            {
                                oldEffect.Stop();
                                effect.Start(player);
                            }
                        }
                    }
                }
            }

            return(9000); // Pulsing every 9 seconds with a duration of 9 seconds - Tolakram
        }
        public static int SpawnChests(RegionTimer timer)
        {
            Console.WriteLine("Treasure Chests created");
            IList <ItemTemplate> items = GameServer.Database.SelectObjects <ItemTemplate>("PackageID = '" + GameServer.Database.Escape("DragonWeapons") + "' OR PackageID = '" + GameServer.Database.Escape("LabWeaps") + "' OR PackageID = '" + GameServer.Database.Escape("Artifacts") + "'");

            for (int i = 0; i < numberOfChests; i++)
            {
                TreasureChest chest = new TreasureChest(items);
                //15k
                chest.X               = Util.Random(startX - radius, startX + radius);
                chest.Y               = Util.Random(startY - radius, startY + radius);
                chest.Z               = 10000;
                chest.Heading         = 13;
                chest.CurrentRegionID = currentregionID;
                chest.Model           = 1596;
                chest.AddToWorld();
            }
            foreach (GameClient client in WorldMgr.GetAllPlayingClients())
            {
                client.Player.TempProperties.removeProperty("Treasure_Chest");
                client.Out.SendMessage(numberOfChests + " Treasure Chests created in this zone", eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow);
                client.Out.SendMessage(numberOfChests + " Treasure Chests created in this zone", eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow);
                client.Out.SendMessage(numberOfChests + " Treasure Chests created in this zone", eChatType.CT_ScreenCenter, eChatLoc.CL_SystemWindow);
            }
            Mob mob = GameServer.Database.SelectObject <Mob>("Name = '" + GameServer.Database.Escape("Redemption") + "'");

            if (mob != null)
            {
                GameNPC npc = new GameNPC();
                npc.LoadFromDatabase(mob);
                new RegionTimer(npc, new RegionTimerCallback(SpawnChests), (TreasureChestRecastDelay * 60 * 1000));
            }
            return(0);
        }
示例#7
0
 protected int RemoveCallback(RegionTimer timer)
 {
     m_removeTimer.Stop();
     m_removeTimer = null;
     Delete();
     return(0);
 }
示例#8
0
 /// <summary>
 /// This function is called to show the spell animation to players
 /// </summary>
 /// <param name="callingTimer"></param>
 /// <returns>new delay in milliseconds</returns>
 protected virtual int EndCastCallback(RegionTimer callingTimer)
 {
     foreach (GamePlayer players in this.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
     {
         players.Out.SendSpellEffectAnimation(this, this, EFFECT_ID, 0, false, 0x01);
     }
     return(0);
 }
 public void Stop()
 {
     RemoveHandlers();
     if (m_timer != null)
     {
         m_timer.Stop();
         m_timer = null;
     }
 }
 /// <summary>
 /// Starts a new pickuptimer with the given time (in seconds)
 /// </summary>
 /// <param name="time"></param>
 public void StartPickupTimer(int time)
 {
     if (m_pickup != null)
     {
         m_pickup.Stop();
         m_pickup = null;
     }
     m_pickup = new RegionTimer(this, new RegionTimerCallback(CallBack), time * 1000);
 }
示例#11
0
文件: effectNPC.cs 项目: mynew4/DAoC
 public int Effect(RegionTimer timer)
 {
     m_timer.Dequeue();
     GamePlayer player = (GamePlayer)castplayer.Dequeue();
     foreach (GamePlayer visplayer in this.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
     {
         visplayer.Out.SendSpellEffectAnimation(this, player, spell, 0, false, 1);
     }
     return 0;
 }
        private int CallBack(RegionTimer timer)
        {
            if (targetName == "")
            {
                Console.WriteLine("targetname == \"\"");
                return(0);
            }
            GamePlayer target = null;

            foreach (GameClient client in WorldMgr.GetAllPlayingClients())
            {
                if (client.Player.Name == targetName)
                {
                    Console.WriteLine("Found player");
                    target = client.Player;
                }
            }
            if (m_pickup == null)
            {
                return(0);
            }
            if (target == null)
            {
                targetName = "";
                return(0);
            }
            if (this == null)
            {
                target.Out.SendCloseTimerWindow();
                return(0);
            }
            if (target.InCombat)
            {
                SendReply(target, "You can not steal my loot while in combat, argh! ");
                targetName = "";
                return(0);
            }
            if (!this.IsWithinRadius(target, WorldMgr.INTERACT_DISTANCE, true))
            {
                targetName = "";
                return(0);
            }
            target.Out.SendCloseTimerWindow();
            GiveRewards(target);
            targetName = "";

            m_pickup.Stop();

            this.Model = 1;
            this.Name  = "Used";
            this.RemoveFromWorld();

            return(0);
        }
		protected virtual int EndCast(RegionTimer timer)
		{
			if (m_player.IsMezzed || m_player.IsStunned || m_player.IsSitting)
				return 0;
			Statics.ThornweedFieldBase twf = new Statics.ThornweedFieldBase(m_dmgValue);
			twf.CreateStatic(m_player, m_player.GroundTarget, m_duration, 3, 500);
			DisableSkill(m_player);
			timer.Stop();
			timer = null;
			return 0;
		}
示例#14
0
 private void StopDecay()
 {
     lock (m_decayTimerLock)
     {
         if (m_decayTimer == null)
         {
             return;
         }
         m_decayTimer.Stop();
         m_decayTimer = null;
     }
 }
 public void StopPickupTimer()
 {
     foreach (GamePlayer player in Owners)
     {
         if (player.ObjectState == eObjectState.Active)
         {
             player.Out.SendMessage("You may now pick up " + Name + "!", eChatType.CT_Loot, eChatLoc.CL_SystemWindow);
         }
     }
     m_pickup.Stop();
     m_pickup = null;
 }
示例#16
0
文件: Caster.cs 项目: mynew4/DAoC
		protected virtual int Timer(RegionTimer callingTimer)
		{
			if (base.IsAlive)
			{
				foreach (GamePlayer player in this.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
				{
					player.Out.SendSpellCastAnimation(this, 4321, 30);
					RegionTimer timer = new RegionTimer(player, new RegionTimerCallback(ShowEffect), 3000);
				}
			}
			return INTERVAL;
		}
示例#17
0
 /// <summary>
 /// Starts the Respawn Timer
 /// </summary>
 protected virtual void StartRespawn(int respawnSeconds)
 {
     lock (m_respawnTimerLock)
     {
         if (m_respawnTimer == null)
         {
             m_respawnTimer          = new RegionTimer(this);
             m_respawnTimer.Callback = new RegionTimerCallback(RespawnTimerCallback);
             m_respawnTimer.Start(respawnSeconds * 1000);
         }
     }
 }
示例#18
0
        /// <summary>
        /// Called when craft time is finished
        /// </summary>
        /// <param name="timer"></param>
        /// <returns></returns>
        protected static int Proceed(RegionTimer timer)
        {
            GamePlayer    player       = (GamePlayer)timer.Properties.getProperty <object>(AbstractCraftingSkill.PLAYER_CRAFTER, null);
            GamePlayer    tradePartner = (GamePlayer)timer.Properties.getProperty <object>(PLAYER_PARTNER, null);
            InventoryItem item         = (InventoryItem)timer.Properties.getProperty <object>(AbstractCraftingSkill.RECIPE_BEING_CRAFTED, null);

            if (player == null || item == null)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("There was a problem getting back the item to the player in the secondary craft system.");
                }

                return(0);
            }

            player.CraftTimer.Stop();
            player.Out.SendCloseTimerWindow();

            if (Util.Chance(CalculateSuccessChances(player, item)))
            {
                int toRecoverCond = (int)((item.MaxCondition - item.Condition) * 0.01 / item.MaxCondition) + 1;
                if (toRecoverCond >= item.Durability)
                {
                    item.Condition += (int)(item.Durability * item.MaxCondition / 0.01);
                    item.Durability = 0;
                }
                else
                {
                    item.Condition   = item.MaxCondition;
                    item.Durability -= toRecoverCond;
                }

                player.Out.SendInventorySlotsUpdate(new int[] { item.SlotPosition });

                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Repair.Proceed.FullyRepaired1", item.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                if (tradePartner != null)
                {
                    tradePartner.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Repair.Proceed.FullyRepaired2", player.Name, item.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                }
            }
            else
            {
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Repair.Proceed.FailImprove1", item.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                if (tradePartner != null)
                {
                    tradePartner.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "Repair.Proceed.FailImprove2", player.Name, item.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                }
            }

            return(0);
        }
示例#19
0
		protected virtual int EndCast(RegionTimer timer)
		{
			if (caster.TargetObject == null)
			{
				caster.Out.SendMessage("You need a target for this ability!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				caster.DisableSkill(this, 3 * 1000);
				return 0;
			}

            if ( !caster.IsWithinRadius( caster.TargetObject, (int)( 1500 * caster.GetModified( eProperty.SpellRange ) * 0.01 ) ) )
			{
				caster.Out.SendMessage(caster.TargetObject + " is too far away.", eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
				return 0;
			}

			foreach (GamePlayer player in caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
			{
				player.Out.SendSpellEffectAnimation(caster, (caster.TargetObject as GameLiving), 7025, 0, false, 1);
			}

			foreach (GameNPC mob in caster.TargetObject.GetNPCsInRadius(500))
			{
				if (!GameServer.ServerRules.IsAllowedToAttack(caster, mob, true))
					continue;

				mob.TakeDamage(caster, eDamageType.Heat, dmgValue, 0);
				caster.Out.SendMessage("You hit the " + mob.Name + " for " + dmgValue + " damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
				foreach (GamePlayer player2 in caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
				{
					player2.Out.SendSpellEffectAnimation(caster, mob, 7025, 0, false, 1);
				}
			}

			foreach (GamePlayer aeplayer in caster.TargetObject.GetPlayersInRadius(500))
			{
				if (!GameServer.ServerRules.IsAllowedToAttack(caster, aeplayer, true))
					continue;

				aeplayer.TakeDamage(caster, eDamageType.Heat, dmgValue, 0);
				caster.Out.SendMessage("You hit " + aeplayer.Name + " for " + dmgValue + " damage.", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
				aeplayer.Out.SendMessage(caster.Name + " hits you for " + dmgValue + " damage.", eChatType.CT_YouWereHit, eChatLoc.CL_SystemWindow); 
				foreach (GamePlayer player3 in caster.TargetObject.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
				{
					player3.Out.SendSpellEffectAnimation(caster, aeplayer, 7025, 0, false, 1);
				}
			}

			DisableSkill(caster);
			timer.Stop();
			timer = null;
			return 0;
		}
示例#20
0
		/// <summary>
		/// Cast glare on the target.
		/// </summary>
		/// <param name="timer">The timer that started this cast.</param>
		/// <returns></returns>
		private int CastGlare(RegionTimer timer)
		{
			// Turn around to the target and cast glare, then go back to the original
			// target, if one exists.

			GameObject oldTarget = TargetObject;
			TargetObject = GlareTarget;
			Z = SpawnPoint.Z; // this is a fix to correct Z errors that sometimes happen during dragon fights
			TurnTo(GlareTarget);
			CastSpell(Glare, SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells));
			GlareTarget = null;
			if (oldTarget != null) TargetObject = oldTarget;
			return 0;
		}
示例#21
0
        /// <summary>
        /// Make the item when craft time is finished
        /// </summary>
        protected virtual int MakeItem(RegionTimer timer)
        {
            GamePlayer             player       = timer.Properties.getProperty <GamePlayer>(PLAYER_CRAFTER, null);
            DBCraftedItem          recipe       = timer.Properties.getProperty <DBCraftedItem>(RECIPE_BEING_CRAFTED, null);
            IList <DBCraftedXItem> rawMaterials = timer.Properties.getProperty <IList <DBCraftedXItem> >(RECIPE_RAW_MATERIAL_LIST, null);

            if (player == null || recipe == null || rawMaterials == null)
            {
                if (player != null)
                {
                    player.Out.SendMessage("Could not find recipe or item to craft!", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                }

                log.Error("Crafting.MakeItem: Could not retrieve player, recipe, or raw materials to craft from CraftTimer.");
                return(0);
            }

            ItemTemplate itemToCraft = GameServer.Database.FindObjectByKey <ItemTemplate>(recipe.Id_nb);

            if (itemToCraft == null)
            {
                return(0);
            }

            player.CraftTimer.Stop();
            player.Out.SendCloseTimerWindow();

            if (Util.Chance(CalculateChanceToMakeItem(player, recipe)))
            {
                if (!RemoveUsedMaterials(player, recipe, rawMaterials))
                {
                    player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "AbstractCraftingSkill.MakeItem.NotAllMaterials"), eChatType.CT_System, eChatLoc.CL_SystemWindow);

                    if (player.Client.Account.PrivLevel == 1)
                    {
                        return(0);
                    }
                }

                BuildCraftedItem(player, recipe, itemToCraft);
                GainCraftingSkillPoints(player, recipe, rawMaterials);
            }
            else
            {
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "AbstractCraftingSkill.MakeItem.LoseNoMaterials", itemToCraft.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                player.Out.SendPlaySound(eSoundType.Craft, 0x02);
            }

            return(0);
        }
示例#22
0
        /// <summary>
        /// The callback that will respawn this object
        /// </summary>
        /// <param name="respawnTimer">the timer calling this callback</param>
        /// <returns>the new interval</returns>
        protected virtual int RespawnTimerCallback(RegionTimer respawnTimer)
        {
            lock (m_respawnTimerLock)
            {
                if (m_respawnTimer != null)
                {
                    m_respawnTimer.Stop();
                    m_respawnTimer = null;
                    AddToWorld();
                }
            }

            return(0);
        }
示例#23
0
        public int DeSpawnEncounter(RegionTimer timer) // this one gets called if the 15 min timer runs out.
        {
            foreach (GameWallofFire fire in WallofFireList)
            {
                fire.RemoveFromWorld();
            }

            WallofFireList.Clear();
            foreach (GameStairGuard guard in StairGuardList)
            {
                guard.Health = 0;
                guard.Delete();
            }

            StairGuardList.Clear();
            foreach (GameNPC boss in BossList)
            {
                boss.Health = 0;
                boss.Delete();
                if (boss == Aith)
                {
                    GameEventMgr.RemoveHandler(boss, GameNPCEvent.Dying, new DOLEventHandler(AithosHasDied));
                }

                if (boss == Zop)
                {
                    GameEventMgr.RemoveHandler(boss, GameNPCEvent.Dying, new DOLEventHandler(ZopHasDied));
                }

                if (boss == Sun)
                {
                    GameEventMgr.RemoveHandler(boss, GameNPCEvent.Dying, new DOLEventHandler(SunHasDied));
                }
            }

            BossList.Clear();

            foreach (GameNPC purro in PurrosList)
            {
                purro.Health = 0;
                purro.Delete();
            }

            PurrosList.Clear();

            InProgress = false;
            return(0);
        }
示例#24
0
        /// <summary>
        /// Is called whenever the CurrentCarrier is supposed to loose the relic.
        /// </summary>
        /// <param name="removeFromInventory">Defines wheater the Item in the Inventory should be removed.</param>
        protected virtual void PlayerLoosesRelic(bool removeFromInventory)
        {
            if (m_currentCarrier == null)
            {
                return;
            }

            GamePlayer player = m_currentCarrier;

            if (player.TempProperties.getProperty <object>(PLAYER_CARRY_RELIC_WEAK, null) == null)
            {
                log.Warn("GameRelic: " + player.Name + " has already lost" + Name);
                return;
            }

            if (removeFromInventory)
            {
                lock (player.Inventory)
                {
                    bool success = player.Inventory.RemoveItem(m_item);
                    InventoryLogging.LogInventoryAction(player, this, eInventoryActionType.Other, m_item.Template, m_item.Count);
                    log.Debug("Remove " + m_item.Name + " from " + player.Name + "'s Inventory " + (success ? "successfully." : "with errors."));
                }
            }

            // remove the handlers from the player
            SetHandlers(player, false);

            // kill the pulsingEffectTimer on the player
            StartPlayerTimer(null);

            player.TempProperties.removeProperty(PLAYER_CARRY_RELIC_WEAK);
            m_currentCarrier = null;
            player.Out.SendUpdateMaxSpeed();

            if (IsMounted == false)
            {
                // launch the reset timer if this relic is not dropped on a pad
                m_timeRelicOnGround = CurrentRegion.Time;
                m_returnRelicTimer  = new RegionTimer(this, new RegionTimerCallback(ReturnRelicTick), RelicEffectInterval);
                log.DebugFormat("{0} dropped, return timer for relic set to {1} seconds.", Name, ReturnRelicInterval / 1000);

                // update the position of the worldObject Relic
                Update();
                SaveIntoDatabase();
                AddToWorld();
            }
        }
示例#25
0
 public virtual void ManualRespawn()
 {
     if (respawntimer != null)
     {
         respawntimer.Stop();
         respawntimer = null;
     }
     if (ObjectState == eObjectState.Active)
     {
         return;
     }
     Position        = new Vector3(SpawnX, SpawnY, SpawnZ);
     Heading         = (ushort)SpawnHeading;
     CurrentRegionID = (ushort)SpawnRegion;
     XP = MinotaurRelicManager.MAX_RELIC_EXP;
     AddToWorld();
 }
		protected virtual int EndCast(RegionTimer timer)
		{
            bool castWasSuccess = player.TempProperties.getProperty(NM_CAST_SUCCESS, false);
            player.TempProperties.removeProperty(IS_CASTING);
            GameEventMgr.RemoveHandler(player, GamePlayerEvent.Moving, new DOLEventHandler(CastInterrupted));
            GameEventMgr.RemoveHandler(player, GamePlayerEvent.AttackFinished, new DOLEventHandler(CastInterrupted));
            GameEventMgr.RemoveHandler(player, GamePlayerEvent.Dying, new DOLEventHandler(CastInterrupted));
            if (player.IsMezzed || player.IsStunned || player.IsSitting)
                return 0;
            if (!castWasSuccess)
                return 0;
			Statics.NegativeMaelstromBase nm = new Statics.NegativeMaelstromBase(dmgValue);
			nm.CreateStatic(player, player.GroundTarget, duration, 5, 350);
            DisableSkill(player); 
			timer.Stop();
			timer = null;
			return 0;
		}
示例#27
0
文件: Caster.cs 项目: mynew4/DAoC
		public int ShowEffect(RegionTimer timer)
		{
			if (base.IsAlive)
			{
				foreach (GamePlayer player in this.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
				{
					player.Out.SendSpellEffectAnimation(this, this, 4321, 0, false, 1);
				}
				foreach (GamePlayer player in this.GetPlayersInRadius(WorldMgr.INFO_DISTANCE))
				{

					player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "GuardCaster.SkinsHardens", this.Name), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);

				}
			}
			timer.Stop();
			timer = null;
			return 0;
		}
示例#28
0
        /// <summary>
        /// Called when the Respawntimer is reached
        /// </summary>
        /// <param name="respawnTimer"></param>
        /// <returns></returns>
        protected override int RespawnTimerCallback(RegionTimer respawnTimer)
        {
            if (respawntimer != null)
            {
                respawntimer.Stop();
                respawntimer = null;
            }

            if (ObjectState == eObjectState.Active)
            {
                return(0);
            }
            Position        = new Vector3(SpawnX, SpawnY, SpawnZ);
            Heading         = (ushort)SpawnHeading;
            CurrentRegionID = (ushort)SpawnRegion;
            XP = MinotaurRelicManager.MAX_RELIC_EXP;
            AddToWorld();
            return(0);
        }
示例#29
0
 private void StartDecay()
 {
     if (ObjectState != eObjectState.Active)
     {
         return;
     }
     lock (m_decayTimerLock)
     {
         if (m_decayTimer == null)
         {
             m_decayTimer          = new RegionTimer(this);
             m_decayTimer.Callback = new RegionTimerCallback(DecayTimerCallback);
         }
         else if (m_decayTimer.IsAlive)
         {
             return;
         }
         m_decayTimer.Start(DECAYPERIOD);
     }
 }
        protected virtual int MakeItem(RegionTimer timer)
        {
            GamePlayer player = timer.Properties.getProperty <GamePlayer>(PLAYER_CRAFTER);
            Recipe     recipe = timer.Properties.getProperty <Recipe>(RECIPE_BEING_CRAFTED);

            if (player == null || recipe == null)
            {
                if (player != null)
                {
                    player.Out.SendMessage("Could not find recipe or item to craft!", eChatType.CT_Important, eChatLoc.CL_SystemWindow);
                }
                log.Error("Crafting.MakeItem: Could not retrieve player, recipe, or raw materials to craft from CraftTimer.");
                return(0);
            }

            player.CraftTimer.Stop();
            player.Out.SendCloseTimerWindow();

            if (Util.Chance(CalculateChanceToMakeItem(player, recipe.Level)))
            {
                if (!RemoveUsedMaterials(player, recipe))
                {
                    player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "AbstractCraftingSkill.MakeItem.NotAllMaterials"), eChatType.CT_System, eChatLoc.CL_SystemWindow);

                    if (player.Client.Account.PrivLevel == 1)
                    {
                        return(0);
                    }
                }

                BuildCraftedItem(player, recipe);
                GainCraftingSkillPoints(player, recipe);
            }
            else
            {
                player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "AbstractCraftingSkill.MakeItem.LoseNoMaterials", recipe.Product.Name), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                player.Out.SendPlaySound(eSoundType.Craft, 0x02);
            }
            return(0);
        }
示例#31
0
        /// <summary>
        /// Called when the Respawntimer is reached
        /// </summary>
        /// <param name="respawnTimer"></param>
        /// <returns></returns>
        protected override int RespawnTimerCallback(RegionTimer respawnTimer)
        {
            if (Respawntimer != null)
            {
                Respawntimer.Stop();
                Respawntimer = null;
            }

            if (ObjectState == eObjectState.Active)
            {
                return(0);
            }

            X               = SpawnX;
            Y               = SpawnY;
            Z               = SpawnZ;
            Heading         = (ushort)SpawnHeading;
            CurrentRegionID = (ushort)SpawnRegion;
            Xp              = MinotaurRelicManager.MaxRelicExp;
            AddToWorld();
            return(0);
        }
示例#32
0
 /// <summary>
 /// Starts the "signalising effect" sequence on the carrier.
 /// </summary>
 /// <param name="player">Player to set the timer on. Timer stops if param is null</param>
 protected virtual void StartPlayerTimer(GamePlayer player)
 {
     if (player != null)
     {
         if (m_currentCarrierTimer != null)
         {
             log.Warn("GameRelic: PlayerTimer already set on a player, stopping timer!");
             m_currentCarrierTimer.Stop();
             m_currentCarrierTimer = null;
         }
         m_currentCarrierTimer = new RegionTimer(player, new RegionTimerCallback(CarrierTimerTick));
         m_currentCarrierTimer.Start(RelicEffectInterval);
     }
     else
     {
         if (m_currentCarrierTimer != null)
         {
             m_currentCarrierTimer.Stop();
             m_currentCarrierTimer = null;
         }
     }
 }
示例#33
0
文件: GameBoat.cs 项目: mywebext/DOL
        public override bool RiderDismount(bool forced, GamePlayer player)
        {
            if (!base.RiderDismount(forced, player))
            {
                return(false);
            }

            if (CurrentRiders.Length == 0)
            {
                if (m_removeTimer == null)
                {
                    m_removeTimer = new RegionTimer(this, new RegionTimerCallback(RemoveCallback));
                }
                else if (m_removeTimer.IsAlive)
                {
                    m_removeTimer.Stop();
                }
                m_removeTimer.Start(15 * 60 * 1000);
            }

            return(true);
        }
示例#34
0
        /// <summary>
        /// Called when the Relic has reached 0 XP and drops
        /// </summary>
        public virtual void RelicDispose()
        {
            if (timer != null)
            {
                timer.Dispose();
                timer = null;
            }

            if (Owner != null)
            {
                PlayerLoosesRelic(Owner, true);
            }

            RemoveFromWorld();

            if (respawntimer != null)
            {
                respawntimer.Stop();
                respawntimer = null;
            }
            respawntimer = new RegionTimer(this, new RegionTimerCallback(RespawnTimerCallback),
                                           Util.Random(MinotaurRelicManager.MIN_RESPAWN_TIMER, MinotaurRelicManager.MAX_RESPAWN_TIMER));
        }
示例#35
0
        /// <summary>
        /// Called when the Relic has reached 0 XP and drops
        /// </summary>
        public virtual void RelicDispose()
        {
            if (_timer != null)
            {
                _timer.Dispose();
                _timer = null;
            }

            if (Owner != null)
            {
                PlayerLoosesRelic(Owner, true);
            }

            RemoveFromWorld();

            if (Respawntimer != null)
            {
                Respawntimer.Stop();
                Respawntimer = null;
            }

            Respawntimer = new RegionTimer(this, RespawnTimerCallback, Util.Random(MinotaurRelicManager.MinRespawnTimer, MinotaurRelicManager.MaxRespawnTimer));
        }
示例#36
0
        protected virtual int PulseTimer(RegionTimer timer)
        {
            if (currentTick >= m_lifeTime || m_caster == null)
            {
                this.RemoveFromWorld();
                timer.Stop();
                timer=null;
                return 0;
            }
            if (currentTick%m_pulseFrequency==0){
                currentPulse++;
                foreach(GamePlayer target in this.GetPlayersInRadius(m_radius))
                {
                    CastSpell(target);
                }
                foreach (GameNPC npc in this.GetNPCsInRadius(m_radius))
                {
                    CastSpell(npc);
                }
            }

            currentTick++;
            return 1000;
        }
示例#37
0
		private int MakeDelayedDamage(RegionTimer callingTimer)
		{
			DoDamage();
			return 0;
		}
示例#38
0
		/// <summary>
		/// Called when the Respawntimer is reached
		/// </summary>
		/// <param name="respawnTimer"></param>
		/// <returns></returns>
		protected override int RespawnTimerCallback(RegionTimer respawnTimer)
		{
			if (respawntimer != null)
			{
				respawntimer.Stop();
				respawntimer = null;
			}

			if (ObjectState == eObjectState.Active) return 0;
			X = SpawnX;
			Y = SpawnY;
			Z = SpawnZ;
			Heading = (ushort)SpawnHeading;
			CurrentRegionID = (ushort)SpawnRegion;
			XP = MinotaurRelicManager.MAX_RELIC_EXP;
			AddToWorld();
			return 0;
		}
示例#39
0
		public virtual void ManualRespawn()
		{
			if (respawntimer != null)
			{
				respawntimer.Stop();
				respawntimer = null;
			}
			if (ObjectState == eObjectState.Active) return;
			X = SpawnX;
			Y = SpawnY;
			Z = SpawnZ;
			Heading = (ushort)SpawnHeading;
			CurrentRegionID = (ushort)SpawnRegion;
			XP = MinotaurRelicManager.MAX_RELIC_EXP;
			AddToWorld();
		}
示例#40
0
		/// <summary>
		/// when the relic is lost and ReturnRelicInterval is elapsed
		/// </summary>
		protected virtual int ReturnRelicTick(RegionTimer timer)
		{
			if (CurrentRegion.Time - m_timeRelicOnGround < ReturnRelicInterval)
			{
				// Note: This does not show up, possible issue with SendSpellEffect
				ushort effectID = (ushort)Util.Random(5811, 5815);
				foreach (GamePlayer ppl in GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
				{
					ppl.Out.SendSpellEffectAnimation(this, this, effectID, 0, false, 0x01);
				}
				return RelicEffectInterval;
			}

			if (ReturnRelicPad != null)
			{
				log.Debug("Relic " + this.Name + " is lost and returns to " + ReturnRelicPad.ToString());
				RemoveFromWorld();
				RelicPadTakesOver(ReturnRelicPad, true);
				SaveIntoDatabase();
				AddToWorld();
			}
			else
			{
				log.Error("Relic " + this.Name + " is lost and ReturnRelicPad is null!");
			}
			m_returnRelicTimer.Stop();
			m_returnRelicTimer = null;
			return 0;
		}
示例#41
0
		/// <summary>
		/// The callback for the pulsing spelleffect
		/// </summary>
		/// <param name="timer">The ObjectTimerCallback object</param>
		private int CarrierTimerTick(RegionTimer timer)
		{
			//update the relic position
			Update();

			// check to make sure relic is in a legal region and still in the players backpack

			if (GameServer.KeepManager.FrontierRegionsList.Contains(CurrentRegionID) == false)
			{
				log.DebugFormat("{0} taken out of frontiers, relic returned to previous pad.", Name);
				RelicPadTakesOver(ReturnRelicPad, true);
				SaveIntoDatabase();
				AddToWorld();
				return 0;
			}

			if (CurrentCarrier != null && CurrentCarrier.Inventory.GetFirstItemByID(m_item.Id_nb, eInventorySlot.FirstBackpack, eInventorySlot.LastBackpack) == null)
			{
				log.DebugFormat("{0} not found in carriers backpack, relic returned to previous pad.", Name);
				RelicPadTakesOver(ReturnRelicPad, true);
				SaveIntoDatabase();
				AddToWorld();
				return 0;
			}

			//fireworks spells temp
			ushort effectID = (ushort)Util.Random(5811, 5815);
			foreach (GamePlayer ppl in m_currentCarrier.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
				ppl.Out.SendSpellEffectAnimation(m_currentCarrier, m_currentCarrier, effectID, 0, false, 0x01);

			return RelicEffectInterval;
		}
示例#42
0
		private int DecayTimerCallback(RegionTimer callingTimer)
		{
			TakeDamage(this, eDamageType.Natural, DeductHp, 0);
			return DECAYPERIOD;
		}
示例#43
0
        /// <summary>
        /// Cast glare on the target.
        /// </summary>
        /// <param name="timer">The timer that started this cast.</param>
        /// <returns></returns>
        private int CastGlare(RegionTimer timer)
        {
            // Turn around to the target and cast glare, then go back to the original
            // target, if one exists.

            GameObject oldTarget = TargetObject;
            TargetObject = GlareTarget;
            Z = SpawnPoint.Z; // this is a fix to correct Z errors that sometimes happen during dragon fights
            TurnTo(GlareTarget);
            CastSpell(Glare, SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells));
            GlareTarget = null;
            if (oldTarget != null) TargetObject = oldTarget;
            return 0;
        }
示例#44
0
		/// <summary>
		/// The callback that will respawn this mob
		/// </summary>
		/// <param name="respawnTimer">the timer calling this callback</param>
		/// <returns>the new interval</returns>
		protected virtual int RespawnTimerCallback(RegionTimer respawnTimer)
		{
			int dummy;
			// remove Mob from "respawning"
			CurrentRegion.MobsRespawning.TryRemove(this, out dummy);
			
			lock (m_respawnTimerLock)
			{
				if (m_respawnTimer != null)
				{
					m_respawnTimer.Stop();
					m_respawnTimer = null;
				}
			}

			//DOLConsole.WriteLine("respawn");
			//TODO some real respawn handling
			if (IsAlive) return 0;
			if (ObjectState == eObjectState.Active) return 0;

			//Heal this mob, move it to the spawnlocation
			Health = MaxHealth;
			Mana = MaxMana;
			Endurance = MaxEndurance;
			int origSpawnX = m_spawnPoint.X;
			int origSpawnY = m_spawnPoint.Y;
			//X=(m_spawnX+Random(750)-350); //new SpawnX = oldSpawn +- 350 coords
			//Y=(m_spawnY+Random(750)-350);	//new SpawnX = oldSpawn +- 350 coords
			X = m_spawnPoint.X;
			Y = m_spawnPoint.Y;
			Z = m_spawnPoint.Z;
			Heading = m_spawnHeading;
			AddToWorld();
			m_spawnPoint.X = origSpawnX;
			m_spawnPoint.Y = origSpawnY;
			return 0;
		}
示例#45
0
		/// <summary>
		/// Callback timer for health regeneration
		/// </summary>
		/// <param name="selfRegenerationTimer">the regeneration timer</param>
		/// <returns>the new interval</returns>
		protected override int HealthRegenerationTimerCallback(RegionTimer selfRegenerationTimer)
		{
			int period = m_healthRegenerationPeriod;
			if (!InCombat)
			{
				int oldPercent = HealthPercent;
				period = base.HealthRegenerationTimerCallback(selfRegenerationTimer);
				if (oldPercent != HealthPercent)
					BroadcastUpdate();
			}
			return (Health < MaxHealth) ? period : 0;
		}
示例#46
0
		/// <summary>
		/// Keep following a specific object at a max distance
		/// </summary>
		protected virtual int FollowTimerCallback(RegionTimer callingTimer)
		{
			if (IsCasting)
				return ServerProperties.Properties.GAMENPC_FOLLOWCHECK_TIME;

			bool wasInRange = m_followTimer.Properties.getProperty(FOLLOW_TARGET_IN_RANGE, false);
			m_followTimer.Properties.removeProperty(FOLLOW_TARGET_IN_RANGE);

			GameObject followTarget = (GameObject)m_followTarget.Target;
			GameLiving followLiving = followTarget as GameLiving;

			//Stop following if target living is dead
			if (followLiving != null && !followLiving.IsAlive)
			{
				StopFollowing();
				Notify(GameNPCEvent.FollowLostTarget, this, new FollowLostTargetEventArgs(followTarget));
				return 0;
			}

			//Stop following if we have no target
			if (followTarget == null || followTarget.ObjectState != eObjectState.Active || CurrentRegionID != followTarget.CurrentRegionID)
			{
				StopFollowing();
				Notify(GameNPCEvent.FollowLostTarget, this, new FollowLostTargetEventArgs(followTarget));
				return 0;
			}

			//Calculate the difference between our position and the players position
			float diffx = (long)followTarget.X - X;
			float diffy = (long)followTarget.Y - Y;
			float diffz = (long)followTarget.Z - Z;

			//SH: Removed Z checks when one of the two Z values is zero(on ground)
			//Tolakram: a Z of 0 does not indicate on the ground.  Z varies based on terrain  Removed 0 Z check
			float distance = (float)Math.Sqrt(diffx * diffx + diffy * diffy + diffz * diffz);

			//if distance is greater then the max follow distance, stop following and return home
			if ((int)distance > m_followMaxDist)
			{
				StopFollowing();
				Notify(GameNPCEvent.FollowLostTarget, this, new FollowLostTargetEventArgs(followTarget));
				this.WalkToSpawn();
				return 0;
			}
			int newX, newY, newZ;

			if (this.Brain is StandardMobBrain)
			{
				StandardMobBrain brain = this.Brain as StandardMobBrain;

				//if the npc hasn't hit or been hit in a while, stop following and return home
				if (!(Brain is IControlledBrain))
				{
					if (AttackState && brain != null && followLiving != null)
					{
						long seconds = 20 + ((brain.GetAggroAmountForLiving(followLiving) / (MaxHealth + 1)) * 100);
						long lastattacked = LastAttackTick;
						long lasthit = LastAttackedByEnemyTick;
						if (CurrentRegion.Time - lastattacked > seconds * 1000 && CurrentRegion.Time - lasthit > seconds * 1000)
						{
							//StopFollow();
							Notify(GameNPCEvent.FollowLostTarget, this, new FollowLostTargetEventArgs(followTarget));
							//brain.ClearAggroList();
							this.WalkToSpawn();
							return 0;
						}
					}
				}

				//If we're part of a formation, we can get out early.
				newX = followTarget.X;
				newY = followTarget.Y;
				newZ = followTarget.Z;
				if (brain.CheckFormation(ref newX, ref newY, ref newZ))
				{
					WalkTo(newX, newY, (ushort)newZ, MaxSpeed);
					return ServerProperties.Properties.GAMENPC_FOLLOWCHECK_TIME;
				}
			}

			// Tolakram - Distances under 100 do not calculate correctly leading to the mob always being told to walkto
			int minAllowedFollowDistance = MIN_ALLOWED_FOLLOW_DISTANCE;

			// pets can follow closer.  need to implement /fdistance command to make this adjustable
			if (this.Brain is IControlledBrain)
				minAllowedFollowDistance = MIN_ALLOWED_PET_FOLLOW_DISTANCE;

			//Are we in range yet?
			if ((int)distance <= (m_followMinDist < minAllowedFollowDistance ? minAllowedFollowDistance : m_followMinDist))
			{
				StopMoving();
				TurnTo(followTarget);
				if (!wasInRange)
				{
					m_followTimer.Properties.setProperty(FOLLOW_TARGET_IN_RANGE, true);
					FollowTargetInRange();
				}
				return ServerProperties.Properties.GAMENPC_FOLLOWCHECK_TIME;
			}

			// follow on distance
			diffx = (diffx / distance) * m_followMinDist;
			diffy = (diffy / distance) * m_followMinDist;
			diffz = (diffz / distance) * m_followMinDist;

			//Subtract the offset from the target's position to get
			//our target position
			newX = (int)(followTarget.X - diffx);
			newY = (int)(followTarget.Y - diffy);
			newZ = (int)(followTarget.Z - diffz);
			WalkTo(newX, newY, (ushort)newZ, MaxSpeed);
			return ServerProperties.Properties.GAMENPC_FOLLOWCHECK_TIME;
		}
示例#47
0
		/// <summary>
		/// Starts the Respawn Timer
		/// </summary>
		public virtual void StartRespawn()
		{
			if (IsAlive) return;

			if (this.Brain is IControlledBrain)
				return;

			int respawnInt = RespawnInterval;
			if (respawnInt > 0)
			{
				lock (m_respawnTimerLock)
				{
					if (m_respawnTimer == null)
					{
						m_respawnTimer = new RegionTimer(this);
						m_respawnTimer.Callback = new RegionTimerCallback(RespawnTimerCallback);
					}
					else if (m_respawnTimer.IsAlive)
					{
						m_respawnTimer.Stop();
					}
					// register Mob as "respawning"
					CurrentRegion.MobsRespawning.TryAdd(this, respawnInt);
					
					m_respawnTimer.Start(respawnInt);
				}
			}
		}
示例#48
0
		public void StopPickupTimer()
		{
			foreach (GamePlayer player in Owners)
			{
				if (player.ObjectState == eObjectState.Active)
				{
					player.Out.SendMessage("You may now pick up " + Name + "!", eChatType.CT_Loot, eChatLoc.CL_SystemWindow);
				}
			}
			m_pickup.Stop();
			m_pickup = null;
		}
示例#49
0
		private int CallBack(RegionTimer timer)
		{
			m_pickup.Stop();
			m_pickup = null;
			return 0;
		}
示例#50
0
		/// <summary>
		/// Starts a new pickuptimer with the given time (in seconds)
		/// </summary>
		/// <param name="time"></param>
		public void StartPickupTimer(int time)
		{
			if (m_pickup != null)
			{
				m_pickup.Stop();
				m_pickup = null;
			}
			m_pickup = new RegionTimer(this, new RegionTimerCallback(CallBack), time * 1000);
		}
示例#51
0
		private void StartDecay()
		{
			if (ObjectState != eObjectState.Active)
				return;
			lock (m_decayTimerLock)
			{
				if (m_decayTimer == null)
				{
					m_decayTimer = new RegionTimer(this);
					m_decayTimer.Callback = new RegionTimerCallback(DecayTimerCallback);
				}
				else if (m_decayTimer.IsAlive)
					return;
				m_decayTimer.Start(DECAYPERIOD);
			}
		}
示例#52
0
		/// <summary>
		/// Cast Breath on the raid (AoE damage and AoE resist debuff).
		/// </summary>
		/// <param name="timer">The timer that started this cast.</param>
		/// <returns></returns>
		private int CastBreath(RegionTimer timer)
		{
			CastSpell(Breath, SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells));
			CastSpell(ResistDebuff, SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells));
			return 0;
		}
示例#53
0
		private void StopDecay()
		{
			lock (m_decayTimerLock)
			{
				if (m_decayTimer == null)
					return;
				m_decayTimer.Stop();
				m_decayTimer = null;
			}
		}
示例#54
0
		/// <summary>
		/// Is called whenever the CurrentCarrier is supposed to loose the relic.
		/// </summary>
		/// <param name="removeFromInventory">Defines wheater the Item in the Inventory should be removed.</param>
		protected virtual void PlayerLoosesRelic(bool removeFromInventory)
		{
			if (m_currentCarrier == null)
			{
				return;
			}

			GamePlayer player = m_currentCarrier;

			if (player.TempProperties.getProperty<object>(PLAYER_CARRY_RELIC_WEAK, null) == null)
			{
				log.Warn("GameRelic: " + player.Name + " has already lost" + Name);
				return;
			}
			if (removeFromInventory)
			{
				lock (player.Inventory)
				{
					bool success = player.Inventory.RemoveItem(m_item);
					InventoryLogging.LogInventoryAction(player, this, eInventoryActionType.Other, m_item.Template, m_item.Count);
					log.Debug("Remove " + m_item.Name + " from " + player.Name + "'s Inventory " + ((success) ? "successfully." : "with errors."));
				}

			}

			// remove the handlers from the player
			SetHandlers(player, false);
			//kill the pulsingEffectTimer on the player
			StartPlayerTimer(null);

			player.TempProperties.removeProperty(PLAYER_CARRY_RELIC_WEAK);
			m_currentCarrier = null;
			player.Out.SendUpdateMaxSpeed();

			if (IsMounted == false)
			{
				// launch the reset timer if this relic is not dropped on a pad
				m_timeRelicOnGround = CurrentRegion.Time;
				m_returnRelicTimer = new RegionTimer(this, new RegionTimerCallback(ReturnRelicTick), RelicEffectInterval);
				log.DebugFormat("{0} dropped, return timer for relic set to {1} seconds.", Name, ReturnRelicInterval / 1000);

				// update the position of the worldObject Relic
				Update();
				SaveIntoDatabase();
				AddToWorld();
			}
		}
示例#55
0
 /// <summary>
 /// Cast Breath on the raid (AoE damage and AoE resist debuff).
 /// </summary>
 /// <param name="timer">The timer that started this cast.</param>
 /// <returns></returns>
 private int CastBreath(RegionTimer timer)
 {
     CastSpell(Breath, SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells));
     CastSpell(ResistDebuff, SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells));
     return 0;
 }
示例#56
0
		/// <summary>
		/// Start the 5 second timer for the stun.
		/// </summary>
		private int CastStun(RegionTimer timer)
		{
			CastSpell(Stun, SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells));
			return 0;
		}
示例#57
0
 /// <summary>
 /// Start the 5 second timer for the stun.
 /// </summary>
 private int CastStun(RegionTimer timer)
 {
     CastSpell(Stun, SkillBase.GetSpellLine(GlobalSpellsLines.Mob_Spells));
     return 0;
 }
示例#58
0
		/// <summary>
		/// Called when the Relic has reached 0 XP and drops
		/// </summary>
		public virtual void RelicDispose()
		{
			if (timer != null)
			{
				timer.Dispose();
				timer = null;
			}

			if (Owner != null)
				PlayerLoosesRelic(Owner, true);

			RemoveFromWorld();

			if (respawntimer != null)
			{
				respawntimer.Stop();
				respawntimer = null;
			}
			respawntimer = new RegionTimer(this, new RegionTimerCallback(RespawnTimerCallback),
			                               Util.Random(MinotaurRelicManager.MIN_RESPAWN_TIMER, MinotaurRelicManager.MAX_RESPAWN_TIMER));
		}
示例#59
0
		/// <summary>
		/// This method is called from the Interaction with the GameStaticItem
		/// </summary>
		/// <param name="player"></param>
		protected virtual void PlayerTakesRelic(GamePlayer player)
		{
			if (player.TempProperties.getProperty<object>(PLAYER_CARRY_RELIC_WEAK, null) != null)
			{
				player.Out.SendMessage("You are already carrying a relic.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return;
			}
			if (player.IsStealthed)
			{
				player.Out.SendMessage("You cannot carry a relic while stealthed.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return;
			}

			if (!player.IsAlive)
			{
				player.Out.SendMessage("You are dead!", eChatType.CT_System, eChatLoc.CL_SystemWindow);
				return;
			}

			if (IsMounted)
			{
				AbstractGameKeep keep = GameServer.KeepManager.GetKeepCloseToSpot(m_currentRelicPad.CurrentRegionID, m_currentRelicPad, WorldMgr.VISIBILITY_DISTANCE);

				log.DebugFormat("keep {0}", keep);

				if (keep != null && keep.Realm != player.Realm)
				{
					player.Out.SendMessage("You must capture this keep before taking a relic.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
					return;
				}
			}

			if (player.Inventory.AddItem(eInventorySlot.FirstEmptyBackpack, m_item))
			{
				if (m_item == null)
					log.Warn("GameRelic: Could not retrive " + Name + " as InventoryItem on player " + player.Name);
				InventoryLogging.LogInventoryAction(this, player, eInventoryActionType.Other, m_item.Template, m_item.Count);


				m_currentCarrier = player;
				player.TempProperties.setProperty(PLAYER_CARRY_RELIC_WEAK, this);
				player.Out.SendUpdateMaxSpeed();

				if (IsMounted)
				{
					m_currentRelicPad.RemoveRelic(this);
					ReturnRelicPad = m_currentRelicPad;
					LastRealm = m_currentRelicPad.Realm; // save who owned this in case of server restart while relic is off pad
					m_currentRelicPad = null;
				}

				RemoveFromWorld();
				SaveIntoDatabase();
				Realm = 0;
				SetHandlers(player, true);
				StartPlayerTimer(player);
				if (m_returnRelicTimer != null)
				{
					m_returnRelicTimer.Stop();
					m_returnRelicTimer = null;
				}

			}
			else
			{
				player.Out.SendMessage("You dont have enough space in your backpack to carry this.", eChatType.CT_System, eChatLoc.CL_SystemWindow);
			}
		}
示例#60
0
		/// <summary>
		/// Starts the "signalising effect" sequence on the carrier.
		/// </summary>
		/// <param name="player">Player to set the timer on. Timer stops if param is null</param>
		protected virtual void StartPlayerTimer(GamePlayer player)
		{
			if (player != null)
			{
				if (m_currentCarrierTimer != null)
				{
					log.Warn("GameRelic: PlayerTimer already set on a player, stopping timer!");
					m_currentCarrierTimer.Stop();
					m_currentCarrierTimer = null;
				}
				m_currentCarrierTimer = new RegionTimer(player, new RegionTimerCallback(CarrierTimerTick));
				m_currentCarrierTimer.Start(RelicEffectInterval);

			}
			else
			{
				if (m_currentCarrierTimer != null)
				{
					m_currentCarrierTimer.Stop();
					m_currentCarrierTimer = null;
				}
			}


		}