コード例 #1
0
        public void OnPlayerUseWorldItemSecondary(object secondaryResult)
        {               //this is where we handle skills
            WIListResult dialogResult = secondaryResult as WIListResult;

            if (dialogResult.SecondaryResult.Contains("SetWIState"))
            {
                string stateName = dialogResult.SecondaryResult.Replace("SetWIState", "");
                SetState(stateName);
            }
        }
コード例 #2
0
        public virtual void OnPlayerUseWorldItemSecondary(object secondaryResult)
        {                               //this is where we handle skills
            WIListResult dialogResult = secondaryResult as WIListResult;

            for (int i = 0; i < mLastAssociatedSkillList.Count; i++)
            {
                Skill skill = mLastAssociatedSkillList[i];
                if (skill.name == dialogResult.SecondaryResult)
                {
                    //SKILL USE
                    skill.Use(Item, dialogResult.SecondaryResultFlavor);
                    break;
                }
            }
        }
コード例 #3
0
ファイル: Bartender.cs プロジェクト: yazici/FRONTIERS
        public void OnPlayerUseWorldItemSecondary(object secondaryResult)
        {
            WIListResult dialogResult = secondaryResult as WIListResult;

            switch (dialogResult.SecondaryResult)
            {
            case "Drink":
                if (!CanBuyDrink)
                {
                    if (gBartenderSpeech == null)
                    {
                        gBartenderSpeech = new Speech();
                    }
                    gBartenderSpeech.Text = "That's enough for one night, {lad/lass}.";
                    worlditem.Get <Talkative>().SayDTS(gBartenderSpeech);
                }
                else
                {
                    if (Player.Local.Inventory.InventoryBank.TryToRemove(PricePerDrink))
                    {
                        Profile.Get.CurrentGame.Character.Rep.GainGlobalReputation(1);
                        //spawn a cup and put some mead in it
                        WorldItem cup = null;
                        if (WorldItems.CloneRandomFromCategory("BartenderCups", WIGroups.Get.World, out cup))
                        {
                            cup.Initialize();
                            LiquidContainer container = null;
                            if (cup.Is <LiquidContainer>(out container))
                            {
                                container.State.Contents.CopyFrom(BartenderDrinkContents);
                                container.State.Contents.InstanceWeight = container.State.Capacity;
                            }
                            //try to equip it in the player's hands
                            Player.Local.Inventory.TryToEquip(cup);
                        }
                        State.NumTimesBoughtDrink++;
                        State.NumTimesBoughtDrinkTonight++;
                        State.LastTimeBoughtDrink = WorldClock.AdjustedRealTime;
                    }
                }
                break;

            case "Round":
                if (Player.Local.Inventory.InventoryBank.TryToRemove(PricePerRound))
                {
                    if (gBartenderSpeech == null)
                    {
                        gBartenderSpeech = new Speech();
                    }
                    gBartenderSpeech.Text = "Looks like this round's on {PlayerFirstName}!";
                    worlditem.Get <Talkative>().SayDTS(gBartenderSpeech);
                    Profile.Get.CurrentGame.Character.Rep.GainGlobalReputation(5);
                    State.NumTimesBoughtRound++;
                    State.LastTimeBoughtRound = WorldClock.AdjustedRealTime;
                }
                break;

            default:
                break;
            }
        }