Example #1
0
        public TradePrices(ScrollsPost.Mod mod, TradeSystem trade)
        {
            this.mod = mod;
            this.trade = trade;

            new Thread(new ThreadStart(CheckData)).Start();
        }
Example #2
0
        public CollectionSync(ScrollsPost.Mod mod)
        {
            this.mod = mod;
            this.config = mod.config;

            App.Communicator.addListener(this);
        }
Example #3
0
        public ReplayLogger(ScrollsPost.Mod mod)
        {
            this.mod = mod;
            App.Communicator.addListener(this);

            replayFolder = this.mod.OwnFolder() + Path.DirectorySeparatorChar + "replays";
            if( !Directory.Exists(replayFolder + Path.DirectorySeparatorChar) ) {
                Directory.CreateDirectory(replayFolder + Path.DirectorySeparatorChar);
            }

            uploadCachePath = replayFolder + Path.DirectorySeparatorChar + "upload-cache";
        }
Example #4
0
        public ReplayRunner(ScrollsPost.Mod mod, String path)
        {
            this.mod = mod;
            // Convert a .sgr replay to .spr
            if( path.EndsWith(".sgr") ) {
                path = ConvertScrollsGuide(path);
            }

            this.replayPrimaryPath = path;
            this.primaryType = path.EndsWith("-white.spr") ? "white" : "black";

            // Check if we have both perspectives available to us
            String secondary = path.EndsWith("-white.spr") ? path.Replace("-white.spr", "-black.spr") : path.Replace("-black.spr", "-white.spr");
            if( File.Exists(secondary) ) {
                this.replaySecondaryPath = secondary;
            } else if( !secondary.Contains(mod.replayLogger.replayFolder) ) {
                // In case we're playing a replay from the download folder but we have the primary in our replay folder
                secondary = mod.replayLogger.replayFolder + Path.DirectorySeparatorChar + Path.GetFileName(secondary);
                if( File.Exists(secondary) ) {
                    this.replaySecondaryPath = secondary;
                }
            }

            // Always make sure the white is the primary as that person starts off the game
            if( !String.IsNullOrEmpty(this.replaySecondaryPath) && this.primaryType.Equals("black") ) {
                path = this.replayPrimaryPath;
                this.replayPrimaryPath = this.replaySecondaryPath;
                this.replaySecondaryPath = path;
                this.primaryType = "white";
            }

            GUISkin skin = (GUISkin)Resources.Load("_GUISkins/LobbyMenu");
            this.buttonStyle = skin.button;
            this.buttonStyle.normal.background = this.buttonStyle.hover.background;
            this.buttonStyle.normal.textColor = new Color(1f, 1f, 1f, 1f);
            this.buttonStyle.fontSize = (int)((10 + Screen.height / 72) * 0.65f);

            this.buttonStyle.hover.textColor = new Color(0.80f, 0.80f, 0.80f, 1f);

            this.buttonStyle.active.background = this.buttonStyle.hover.background;
            this.buttonStyle.active.textColor = new Color(0.60f, 0.60f, 0.60f, 1f);

            this.speedButtonStyle = new GUIStyle(this.buttonStyle);
            this.speedButtonStyle.fontSize = (int)Math.Round(this.buttonStyle.fontSize * 0.80f);

            this.realTimeButtonStyle = new GUIStyle(this.buttonStyle);
            this.realTimeButtonStyle.fontSize = (int)Math.Round(this.buttonStyle.fontSize * 1.20f);

            sceneLoaded = false;
            playerThread = new Thread(new ThreadStart(Start));
            playerThread.Start();
        }
Example #5
0
        public ConfigManager(ScrollsPost.Mod mod)
        {
            //this.mod = mod;

            // Setup the directory to start with
            String path = mod.OwnFolder() + Path.DirectorySeparatorChar + "config";
            if( !Directory.Exists(path + Path.DirectorySeparatorChar) ) {
                Directory.CreateDirectory(path + Path.DirectorySeparatorChar);
            }

            configPath = String.Format("{0}{1}config{1}{2}.json", mod.OwnFolder(), Path.DirectorySeparatorChar, App.MyProfile.ProfileInfo.id);

            Load();
        }
Example #6
0
        public PriceCheck(ScrollsPost.Mod mod, String period, String search)
        {
            this.mod = mod;

            WebClient wc = new WebClient();
            wc.DownloadStringCompleted += (sender, e) => {
                Loaded(search, e);
            };

            try {
                wc.DownloadStringAsync(new Uri("http://api.scrollspost.com/v1/price/" + period + "/" + search + "?formatting=1"));
            } catch ( WebException we ) { // eeeeeeeeeeeeeeee
                mod.SendMessage("We had an error while loading price info, contact us at [email protected] for help.");
                mod.WriteLog("Failed to load price check", we);
            }
        }
Example #7
0
        public ReplayRunner(ScrollsPost.Mod mod, String path, GameSocket gs)
        {
            this.mod = mod;
            this.gs = gs;
            // Convert a .sgr replay to .spr
            if( path.EndsWith(".sgr") ) {
                path = ConvertScrollsGuide(path);
            }

            this.replayPrimaryPath = path;
            this.primaryType = path.EndsWith("-white.spr") ? "white" : "black";

            // Check if we have both perspectives available to us
            String secondary = path.EndsWith("-white.spr") ? path.Replace("-white.spr", "-black.spr") : path.Replace("-black.spr", "-white.spr");
            if( File.Exists(secondary) ) {
                this.replaySecondaryPath = secondary;
            } else if( !secondary.Contains(mod.replayLogger.replayFolder) ) {
                // In case we're playing a replay from the download folder but we have the primary in our replay folder
                secondary = mod.replayLogger.replayFolder + Path.DirectorySeparatorChar + Path.GetFileName(secondary);
                if( File.Exists(secondary) ) {
                    this.replaySecondaryPath = secondary;
                }
            }

            // Always make sure the white is the primary as that person starts off the game
            if( !String.IsNullOrEmpty(this.replaySecondaryPath) && this.primaryType.Equals("black") ) {
                path = this.replayPrimaryPath;
                this.replayPrimaryPath = this.replaySecondaryPath;
                this.replaySecondaryPath = path;
                this.primaryType = "white";
            }

            GUISkin skin = (GUISkin)Resources.Load("_GUISkins/LobbyMenu");
            this.buttonStyle = skin.button;
            this.buttonStyle.normal.background = this.buttonStyle.hover.background;
            this.buttonStyle.normal.textColor = new Color(1f, 1f, 1f, 1f);
            this.buttonStyle.fontSize = (int)((10 + Screen.height / 72) * 0.65f);

            this.buttonStyle.hover.textColor = new Color(0.80f, 0.80f, 0.80f, 1f);

            this.buttonStyle.active.background = this.buttonStyle.hover.background;
            this.buttonStyle.active.textColor = new Color(0.60f, 0.60f, 0.60f, 1f);

            this.speedButtonStyle = new GUIStyle(this.buttonStyle);
            this.speedButtonStyle.fontSize = (int)Math.Round(this.buttonStyle.fontSize * 0.80f);

            this.realTimeButtonStyle = new GUIStyle(this.buttonStyle);
            this.realTimeButtonStyle.fontSize = (int)Math.Round(this.buttonStyle.fontSize * 1.20f);

            sceneLoaded = false;

            deselectMethod = typeof(BattleMode).GetMethod("deselectAllTiles", BindingFlags.Instance | BindingFlags.NonPublic);
            effectField = typeof(BattleMode).GetField("currentEffect", BindingFlags.NonPublic | BindingFlags.Instance);
            animFrameField = typeof(AnimPlayer).GetField("_fframe", BindingFlags.NonPublic | BindingFlags.Instance);
            nextMessageMethod = typeof(MiniCommunicator).GetMethod("_handleMessage", BindingFlags.NonPublic | BindingFlags.Instance);
            //tmpUpdate = typeof(ThreadedMessageParser).GetMethod("update", BindingFlags.NonPublic | BindingFlags.Instance);
            dispatchMessages = typeof(MiniCommunicator).GetMethod("_dispatchMessageToListeners", BindingFlags.NonPublic | BindingFlags.Instance);
            Console.WriteLine("start replay");

            playerThread = new Thread(new ThreadStart(Start));
            playerThread.Start();
        }
Example #8
0
 //private AccountVerifier verifier;
 public ConfigGUI(ScrollsPost.Mod mod)
 {
     this.mod = mod;
     this.config = mod.config;
 }
Example #9
0
 public DeckManager(ScrollsPost.Mod mod)
 {
     this.mod = mod;
     buttonSkin = (GUISkin) Resources.Load("_GUISkins/Lobby");
 }