Esempio n. 1
0
        public static bool GameLocation_performTouchAction_prefix(GameLocation __instance, string fullActionString, Vector2 playerStandingPosition)
        {
            if (!(__instance is MineShaft))
            {
                return(true);
            }
            ModEntry.context.Monitor.Log($"touch action at {playerStandingPosition} {fullActionString}");

            string action = fullActionString.Split(' ')[0];

            if (action == "collapseFloor")
            {
                CollapsingFloors.collapseFloor(__instance as MineShaft, playerStandingPosition);
                return(false);
            }
            if (action.StartsWith("tilePuzzle_"))
            {
                TilePuzzles.pressTile(__instance as MineShaft, playerStandingPosition, action);
                return(false);
            }
            if (action.StartsWith("lightPuzzle_"))
            {
                LightPuzzles.pressTile(__instance as MineShaft, playerStandingPosition, action);
                return(false);
            }
            if (action == "randomTrap")
            {
                Traps.TriggerRandomTrap(__instance as MineShaft, playerStandingPosition, true);
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        private static void AnswerResult(string responseKey)
        {
            string[] split = responseKey.Split('#');
            int      x     = int.Parse(split[1]);
            int      y     = int.Parse(split[2]);

            Game1.player.currentLocation.removeTileProperty(x, y, "Buildings", "Action");

            string type = split[3];

            switch (type)
            {
            case "Y":
                Game1.player.currentLocation.removeTile(x, y - 1, "Front");
                Game1.player.currentLocation.removeTile(x, y, "Buildings");
                Utils.DropChest(Game1.player.currentLocation as MineShaft, new Vector2(x, y));
                return;

            case "S":
                Game1.player.currentLocation.removeTile(x, y - 1, "Front");
                Game1.player.currentLocation.removeTile(x, y, "Buildings");
                CollapsingFloors.collapseFloor(Game1.player.currentLocation as MineShaft, Game1.player.getTileLocation());
                return;

            default:
                Game1.player.currentLocation.setMapTileIndex(x, y - 1, litEyes + 16, "Front");
                Traps.TriggerRandomTrap(Game1.player.currentLocation as MineShaft, Game1.player.getTileLocation(), false);
                return;
            }
        }
Esempio n. 3
0
        internal static void OfferObject(MineShaft shaft, string action, Location tileLocation, Farmer who)
        {
            string[] parts = action.Split('_').Skip(1).ToArray();

            int type = int.Parse(parts[0]);
            int cx   = int.Parse(parts[1]);
            int cy   = int.Parse(parts[2]);

            if (who.ActiveObject == null)
            {
                Game1.activeClickableMenu = new DialogueBox(helper.Translation.Get($"altar-explain-{type}"));
                return;
            }

            int value = who.ActiveObject.salePrice();

            who.reduceActiveItemByOne();
            if (value < 10)
            {
                if (type == 0)
                {
                    CollapsingFloors.collapseFloor(shaft, who.getTileLocation());
                    return;
                }
                else if (type == 1)
                {
                    Traps.TriggerRandomTrap(shaft, who.getTileLocation(), false);
                    return;
                }
            }

            string sound = "yoba";

            if (type == 0)
            {
                sound = "grunt";
            }
            else if (type == 1)
            {
                sound = "debuffSpell";
            }
            shaft.playSound(sound, SoundContext.Default);

            BuffsDisplay buffsDisplay = Game1.buffsDisplay;
            Buff         buff2        = GetBuff(value, who, shaft, type);

            buffsDisplay.addOtherBuff(buff2);
        }