Пример #1
0
        /// <summary>
        /// Returns exp penalty for given level and option.
        /// </summary>
        /// <param name="level"></param>
        /// <param name="option"></param>
        /// <returns></returns>
        public int GetExpPenalty(int level, ReviveOptions option)
        {
            float optionMultiplicator;

            switch (option)
            {
            // Check both Nao Stone options for exp, as the exp aren't
            // reduced until the second option gets in.
            case ReviveOptions.NaoStone: optionMultiplicator = 0.001f; break;

            case ReviveOptions.NaoStoneRevive: optionMultiplicator = 0.001f; break;

            case ReviveOptions.PhoenixFeather: optionMultiplicator = 0.0025f; break;

            case ReviveOptions.DungeonEntrance: optionMultiplicator = 0.005f; break;

            case ReviveOptions.StatueOfGoddess: optionMultiplicator = 0.0075f; break;

            case ReviveOptions.Here: optionMultiplicator = 0.01f; break;

            case ReviveOptions.Town:
                var premium = true;
                if (premium)
                {
                    goto default;
                }
                optionMultiplicator = 0.005f; break;

            default: return(0);
            }

            float levelMultiplicator;

            if (level < 10)
            {
                levelMultiplicator = 1;
            }
            else if (level < 30)
            {
                levelMultiplicator = 3;
            }
            else if (level < 50)
            {
                levelMultiplicator = 4;
            }
            else if (level < 100)
            {
                levelMultiplicator = 5;
            }
            else
            {
                levelMultiplicator = 6;
            }

            var exp = AuraData.ExpDb.GetForLevel(level);

            return((int)(exp * optionMultiplicator * levelMultiplicator));
        }
Пример #2
0
		public void Clear()
		{
			this.Options = ReviveOptions.None;
		}
Пример #3
0
		public bool Has(ReviveOptions option)
		{
			return ((this.Options & option) != 0);
		}
Пример #4
0
		public void Add(ReviveOptions option)
		{
			this.Options |= option;
		}
Пример #5
0
		/// <summary>
		/// Revives creature.
		/// </summary>
		/// <param name="option">Determines the penalty and stat recovery.</param>
		public void Revive(ReviveOptions option)
		{
			if (!this.IsDead)
				return;

			// Get and check exp penalty
			// "Here" wil be disabled by the client if not enough exp are
			// available, nothing else though, so we send an error message
			// if creature doesn't have enough exp, instead of issuing a
			// warning.
			var expPenalty = this.DeadMenu.GetExpPenalty(this.Level, option);
			var minExp = AuraData.ExpDb.GetTotalForNextLevel(this.Level - 2);

			if (this.Exp - expPenalty < minExp)
			{
				// Unofficial
				Send.Notice(this, NoticeType.MiddleSystem, Localization.Get("Insufficient EXP."));
				Send.DeadFeather(this);
				Send.Revived(this);
				return;
			}

			switch (option)
			{
				case ReviveOptions.Town:
				case ReviveOptions.TirChonaill:
				case ReviveOptions.DungeonEntrance:
				case ReviveOptions.BarriLobby:
					// 100% life and 50% injury recovery
					this.Injuries -= this.Injuries * 0.50f;
					this.Life = this.LifeMax;
					break;

				case ReviveOptions.Here:
					// 5 life recovery and 50% additional injuries
					this.Injuries += this.LifeInjured * 0.50f;
					this.Life = 5;
					break;

				case ReviveOptions.HereNoPenalty:
					// 100% life and 100% injury recovery
					this.Injuries = 0;
					this.Life = this.LifeMax;
					break;

				case ReviveOptions.ArenaLobby:
				case ReviveOptions.ArenaWaitingRoom:
					// 100% life, 100% injury, and 100% stamina recovery
					this.Injuries = 0;
					this.Life = this.LifeMax;
					this.Stamina = this.StaminaMax;
					break;

				case ReviveOptions.ArenaSide:
					// 50% life, 20% injury, and 50% stamina recovery
					this.Injuries -= this.Injuries * 0.20f;
					this.Life = this.LifeMax * 0.50f;
					this.Stamina = this.StaminaMax * 0.50f;
					break;

				case ReviveOptions.InCamp:
				case ReviveOptions.StatueOfGoddess:
					// 25% life recovery and 10% additional injuries
					this.Injuries += this.LifeInjured * 0.10f;
					this.Life = this.LifeMax * 0.25f;
					break;

				case ReviveOptions.PhoenixFeather:
					// 10% additional injuries
					this.Injuries += this.LifeInjured * 0.10f;
					this.Life = 1;
					break;

				case ReviveOptions.WaitForRescue:
					this.DeadMenu.Options ^= ReviveOptions.PhoenixFeather;
					Send.DeadFeather(this);
					Send.Revived(this);
					return;

				case ReviveOptions.NaoStone:
					this.DeadMenu.Options = ReviveOptions.NaoStoneRevive;
					Send.DeadFeather(this);
					Send.NaoRevivalEntrance(this);
					Send.Revived(this);
					return;

				case ReviveOptions.NaoStoneRevive:
					// First try beginner stones, then normals
					var item = this.Inventory.GetItem(a => a.HasTag("/notTransServer/nao_coupon/"), StartAt.BottomRight);
					if (item == null)
					{
						item = this.Inventory.GetItem(a => a.HasTag("/nao_coupon/"), StartAt.BottomRight);
						if (item == null)
						{
							Log.Error("Creature.Revive: Unable to remove Nao Soul Stone, none found.");
							return;
						}
					}

					// 100% life and 100% injury recovery
					this.Injuries = 0;
					this.Life = this.LifeMax;

					// Blessing of all items
					this.BlessAll();

					// Remove Soul Stone
					this.Inventory.Decrement(item);

					Send.NaoRevivalExit(this);
					break;

				default:
					Log.Warning("Creature.Revive: Unknown revive option: {0}", option);

					// Fallback, set Life to something positive.
					if (this.Life <= 1)
						this.Life = 1;
					break;
			}

			this.Deactivate(CreatureStates.Dead);
			this.DeadMenu.Clear();

			if (expPenalty != 0)
			{
				this.Exp = Math.Max(minExp, this.Exp - expPenalty);
				Send.StatUpdate(this, StatUpdateType.Private, Stat.Experience);
			}

			Send.RemoveDeathScreen(this);
			Send.StatUpdate(this, StatUpdateType.Private, Stat.Life, Stat.LifeInjured, Stat.LifeMax, Stat.LifeMaxMod, Stat.Stamina, Stat.Hunger);
			Send.StatUpdate(this, StatUpdateType.Public, Stat.Life, Stat.LifeInjured, Stat.LifeMax, Stat.LifeMaxMod);
			Send.RiseFromTheDead(this);
			Send.DeadFeather(this);
			Send.Revived(this);
		}
Пример #6
0
 public bool Has(ReviveOptions option)
 {
     return((this.Options & option) != 0);
 }
Пример #7
0
 public void Add(ReviveOptions option)
 {
     this.Options |= option;
 }
Пример #8
0
		/// <summary>
		/// Revives creature.
		/// </summary>
		/// <param name="option">Determines the penalty and stat recovery.</param>
		public void Revive(ReviveOptions option)
		{
			if (!this.IsDead)
				return;

			switch (option)
			{
				case ReviveOptions.Town:
				case ReviveOptions.TirChonaill:
				case ReviveOptions.DungeonEntrance:
				case ReviveOptions.BarriLobby:
					// 100% life and 50% injury recovery
					this.Injuries -= this.Injuries * 0.50f;
					this.Life = this.LifeMax;
					break;

				case ReviveOptions.Here:
					// 5 life recovery and 50% additional injuries
					this.Injuries += this.LifeInjured * 0.50f;
					this.Life = 5;
					break;

				case ReviveOptions.HereNoPenalty:
					// 100% life and 100% injury recovery
					this.Injuries = 0;
					this.Life = this.LifeMax;
					break;

				case ReviveOptions.ArenaLobby:
				case ReviveOptions.ArenaWaitingRoom:
					// 100% life, 100% injury, and 100% stamina recovery
					this.Injuries = 0;
					this.Life = this.LifeMax;
					this.Stamina = this.StaminaMax;
					break;

				case ReviveOptions.ArenaSide:
					// 50% life, 20% injury, and 50% stamina recovery
					this.Injuries -= this.Injuries * 0.20f;
					this.Life = this.LifeMax * 0.50f;
					this.Stamina = this.StaminaMax * 0.50f;
					break;

				case ReviveOptions.InCamp:
				case ReviveOptions.StatueOfGoddess:
					// 25% life recovery and 10% additional injuries
					this.Injuries += this.LifeInjured * 0.10f;
					this.Life = this.LifeMax * 0.25f;
					break;

				case ReviveOptions.WaitForRescue:
					// 10% additional injuries
					this.Injuries += this.LifeInjured * 0.10f;
					this.Life = 1;
					break;

				default:
					Log.Warning("Creature.Revive: Unknown revive option: {0}", option);

					// Fallback, set Life to something positive.
					if (this.Life <= 1)
						this.Life = 1;
					break;
			}

			this.Deactivate(CreatureStates.Dead);

			Send.RemoveDeathScreen(this);
			Send.StatUpdate(this, StatUpdateType.Private, Stat.Life, Stat.LifeInjured, Stat.LifeMax, Stat.LifeMaxMod, Stat.Stamina, Stat.Hunger);
			Send.StatUpdate(this, StatUpdateType.Public, Stat.Life, Stat.LifeInjured, Stat.LifeMax, Stat.LifeMaxMod);
			Send.RiseFromTheDead(this);
			//Send.DeadFeather(creature);
			Send.Revived(this);
		}
Пример #9
0
 public void Clear()
 {
     this.Options = ReviveOptions.None;
 }
Пример #10
0
		/// <summary>
		/// Returns exp penalty for given level and option.
		/// </summary>
		/// <param name="level"></param>
		/// <param name="option"></param>
		/// <returns></returns>
		public int GetExpPenalty(int level, ReviveOptions option)
		{
			float optionMultiplicator;
			switch (option)
			{
				// Check both Nao Stone options for exp, as the exp aren't
				// reduced until the second option gets in.
				case ReviveOptions.NaoStone: optionMultiplicator = 0.001f; break;
				case ReviveOptions.NaoStoneRevive: optionMultiplicator = 0.001f; break;

				case ReviveOptions.PhoenixFeather: optionMultiplicator = 0.0025f; break;
				case ReviveOptions.DungeonEntrance: optionMultiplicator = 0.005f; break;
				case ReviveOptions.StatueOfGoddess: optionMultiplicator = 0.0075f; break;
				case ReviveOptions.Here: optionMultiplicator = 0.01f; break;

				case ReviveOptions.Town:
					var premium = true;
					if (premium)
						goto default;
					optionMultiplicator = 0.005f; break;

				default: return 0;
			}

			float levelMultiplicator;
			if (level < 10) levelMultiplicator = 1;
			else if (level < 30) levelMultiplicator = 3;
			else if (level < 50) levelMultiplicator = 4;
			else if (level < 100) levelMultiplicator = 5;
			else levelMultiplicator = 6;

			var exp = AuraData.ExpDb.GetForLevel(level);

			return (int)(exp * optionMultiplicator * levelMultiplicator);
		}