Exemple #1
0
 internal void fixPaths(NPC npc, FarmHouse house)
 {
     if (npc.getTileLocationPoint() == house.getEntryLocation())
     {
         Logger.Log(npc.name + " entered at the entry point, repositioning at modded entry (if any)...");
         npc.setTilePosition(FarmHouseStates.getEntryLocation(house));
     }
     Logger.Log("Fixing paths for " + npc.name + "...");
     if (npc.isMarried() && npc.getSpouse() == Game1.player)
     {
         Logger.Log(npc.name + " is married to " + Game1.player.name + "...");
         if (npc.controller != null && npc.controller.endPoint != null && npc.controller.endPoint == house.getKitchenStandingSpot())
         {
             Logger.Log(npc.name + " is pathing to the kitchen...");
             npc.willDestroyObjectsUnderfoot = false;
             npc.controller = new PathFindController(npc, house, FarmHouseStates.getKitchenSpot(house), 0);
             if (npc.controller.pathToEndPoint == null)
             {
                 npc.willDestroyObjectsUnderfoot = true;
                 npc.controller = new PathFindController(npc, house, FarmHouseStates.getKitchenSpot(house), 0);
                 npc.setNewDialogue(Game1.LoadStringByGender((int)((NetFieldBase <int, NetInt>)npc.gender), "Strings\\StringsFromCSFiles:NPC.cs.4500"), false, false);
             }
             else if (Game1.timeOfDay > 1300)
             {
                 if (Game1.shortDayNameFromDayOfSeason(Game1.dayOfMonth).ToLower().Equals("mon") || Game1.shortDayNameFromDayOfSeason(Game1.dayOfMonth).ToLower().Equals("fri") && !npc.name.Equals((object)"Maru") && (!npc.name.Equals((object)"Penny") && !npc.name.Equals((object)"Harvey")))
                 {
                     npc.setNewDialogue("MarriageDialogue", "funReturn_", -1, false, true);
                 }
                 else
                 {
                     npc.setNewDialogue("MarriageDialogue", "jobReturn_", -1, false, false);
                 }
             }
         }
         else if (npc.controller != null && npc.controller.endPoint != null && npc.controller.endPoint == house.getSpouseBedSpot(npc.name))
         {
             Logger.Log(npc.name + " is heading to bed...");
             npc.willDestroyObjectsUnderfoot = false;
             npc.controller = new PathFindController(npc, house, FarmHouseStates.getBedSpot(house, true), 0);
             if (npc.controller.pathToEndPoint == null)
             {
                 npc.willDestroyObjectsUnderfoot = true;
                 npc.controller = new PathFindController(npc, house, FarmHouseStates.getBedSpot(house, true), 0);
                 npc.setNewDialogue(Game1.LoadStringByGender((int)((NetFieldBase <int, NetInt>)npc.gender), "Strings\\StringsFromCSFiles:NPC.cs.4500"), false, false);
             }
             else if (Game1.timeOfDay > 1300)
             {
                 if (Game1.shortDayNameFromDayOfSeason(Game1.dayOfMonth).ToLower().Equals("mon") || Game1.shortDayNameFromDayOfSeason(Game1.dayOfMonth).ToLower().Equals("fri") && !npc.name.Equals((object)"Maru") && (!npc.name.Equals((object)"Penny") && !npc.name.Equals((object)"Harvey")))
                 {
                     npc.setNewDialogue("MarriageDialogue", "funReturn_", -1, false, true);
                 }
                 else
                 {
                     npc.setNewDialogue("MarriageDialogue", "jobReturn_", -1, false, false);
                 }
             }
         }
     }
 }
Exemple #2
0
        internal void fixSpousePosition(FarmHouse house)
        {
            if (!Game1.player.isMarried() || Game1.player.getSpouse().currentLocation != house)
            {
                return;
            }
            NPC spouse = Game1.player.getSpouse();

            if (spouse.getTileLocationPoint() == house.getKitchenStandingSpot())
            {
                //Spouse was placed at the kitchen standing spot, move them to modded one.
                Logger.Log("Spouse was in kitchen standing spot...");
                Point kitchenLocation = FarmHouseStates.getKitchenSpot(house);
                spouse.setTilePosition(kitchenLocation);
                Logger.Log(spouse.name + " was moved to " + kitchenLocation.ToString());
            }
            else if (isSpouseInSpouseRoom(spouse, house))
            {
                Logger.Log(spouse.name + " began the day in the spouse room...");
                FarmHouseState state = FarmHouseStates.getState(house);
                if (state.spouseRoomData == null)
                {
                    FarmHouseStates.updateFromMapPath(house, house.mapPath);
                }
                if (state.spouseRoomData != "")
                {
                    Logger.Log("Map defined spouse room location...");
                    string[] spouseRoomPoint    = state.spouseRoomData.Split(' ');
                    Vector2  spouseRoomLocation = new Vector2(Convert.ToInt32(spouseRoomPoint[0]) + 3, Convert.ToInt32(spouseRoomPoint[1]) + 4);
                    spouse.setTileLocation(spouseRoomLocation);
                    Logger.Log(spouse.name + " was moved to " + spouseRoomLocation.ToString());
                }
                else
                {
                    Logger.Log("Map did not define spouse room location.");
                }
            }
            else if (!house.isTileLocationOpen(new xTile.Dimensions.Location(spouse.getTileX(), spouse.getTileY())))
            {
                Logger.Log(spouse.name + " was in the void or was stuck, relocating...");
                spouse.setTilePosition(house.getRandomOpenPointInHouse(Game1.random));
            }
        }