Example #1
0
 public override void dayUpdate(int dayOfMonth)
 {
     base.dayUpdate(dayOfMonth);
     if (this.daysOfConstructionLeft <= 0)
     {
         if ((this.indoors as AnimalHouse).incubatingEgg.Y > 0)
         {
             --(this.indoors as AnimalHouse).incubatingEgg.X;
             if ((this.indoors as AnimalHouse).incubatingEgg.X <= 0)
             {
                 long       newId      = MultiplayerUtility.getNewID();
                 FarmAnimal farmAnimal = new FarmAnimal((this.indoors as AnimalHouse).incubatingEgg.Y == 442 ? "Duck" : ((this.indoors as AnimalHouse).incubatingEgg.Y == 180 || (this.indoors as AnimalHouse).incubatingEgg.Y == 182 ? "BrownChicken" : ((this.indoors as AnimalHouse).incubatingEgg.Y == 107 ? "Dinosaur" : "Chicken")), newId, this.owner);
                 (this.indoors as AnimalHouse).incubatingEgg.X            = 0;
                 (this.indoors as AnimalHouse).incubatingEgg.Y            = -1;
                 this.indoors.map.GetLayer("Front").Tiles[1, 2].TileIndex = 45;
                 ((AnimalHouse)this.indoors).animals.Add(newId, farmAnimal);
             }
         }
         if ((this.indoors as AnimalHouse).animalLimit == 16)
         {
             int num = Math.Min((this.indoors as AnimalHouse).animals.Count - this.indoors.numberOfObjectsWithName("Hay"), (Game1.getLocationFromName("Farm") as Farm).piecesOfHay);
             (Game1.getLocationFromName("Farm") as Farm).piecesOfHay -= num;
             for (int index = 0; index < 16 && num > 0; ++index)
             {
                 Vector2 key = new Vector2((float)(6 + index), 3f);
                 if (!this.indoors.objects.ContainsKey(key))
                 {
                     this.indoors.objects.Add(key, new StardewValley.Object(178, 1, false, -1, 0));
                 }
                 --num;
             }
         }
     }
     this.currentOccupants = ((AnimalHouse)this.indoors).animals.Count;
 }
Example #2
0
        public override void sendMessage(byte which, object[] data)
        {
            NetOutgoingMessage netOutgoingMessage = this.client.CreateMessage();

            MultiplayerUtility.writeData(netOutgoingMessage, which, data);
            this.client.SendMessage(netOutgoingMessage, NetDeliveryMethod.ReliableOrdered);
        }
Example #3
0
 public override void sendMessages(GameTime time)
 {
     LidgrenServer.messageSendCounter -= time.ElapsedGameTime.Milliseconds;
     if (LidgrenServer.messageSendCounter >= 0)
     {
         return;
     }
     LidgrenServer.messageSendCounter = 50;
     foreach (NetConnection connection in this.server.Connections)
     {
         if (Game1.otherFarmers.ContainsKey(connection.RemoteUniqueIdentifier) && Game1.otherFarmers[connection.RemoteUniqueIdentifier].multiplayerMessage.Count > 0)
         {
             NetOutgoingMessage message = this.server.CreateMessage();
             for (int index = 0; index < Game1.otherFarmers[connection.RemoteUniqueIdentifier].multiplayerMessage.Count; ++index)
             {
                 MultiplayerUtility.writeData(message, (byte)Game1.otherFarmers[connection.RemoteUniqueIdentifier].multiplayerMessage[index][0], ((IEnumerable <object>)Game1.otherFarmers[connection.RemoteUniqueIdentifier].multiplayerMessage[index]).Skip <object>(1).ToArray <object>());
             }
             int num = (int)this.server.SendMessage(message, connection, NetDeliveryMethod.ReliableOrdered);
         }
     }
     foreach (KeyValuePair <long, Farmer> otherFarmer in Game1.otherFarmers)
     {
         otherFarmer.Value.multiplayerMessage.Clear();
     }
 }
Example #4
0
 // Token: 0x0600117C RID: 4476 RVA: 0x0016684C File Offset: 0x00164A4C
 public Forest(Map map, string name) : base(map, name)
 {
     this.marniesLivestock = new List <FarmAnimal>();
     this.marniesLivestock.Add(new FarmAnimal("Dairy Cow", MultiplayerUtility.getNewID(), -1L));
     this.marniesLivestock.Add(new FarmAnimal("Dairy Cow", MultiplayerUtility.getNewID(), -1L));
     this.marniesLivestock[0].position = new Vector2((float)(98 * Game1.tileSize), (float)(20 * Game1.tileSize));
     this.marniesLivestock[1].position = new Vector2((float)(101 * Game1.tileSize), (float)(20 * Game1.tileSize));
     this.log = new ResourceClump(602, 2, 2, new Vector2(1f, 6f));
 }
Example #5
0
        // Token: 0x06000B3E RID: 2878 RVA: 0x000E3EF8 File Offset: 0x000E20F8
        private void addNewFarmer(long id)
        {
            Farmer f = new Farmer(new FarmerSprite(Game1.content.Load <Texture2D>("Characters\\Farmer\\farmer_base")), new Vector2((float)(Game1.tileSize * 10), (float)(Game1.tileSize * 15)), 2, "Max", new List <Item>(), true);

            f.FarmerSprite.setOwner(f);
            f.currentLocation     = Game1.getLocationFromName("BusStop");
            f.uniqueMultiplayerID = id;
            Game1.getLocationFromName(f.currentLocation.name).farmers.Add(f);
            Game1.otherFarmers.Add(id, f);
            MultiplayerUtility.broadcastPlayerIntroduction(id, "Max");
        }
 public void tryToUpgrade(Building toUpgrade, BluePrint blueprint)
 {
     if (toUpgrade != null && blueprint.name != null && toUpgrade.buildingType.Equals(blueprint.nameOfBuildingToUpgrade))
     {
         if (toUpgrade.indoors.farmers.Count > 0)
         {
             Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\Locations:BuildableLocation_CantUpgrade_SomeoneInside"), Color.Red, 3500f));
         }
         else
         {
             toUpgrade.indoors.map                = Game1.game1.xTileContent.Load <Map>("Maps\\" + blueprint.mapToWarpTo);
             toUpgrade.indoors.name               = blueprint.mapToWarpTo;
             toUpgrade.indoors.isStructure        = true;
             toUpgrade.nameOfIndoorsWithoutUnique = blueprint.mapToWarpTo;
             toUpgrade.buildingType               = blueprint.name;
             toUpgrade.texture = blueprint.texture;
             if (toUpgrade.indoors.GetType() == typeof(AnimalHouse))
             {
                 ((AnimalHouse)toUpgrade.indoors).resetPositionsOfAllAnimals();
             }
             Game1.playSound("axe");
             blueprint.consumeResources();
             toUpgrade.performActionOnUpgrade((GameLocation)this);
             toUpgrade.color = Color.White;
             Game1.exitActiveMenu();
             if (!Game1.IsMultiplayer)
             {
                 return;
             }
             MultiplayerUtility.broadcastBuildingChange((byte)2, new Vector2((float)toUpgrade.tileX, (float)toUpgrade.tileY), blueprint.name, Game1.currentLocation.name, Game1.player.uniqueMultiplayerID);
         }
     }
     else
     {
         if (toUpgrade == null)
         {
             return;
         }
         Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\Locations:BuildableLocation_CantUpgrade_IncorrectBuildingType"), Color.Red, 3500f));
     }
 }
Example #7
0
 public override void dayUpdate(int dayOfMonth)
 {
     base.dayUpdate(dayOfMonth);
     if (this.daysOfConstructionLeft <= 0)
     {
         if ((this.indoors as AnimalHouse).incubatingEgg.Y > 0)
         {
             AnimalHouse expr_43_cp_0_cp_0 = this.indoors as AnimalHouse;
             expr_43_cp_0_cp_0.incubatingEgg.X = expr_43_cp_0_cp_0.incubatingEgg.X - 1;
             if ((this.indoors as AnimalHouse).incubatingEgg.X <= 0)
             {
                 long       newID = MultiplayerUtility.getNewID();
                 FarmAnimal value = new FarmAnimal(((this.indoors as AnimalHouse).incubatingEgg.Y == 442) ? "Duck" : (((this.indoors as AnimalHouse).incubatingEgg.Y == 180 || (this.indoors as AnimalHouse).incubatingEgg.Y == 182) ? "BrownChicken" : (((this.indoors as AnimalHouse).incubatingEgg.Y == 107) ? "Dinosaur" : "Chicken")), newID, this.owner);
                 (this.indoors as AnimalHouse).incubatingEgg.X            = 0;
                 (this.indoors as AnimalHouse).incubatingEgg.Y            = -1;
                 this.indoors.map.GetLayer("Front").Tiles[1, 2].TileIndex = 45;
                 ((AnimalHouse)this.indoors).animals.Add(newID, value);
             }
         }
         if ((this.indoors as AnimalHouse).animalLimit == 16)
         {
             int arg_1A6_0 = (this.indoors as AnimalHouse).animals.Count;
             int num       = this.indoors.numberOfObjectsWithName("Hay");
             int num2      = Math.Min(arg_1A6_0 - num, (Game1.getLocationFromName("Farm") as Farm).piecesOfHay);
             (Game1.getLocationFromName("Farm") as Farm).piecesOfHay -= num2;
             int num3 = 0;
             while (num3 < 16 && num2 > 0)
             {
                 Vector2 key = new Vector2((float)(6 + num3), 3f);
                 if (!this.indoors.objects.ContainsKey(key))
                 {
                     this.indoors.objects.Add(key, new StardewValley.Object(178, 1, false, -1, 0));
                 }
                 num2--;
                 num3++;
             }
         }
     }
     this.currentOccupants = ((AnimalHouse)this.indoors).animals.Count;
 }
 // Token: 0x060012C2 RID: 4802 RVA: 0x0017C604 File Offset: 0x0017A804
 public override void dayUpdate(int dayOfMonth)
 {
     base.dayUpdate(dayOfMonth);
     if (this.daysOfConstructionLeft <= 0)
     {
         if ((this.indoors as AnimalHouse).incubatingEgg.Y > 0)
         {
             AnimalHouse expr_43_cp_0_cp_0 = this.indoors as AnimalHouse;
             expr_43_cp_0_cp_0.incubatingEgg.X = expr_43_cp_0_cp_0.incubatingEgg.X - 1;
             if ((this.indoors as AnimalHouse).incubatingEgg.X <= 0)
             {
                 long       id    = MultiplayerUtility.getNewID();
                 FarmAnimal layed = new FarmAnimal(((this.indoors as AnimalHouse).incubatingEgg.Y == 442) ? "Duck" : (((this.indoors as AnimalHouse).incubatingEgg.Y == 180 || (this.indoors as AnimalHouse).incubatingEgg.Y == 182) ? "BrownChicken" : (((this.indoors as AnimalHouse).incubatingEgg.Y == 107) ? "Dinosaur" : "Chicken")), id, this.owner);
                 (this.indoors as AnimalHouse).incubatingEgg.X            = 0;
                 (this.indoors as AnimalHouse).incubatingEgg.Y            = -1;
                 this.indoors.map.GetLayer("Front").Tiles[1, 2].TileIndex = 45;
                 ((AnimalHouse)this.indoors).animals.Add(id, layed);
             }
         }
         if ((this.indoors as AnimalHouse).animalLimit == 16)
         {
             int arg_1A6_0      = (this.indoors as AnimalHouse).animals.Count;
             int numExistingHay = this.indoors.numberOfObjectsWithName("Hay");
             int piecesHay      = Math.Min(arg_1A6_0 - numExistingHay, (Game1.getLocationFromName("Farm") as Farm).piecesOfHay);
             (Game1.getLocationFromName("Farm") as Farm).piecesOfHay -= piecesHay;
             int i = 0;
             while (i < 16 && piecesHay > 0)
             {
                 Vector2 tile = new Vector2((float)(6 + i), 3f);
                 if (!this.indoors.objects.ContainsKey(tile))
                 {
                     this.indoors.objects.Add(tile, new Object(178, 1, false, -1, 0));
                 }
                 piecesHay--;
                 i++;
             }
         }
     }
     this.currentOccupants = ((AnimalHouse)this.indoors).animals.Count;
 }
Example #9
0
 // Token: 0x06000B41 RID: 2881 RVA: 0x000E4388 File Offset: 0x000E2588
 public override void sendMessages(GameTime time)
 {
     LidgrenServer.messageSendCounter -= time.ElapsedGameTime.Milliseconds;
     if (LidgrenServer.messageSendCounter < 0)
     {
         LidgrenServer.messageSendCounter = 50;
         foreach (NetConnection player in this.server.Connections)
         {
             if (Game1.otherFarmers.ContainsKey(player.RemoteUniqueIdentifier) && Game1.otherFarmers[player.RemoteUniqueIdentifier].multiplayerMessage.Count > 0)
             {
                 NetOutgoingMessage msg = this.server.CreateMessage();
                 for (int i = 0; i < Game1.otherFarmers[player.RemoteUniqueIdentifier].multiplayerMessage.Count; i++)
                 {
                     MultiplayerUtility.writeData(msg, (byte)Game1.otherFarmers[player.RemoteUniqueIdentifier].multiplayerMessage[i][0], Game1.otherFarmers[player.RemoteUniqueIdentifier].multiplayerMessage[i].Skip(1).ToArray <object>());
                 }
                 this.server.SendMessage(msg, player, NetDeliveryMethod.ReliableOrdered);
             }
         }
         foreach (KeyValuePair <long, Farmer> v in Game1.otherFarmers)
         {
             v.Value.multiplayerMessage.Clear();
         }
     }
 }
Example #10
0
        public void textBoxEnter(TextBox sender)
        {
            if (Game1.IsMultiplayer && sender.Text.Length > 0)
            {
                string message = sender.Text.Trim();
                if (message.Length < 1)
                {
                    return;
                }
                if ((int)message[0] == 47)
                {
                    if (message.Split(' ')[0].Length > 1)
                    {
                        try
                        {
                            string s = message.Split(' ')[0].Substring(1);
                            // ISSUE: reference to a compiler-generated method
                            uint stringHash = \u003CPrivateImplementationDetails\u003E.ComputeStringHash(s);
                            if (stringHash <= 1013213428U)
                            {
                                if ((int)stringHash != 355814093)
                                {
                                    if ((int)stringHash != 405908334)
                                    {
                                        if ((int)stringHash == 1013213428 && s == "texture")
                                        {
                                            Game1.player.Sprite.Texture = Game1.content.Load <Texture2D>("Characters\\" + message.Split(' ')[1]);
                                            goto label_26;
                                        }
                                        else
                                        {
                                            goto label_21;
                                        }
                                    }
                                    else if (!(s == "nick"))
                                    {
                                        goto label_21;
                                    }
                                }
                                else if (!(s == "nickname"))
                                {
                                    goto label_21;
                                }
                            }
                            else if (stringHash <= 2180167635U)
                            {
                                if ((int)stringHash != 1158129075)
                                {
                                    if ((int)stringHash != -2114799661 || !(s == "rename"))
                                    {
                                        goto label_21;
                                    }
                                }
                                else if (s == "othergirl")
                                {
                                    Game1.otherFarmers.Values.ElementAt <Farmer>(0).Sprite.Texture = Game1.content.Load <Texture2D>("Characters\\farmergirl");
                                    goto label_26;
                                }
                                else
                                {
                                    goto label_21;
                                }
                            }
                            else if ((int)stringHash != -1925595674)
                            {
                                if ((int)stringHash == -1571474013 && s == "girl")
                                {
                                    Game1.player.Sprite.Texture = Game1.content.Load <Texture2D>("Characters\\farmergirl");
                                    Game1.player.isMale         = false;
                                    goto label_26;
                                }
                                else
                                {
                                    goto label_21;
                                }
                            }
                            else if (!(s == "name"))
                            {
                                goto label_21;
                            }
                            MultiplayerUtility.sendNameChange(message.Substring(message.IndexOf(' ') + 1), Game1.player.uniqueMultiplayerID);
                            goto label_26;
label_21:
                            this.receiveChatMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:ChatBox.cs.10261"), 0L);
                            goto label_26;
                        }
                        catch (Exception ex)
                        {
                            this.receiveChatMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:ChatBox.cs.10262"), 0L);
                            goto label_26;
                        }
                    }
                }
                MultiplayerUtility.sendChatMessage(message, Game1.player.uniqueMultiplayerID);
                if (Game1.IsServer)
                {
                    this.receiveChatMessage(message, Game1.player.uniqueMultiplayerID);
                }
            }
label_26:
            sender.Text = "";
            this.clickAway();
        }
Example #11
0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (Game1.globalFade || this.freeze)
     {
         return;
     }
     if (this.okButton != null && this.okButton.containsPoint(x, y) && this.readyToClose())
     {
         if (this.onFarm)
         {
             Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.setUpForReturnToShopMenu), 0.02f);
             Game1.playSound("smallSelect");
         }
         else
         {
             Game1.exitActiveMenu();
             Game1.playSound("bigDeSelect");
         }
     }
     if (this.onFarm)
     {
         Vector2  tile       = new Vector2((float)((x + Game1.viewport.X) / Game1.tileSize), (float)((y + Game1.viewport.Y) / Game1.tileSize));
         Building buildingAt = (Game1.getLocationFromName("Farm") as Farm).getBuildingAt(tile);
         if (buildingAt != null && !this.namingAnimal)
         {
             if (buildingAt.buildingType.Contains(this.animalBeingPurchased.buildingTypeILiveIn))
             {
                 if ((buildingAt.indoors as AnimalHouse).isFull())
                 {
                     Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11321", new object[0]));
                 }
                 else if (this.animalBeingPurchased.harvestType != 2)
                 {
                     this.namingAnimal  = true;
                     this.newAnimalHome = buildingAt;
                     if (this.animalBeingPurchased.sound != null && Game1.soundBank != null)
                     {
                         Cue expr_15B = Game1.soundBank.GetCue(this.animalBeingPurchased.sound);
                         expr_15B.SetVariable("Pitch", (float)(1200 + Game1.random.Next(-200, 201)));
                         expr_15B.Play();
                     }
                     this.textBox.OnEnterPressed        += this.e;
                     this.textBox.Text                   = this.animalBeingPurchased.displayName;
                     Game1.keyboardDispatcher.Subscriber = this.textBox;
                     if (Game1.options.SnappyMenus)
                     {
                         this.currentlySnappedComponent = base.getComponentWithID(104);
                         this.snapCursorToCurrentSnappedComponent();
                     }
                 }
                 else if (Game1.player.money >= this.priceOfAnimal)
                 {
                     this.newAnimalHome                     = buildingAt;
                     this.animalBeingPurchased.home         = this.newAnimalHome;
                     this.animalBeingPurchased.homeLocation = new Vector2((float)this.newAnimalHome.tileX, (float)this.newAnimalHome.tileY);
                     this.animalBeingPurchased.setRandomPosition(this.animalBeingPurchased.home.indoors);
                     (this.newAnimalHome.indoors as AnimalHouse).animals.Add(this.animalBeingPurchased.myID, this.animalBeingPurchased);
                     (this.newAnimalHome.indoors as AnimalHouse).animalsThatLiveHere.Add(this.animalBeingPurchased.myID);
                     this.newAnimalHome = null;
                     this.namingAnimal  = false;
                     if (this.animalBeingPurchased.sound != null && Game1.soundBank != null)
                     {
                         Cue expr_2DC = Game1.soundBank.GetCue(this.animalBeingPurchased.sound);
                         expr_2DC.SetVariable("Pitch", (float)(1200 + Game1.random.Next(-200, 201)));
                         expr_2DC.Play();
                     }
                     Game1.player.money -= this.priceOfAnimal;
                     Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11324", new object[]
                     {
                         this.animalBeingPurchased.displayType
                     }), Color.LimeGreen, 3500f));
                     this.animalBeingPurchased = new FarmAnimal(this.animalBeingPurchased.type, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID);
                 }
                 else if (Game1.player.money < this.priceOfAnimal)
                 {
                     Game1.dayTimeMoneyBox.moneyShakeTimer = 1000;
                 }
             }
             else
             {
                 Game1.showRedMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11326", new object[]
                 {
                     this.animalBeingPurchased.displayType
                 }));
             }
         }
         if (this.namingAnimal)
         {
             if (this.doneNamingButton.containsPoint(x, y))
             {
                 this.textBoxEnter(this.textBox);
                 Game1.playSound("smallSelect");
             }
             else if (this.namingAnimal && this.randomButton.containsPoint(x, y))
             {
                 this.animalBeingPurchased.name        = Dialogue.randomName();
                 this.animalBeingPurchased.displayName = this.animalBeingPurchased.name;
                 this.textBox.Text       = this.animalBeingPurchased.displayName;
                 this.randomButton.scale = this.randomButton.baseScale;
                 Game1.playSound("drumkit6");
             }
             this.textBox.Update();
             return;
         }
     }
     else
     {
         foreach (ClickableTextureComponent current in this.animalsToPurchase)
         {
             if (current.containsPoint(x, y) && (current.item as StardewValley.Object).type == null)
             {
                 int num = current.item.salePrice();
                 if (Game1.player.money >= num)
                 {
                     Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.setUpForAnimalPlacement), 0.02f);
                     Game1.playSound("smallSelect");
                     this.onFarm = true;
                     this.animalBeingPurchased = new FarmAnimal(current.hoverText, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID);
                     this.priceOfAnimal        = num;
                 }
                 else
                 {
                     Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11325", new object[0]), Color.Red, 3500f));
                 }
             }
         }
     }
 }
Example #12
0
        private static void parseDataMessageFromServer(NetIncomingMessage msg)
        {
            while ((long)msg.LengthBits - msg.Position >= 8L)
            {
                switch (msg.ReadByte())
                {
                case 0:
                    Game1.otherFarmers[msg.ReadInt64()].setMoving(msg.ReadByte());
                    break;

                case 1:
                    Game1.otherFarmers[msg.ReadInt64()].updatePositionFromServer(msg.ReadVector2());
                    break;

                case 2:
                    MultiplayerUtility.receivePlayerIntroduction(msg.ReadInt64(), msg.ReadString());
                    break;

                case 3:
                {
                    long key = msg.ReadInt64();
                    Game1.otherFarmers[key].FarmerSprite.CurrentToolIndex = msg.ReadInt32();
                    if (msg.ReadByte() == 1)
                    {
                        ((FarmerSprite)Game1.otherFarmers[key].sprite).animateBackwardsOnce(msg.ReadInt32(), msg.ReadFloat());
                        msg.ReadByte();
                    }
                    else
                    {
                        ((FarmerSprite)Game1.otherFarmers[key].sprite).animateOnce(msg.ReadInt32(), msg.ReadFloat(), (int)msg.ReadByte());
                    }
                    break;
                }

                case 4:
                    MultiplayerUtility.performObjectAlteration(msg.ReadInt16(), msg.ReadInt16(), msg.ReadByte(), msg.ReadByte(), msg.ReadInt32());
                    break;

                case 5:
                    MultiplayerUtility.warpCharacter(msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadByte(), msg.ReadInt64());
                    break;

                case 6:
                    MultiplayerUtility.performSwitchHeldItem(msg.ReadInt64(), msg.ReadByte(), (int)msg.ReadInt16());
                    break;

                case 7:
                    MultiplayerUtility.performToolAction(msg.ReadByte(), msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadByte(), msg.ReadInt16(), msg.ReadInt64());
                    break;

                case 8:
                    MultiplayerUtility.performDebrisPickup(msg.ReadInt32(), msg.ReadString(), msg.ReadInt64());
                    break;

                case 9:
                    MultiplayerUtility.performCheckAction(msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadInt64());
                    break;

                case 10:
                    MultiplayerUtility.receiveChatMessage(msg.ReadString(), msg.ReadInt64());
                    break;

                case 11:
                    MultiplayerUtility.receiveNameChange(msg.ReadString(), msg.ReadInt64());
                    break;

                case 12:
                    MultiplayerUtility.receiveTenMinuteSync(msg.ReadInt16());
                    break;

                case 13:
                    MultiplayerUtility.receiveBuildingChange(msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadInt64(), msg.ReadInt64());
                    break;

                case 14:
                    MultiplayerUtility.performDebrisCreate(msg.ReadInt16(), msg.ReadInt32(), msg.ReadInt32(), msg.ReadByte(), msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), 0L);
                    break;

                case 15:
                    MultiplayerUtility.performNPCMove(msg.ReadInt32(), msg.ReadInt32(), msg.ReadInt64());
                    break;

                case 16:
                    MultiplayerUtility.performNPCBehavior(msg.ReadInt64(), msg.ReadByte());
                    break;

                case 17:
                    MultiplayerUtility.allFarmersReadyCheck();
                    break;

                case 18:
                    MultiplayerUtility.parseServerToClientsMessage(msg.ReadString());
                    break;

                case 19:
                    MultiplayerUtility.interpretMessageToEveryone(msg.ReadInt32(), msg.ReadString(), msg.ReadInt64());
                    break;
                }
            }
        }
Example #13
0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (Game1.globalFade || freeze)
     {
         return;
     }
     if (okButton != null && okButton.containsPoint(x, y) && readyToClose())
     {
         if (onFarm)
         {
             Game1.globalFadeToBlack(new Game1.afterFadeFunction(setUpForReturnToShopMenu), 0.02f);
             Game1.playSound("smallSelect");
         }
         else
         {
             Game1.exitActiveMenu();
             Game1.playSound("bigDeSelect");
         }
     }
     if (onFarm)
     {
         Vector2  tile       = new Vector2((x + Game1.viewport.X) / Game1.tileSize, (y + Game1.viewport.Y) / Game1.tileSize);
         Building buildingAt = currentFarm.getBuildingAt(tile);
         if (buildingAt != null && !namingAnimal)
         {
             if (buildingAt.buildingType.Contains(animalBeingPurchased.buildingTypeILiveIn))
             {
                 if ((buildingAt.indoors as AnimalHouse).isFull())
                 {
                     Game1.showRedMessage("That Building Is Full");
                 }
                 else if (animalBeingPurchased.harvestType != 2)
                 {
                     namingAnimal  = true;
                     newAnimalHome = buildingAt;
                     if (animalBeingPurchased.sound != null && Game1.soundBank != null)
                     {
                         Cue cue = Game1.soundBank.GetCue(animalBeingPurchased.sound);
                         cue.SetVariable("Pitch", 1200 + Game1.random.Next(-200, 201));
                         cue.Play();
                     }
                     textBox.OnEnterPressed += e;
                     Game1.keyboardDispatcher.Subscriber = textBox;
                     textBox.Text     = animalBeingPurchased.name;
                     textBox.Selected = true;
                 }
                 else if (Game1.player.money >= priceOfAnimal)
                 {
                     newAnimalHome                     = buildingAt;
                     animalBeingPurchased.home         = newAnimalHome;
                     animalBeingPurchased.homeLocation = new Vector2(newAnimalHome.tileX, newAnimalHome.tileY);
                     animalBeingPurchased.setRandomPosition(animalBeingPurchased.home.indoors);
                     (newAnimalHome.indoors as AnimalHouse).animals.Add(animalBeingPurchased.myID, animalBeingPurchased);
                     (newAnimalHome.indoors as AnimalHouse).animalsThatLiveHere.Add(animalBeingPurchased.myID);
                     newAnimalHome = null;
                     namingAnimal  = false;
                     if (animalBeingPurchased.sound != null && Game1.soundBank != null)
                     {
                         Cue cue2 = Game1.soundBank.GetCue(animalBeingPurchased.sound);
                         cue2.SetVariable("Pitch", 1200 + Game1.random.Next(-200, 201));
                         cue2.Play();
                     }
                     Game1.player.money -= priceOfAnimal;
                     Game1.addHUDMessage(new HUDMessage("Purchased " + animalBeingPurchased.type, Color.LimeGreen, 3500f));
                     animalBeingPurchased = new FarmAnimal(animalBeingPurchased.type, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID);
                 }
                 else if (Game1.player.money < priceOfAnimal)
                 {
                     Game1.dayTimeMoneyBox.moneyShakeTimer = 1000;
                 }
             }
             else
             {
                 Game1.showRedMessage(animalBeingPurchased.type.Split(new char[]
                 {
                     ' '
                 }).Last() + "s Can't Live There.");
             }
         }
         if (namingAnimal && doneNamingButton.containsPoint(x, y))
         {
             textBoxEnter(textBox);
             Game1.playSound("smallSelect");
             return;
         }
         if (namingAnimal && randomButton.containsPoint(x, y))
         {
             animalBeingPurchased.name = Dialogue.randomName();
             textBox.Text       = animalBeingPurchased.name;
             randomButton.scale = randomButton.baseScale;
             Game1.playSound("drumkit6");
             return;
         }
     }
     else
     {
         if (backButton.containsPoint(x, y))
         {
             currentFarmIndex = (currentFarmIndex == 0) ? 1 : 0;
             populateAnimalStock();
             backButton.scale = backButton.baseScale;
         }
         if (forwardButton.containsPoint(x, y))
         {
             currentFarmIndex = (currentFarmIndex == 0) ? 1 : 0;
             populateAnimalStock();
             forwardButton.scale = forwardButton.baseScale;
         }
         foreach (ClickableTextureComponent current in animalsToPurchase)
         {
             if (current.containsPoint(x, y) && (current.item as StardewValley.Object).type == null)
             {
                 int num = Convert.ToInt32(current.name);
                 if (Game1.player.money >= num)
                 {
                     Game1.globalFadeToBlack(new Game1.afterFadeFunction(setUpForAnimalPlacement), 0.02f);
                     Game1.playSound("smallSelect");
                     onFarm = true;
                     animalBeingPurchased = new FarmAnimal(current.hoverText, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID);
                     priceOfAnimal        = num;
                 }
                 else
                 {
                     Game1.addHUDMessage(new HUDMessage("Not Enough Money", Color.Red, 3500f));
                 }
             }
         }
     }
 }
Example #14
0
 // Token: 0x06000F96 RID: 3990 RVA: 0x0013F5B0 File Offset: 0x0013D7B0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (Game1.globalFade || this.freeze)
     {
         return;
     }
     if (this.okButton != null && this.okButton.containsPoint(x, y) && this.readyToClose())
     {
         if (this.onFarm)
         {
             Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.setUpForReturnToShopMenu), 0.02f);
             Game1.playSound("smallSelect");
         }
         else
         {
             Game1.exitActiveMenu();
             Game1.playSound("bigDeSelect");
         }
     }
     if (this.onFarm)
     {
         Vector2  clickTile = new Vector2((float)((x + Game1.viewport.X) / Game1.tileSize), (float)((y + Game1.viewport.Y) / Game1.tileSize));
         Building selection = (Game1.getLocationFromName("Farm") as Farm).getBuildingAt(clickTile);
         if (selection != null && !this.namingAnimal)
         {
             if (selection.buildingType.Contains(this.animalBeingPurchased.buildingTypeILiveIn))
             {
                 if ((selection.indoors as AnimalHouse).isFull())
                 {
                     Game1.showRedMessage("That Building Is Full");
                 }
                 else if (this.animalBeingPurchased.harvestType != 2)
                 {
                     this.namingAnimal  = true;
                     this.newAnimalHome = selection;
                     if (this.animalBeingPurchased.sound != null && Game1.soundBank != null)
                     {
                         Cue expr_14B = Game1.soundBank.GetCue(this.animalBeingPurchased.sound);
                         expr_14B.SetVariable("Pitch", (float)(1200 + Game1.random.Next(-200, 201)));
                         expr_14B.Play();
                     }
                     this.textBox.OnEnterPressed        += this.e;
                     Game1.keyboardDispatcher.Subscriber = this.textBox;
                     this.textBox.Text     = this.animalBeingPurchased.name;
                     this.textBox.Selected = true;
                 }
                 else if (Game1.player.money >= this.priceOfAnimal)
                 {
                     this.newAnimalHome                     = selection;
                     this.animalBeingPurchased.home         = this.newAnimalHome;
                     this.animalBeingPurchased.homeLocation = new Vector2((float)this.newAnimalHome.tileX, (float)this.newAnimalHome.tileY);
                     this.animalBeingPurchased.setRandomPosition(this.animalBeingPurchased.home.indoors);
                     (this.newAnimalHome.indoors as AnimalHouse).animals.Add(this.animalBeingPurchased.myID, this.animalBeingPurchased);
                     (this.newAnimalHome.indoors as AnimalHouse).animalsThatLiveHere.Add(this.animalBeingPurchased.myID);
                     this.newAnimalHome = null;
                     this.namingAnimal  = false;
                     if (this.animalBeingPurchased.sound != null && Game1.soundBank != null)
                     {
                         Cue expr_2B5 = Game1.soundBank.GetCue(this.animalBeingPurchased.sound);
                         expr_2B5.SetVariable("Pitch", (float)(1200 + Game1.random.Next(-200, 201)));
                         expr_2B5.Play();
                     }
                     Game1.player.money -= this.priceOfAnimal;
                     Game1.addHUDMessage(new HUDMessage("Purchased " + this.animalBeingPurchased.type, Color.LimeGreen, 3500f));
                     this.animalBeingPurchased = new FarmAnimal(this.animalBeingPurchased.type, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID);
                 }
                 else if (Game1.player.money < this.priceOfAnimal)
                 {
                     Game1.dayTimeMoneyBox.moneyShakeTimer = 1000;
                 }
             }
             else
             {
                 Game1.showRedMessage(this.animalBeingPurchased.type.Split(new char[]
                 {
                     ' '
                 }).Last <string>() + "s Can't Live There.");
             }
         }
         if (this.namingAnimal && this.doneNamingButton.containsPoint(x, y))
         {
             this.textBoxEnter(this.textBox);
             Game1.playSound("smallSelect");
             return;
         }
         if (this.namingAnimal && this.randomButton.containsPoint(x, y))
         {
             this.animalBeingPurchased.name = Dialogue.randomName();
             this.textBox.Text       = this.animalBeingPurchased.name;
             this.randomButton.scale = this.randomButton.baseScale;
             Game1.playSound("drumkit6");
             return;
         }
     }
     else
     {
         foreach (ClickableTextureComponent c in this.animalsToPurchase)
         {
             if (c.containsPoint(x, y) && (c.item as Object).type == null)
             {
                 int price = Convert.ToInt32(c.name);
                 if (Game1.player.money >= price)
                 {
                     Game1.globalFadeToBlack(new Game1.afterFadeFunction(this.setUpForAnimalPlacement), 0.02f);
                     Game1.playSound("smallSelect");
                     this.onFarm = true;
                     this.animalBeingPurchased = new FarmAnimal(c.hoverText, MultiplayerUtility.getNewID(), Game1.player.uniqueMultiplayerID);
                     this.priceOfAnimal        = price;
                 }
                 else
                 {
                     Game1.addHUDMessage(new HUDMessage("Not Enough Money", Color.Red, 3500f));
                 }
             }
         }
     }
 }
Example #15
0
            public static void performTenMinuteClockUpdate()
            {
                if (Game1.IsServer)
                {
                    MultiplayerUtility.broadcastGameClock();
                }
                int trulyDarkTime = Game1.getTrulyDarkTime();

                Game1.gameTimeInterval = 0;
                Game1.timeOfDay       += 10;
                if (Game1.timeOfDay % 100 >= 60)
                {
                    Game1.timeOfDay = Game1.timeOfDay - Game1.timeOfDay % 100 + 100;
                }
                if (Game1.isLightning && Game1.timeOfDay < 2400)
                {
                    Utility.performLightningUpdate();
                }
                if (Game1.timeOfDay == trulyDarkTime)
                {
                    Game1.currentLocation.switchOutNightTiles();
                }
                else if (Game1.timeOfDay == Game1.getModeratelyDarkTime())
                {
                    if (Game1.currentLocation.IsOutdoors && !Game1.isRaining)
                    {
                        Game1.ambientLight = Color.White;
                    }
                    if (!Game1.isRaining && !(Game1.currentLocation is MineShaft) && (Game1.currentSong != null && !Game1.currentSong.Name.Contains("ambient")) && Game1.currentLocation is Town)
                    {
                        Game1.changeMusicTrack("none");
                    }
                }
                if (Game1.currentLocation.isOutdoors && !Game1.isRaining && (!Game1.eventUp && Game1.currentSong != null) && (Game1.currentSong.Name.Contains("day") && Game1.isDarkOut()))
                {
                    Game1.changeMusicTrack("none");
                }
                if (Game1.weatherIcon == 1)
                {
                    int int32 = Convert.ToInt32(Game1.temporaryContent.Load <Dictionary <string, string> >("Data\\Festivals\\" + Game1.currentSeason + (object)Game1.dayOfMonth)["conditions"].Split('/')[1].Split(' ')[0]);
                    if (Game1.whereIsTodaysFest == null)
                    {
                        Game1.whereIsTodaysFest = Game1.temporaryContent.Load <Dictionary <string, string> >("Data\\Festivals\\" + Game1.currentSeason + (object)Game1.dayOfMonth)["conditions"].Split('/')[0];
                    }
                    if (Game1.timeOfDay == int32)
                    {
                        string str = Game1.temporaryContent.Load <Dictionary <string, string> >("Data\\Festivals\\" + Game1.currentSeason + (object)Game1.dayOfMonth)["conditions"].Split('/')[0];
                        if (!(str == "Forest"))
                        {
                            if (!(str == "Town"))
                            {
                                if (str == "Beach")
                                {
                                    str = Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2639");
                                }
                            }
                            else
                            {
                                str = Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2637");
                            }
                        }
                        else
                        {
                            str = Game1.currentSeason.Equals("winter") ? Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2634") : Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2635");
                        }
                        Game1.showGlobalMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2640", (object)Game1.temporaryContent.Load <Dictionary <string, string> >("Data\\Festivals\\" + Game1.currentSeason + (object)Game1.dayOfMonth)["name"]) + str);
                    }
                }
                Game1.player.performTenMinuteUpdate();
                switch (Game1.timeOfDay)
                {
                case 2500:
                    Game1.dayTimeMoneyBox.timeShakeTimer = 2000;
                    Game1.player.doEmote(24);
                    break;

                case 2600:
                    Game1.dayTimeMoneyBox.timeShakeTimer = 2000;
                    Game1.farmerShouldPassOut            = true;
                    if (Game1.player.getMount() != null)
                    {
                        Game1.player.getMount().dismount();
                        break;
                    }
                    break;

                case 2800:
                    Game1.exitActiveMenu();
                    Game1.player.faceDirection(2);
                    Game1.player.completelyStopAnimatingOrDoingAction();
                    Game1.player.animateOnce(293);
                    if (Game1.player.getMount() != null)
                    {
                        Game1.player.getMount().dismount();
                        break;
                    }
                    break;

                case 1200:
                    if (Game1.currentLocation.isOutdoors && !Game1.isRaining && (Game1.currentSong == null || Game1.currentSong.IsStopped || Game1.currentSong.Name.ToLower().Contains("ambient")))
                    {
                        Game1.playMorningSong();
                        break;
                    }
                    break;

                case 2000:
                    if (!Game1.isRaining && Game1.currentLocation is Town)
                    {
                        Game1.changeMusicTrack("none");
                        break;
                    }
                    break;

                case 2400:
                    Game1.dayTimeMoneyBox.timeShakeTimer = 2000;
                    Game1.player.doEmote(24);
                    Game1.showGlobalMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2652"));
                    break;
                }
                if (Game1.timeOfDay >= 2600)
                {
                    Game1.farmerShouldPassOut = true;
                }
                foreach (GameLocation location in Game1.locations)
                {
                    location.performTenMinuteUpdate(Game1.timeOfDay);
                    if (location is Farm)
                    {
                        ((BuildableGameLocation)location).timeUpdate(10);
                    }
                }
                if (Game1.mine == null)
                {
                    return;
                }
                Game1.mine.performTenMinuteUpdate(Game1.timeOfDay);
            }
Example #16
0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (!this.placingStructure)
     {
         this.heldItem = this.inventory.leftClick(x, y, this.heldItem, true);
         for (int index = 0; index < this.sideTabs.Count; ++index)
         {
             if (this.sideTabs[index].containsPoint(x, y) && this.currentTab != index)
             {
                 Game1.playSound("smallSelect");
                 if (index == 3)
                 {
                     this.placingStructure = true;
                     this.demolishing      = true;
                     this.parent.invisible = true;
                 }
                 else
                 {
                     this.sideTabs[this.currentTab].bounds.X -= CataloguePage.widthToMoveActiveTab;
                     this.currentTab = index;
                     this.sideTabs[index].bounds.X += CataloguePage.widthToMoveActiveTab;
                 }
             }
         }
         foreach (ClickableComponent key in this.blueprintButtons[this.currentTab].Keys)
         {
             if (key.containsPoint(x, y))
             {
                 if (this.blueprintButtons[this.currentTab][key].doesFarmerHaveEnoughResourcesToBuild())
                 {
                     this.structureForPlacement = this.blueprintButtons[this.currentTab][key];
                     this.placingStructure      = true;
                     this.parent.invisible      = true;
                     if (this.currentTab == 1)
                     {
                         this.upgrading = true;
                     }
                     Game1.playSound("smallSelect");
                     break;
                 }
                 Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:BlueprintsMenu.cs.10002"), Color.Red, 3500f));
                 break;
             }
         }
     }
     else if (this.demolishing)
     {
         if (!(Game1.currentLocation is Farm))
         {
             return;
         }
         if (Game1.IsClient)
         {
             Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:CataloguePage.cs.10148"), Color.Red, 3500f));
         }
         else
         {
             Vector2  vector2    = new Vector2((float)((Game1.viewport.X + Game1.getOldMouseX()) / Game1.tileSize), (float)((Game1.viewport.Y + Game1.getOldMouseY()) / Game1.tileSize));
             Building buildingAt = ((BuildableGameLocation)Game1.currentLocation).getBuildingAt(vector2);
             if (Game1.IsMultiplayer && buildingAt != null && buildingAt.indoors.farmers.Count > 0)
             {
                 Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:CataloguePage.cs.10149"), Color.Red, 3500f));
             }
             else if (buildingAt != null && ((BuildableGameLocation)Game1.currentLocation).destroyStructure(buildingAt))
             {
                 int num = buildingAt.tileY + buildingAt.tilesHigh;
                 for (int index = 0; index < buildingAt.texture.Bounds.Height / Game1.tileSize; ++index)
                 {
                     GameLocation currentLocation             = Game1.currentLocation;
                     Texture2D    texture                     = buildingAt.texture;
                     Microsoft.Xna.Framework.Rectangle bounds = buildingAt.texture.Bounds;
                     int x1 = bounds.Center.X;
                     bounds = buildingAt.texture.Bounds;
                     int y1     = bounds.Center.Y;
                     int width  = Game1.tileSize / 16;
                     int height = Game1.tileSize / 16;
                     Microsoft.Xna.Framework.Rectangle sourcerectangle = new Microsoft.Xna.Framework.Rectangle(x1, y1, width, height);
                     int xTile           = buildingAt.tileX + Game1.random.Next(buildingAt.tilesWide);
                     int yTile           = buildingAt.tileY + buildingAt.tilesHigh - index;
                     int numberOfChunks  = Game1.random.Next(20, 45);
                     int groundLevelTile = num;
                     Game1.createRadialDebris(currentLocation, texture, sourcerectangle, xTile, yTile, numberOfChunks, groundLevelTile);
                 }
                 Game1.playSound("explosion");
                 Utility.spreadAnimalsAround(buildingAt, (Farm)Game1.currentLocation);
                 if (!Game1.IsServer)
                 {
                     return;
                 }
                 MultiplayerUtility.broadcastBuildingChange((byte)1, vector2, "", Game1.currentLocation.name, Game1.player.uniqueMultiplayerID);
             }
             else
             {
                 this.parent.invisible = false;
                 this.placingStructure = false;
                 this.demolishing      = false;
             }
         }
     }
     else if (this.upgrading && Game1.currentLocation is Farm)
     {
         (Game1.currentLocation as Farm).tryToUpgrade(((BuildableGameLocation)Game1.getLocationFromName("Farm")).getBuildingAt(new Vector2((float)((Game1.viewport.X + Game1.getOldMouseX()) / Game1.tileSize), (float)((Game1.viewport.Y + Game1.getOldMouseY()) / Game1.tileSize))), this.structureForPlacement);
     }
     else if (!CataloguePage.canPlaceThisBuildingOnTheCurrentMap(this.structureForPlacement, Game1.currentLocation))
     {
         Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:CataloguePage.cs.10152"), Color.Red, 3500f));
     }
     else if (!this.structureForPlacement.doesFarmerHaveEnoughResourcesToBuild())
     {
         Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:BlueprintsMenu.cs.10002"), Color.Red, 3500f));
     }
     else if (this.tryToBuild())
     {
         this.structureForPlacement.consumeResources();
         if (this.structureForPlacement.blueprintType.Equals("Animals"))
         {
             return;
         }
         Game1.playSound("axe");
     }
     else
     {
         if (Game1.IsClient)
         {
             return;
         }
         Game1.addHUDMessage(new HUDMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:BlueprintsMenu.cs.10016"), Color.Red, 3500f));
     }
 }
        public bool buildStructure(Building b, Vector2 tileLocation, bool serverMessage, Farmer who)
        {
            if ((!serverMessage ? 0 : (Game1.IsClient ? 1 : 0)) == 0)
            {
                for (int index1 = 0; index1 < b.tilesHigh; ++index1)
                {
                    for (int index2 = 0; index2 < b.tilesWide; ++index2)
                    {
                        if (!this.isBuildable(new Vector2(tileLocation.X + (float)index2, tileLocation.Y + (float)index1)))
                        {
                            return(false);
                        }
                        for (int index3 = 0; index3 < this.farmers.Count; ++index3)
                        {
                            if (this.farmers[index3].GetBoundingBox().Intersects(new Microsoft.Xna.Framework.Rectangle(index2 * Game1.tileSize, index1 * Game1.tileSize, Game1.tileSize, Game1.tileSize)))
                            {
                                return(false);
                            }
                        }
                    }
                }
                if (Game1.IsMultiplayer)
                {
                    MultiplayerUtility.broadcastBuildingChange((byte)0, tileLocation, b.buildingType, this.name, who.uniqueMultiplayerID);
                    if (Game1.IsClient)
                    {
                        return(false);
                    }
                }
            }
            string message = b.isThereAnythingtoPreventConstruction((GameLocation)this);

            if (message != null)
            {
                Game1.addHUDMessage(new HUDMessage(message, Color.Red, 3500f));
                return(false);
            }
            b.tileX = (int)tileLocation.X;
            b.tileY = (int)tileLocation.Y;
            if (b.indoors != null && b.indoors is AnimalHouse)
            {
                foreach (long index in (b.indoors as AnimalHouse).animalsThatLiveHere)
                {
                    FarmAnimal animal1 = Utility.getAnimal(index);
                    if (animal1 != null)
                    {
                        animal1.homeLocation = tileLocation;
                        animal1.home         = b;
                    }
                    else if (animal1 == null && (b.indoors as AnimalHouse).animals.ContainsKey(index))
                    {
                        FarmAnimal animal2 = (b.indoors as AnimalHouse).animals[index];
                        animal2.homeLocation = tileLocation;
                        animal2.home         = b;
                    }
                }
            }
            if (b.indoors != null)
            {
                foreach (Warp warp in b.indoors.warps)
                {
                    int num1 = b.humanDoor.X + b.tileX;
                    warp.TargetX = num1;
                    int num2 = b.humanDoor.Y + b.tileY + 1;
                    warp.TargetY = num2;
                }
            }
            this.buildings.Add(b);
            return(true);
        }
        public bool buildStructure(BluePrint structureForPlacement, Vector2 tileLocation, bool serverMessage, Farmer who, bool magicalConstruction = false)
        {
            if ((!serverMessage ? 0 : (Game1.IsClient ? 1 : 0)) == 0)
            {
                for (int index1 = 0; index1 < structureForPlacement.tilesHeight; ++index1)
                {
                    for (int index2 = 0; index2 < structureForPlacement.tilesWidth; ++index2)
                    {
                        if (!this.isBuildable(new Vector2(tileLocation.X + (float)index2, tileLocation.Y + (float)index1)))
                        {
                            return(false);
                        }
                        for (int index3 = 0; index3 < this.farmers.Count; ++index3)
                        {
                            if (this.farmers[index3].GetBoundingBox().Intersects(new Microsoft.Xna.Framework.Rectangle(index2 * Game1.tileSize, index1 * Game1.tileSize, Game1.tileSize, Game1.tileSize)))
                            {
                                return(false);
                            }
                        }
                    }
                }
                if (Game1.IsMultiplayer)
                {
                    MultiplayerUtility.broadcastBuildingChange((byte)0, tileLocation, structureForPlacement.name, this.name, who.uniqueMultiplayerID);
                    if (Game1.IsClient)
                    {
                        return(false);
                    }
                }
            }
            string name = structureForPlacement.name;
            // ISSUE: reference to a compiler-generated method
            uint     stringHash = \u003CPrivateImplementationDetails\u003E.ComputeStringHash(name);
            Building building;

            if (stringHash <= 1972213674U)
            {
                if (stringHash <= 846075854U)
                {
                    if ((int)stringHash != 45101750)
                    {
                        if ((int)stringHash != 846075854 || !(name == "Big Barn"))
                        {
                            goto label_39;
                        }
                        else
                        {
                            goto label_36;
                        }
                    }
                    else if (name == "Stable")
                    {
                        building = (Building) new Stable(structureForPlacement, tileLocation);
                        goto label_40;
                    }
                    else
                    {
                        goto label_39;
                    }
                }
                else if ((int)stringHash != 1684694008)
                {
                    if ((int)stringHash != 1972213674 || !(name == "Big Coop"))
                    {
                        goto label_39;
                    }
                }
                else if (!(name == "Coop"))
                {
                    goto label_39;
                }
            }
            else if (stringHash <= 2601855023U)
            {
                if ((int)stringHash != -1719902568)
                {
                    if ((int)stringHash != -1693112273 || !(name == "Deluxe Barn"))
                    {
                        goto label_39;
                    }
                    else
                    {
                        goto label_36;
                    }
                }
                else if (name == "Junimo Hut")
                {
                    building = (Building) new JunimoHut(structureForPlacement, tileLocation);
                    goto label_40;
                }
                else
                {
                    goto label_39;
                }
            }
            else if ((int)stringHash != -1111878468)
            {
                if ((int)stringHash != -560689829)
                {
                    if ((int)stringHash == -361784093 && name == "Mill")
                    {
                        building = (Building) new Mill(structureForPlacement, tileLocation);
                        goto label_40;
                    }
                    else
                    {
                        goto label_39;
                    }
                }
                else if (!(name == "Deluxe Coop"))
                {
                    goto label_39;
                }
            }
            else if (name == "Barn")
            {
                goto label_36;
            }
            else
            {
                goto label_39;
            }
            building = (Building) new Coop(structureForPlacement, tileLocation);
            goto label_40;
label_36:
            building = (Building) new Barn(structureForPlacement, tileLocation);
            goto label_40;
label_39:
            building = new Building(structureForPlacement, tileLocation);
label_40:
            building.owner = who.uniqueMultiplayerID;
            string message = building.isThereAnythingtoPreventConstruction((GameLocation)this);

            if (message != null)
            {
                Game1.addHUDMessage(new HUDMessage(message, Color.Red, 3500f));
                return(false);
            }
            this.buildings.Add(building);
            building.performActionOnConstruction((GameLocation)this);
            return(true);
        }
 // Token: 0x06000DB9 RID: 3513 RVA: 0x00116F10 File Offset: 0x00115110
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     if (!this.placingStructure)
     {
         this.heldItem = this.inventory.leftClick(x, y, this.heldItem, true);
         for (int i = 0; i < this.sideTabs.Count; i++)
         {
             if (this.sideTabs[i].containsPoint(x, y) && this.currentTab != i)
             {
                 Game1.playSound("smallSelect");
                 if (i == 3)
                 {
                     this.placingStructure = true;
                     this.demolishing      = true;
                     this.parent.invisible = true;
                 }
                 else
                 {
                     ClickableTextureComponent expr_8F_cp_0_cp_0 = this.sideTabs[this.currentTab];
                     expr_8F_cp_0_cp_0.bounds.X = expr_8F_cp_0_cp_0.bounds.X - CataloguePage.widthToMoveActiveTab;
                     this.currentTab            = i;
                     ClickableTextureComponent expr_B5_cp_0_cp_0 = this.sideTabs[i];
                     expr_B5_cp_0_cp_0.bounds.X = expr_B5_cp_0_cp_0.bounds.X + CataloguePage.widthToMoveActiveTab;
                 }
             }
         }
         using (Dictionary <ClickableComponent, BluePrint> .KeyCollection.Enumerator enumerator = this.blueprintButtons[this.currentTab].Keys.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 ClickableComponent c = enumerator.Current;
                 if (c.containsPoint(x, y))
                 {
                     if (this.blueprintButtons[this.currentTab][c].doesFarmerHaveEnoughResourcesToBuild())
                     {
                         this.structureForPlacement = this.blueprintButtons[this.currentTab][c];
                         this.placingStructure      = true;
                         this.parent.invisible      = true;
                         if (this.currentTab == 1)
                         {
                             this.upgrading = true;
                         }
                         Game1.playSound("smallSelect");
                         break;
                     }
                     Game1.addHUDMessage(new HUDMessage("Not Enough Resources", Color.Red, 3500f));
                     break;
                 }
             }
             return;
         }
     }
     if (this.demolishing)
     {
         if (!(Game1.currentLocation is Farm))
         {
             return;
         }
         if (Game1.IsClient)
         {
             Game1.addHUDMessage(new HUDMessage("Only the farm owner can demolish.", Color.Red, 3500f));
             return;
         }
         Vector2  tileLocation = new Vector2((float)((Game1.viewport.X + Game1.getOldMouseX()) / Game1.tileSize), (float)((Game1.viewport.Y + Game1.getOldMouseY()) / Game1.tileSize));
         Building destroyed    = ((Farm)Game1.currentLocation).getBuildingAt(tileLocation);
         if (Game1.IsMultiplayer && destroyed != null && destroyed.indoors.farmers.Count > 0)
         {
             Game1.addHUDMessage(new HUDMessage("Someone's in there!", Color.Red, 3500f));
             return;
         }
         if (destroyed == null || !((Farm)Game1.currentLocation).destroyStructure(destroyed))
         {
             this.parent.invisible = false;
             this.placingStructure = false;
             this.demolishing      = false;
             return;
         }
         int groundYTile = destroyed.tileY + destroyed.tilesHigh;
         for (int j = 0; j < destroyed.texture.Bounds.Height / Game1.tileSize; j++)
         {
             Game1.createRadialDebris(Game1.currentLocation, destroyed.texture, new Microsoft.Xna.Framework.Rectangle(destroyed.texture.Bounds.Center.X, destroyed.texture.Bounds.Center.Y, Game1.tileSize / 16, Game1.tileSize / 16), destroyed.tileX + Game1.random.Next(destroyed.tilesWide), destroyed.tileY + destroyed.tilesHigh - j, Game1.random.Next(20, 45), groundYTile);
         }
         Game1.playSound("explosion");
         Utility.spreadAnimalsAround(destroyed, (Farm)Game1.currentLocation);
         if (Game1.IsServer)
         {
             MultiplayerUtility.broadcastBuildingChange(1, tileLocation, "", Game1.currentLocation.name, Game1.player.uniqueMultiplayerID);
             return;
         }
     }
     else
     {
         if (this.upgrading && Game1.currentLocation.GetType() == typeof(Farm))
         {
             (Game1.currentLocation as Farm).tryToUpgrade(((Farm)Game1.getLocationFromName("Farm")).getBuildingAt(new Vector2((float)((Game1.viewport.X + Game1.getOldMouseX()) / Game1.tileSize), (float)((Game1.viewport.Y + Game1.getOldMouseY()) / Game1.tileSize))), this.structureForPlacement);
             return;
         }
         if (!CataloguePage.canPlaceThisBuildingOnTheCurrentMap(this.structureForPlacement, Game1.currentLocation))
         {
             Game1.addHUDMessage(new HUDMessage("You can't build that in this location.", Color.Red, 3500f));
             return;
         }
         if (!this.structureForPlacement.doesFarmerHaveEnoughResourcesToBuild())
         {
             Game1.addHUDMessage(new HUDMessage("Not Enough Resources", Color.Red, 3500f));
             return;
         }
         if (this.tryToBuild())
         {
             this.structureForPlacement.consumeResources();
             if (!this.structureForPlacement.blueprintType.Equals("Animals"))
             {
                 Game1.playSound("axe");
                 return;
             }
         }
         else if (!Game1.IsClient)
         {
             Game1.addHUDMessage(new HUDMessage("Can't Build There", Color.Red, 3500f));
         }
     }
 }
        public bool buildStructure(Building b, Vector2 tileLocation, bool serverMessage, Farmer who)
        {
            if (!serverMessage || !Game1.IsClient)
            {
                for (int i = 0; i < b.tilesHigh; i++)
                {
                    for (int j = 0; j < b.tilesWide; j++)
                    {
                        Vector2 tileLocation2 = new Vector2(tileLocation.X + (float)j, tileLocation.Y + (float)i);
                        if (!this.isBuildable(tileLocation2))
                        {
                            return(false);
                        }
                        for (int k = 0; k < this.farmers.Count; k++)
                        {
                            if (this.farmers[k].GetBoundingBox().Intersects(new Microsoft.Xna.Framework.Rectangle(j * Game1.tileSize, i * Game1.tileSize, Game1.tileSize, Game1.tileSize)))
                            {
                                return(false);
                            }
                        }
                    }
                }
                if (Game1.IsMultiplayer)
                {
                    MultiplayerUtility.broadcastBuildingChange(0, tileLocation, b.buildingType, this.name, who.uniqueMultiplayerID);
                    if (Game1.IsClient)
                    {
                        return(false);
                    }
                }
            }
            string text = b.isThereAnythingtoPreventConstruction(this);

            if (text != null)
            {
                Game1.addHUDMessage(new HUDMessage(text, Color.Red, 3500f));
                return(false);
            }
            b.tileX = (int)tileLocation.X;
            b.tileY = (int)tileLocation.Y;
            if (b.indoors != null && b.indoors is AnimalHouse)
            {
                foreach (long current in (b.indoors as AnimalHouse).animalsThatLiveHere)
                {
                    FarmAnimal farmAnimal = Utility.getAnimal(current);
                    if (farmAnimal != null)
                    {
                        farmAnimal.homeLocation = tileLocation;
                        farmAnimal.home         = b;
                    }
                    else if (farmAnimal == null && (b.indoors as AnimalHouse).animals.ContainsKey(current))
                    {
                        farmAnimal = (b.indoors as AnimalHouse).animals[current];
                        farmAnimal.homeLocation = tileLocation;
                        farmAnimal.home         = b;
                    }
                }
            }
            if (b.indoors != null)
            {
                foreach (Warp expr_1F9 in b.indoors.warps)
                {
                    expr_1F9.TargetX = b.humanDoor.X + b.tileX;
                    expr_1F9.TargetY = b.humanDoor.Y + b.tileY + 1;
                }
            }
            this.buildings.Add(b);
            return(true);
        }
        // Token: 0x06001069 RID: 4201 RVA: 0x001529CC File Offset: 0x00150BCC
        public bool buildStructure(Building b, Vector2 tileLocation, bool serverMessage, Farmer who)
        {
            if (!serverMessage || !Game1.IsClient)
            {
                for (int y = 0; y < b.tilesHigh; y++)
                {
                    for (int x = 0; x < b.tilesWide; x++)
                    {
                        Vector2 currentGlobalTilePosition = new Vector2(tileLocation.X + (float)x, tileLocation.Y + (float)y);
                        if (!this.isBuildable(currentGlobalTilePosition))
                        {
                            return(false);
                        }
                        for (int i = 0; i < this.farmers.Count; i++)
                        {
                            if (this.farmers[i].GetBoundingBox().Intersects(new Microsoft.Xna.Framework.Rectangle(x * Game1.tileSize, y * Game1.tileSize, Game1.tileSize, Game1.tileSize)))
                            {
                                return(false);
                            }
                        }
                    }
                }
                if (Game1.IsMultiplayer)
                {
                    MultiplayerUtility.broadcastBuildingChange(0, tileLocation, b.buildingType, this.name, who.uniqueMultiplayerID);
                    if (Game1.IsClient)
                    {
                        return(false);
                    }
                }
            }
            string finalCheckResult = b.isThereAnythingtoPreventConstruction(this);

            if (finalCheckResult != null)
            {
                Game1.addHUDMessage(new HUDMessage(finalCheckResult, Color.Red, 3500f));
                return(false);
            }
            b.tileX = (int)tileLocation.X;
            b.tileY = (int)tileLocation.Y;
            if (b.indoors != null && b.indoors is AnimalHouse)
            {
                foreach (long a in (b.indoors as AnimalHouse).animalsThatLiveHere)
                {
                    FarmAnimal animal = Utility.getAnimal(a);
                    if (animal != null)
                    {
                        animal.homeLocation = tileLocation;
                        animal.home         = b;
                    }
                    else if (animal == null && (b.indoors as AnimalHouse).animals.ContainsKey(a))
                    {
                        animal = (b.indoors as AnimalHouse).animals[a];
                        animal.homeLocation = tileLocation;
                        animal.home         = b;
                    }
                }
            }
            if (b.indoors != null)
            {
                foreach (Warp expr_1F9 in b.indoors.warps)
                {
                    expr_1F9.TargetX = b.humanDoor.X + b.tileX;
                    expr_1F9.TargetY = b.humanDoor.Y + b.tileY + 1;
                }
            }
            this.buildings.Add(b);
            return(true);
        }
Example #22
0
        // Token: 0x06000B40 RID: 2880 RVA: 0x000E408C File Offset: 0x000E228C
        private static void parseDataMessageFromClient(NetIncomingMessage msg)
        {
            switch (msg.ReadByte())
            {
            case 0:
                Game1.otherFarmers[msg.SenderConnection.RemoteUniqueIdentifier].setMoving(msg.ReadByte());
                return;

            case 1:
            case 2:
            case 12:
            case 15:
            case 16:
            case 18:
                break;

            case 3:
                ((FarmerSprite)Game1.otherFarmers[msg.SenderConnection.RemoteUniqueIdentifier].sprite).CurrentToolIndex = msg.ReadInt32();
                if (msg.ReadByte() == 1)
                {
                    ((FarmerSprite)Game1.otherFarmers[msg.SenderConnection.RemoteUniqueIdentifier].sprite).animateBackwardsOnce(msg.ReadInt32(), msg.ReadFloat());
                    msg.ReadByte();
                    return;
                }
                ((FarmerSprite)Game1.otherFarmers[msg.SenderConnection.RemoteUniqueIdentifier].sprite).animateOnce(msg.ReadInt32(), msg.ReadFloat(), (int)msg.ReadByte());
                return;

            case 4:
                MultiplayerUtility.serverTryToPerformObjectAlteration(msg.ReadInt16(), msg.ReadInt16(), msg.ReadByte(), msg.ReadByte(), msg.ReadInt32(), Game1.otherFarmers[msg.SenderConnection.RemoteUniqueIdentifier]);
                return;

            case 5:
                MultiplayerUtility.warpCharacter(msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadByte(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 6:
                MultiplayerUtility.performSwitchHeldItem(msg.SenderConnection.RemoteUniqueIdentifier, msg.ReadByte(), (int)msg.ReadInt16());
                return;

            case 7:
                MultiplayerUtility.performToolAction(msg.ReadByte(), msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadByte(), msg.ReadInt16(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 8:
                MultiplayerUtility.performDebrisPickup(msg.ReadInt32(), msg.ReadString(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 9:
                MultiplayerUtility.performCheckAction(msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 10:
                MultiplayerUtility.receiveChatMessage(msg.ReadString(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 11:
                MultiplayerUtility.receiveNameChange(msg.ReadString(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 13:
                MultiplayerUtility.receiveBuildingChange(msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.SenderConnection.RemoteUniqueIdentifier, 0L);
                return;

            case 14:
                MultiplayerUtility.performDebrisCreate(msg.ReadInt16(), msg.ReadInt32(), msg.ReadInt32(), msg.ReadByte(), msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 17:
                Game1.otherFarmers[msg.SenderConnection.RemoteUniqueIdentifier].readyConfirmation = true;
                MultiplayerUtility.allFarmersReadyCheck();
                return;

            case 19:
                MultiplayerUtility.interpretMessageToEveryone(msg.ReadInt32(), msg.ReadString(), msg.SenderConnection.RemoteUniqueIdentifier);
                break;

            default:
                return;
            }
        }
        // Token: 0x0600106B RID: 4203 RVA: 0x00152DC4 File Offset: 0x00150FC4
        public bool buildStructure(BluePrint structureForPlacement, Vector2 tileLocation, bool serverMessage, Farmer who, bool magicalConstruction = false)
        {
            if (!serverMessage || !Game1.IsClient)
            {
                for (int y = 0; y < structureForPlacement.tilesHeight; y++)
                {
                    for (int x = 0; x < structureForPlacement.tilesWidth; x++)
                    {
                        Vector2 currentGlobalTilePosition = new Vector2(tileLocation.X + (float)x, tileLocation.Y + (float)y);
                        if (!this.isBuildable(currentGlobalTilePosition))
                        {
                            return(false);
                        }
                        for (int i = 0; i < this.farmers.Count; i++)
                        {
                            if (this.farmers[i].GetBoundingBox().Intersects(new Microsoft.Xna.Framework.Rectangle(x * Game1.tileSize, y * Game1.tileSize, Game1.tileSize, Game1.tileSize)))
                            {
                                return(false);
                            }
                        }
                    }
                }
                if (Game1.IsMultiplayer)
                {
                    MultiplayerUtility.broadcastBuildingChange(0, tileLocation, structureForPlacement.name, this.name, who.uniqueMultiplayerID);
                    if (Game1.IsClient)
                    {
                        return(false);
                    }
                }
            }
            string   name = structureForPlacement.name;
            uint     num  = < PrivateImplementationDetails >.ComputeStringHash(name);
            Building b;

            if (num <= 1972213674u)
            {
                if (num <= 846075854u)
                {
                    if (num != 45101750u)
                    {
                        if (num != 846075854u)
                        {
                            goto IL_251;
                        }
                        if (!(name == "Big Barn"))
                        {
                            goto IL_251;
                        }
                        goto IL_233;
                    }
                    else
                    {
                        if (!(name == "Stable"))
                        {
                            goto IL_251;
                        }
                        b = new Stable(structureForPlacement, tileLocation);
                        goto IL_259;
                    }
                }
                else if (num != 1684694008u)
                {
                    if (num != 1972213674u)
                    {
                        goto IL_251;
                    }
                    if (!(name == "Big Coop"))
                    {
                        goto IL_251;
                    }
                }
                else if (!(name == "Coop"))
                {
                    goto IL_251;
                }
            }
            else if (num <= 2601855023u)
            {
                if (num != 2575064728u)
                {
                    if (num != 2601855023u)
                    {
                        goto IL_251;
                    }
                    if (!(name == "Deluxe Barn"))
                    {
                        goto IL_251;
                    }
                    goto IL_233;
                }
                else
                {
                    if (!(name == "Junimo Hut"))
                    {
                        goto IL_251;
                    }
                    b = new JunimoHut(structureForPlacement, tileLocation);
                    goto IL_259;
                }
            }
            else if (num != 3183088828u)
            {
                if (num != 3734277467u)
                {
                    if (num != 3933183203u)
                    {
                        goto IL_251;
                    }
                    if (!(name == "Mill"))
                    {
                        goto IL_251;
                    }
                    b = new Mill(structureForPlacement, tileLocation);
                    goto IL_259;
                }
                else if (!(name == "Deluxe Coop"))
                {
                    goto IL_251;
                }
            }
            else
            {
                if (!(name == "Barn"))
                {
                    goto IL_251;
                }
                goto IL_233;
            }
            b = new Coop(structureForPlacement, tileLocation);
            goto IL_259;
IL_233:
            b = new Barn(structureForPlacement, tileLocation);
            goto IL_259;
IL_251:
            b = new Building(structureForPlacement, tileLocation);
IL_259:
            b.owner = who.uniqueMultiplayerID;
            string finalCheckResult = b.isThereAnythingtoPreventConstruction(this);

            if (finalCheckResult != null)
            {
                Game1.addHUDMessage(new HUDMessage(finalCheckResult, Color.Red, 3500f));
                return(false);
            }
            this.buildings.Add(b);
            b.performActionOnConstruction(this);
            return(true);
        }
Example #24
0
        // Token: 0x06000DD2 RID: 3538 RVA: 0x0011B0CC File Offset: 0x001192CC
        public void textBoxEnter(TextBox sender)
        {
            if (Game1.IsMultiplayer && sender.Text.Length > 0)
            {
                string textToSend = sender.Text.Trim();
                if (textToSend.Length < 1)
                {
                    return;
                }
                if (textToSend[0] == '/' && textToSend.Split(new char[]
                {
                    ' '
                })[0].Length > 1)
                {
                    try
                    {
                        string text = textToSend.Split(new char[]
                        {
                            ' '
                        })[0].Substring(1);
                        uint num = < PrivateImplementationDetails >.ComputeStringHash(text);
                        if (num <= 1013213428u)
                        {
                            if (num != 355814093u)
                            {
                                if (num != 405908334u)
                                {
                                    if (num != 1013213428u)
                                    {
                                        goto IL_211;
                                    }
                                    if (!(text == "texture"))
                                    {
                                        goto IL_211;
                                    }
                                    Game1.player.Sprite.Texture = Game1.content.Load <Texture2D>("Characters\\" + textToSend.Split(new char[]
                                    {
                                        ' '
                                    })[1]);
                                    goto IL_21E;
                                }
                                else if (!(text == "nick"))
                                {
                                    goto IL_211;
                                }
                            }
                            else if (!(text == "nickname"))
                            {
                                goto IL_211;
                            }
                        }
                        else if (num <= 2180167635u)
                        {
                            if (num != 1158129075u)
                            {
                                if (num != 2180167635u)
                                {
                                    goto IL_211;
                                }
                                if (!(text == "rename"))
                                {
                                    goto IL_211;
                                }
                            }
                            else
                            {
                                if (!(text == "othergirl"))
                                {
                                    goto IL_211;
                                }
                                Game1.otherFarmers.Values.ElementAt(0).Sprite.Texture = Game1.content.Load <Texture2D>("Characters\\farmergirl");
                                goto IL_21E;
                            }
                        }
                        else if (num != 2369371622u)
                        {
                            if (num != 2723493283u)
                            {
                                goto IL_211;
                            }
                            if (!(text == "girl"))
                            {
                                goto IL_211;
                            }
                            Game1.player.Sprite.Texture = Game1.content.Load <Texture2D>("Characters\\farmergirl");
                            Game1.player.isMale         = false;
                            goto IL_21E;
                        }
                        else if (!(text == "name"))
                        {
                            goto IL_211;
                        }
                        MultiplayerUtility.sendNameChange(textToSend.Substring(textToSend.IndexOf(' ') + 1), Game1.player.uniqueMultiplayerID);
                        goto IL_21E;
IL_211:
                        this.receiveChatMessage(" Invalid Command ::", 0L);
IL_21E:
                        goto IL_258;
                    }
                    catch (Exception)
                    {
                        this.receiveChatMessage(" Invalid Command Arguments ::", 0L);
                        goto IL_258;
                    }
                }
                MultiplayerUtility.sendChatMessage(textToSend, Game1.player.uniqueMultiplayerID);
                if (Game1.IsServer)
                {
                    this.receiveChatMessage(textToSend, Game1.player.uniqueMultiplayerID);
                }
            }
IL_258:
            sender.Text = "";
            this.clickAway();
        }
Example #25
0
        public void textBoxEnter(TextBox sender)
        {
            if (Game1.IsMultiplayer && sender.Text.Length > 0)
            {
                string text = sender.Text.Trim();
                if (text.Length < 1)
                {
                    return;
                }
                if (text[0] == '/' && text.Split(new char[]
                {
                    ' '
                })[0].Length > 1)
                {
                    try
                    {
                        string text2 = text.Split(new char[]
                        {
                            ' '
                        })[0].Substring(1);
                        uint num = < PrivateImplementationDetails >.ComputeStringHash(text2);
                        if (num <= 1013213428u)
                        {
                            if (num != 355814093u)
                            {
                                if (num != 405908334u)
                                {
                                    if (num != 1013213428u)
                                    {
                                        goto IL_214;
                                    }
                                    if (!(text2 == "texture"))
                                    {
                                        goto IL_214;
                                    }
                                    Game1.player.Sprite.Texture = Game1.content.Load <Texture2D>("Characters\\" + text.Split(new char[]
                                    {
                                        ' '
                                    })[1]);
                                    goto IL_231;
                                }
                                else if (!(text2 == "nick"))
                                {
                                    goto IL_214;
                                }
                            }
                            else if (!(text2 == "nickname"))
                            {
                                goto IL_214;
                            }
                        }
                        else if (num <= 2180167635u)
                        {
                            if (num != 1158129075u)
                            {
                                if (num != 2180167635u)
                                {
                                    goto IL_214;
                                }
                                if (!(text2 == "rename"))
                                {
                                    goto IL_214;
                                }
                            }
                            else
                            {
                                if (!(text2 == "othergirl"))
                                {
                                    goto IL_214;
                                }
                                Game1.otherFarmers.Values.ElementAt(0).Sprite.Texture = Game1.content.Load <Texture2D>("Characters\\farmergirl");
                                goto IL_231;
                            }
                        }
                        else if (num != 2369371622u)
                        {
                            if (num != 2723493283u)
                            {
                                goto IL_214;
                            }
                            if (!(text2 == "girl"))
                            {
                                goto IL_214;
                            }
                            Game1.player.Sprite.Texture = Game1.content.Load <Texture2D>("Characters\\farmergirl");
                            Game1.player.isMale         = false;
                            goto IL_231;
                        }
                        else if (!(text2 == "name"))
                        {
                            goto IL_214;
                        }
                        MultiplayerUtility.sendNameChange(text.Substring(text.IndexOf(' ') + 1), Game1.player.uniqueMultiplayerID);
                        goto IL_231;
IL_214:
                        this.receiveChatMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:ChatBox.cs.10261", new object[0]), 0L);
IL_231:
                        goto IL_27B;
                    }
                    catch (Exception)
                    {
                        this.receiveChatMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:ChatBox.cs.10262", new object[0]), 0L);
                        goto IL_27B;
                    }
                }
                MultiplayerUtility.sendChatMessage(text, Game1.player.uniqueMultiplayerID);
                if (Game1.IsServer)
                {
                    this.receiveChatMessage(text, Game1.player.uniqueMultiplayerID);
                }
            }
IL_27B:
            sender.Text = "";
            this.clickAway();
        }