Пример #1
0
        public static bool MassHarvest(BaseObject[] plots)
        {
            Game.Requests.BatchRequest req = new Game.Requests.BatchRequest("laughy") { SessionInfo = new Game.Requests.BasicSessionInfo(float.NaN, Program.Instance.GameSession.ServerSession.Token, Program.Instance.GameSession.ServerSession.FlashRevision, Program.Instance.GameSession.ServerSession.FbId) };
            foreach ( PlotObject plot in plots )
                req.BatchedRequests.Add(new Game.Requests.HarvestPlotSubRequest(1, plot));
            Bot.Server.ServerSession.BlockingCallback result = Program.Instance.GameSession.ServerSession.MakeBlockingRequest(req);

            object[] dataArray;

            if (!Bot.Server.ServerSession.GetRequestData(result, out dataArray))
                return false;
            for (int x = 0; x < dataArray.Length; x++)
            {
                PlotObject curPlot = plots[x] as PlotObject;
                if (!curPlot.OnHarvestResult(req.BatchedRequests[x] as Game.Requests.HarvestPlotSubRequest, dataArray[x] as FluorineFx.ASObject))
                    return false;
            }

            return true;
        }
Пример #2
0
        public static bool MassPlant(BaseObject[] plots, string seedName, bool usePicker = true)
        {
            Game.Requests.BatchRequest req = new Game.Requests.BatchRequest("laughy") { SessionInfo = new Game.Requests.BasicSessionInfo(float.NaN, Program.Instance.GameSession.ServerSession.Token, Program.Instance.GameSession.ServerSession.FlashRevision, Program.Instance.GameSession.ServerSession.FbId) };
            foreach (PlotObject plot in plots)
            {
                if (!usePicker)
                    req.BatchedRequests.Add(new Game.Requests.PlantPlotSubRequest(1, plot, seedName));
                else
                    req.BatchedRequests.Add(new Game.Requests.PlantPlotSubRequest(1, plot, Bot.Scripts.ScriptManager.Instance.Main.SeedPicker.PickSeed(plot)));
            }
            Bot.Server.ServerSession.BlockingCallback result = Program.Instance.GameSession.ServerSession.MakeBlockingRequest(req);
            object[] dataArray;
            if (!Bot.Server.ServerSession.GetRequestData(result, out dataArray))
                return false;

            for (int x = 0; x < dataArray.Length; x++)
            {
                PlotObject curPlot = plots[x] as PlotObject;
                FluorineFx.ASObject firstObject = dataArray[x] as FluorineFx.ASObject;
                if (!curPlot.OnPlantResult(req.BatchedRequests[x] as Game.Requests.PlantPlotSubRequest, firstObject))
                    return false;
            }
            return true;
        }