示例#1
0
        public void OnRefreshBehavior()
        {
            if (!mInitialized || mDestroyed)
            {
                return;
            }

            if (creature.State.Domestication != DomesticatedState.Wild)
            {
                Finish();
                return;
            }

            if (WorldClock.IsTimeOfDay(creature.State.AggressiveTOD))
            {
                Timid timid = null;
                if (worlditem.Is <Timid>(out timid))
                {
                    timid.Finish();
                }
                worlditem.GetOrAdd <Aggressive>();
                creature.Body.EyeMode = BodyEyeMode.Aggressive;
            }
            else
            {
                //if we're not aggressive, we're timid because we're wild
                Aggressive aggressive = null;
                if (worlditem.Is <Aggressive>(out aggressive))
                {
                    aggressive.Finish();
                }
                worlditem.GetOrAdd <Timid>();
                creature.Body.EyeMode = BodyEyeMode.Timid;
            }
        }
示例#2
0
        public void OnTriggerTryToStart(Trigger trigger)
        {
            string failureMessage = string.Empty;

            if (State.HasBeenUnlocked)
            {
                return;
            }

            if (State.TimedLock && !WorldClock.IsTimeOfDay(State.TimesLocked))
            {
                return;
            }

            string keyName = string.Empty;

            if (Player.Local.Inventory.HasKey(State.KeyType, State.KeyTag, out keyName))
            {
                if (!State.HasBeenUnlocked)
                {
                    State.HasBeenUnlocked = true;
                    GUI.GUIManager.PostSuccess("Unlocked with " + keyName);
                }
                return;
            }

            failureMessage = "[Target] is locked";
            trigger.TriggerFail(dynamic, failureMessage);
        }
示例#3
0
文件: Bed.cs 项目: yazici/FRONTIERS
        public override void PopulateOptionsList(List <WIListOption> options, List <string> message)
        {
            mSleptManually = false;

            if (!string.IsNullOrEmpty(RequiredState) && worlditem.State != RequiredState)
            {
                return;
            }

            if (!CanBeUsedManually || !State.HasBeenActivated)
            {
                return;
            }
            RequiresPayment = false;
            CostOfUse       = 0;

            IStackOwner owner = null;

            if (worlditem.Group.HasOwner(out owner) && owner.IsWorldItem)
            {
                owner.worlditem.Is <InnKeeper>(out ParentInkeeper);
                owner.worlditem.Is <Character>(out ParentResident);
            }

            if (HasParentInnkeeper)
            {
                if (!ParentInkeeper.HasPaid)
                {
                    RequiresPayment = true;
                    CostOfUse       = ParentInkeeper.PricePerNight;
                }
            }
            else if (HasParentResident)
            {
                //we can only sleep in residence houses if we know the character
                if (!Characters.KnowsPlayer(ParentResident.worlditem.FileName))
                {
                    return;
                }
            }

            WIListOption dawn = new WIListOption("Sleep 'til Dawn", "Dawn");

            if (WorldClock.IsTimeOfDay(TimeOfDay.ad_TimeDawn) ||
                RequiresPayment && !Player.Local.Inventory.InventoryBank.CanAfford(CostOfUse))
            {
                dawn.Disabled = true;
            }
            options.Add(dawn);

            WIListOption noon = new WIListOption("Sleep 'til Noon", "Noon");

            if (WorldClock.IsTimeOfDay(TimeOfDay.ag_TimeNoon) ||
                RequiresPayment && !Player.Local.Inventory.InventoryBank.CanAfford(CostOfUse))
            {
                noon.Disabled = true;
            }
            options.Add(noon);

            WIListOption dusk = new WIListOption("Sleep 'til Dusk", "Dusk");

            if (WorldClock.IsTimeOfDay(TimeOfDay.aj_TimeDusk) ||
                RequiresPayment && !Player.Local.Inventory.InventoryBank.CanAfford(CostOfUse))
            {
                dusk.Disabled = true;
            }
            options.Add(dusk);

            WIListOption midnight = new WIListOption("Sleep 'til Midnight", "Midnight");

            if (WorldClock.IsTimeOfDay(TimeOfDay.aa_TimeMidnight) ||
                RequiresPayment && !Player.Local.Inventory.InventoryBank.CanAfford(CostOfUse))
            {
                midnight.Disabled = true;
            }
            options.Add(midnight);

            if (RequiresPayment)
            {
                dawn.RequiredCurrencyType     = WICurrencyType.A_Bronze;
                noon.RequiredCurrencyType     = WICurrencyType.A_Bronze;
                dusk.RequiredCurrencyType     = WICurrencyType.A_Bronze;
                midnight.RequiredCurrencyType = WICurrencyType.A_Bronze;

                dawn.CurrencyValue     = CostOfUse;
                noon.CurrencyValue     = CostOfUse;
                dusk.CurrencyValue     = CostOfUse;
                midnight.CurrencyValue = CostOfUse;
            }
        }