Exemplo n.º 1
0
        public static void setConfig(Player p, Patch patch)
        {
            int[]   bounds  = getIndexBoundaries(patch);
            Patch[] patches = Server.getGlobalObjects().getFarmingPatches().getPatchesForPlayer(p, bounds[0], bounds[1]);
            int     config  = 0;

            for (int i = 0; i < patches.Length; i++)
            {
                if (patches[i] != null && !patches[i].isSapling())
                {
                    config += (patches[i].getConfigElement(patches[i].getStatus()) * patches[i].getMultiplyer());
                }
            }
            p.getPackets().sendConfig(patch.getConfigId(), config);
        }
Exemplo n.º 2
0
        private static int[] getIndexBoundaries(Patch patch)
        {
            int[] indexes = new int[2];
            switch (patch.getConfigId())
            {
            case 504:                 // Catherby + Draynor allotments
                indexes[0] = 0;
                indexes[1] = 3;
                break;

            case 505:                 // Ardougne + Canifis allotments
                indexes[0] = 4;
                indexes[1] = 7;
                break;

            case 515:                 // Herb patches
                indexes[0] = 8;
                indexes[1] = 11;
                break;

            case 508:                 // Flower patches
                indexes[0] = 12;
                indexes[1] = 15;
                break;

            case 502:                 // Tree patches
                indexes[0] = 16;
                indexes[1] = 19;
                break;

            case 503:                 // Fruit tree patches
                indexes[0] = 20;
                indexes[1] = 23;
                break;
            }
            return(indexes);
        }