Пример #1
0
        private static void DrinkFromFountain(CharacterInstance ch, ObjectInstance obj)
        {
            if (obj.Values.Quantity <= 0)
            {
                obj.Values.QUantity = GetMaximumCondition();
            }

            LiquidData liquid = RepositoryManager.Instance.LIQUIDS.Get(obj.Values.LiquidID) ??
                                RepositoryManager.Instance.LIQUIDS.Get(0);

            if (!ch.IsNpc())
            {
                var pch = (PlayerInstance)ch;
                if (obj.Values.LiquidID != 0)
                {
                    pch.GainCondition(ConditionTypes.Thirsty, liquid.GetMod(ConditionTypes.Thirsty));
                    pch.GainCondition(ConditionTypes.Full, liquid.GetMod(ConditionTypes.Full));
                    pch.GainCondition(ConditionTypes.Drunk, liquid.GetMod(ConditionTypes.Drunk));

                    if (ch.IsVampire())
                    {
                        pch.GainCondition(ConditionTypes.Bloodthirsty, liquid.GetMod(ConditionTypes.Bloodthirsty));
                    }
                }
                else if (obj.Values.LiquidID == 0)
                {
                    pch.PlayerData.ConditionTable[ConditionTypes.Thirsty] = GetMaximumCondition();
                }
            }

            if (!MudProgHandler.ExecuteObjectProg(MudProgTypes.Use, ch, obj, null, null))
            {
                comm.act(ATTypes.AT_ACTION, "$n drinks from the fountain.", ch, null, null, ToTypes.Room);
                ch.SendTo("You take a long thirst quenching drink.");
            }
        }
Пример #2
0
        private static void DrinkFromContainer(CharacterInstance ch, ObjectInstance obj)
        {
            if (CheckFunctions.CheckIfTrue(ch, obj.Values.Quantity <= 0, "It is already empty."))
            {
                return;
            }

            if (!ch.IsNpc())
            {
                var pch = (PlayerInstance)ch;
                if (CheckFunctions.CheckIfTrue(ch, pch.GetCondition(ConditionTypes.Full) == GetMaximumCondition() ||
                                               pch.GetCondition(ConditionTypes.Thirsty) == GetMaximumCondition(),
                                               "Your stomach is too full to drink more!"))
                {
                    return;
                }
            }

            LiquidData liquid = RepositoryManager.Instance.LIQUIDS.Get(obj.Values.LiquidID) ??
                                RepositoryManager.Instance.LIQUIDS.Get(0);

            if (!MudProgHandler.ExecuteObjectProg(MudProgTypes.Use, ch, obj, null, null))
            {
                comm.act(ATTypes.AT_ACTION, "$n drinks $T from $p.", ch, obj, liquid.ShortDescription, ToTypes.Room);
                comm.act(ATTypes.AT_ACTION, "You drink $T from $p.", ch, obj, liquid.ShortDescription, ToTypes.Character);
            }

            if (!ch.IsNpc())
            {
                var pch = (PlayerInstance)ch;
                pch.GainCondition(ConditionTypes.Thirsty, liquid.GetMod(ConditionTypes.Thirsty));
                pch.GainCondition(ConditionTypes.Full, liquid.GetMod(ConditionTypes.Full));
                pch.GainCondition(ConditionTypes.Drunk, liquid.GetMod(ConditionTypes.Drunk));
                if (ch.IsVampire())
                {
                    pch.GainCondition(ConditionTypes.Bloodthirsty, liquid.GetMod(ConditionTypes.Bloodthirsty));
                }
            }

            if (liquid.Type == LiquidTypes.Poison)
            {
                DrinkPoison(ch, obj);
            }

            if (!ch.IsNpc())
            {
                var pch = (PlayerInstance)ch;

                EvaluateDrunkCondition(pch);
                EvaluateThirstCondition(pch);

                if (ch.IsVampire())
                {
                    EvaluateBloodthirstCondition(pch);
                }
                else if (!ch.IsVampire() && pch.GetCondition(ConditionTypes.Bloodthirsty) >= GetMaximumCondition())
                {
                    pch.PlayerData.ConditionTable[ConditionTypes.Bloodthirsty] = GetMaximumCondition();
                }
            }

            obj.Values.Quantity -= 1;
            if (CheckFunctions.CheckIfTrue(ch, obj.Values.Quantity <= 0, "You drink the last drop from your container."))
            {
                obj.Values.Quantity = 0;
            }
        }