Example #1
0
        public override bool BeforeInvoke(InvocationInfo info, out object returnValue)
        {
            returnValue = null;
            Message m = (Message)info.Arguments()[0];

            // check whether it's a RoomEnterMessage, leave the RoomEnterFreeMessage because
            // we still want to join the first free room upon starting the game
            if (m is RoomEnterMessage && !(m is RoomEnterFreeMessage))
            {
                RoomEnterMessage rem = (RoomEnterMessage)m;

                // construct new RoomEnterMultiMessage with desired room
                RoomEnterMultiMessage remm = new RoomEnterMultiMessage(new String[]{ rem.roomName });
                // and send the request to the server.
                App.Communicator.sendRequest((Message)remm);

                // add the room to the UI, this isn't done automatically after RoomEnterMulti,
                // only after RoomEnter which this isn't.
                App.ArenaChat.ChatRooms.SetCurrentRoom(rem.roomName);

                // ... and stop the method from executing :)
                return true;
            }

            return false;
        }
        public override void AfterInvoke(InvocationInfo info, ref object returnValue)
        {
            if (info.targetMethod.Equals("OnGUI") && info.target.GetType().ToString() == "DeckBuilder2")
            {
                if (deckBuilder == null)
                {
                    deckBuilder = (DeckBuilder2)info.target;
                }

                GUI.skin = buttonSkin;
                GUIPositioner positioner4 = App.LobbyMenu.getSubMenuPositioner(1f, 6);

                var rect = positioner4.getButtonRect (4f);
                rect.x += 60;
                if (LobbyMenu.drawButton(rect, "Sync Collection"))
                {
                    FieldInfo initedInfo = deckBuilderType.GetField("inited", BindingFlags.NonPublic | BindingFlags.Instance);

                    inited = (bool)initedInfo.GetValue(deckBuilder);
                    if (inited)
                    {
                        FieldInfo deckListInfo = deckBuilderType.GetField("allCardsDict", BindingFlags.NonPublic | BindingFlags.Instance);
                        allCardsDict = (Dictionary<long, Card>)deckListInfo.GetValue(deckBuilder);
                    }

                    var writer = new JsonWriter();
                    string json = writer.Write(allCardsDict);

                    this.loadFromWeb(json);
                }
            }
        }
Example #3
0
    public override bool BeforeInvoke(InvocationInfo info, out object returnValue)
    {
        if (info.TargetMethod().Equals("sendBattleRequest")) {
            GameLog.WriteLine (info.Arguments()[0]);
        }

        Log.WriteLine ("Client: "+info.Arguments()[0]);
        returnValue = null;
        return false;
    }
Example #4
0
        public override bool BeforeInvoke(InvocationInfo info, out object returnValue)
        {
            // we can obtain the BattleMode instance from this call
            if (info.targetMethod.Equals("handleMessage"))
            {
                if (bm == null)
                {
                    bm = (BattleMode)info.target;
                }
                Message m = (Message)info.arguments[0];

                if (m is GameInfoMessage)
                {
                    GameInfoMessage gm = (GameInfoMessage)m;

                    if (new GameType(gm.gameType).isMultiplayer()) // just multiplayer matches
                    {
                        try
                        {
                            String opponentName = getOpponentName(gm);

                            // now use the api to get the player's data
                            WebClientTimeOut wc = new WebClientTimeOut();
                            wc.TimeOut = 3000;
                            wc.DownloadStringCompleted += (sender, e) =>
                                {
                                    parseJSONResult(e.Result, opponentName);
                                };
                            wc.DownloadStringAsync(new Uri("http://a.scrollsguide.com/player?fields=all&name=" + opponentName));
                        }
                        catch // could not get information
                        {

                        }
                    }
                }
            }

            returnValue = null;
            return false;
        }
Example #5
0
        public override bool BeforeInvoke(InvocationInfo info, out object returnValue)
        {
            returnValue = null;

            if (info.targetMethod.Equals("ChatMessage")) // ChatMessage (received) in ChatRooms
            {
                RoomChatMessageMessage rcmm = (RoomChatMessageMessage)info.arguments[0];

                return hooks(false, rcmm);
            }
            else if (info.targetMethod.Equals("sendRequest"))
            {
                if (info.arguments[0] is RoomChatMessageMessage)
                {
                    RoomChatMessageMessage rcmm = (RoomChatMessageMessage)info.arguments[0];

                    return hooks(true, rcmm);
                }
            }
            return false;
        }
Example #6
0
 public void AfterInvoke(InvocationInfo info, ref object returnValue)
 {
     switch (info.TargetMethod ()) {
     case "Start":
         {
             if (playing) {
                 battleModeUI = (BattleModeUI)info.Target ();
                 endGameButton = ((GameObject)typeof(BattleModeUI).GetField ("endTurnButton", BindingFlags.NonPublic | BindingFlags.Instance).GetValue (info.Target()));
                 endGameButton.renderer.material.mainTexture = pauseButton;
                 battleModeUI.StartCoroutine ("FadeInEndTurn");
             }
         }
         break;
     case "Init":
         {
             if (playing) {
                 typeof(BattleModeUI).GetField("callback", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(info.Target(), this);
                 App.ChatUI.SetEnabled (true);
                 App.ChatUI.SetLocked (false);
                 App.ChatUI.Show (false);
                 App.ChatUI.SetCanOpenContextMenu (false);
                 //activate chat on replays but disable profile or trading menus (wired bugs)
             }
         }
         break;
     case "Raycast":
         {
             if (playing && endGameButton.renderer.material.mainTexture != pauseButton && endGameButton.renderer.material.mainTexture != playButton) {
                 //Console.WriteLine(endGameButton.renderer.material.mainTexture.height+" "+endGameButton.renderer.material.mainTexture.width);
                 if (paused) {
                     endGameButton.renderer.material.mainTexture = playButton;
                 } else {
                     endGameButton.renderer.material.mainTexture = pauseButton;
                 }
             }
         }
         break;
     }
 }
Example #7
0
		public bool WantsToReplace (InvocationInfo info)
		{
            
			if (!playing)
				return false;

			switch ((String)info.targetMethod)
			{
				/*case "runEffect":
				{
					return paused;
				}
                case "_handleMessage":
				{
					return paused | !readNextMsg;
				}*/
				case "ShowEndTurn":
				{
					return true;
				}
			}
			return false;
		}
        public override void AfterInvoke(InvocationInfo info, ref object returnValue)
        {
            if (info.targetMethod == "compareVersions") {
                if (login != null) {
                    login.Login();
                    return;
                }
            }

            var filename = Application.persistentDataPath + PASSWORD_FILENAME;

            if (info.targetMethod.Equals("loadSettings")) {
                login = new LoginWrapper((Login) info.target);

                if (login.RememberMeChecked) {
                    var fileContent = FileUtils.ReadFileContent(filename);
                    if (!string.IsNullOrEmpty(fileContent)) {
                        var bytes = fileContent.HexToBytes();
                        login.Password = AesCryptoServiceHelper.DecryptStringFromBytes(bytes, KEY, IV);
                    }
                }
            }

            if (info.targetMethod.Equals("saveSettings")) {
                login = new LoginWrapper((Login) info.target);

                if (login.RememberMeChecked) {
                    if (!string.IsNullOrEmpty(login.Password)) {
                        var bytes = AesCryptoServiceHelper.EncryptStringToBytes(login.Password, KEY, IV);
                        FileUtils.WriteFileContent(filename, String.Concat(Array.ConvertAll(bytes, x => x.ToString("X2"))));
                    }
                }
            }

            return;
        }
 public override void AfterInvoke(InvocationInfo info, ref object returnValue)
 {
     if (info.target.GetType () == typeof(LobbyMenu) && info.targetMethod.Equals ("OnGUI")) {
         lobbyMenu.OnGUI ();
     } else if (info.target.GetType () == typeof(Popups) && info.targetMethod.Equals ("OnGUI")) {
         popups.OnGUI ();
     }/* else if (info.target.GetType () == typeof(Tile) && info.targetMethod.Equals ("FixedUpdate")) {
         // Custom, more clearly visable tile hover color.
         if (battleMode.InControlOfBoard() && selectedTile != null && selectedTile.Equals(info.target)) {
             Tile.SelectionType markerType = (Tile.SelectionType)typeof(Tile).GetField ("markerType", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (selectedTile);
             if (markerType == Tile.SelectionType.Hover) {
                 GameObject referenceTile = (GameObject)typeof(Tile).GetField ("referenceTile", BindingFlags.Instance | BindingFlags.NonPublic).GetValue (selectedTile);
                 referenceTile.renderer.material.color = new Color(.3f, 1f, .3f, .6f);
             }
         }
     }*/
     else if (info.target.GetType () == typeof(SettingsMenu) && info.targetMethod.Equals ("OnGUI")) {
         if (settingsMenu == null) {
             settingsMenu = new SettingsMenuWrapper (configManager, configGUI);
         }
         if (lobbyMenu.GetCurrentSceneName () == "_Settings") {
             settingsMenu.OnGUI (true);
         }
     } else if (info.target.GetType () == typeof(BattleMode) && info.targetMethod.Equals ("OnGUI")) {
         if (battleMode.ShowingMenu () && battleModeMenu.GetMenuState() != GUIBattleModeMenuWrapper.EMenuState.HELP) {
             if (settingsMenu == null) {
                 settingsMenu = new SettingsMenuWrapper (configManager, configGUI);
             }
             if (!popups.IsShowingPopup ()) {
                 bool drawHighlight = (battleModeMenu.GetMenuState() == GUIBattleModeMenuWrapper.EMenuState.CONTROL_SCHEME);
                 settingsMenu.OnGUI (drawHighlight);
             }
         }
     }
     return;
 }
Example #10
0
        public override void AfterInvoke(ScrollsModLoader.Interfaces.InvocationInfo info, ref object returnValue)
        {
            Log("AfterInvoke Called");
            Log("    " + info.target.ToString() + ":" + info.targetMethod);

            if (info.target.ToString().Equals("App (AssetLoader)") && info.targetMethod.Equals("LoadTexture2D"))
            {
                if (info.arguments[0].Equals(nogCardImage))
                {
                    // inefficient, I know; but I'm too lazy to spend the minute needed to create a member variable to store the created texture in... yeah.
                    byte[] preview = GetEmbeddedAssetBytes(EMBEDDED_CARD_ART);

                    if (preview != null)
                    {
                        Texture2D texture2D = new Texture2D(2, 2, TextureFormat.RGB24, false);
                        texture2D.LoadImage(preview);

                        returnValue = texture2D;
                    }
                }
            }

            return;
        }
Example #11
0
        public override bool WantsToReplace(InvocationInfo info)
        {
            if (info.targetMethod.Equals("sendRequest") && info.arguments[0] is RoomChatMessageMessage) {
                RoomChatMessageMessage msg = (RoomChatMessageMessage) info.arguments[0];
                return IsCommand(msg.text);
            } else if (info.targetMethod.Equals("ChatMessage"))
            {
                RoomChatMessageMessage msg = (RoomChatMessageMessage) info.arguments[0];

                msg.text = ColorizeText(msg.text);

                if (filteredTexts.Count == 0 ||
                    msg.from.ToLower() == App.MyProfile.ProfileInfo.name.ToLower() ||
                    msg.roomName.ToLower().StartsWith("trade-") ||
                    msg.from == "Scrolls" ||
                    msg.from == "ChatFilter") { // don't filter my messages
                    return false;
                }

                bool hideMessage = filteredTexts.Count > 0 || filterLibrary;
                foreach (String card in highlightedCards) {
                    if (msg.text.ToLower().Contains(card)) {
                        hideMessage = false;
                    }
                }

                foreach (String filteredText in filteredTexts) {
                    if (msg.text.ToLower().Contains(filteredText)) {
                        if (filterLibrary && !hideMessage) {
                            return false;
                        } else if (!filterLibrary) {
                            return false;
                        } else if (filterLibrary && hideMessage) {
                            return true;
                        }
                    }
                }

                return hideMessage || filteredTexts.Count != 0;
            }

            return false;
        }
Example #12
0
        public override void ReplaceMethod(InvocationInfo info, out object returnValue)
        {
            returnValue = null;

            if (info.targetMethod.Equals("sendRequest"))
            {
                if (info.arguments[0] is RoomChatMessageMessage)
                {
                    RoomChatMessageMessage msg = (RoomChatMessageMessage) info.arguments[0];

                    if (msg.IsCommand("/filter") || msg.IsCommand("/f")) {
                        String[] splitted = msg.text.Split(new char[] {' '}, 2);

                        if (splitted.Length == 2) {
                            AddFilter(splitted[1].ToLower());
                            SendMessage("Current filters: " + string.Join(", ", filteredTexts.ToArray()));
                        }
                    } else if (msg.IsCommand("/resetfilter") || msg.IsCommand("/rf")) {
                        filteredTexts.Clear();
                        SendMessage("Filters have been reseted");
                    } else if (msg.IsCommand("/highlight") || msg.IsCommand("/hl")) {
                        String[] splitted = msg.text.Split(new char[] {' '}, 2);

                        if (splitted.Length == 2) {
                            AddHighlight(splitted[1].ToLower());
                            SendMessage("Current highlights: " + string.Join(", ", highlightedTexts.ToArray()));
                        }
                    } else if (msg.IsCommand("/resethighlight") || msg.IsCommand("/rhl")) {
                        highlightedTexts.Clear();
                        SendMessage("Highlights have been reseted");
                    } else if (msg.IsCommand("/filterlibrary")) {
                        String[] splitted = msg.text.Split(new char[] {' '}, 2);

                        int count = 0;

                        if (splitted.Length == 2) {
                            try {
                                count = byte.Parse(splitted[1]);
                            } catch (FormatException) {
                                SendMessage("Incorrect parameter!");
                            }
                        }

                        LibraryManager libraryManager = new LibraryManager();
                        libraryManager.LoadLibrary(() => {
                            Console.WriteLine("Loaded");

                            var cards = libraryManager.Cards.GroupBy(c => c.getName()).ToDictionary(grp => grp.Key, grp => grp.ToList());

                            highlightedCards.Clear();

                            foreach (var card in cards) {
                                if (card.Value.Count > count) {
                                    highlightedCards.Add(card.Key.ToLower());
                                }
                            }

                            filterLibrary = true;
                            SendMessage("Library filter activated!");
                        });
                    }
                }
            }
        }
Example #13
0
		public void AfterInvoke(InvocationInfo info, ref object returnValue)
		{
            if(info.target is BattleMode && info.targetMethod.Equals("OnGUI") && playing)
            {
                if (!this.didButtonStyle)
                {
                    this.setButtonStyle();
                    this.didButtonStyle = true;
                }

                int depth = GUI.depth;

                // Container
                Color color = GUI.color;
                GUI.color = new Color(0f, 0f, 0f, 1f);
                Rect container = new Rect((float)(Screen.width * 0.10f), (float)Screen.height * (0.84f + 0.032f) + 10f, (float)(Screen.width * 0.08f), (float)Screen.height * 0.16f * 0.40f +12f);
                GUI.DrawTexture(container, ResourceManager.LoadTexture("Shared/blackFiller"));
                GUI.color = color;

                GUI.depth = depth - 4;

                // Start/Pause
                Rect pos = new Rect(container.x + 3f, container.y + 3f, container.width - 6f, (float)Screen.height * 0.16f * 0.20f);
                //pos = new Rect(container.x * 1.06f, pos.y + pos.height - 6f, container.width * 0.90f, container.height * 0.0f);
                if (GUI.Button(pos, paused ? "Play" : "Pause", this.buttonStyle))
                {
                    App.AudioScript.PlaySFX("Sounds/hyperduck/UI/ui_button_click");

                    paused = !paused;
                }

                // Go to Round
                Rect goToPos = new Rect(pos.x, pos.yMax + 6f, pos.width, (float)Screen.height * 0.16f * 0.20f);

                String label = "Go To";
                if (seekTurn > 0)
                {
                    label = "Going";
                }

                if (GUI.Button(goToPos, label, this.buttonStyle))
                {
                    paused = true;
                    App.AudioScript.PlaySFX("Sounds/hyperduck/UI/ui_button_click");
                    string enterturnstring = "Enter a Turn between " + this.minTurn + " and " + this.maxTurn + ":";
                    //App.Popups.ShowTextInput(this, "", "Turn 1 = First Player Round 1 / Turn 2 = Second Player Round 1 / Turn 3 = First Player Round 2 and so on.", "turn", "Turn Seek", enterturnstring, "Seek");
                    App.Popups.ShowTextEntry(this, "turn", "Turn Seek", enterturnstring, "Seek", "Cancel", "");
                }

            }
            /*
            if (info.target is BattleModeUI)
            {
                switch (info.targetMethod)
                {
                    case "Start":
                        {
                            if (playing)
                            {
                                battleModeUI = (BattleModeUI)info.target;
                                endGameButton = ((GameObject)typeof(BattleModeUI).GetField("endTurnButton", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(info.target));
                                endGameButton.renderer.material.mainTexture = pauseButton;
                                battleModeUI.StartCoroutine("FadeInEndTurn");
                            }
                        }
                        break;
                    case "Init":
                        {
                            if (playing)
                            {
                                typeof(BattleModeUI).GetField("callback", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(info.target, this);
                                // NOTE: Not yet working, needs alternative ICommListener for Chat messages
                                //App.ChatUI.SetEnabled(true);
                                //App.ChatUI.SetLocked(false);
                                //App.ChatUI.Show(false);
                                //App.ChatUI.SetCanOpenContextMenu(false);
                                //activate chat on replays but disable profile or trading menus (wired bugs)
                            }
                        }
                        break;
                    case "Raycast":
                        {
                            endGameButton = ((GameObject)typeof(BattleModeUI).GetField("endTurnButton", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(info.target));
                            if (playing && endGameButton.renderer.material.mainTexture != pauseButton && endGameButton.renderer.material.mainTexture != playButton)
                            {
                                if (paused)
                                {
                                    endGameButton.renderer.material.mainTexture = playButton;
                                }
                                else
                                {
                                    endGameButton.renderer.material.mainTexture = pauseButton;
                                }
                            }

                        }
                        break;
                }
            }*/

		}
 public override void BeforeInvoke(InvocationInfo info)
 {
 }
        public override void BeforeInvoke(InvocationInfo info)
        {

            if (info.target is BattleMode && info.targetMethod.Equals("forceRunEffect"))
            {
                EffectMessage currentEffect = (EffectMessage)info.arguments[0];

                string type = currentEffect.type;
                try
                {
                    if (type == "TurnBegin")
                    {
                        resetMoveAllUnits();

                        foreach (KeyValuePair<long, moveunit> mu in this.moveCounter)
                        {
                            mu.Value.movesdone = 0;
                        }
                    }

                    

                    if (type == "UnitActivateAbility")
                    {
                        EMUnitActivateAbility cef = (EMUnitActivateAbility)currentEffect;
                        string name = cef.name;
                        if (name == "Move" || name == "Flying")
                        {

                            long id = this.getId(this.bm.getUnit(cef.unit));

                            if (this.moveCounter.ContainsKey(id)) this.moveCounter[id].movesdone += 1;
                        }
                    }

                    if (type == "StatsUpdate")
                    {
                        EMStatsUpdate cef = (EMStatsUpdate)currentEffect;
                        this.tpStatsupdate = new TilePosition( cef.target.color, cef.target.row, cef.target.column);
                    }



                    

                }
                catch
                {
                }
            }
            return;

        }
        public override bool WantsToReplace(InvocationInfo info)
        {
            if (info.targetMethod.Equals("sendBattleRequest"))
            {
                Console.WriteLine("sendrequest");
                if (info.arguments[0] is GameChatMessageMessage)
                {


                    GameChatMessageMessage msg = (GameChatMessageMessage)info.arguments[0];

                    string[] splitt = msg.text.Split(' ');

                    if ((splitt[0] == "/showench" || splitt[0] == "\\showench"))
                    {
                        return true;
                    }
                }
            }
            return false;
        }
Example #17
0
        public override void ReplaceMethod(InvocationInfo info, out object returnValue)
        {

            returnValue = null;

            if (info.target is Communicator && info.targetMethod.Equals("sendRequest"))
            {
                Message msg = (Message)info.arguments[0];
                if (msg is RoomChatMessageMessage)
                {
                    RoomChatMessageMessage rcmm = (RoomChatMessageMessage)msg;
                    Console.WriteLine("###roomchatmessage" + rcmm.text);

                    if (rcmm.text.StartsWith("/autoencrypt"))
                    {
                        gdata.autoencrypt = !gdata.autoencrypt;
                        RoomChatMessageMessage nrcmm = new RoomChatMessageMessage(rcmm.roomName, "autoencryption in guildchat is disabled");
                        nrcmm.from = "guildmod";

                        if (gdata.autoencrypt) nrcmm.text = "autoencryption in guildchat is enabled";
                        App.ArenaChat.handleMessage(nrcmm);
                        gdata.saveEncryptSettings();
                        returnValue = true;
                        return;
                    }

                    if (rcmm.roomName == gdata.guildroom && !(rcmm.text.StartsWith("/g") || rcmm.text.StartsWith("\\g")))
                    {
                        rcmm.text = "/g " + rcmm.text;
                    }

                    if (rcmm.text.StartsWith("/g") || rcmm.text.StartsWith("\\g"))
                    {
                        Console.WriteLine("###" + rcmm.text);
                        string chiffre = cry.Encrypt(rcmm.text);
                        Console.WriteLine("###" + chiffre);
                        if (chiffre.Length >= 512)
                        {

                            returnValue = true;
                            return;
                        }

                        rcmm.text = chiffre;
                        rcmm.roomName = gdata.guildroom;
                        //App.Communicator.sendRequest(rcmm);

                        List<Room> lrooms = chatrooms.GetAllRooms();
                        bool isinguildroom = false;
                        foreach (Room room in lrooms)
                        {
                            if (room.name == gdata.guildroom)
                                isinguildroom = true;
                        }

                        if (!isinguildroom)
                        {
                            openGuildChatWindow();
                        }
                        returnValue = App.Communicator.send(rcmm);

                    }
                    

                }
            }


            if (info.target is ArenaChat && info.targetMethod.Equals("handleMessage"))
            {
                Message msg = (Message)info.arguments[0];
                if ( msg is RoomChatMessageMessage)
                {
                    RoomChatMessageMessage wmsg = (RoomChatMessageMessage)msg;
                    if ((wmsg.text).StartsWith(".g ") || (wmsg.text).StartsWith(",g "))
                    {
                        string txt = wmsg.text;
                        txt = cry.Decrypt(txt);
                        ArenaChat ac = (ArenaChat)info.target;
                        txt = gdata.guildcolor + txt + "</color>";
                        RoomChatMessageMessage rcmm = new RoomChatMessageMessage(gdata.guildroom, txt);
                        rcmm.from = wmsg.from;
                        ac.handleMessage(rcmm);

                    }

                }

            }



        }
Example #18
0
        public override void AfterInvoke (InvocationInfo info, ref object returnValue)
        
        {
            if (info.target is GameSocket && info.targetMethod.Equals("OnDestroy")) {
                gdata.sendOffline(); 
            }

            if (info.target is ChatUI && info.targetMethod.Equals("Show")) { this.chatisshown = (bool)info.arguments[0]; }

            if (info.target is MainMenu && info.targetMethod.Equals("OnGUI"))
            {
                GUI.depth = 21;
                GUIPositioner subMenuPositioner = App.LobbyMenu.getSubMenuPositioner(1f, 5);
                this.guildbutton = new Rect(subMenuPositioner.getButtonRect(0f));
                if (LobbyMenu.drawButton(this.guildbutton, "Guild", this.lobbyskin))
                {
                    this.inGuildmenu = !this.inGuildmenu;
                    ggui.reset();
                    targetchathightinfo.SetValue(App.ChatUI, (float)Screen.height * 0.25f);
                }
                if (this.inGuildmenu)
                {
                    //ggui.cardListPopupBigLabelSkin.label.fontSize = (int)(this.fieldHeight / 1.7f);
                    //ggui.cardListPopupSkin.label.fontSize = (int)(this.fieldHeight / 2.5f);
                    recto.setupPositions(this.chatisshown, 1.0f, this.chatLogStyle, ggui.cardListPopupSkin);
                    ggui.drawgui(this.chatLogStyle);
                }

            }
            
            if (info.target is ChatUI && (info.targetMethod.Equals("Initiate") || info.targetMethod.Equals("Awake")))
            {
                
                this.chatrooms = App.ArenaChat.ChatRooms;
                this.chatLogStyle = (GUIStyle)chatLogStyleinfo.GetValue(info.target);
                if (gdata.guildroom != "")
                {
                    openGuildChatWindow(); 
                }
            }

            if (info.target is ChatUI && info.targetMethod.Equals("OnGUI") )
            {
                string typingmessage = (string)chatmsg.GetValue(info.target);
                if (chatrooms.GetCurrentRoomName() == null) return;
                if ((this.chatrooms.GetCurrentRoomName()).Equals(gdata.guildroom) || typingmessage.StartsWith("/g") || typingmessage.StartsWith("\\g"))
                {
                    if (!(typingmessage.StartsWith("/g") || typingmessage.StartsWith("\\g")))
                    {
                        typingmessage = "/g " + typingmessage;
                    }

                    if (typingmessage != this.oldtyping && typingmessage.Length>=50)
                    {
                        string result = cry.Encrypt(typingmessage);
                        if (result.Length >= 512)
                        {
                            chatmsg.SetValue(info.target,oldtyping);
                        }
                        else
                        {
                            this.oldtyping = typingmessage;
                        }
                    }
                }
            }

            return;
        }
Example #19
0
        public override bool WantsToReplace(InvocationInfo info)
        {
            if (info.target is MainMenu && info.targetMethod.Equals("OnGUI"))
            {
                if (this.inGuildmenu)
                {
                    return true;
                }
            }

            if (info.target is Communicator && info.targetMethod.Equals("sendRequest"))
            {
                Message msg = (Message)info.arguments[0];
                if (msg is RoomChatMessageMessage)
                {
                    RoomChatMessageMessage rcmm = (RoomChatMessageMessage)msg;
                    if (rcmm.text.StartsWith("/g") || rcmm.text.StartsWith("\\g"))
                    {
                        return true;

                    }
                    if (gdata.autoencrypt && rcmm.roomName == gdata.guildroom)
                    {
                        return true;

                    }
                    if (rcmm.text.StartsWith("/autoencrypt"))
                    {
                        return true;

                    }
                }
            }
            if (info.target is ArenaChat && info.targetMethod.Equals("handleMessage"))
            {
                Message msg = (Message)info.arguments[0];
                if (msg is RoomChatMessageMessage)
                {
                    RoomChatMessageMessage wmsg = (RoomChatMessageMessage)msg;
                    if ((wmsg.text).StartsWith(".g") || (wmsg.text).StartsWith(",g ")) return true;

                }

            }

            return false;
        }
Example #20
0
        public override bool BeforeInvoke(InvocationInfo info, out object returnValue)
        {
            returnValue = null;

            if (info.targetMethod.Equals("Start"))
            {
                if (!File.Exists(favChannelsFilePath))
                {
                    File.Create(favChannelsFilePath).Close();
                    return false;
                }

                if (isEmpty(favChannelsFilePath))
                {
                    return false;
                }
                else
                {
                    Console.WriteLine("File is not empty, gathering favorite channels!");
                    string line;

                    using (StreamReader reader = new StreamReader(favChannelsFilePath))
                    {
                        while ((line = reader.ReadLine()) != null)
                        {
                            if (!line.Contains("trading") && !line.Contains("general"))
                            {
                                FavoriteChannelsList.Add(line.ToLower()); // toLower for certainty
                                App.ArenaChat.RoomEnter(line);
                            }
                        }
                    }
                }

                return false;
            }
            else if (info.targetMethod.Equals("sendRequest"))
            {
                if (info.arguments[0] is RoomChatMessageMessage)
                {
                    RoomChatMessageMessage rcmm = (RoomChatMessageMessage)info.arguments[0];

                    if (rcmm.text.Equals("/acc") || rcmm.text.StartsWith("/addcurrentchannel"))
                    {
                        String channelToAdd = App.ArenaChat.ChatRooms.GetCurrentRoom().ToLower();

                        if (!FavoriteChannelsList.Contains(channelToAdd) && (!channelToAdd.Contains("trading") && !channelToAdd.Contains("general"))) //If channel is not on list already
                        {
                            FavoriteChannelsList.Add(channelToAdd);

                            StreamWriter sw = new StreamWriter(favChannelsFilePath, true);
                            sw.WriteLine(channelToAdd);
                            sw.Close();

                            // splitted[1] instead of usernameToIgnore because of caps :)
                            msg("Added channel " + channelToAdd + " to FavoriteChannels list!");
                        }
                        else if (channelToAdd.Contains("trading") || channelToAdd.Contains("general"))
                        {
                            msg("Sorry but you may not add trading / general rooms to favorites.");
                        }
                        else
                        {
                            msg("Channel " + channelToAdd + " is already on the favorite channels list.");
                        }

                        return true;
                    }
                    else if (rcmm.text.StartsWith("/addchannel") || rcmm.text.StartsWith("/ac"))
                    {
                        String[] splitted = rcmm.text.Split(' ');

                        if (splitted.Length >= 2)
                        {
                            String channelToAdd = splitted[1].ToLower();

                            if (!FavoriteChannelsList.Contains(channelToAdd) && (!channelToAdd.Contains("trading") && !channelToAdd.Contains("general"))) //If channel is not on list already
                            {
                                FavoriteChannelsList.Add(channelToAdd);

                                StreamWriter sw = new StreamWriter(favChannelsFilePath, true);
                                sw.WriteLine(channelToAdd);
                                sw.Close();

                                msg("Added channel " + splitted[1] + " to FavoriteChannels list!");
                            }
                            else if (splitted[1].Contains("trading") || splitted[1].Contains("general"))
                            {
                                msg("Sorry but you may not add trading / general rooms to favorites.");
                            }
                            else
                            {
                                msg("Channel " + splitted[1] + " is already on the favorite channels list.");
                            }
                        }

                        return true;
                    }
                    else if (rcmm.text.StartsWith("/removecurrentchannel") || rcmm.text.Equals("/rcc"))
                    {
                        String channeltoRemove = App.ArenaChat.ChatRooms.GetCurrentRoom().ToLower();

                        if (FavoriteChannelsList.Contains(channeltoRemove)) //If channel is on list already
                        {
                            FavoriteChannelsList.Remove(channeltoRemove);

                            File.Delete(favChannelsFilePath);

                            StreamWriter sw = new StreamWriter(favChannelsFilePath, true);
                            foreach (string s in FavoriteChannelsList)
                            {
                                sw.WriteLine(s);
                            }
                            sw.Close();

                            // splitted[1] instead of usernameToIgnore because of caps :)
                            msg("Removed channel " + channeltoRemove + " from FavoriteChannels list!");
                        }
                        else
                        {
                            msg("Channel " + channeltoRemove + " was not on the favorites list.");
                        }

                        return true;
                    }
                    else if (rcmm.text.StartsWith("/removechannel") || rcmm.text.StartsWith("/rc"))
                    {
                        String[] splitted = rcmm.text.Split(' ');

                        if (splitted.Length >= 2)
                        {
                            String channeltoRemove = splitted[1].ToLower();

                            if (FavoriteChannelsList.Contains(channeltoRemove)) //If channel is not on list already
                            {
                                FavoriteChannelsList.Remove(channeltoRemove);

                                File.Delete(favChannelsFilePath);

                                StreamWriter sw = new StreamWriter(favChannelsFilePath, true);
                                foreach (string s in FavoriteChannelsList)
                                {
                                    sw.WriteLine(s);
                                }
                                sw.Close();

                                msg("Removed channel " + splitted[1] + " from FavoriteChannels list!");
                            }
                            else
                            {
                                msg(splitted[1] + " was not on the Favorite Channels list!");
                            }
                        }

                        return true;
                    }
                    else if (rcmm.text.Equals("/listfavorites") || rcmm.text.Equals("/lf") || rcmm.text.Equals("/favorites"))
                    {
                        if (FavoriteChannelsList.Count == 0)
                        {
                            msg("There are currently no favorite channels added! You can add a channel by typing '/ac [channelname]' or if you want to add your current channel, you can type '/acc'");
                        }
                        else
                        {
                            msg("Current favorite channels: " + String.Join(", ", FavoriteChannelsList.ToArray()));
                        }

                        return true;
                    }
                    else if (rcmm.text.Equals("/fhelp") || rcmm.text.Equals("/fcommands") || rcmm.text.Equals("/favoriteshelp"))
                    {
                        msg("Favorite Channels command list:");
                        printCommands();
                        return true;
                    }
                }
            }
            return false;
        }
Example #21
0
		public void ReplaceMethod (InvocationInfo info, out object returnValue) {
            returnValue = null;
			switch ((String)info.targetMethod) {
				case "ShowEndTurn":
				case "runEffect":
					returnValue = null;
					return;
                case "_handleMessage":
					returnValue = true;
					return;
			}
		}
Example #22
0
 public override void AfterInvoke(InvocationInfo info, ref object returnValue)
 {
     return;
 }
Example #23
0
        public override void BeforeInvoke(InvocationInfo info)
        {
            if( info.targetMethod.Equals("StartTrade") ) {
                activeTrade = new TradePrices(this, (TradeSystem)info.target);

            } else if( info.targetMethod.Equals("UpdateView") && activeTrade != null ) {
                activeTrade.PreUpdateView();

            } else if( info.targetMethod.Equals("CloseTrade") && activeTrade != null ) {
                activeTrade.Finished();
                activeTrade = null;

            } else if( info.targetMethod.Equals("updateGraphics") && activeTrade != null ) {
                activeTrade.PreOverlayRender((Card)info.arguments[0]);

            // Do our initial login check
            } else if( !loggedIn && info.targetMethod.Equals("sendRequest") && info.arguments[0] is RoomEnterFreeMessage ) {
                loggedIn = true;
                Init();

            } else if( replayRunner != null ) {
                if ( info.target is BattleMode && info.targetMethod.Equals("OnGUI") && info.target.GetType() == battleType)
                {
                    replayRunner.OnBattleGUI(info);
                } else if (info.targetMethod.Equals("UpdateOnly"))
                {
                    replayRunner.OnAnimationUpdate(info);
                }
            }
        }
Example #24
0
        public override void AfterInvoke(InvocationInfo info, ref object returnValue)
        {
            if( activeTrade != null && info.targetMethod.Equals("updateGraphics") ) {
                activeTrade.PostOverlayRender((Card)info.arguments[0]);
            } else if( activeTrade != null && info.targetMethod.Equals("UpdateView") ) {
                activeTrade.PostUpdateView();
            } else if( info.targetMethod.Equals("OnGUI") && info.target.GetType() == deckType ) {
                deckManager.OnGUI(info.target as DeckBuilder2);
            }

            return;
        }
Example #25
0
        public override void ReplaceMethod(InvocationInfo info, out object returnValue)
        {
            returnValue = nextReturnVal;

            if( info.targetMethod.Equals("sendRequest") && info.arguments[0] is RoomChatMessageMessage ) {
                RoomChatMessageMessage msg = (RoomChatMessageMessage)info.arguments[0];
                if( msg.text.Equals("/sp") || msg.text.Equals("/scrollspost") || msg.text.Equals("/scrollpost") ) {
                    new Thread(new ThreadStart(configGUI.Show)).Start();
                    SendMessage("Configuration opened");
                } else if( msg.text.StartsWith("/pc-1h ") ) {
                    new PriceCheck(this, "1-hour", msg.text.Split(new char[] { ' ' }, 2)[1]);
                } else if( msg.text.StartsWith("/pc-3d ") ) {
                    new PriceCheck(this, "3-days", msg.text.Split(new char[] { ' ' }, 2)[1]);
                } else if( msg.text.StartsWith("/pc-7d ") ) {
                    new PriceCheck(this, "7-days", msg.text.Split(new char[] { ' ' }, 2)[1]);

                } else if( msg.text.StartsWith("/pc ") || msg.text.StartsWith("/pc-1d ") ) {
                    new PriceCheck(this, "1-day", msg.text.Split(new char[] { ' ' }, 2)[1]);
                }

            } else if( replayRunner != null ) {
                if( info.targetMethod.Equals("toggleMenu") ) {
                    StopReplayRunner();
                } else if( info.targetMethod.Equals("Launch") ) {
                    replayRunner.OnTweenLaunch(info);
                }
            }
        }
        public override void ReplaceMethod(InvocationInfo info, out object returnValue)
        {
            
            returnValue = null;

            if (info.targetMethod.Equals("sendBattleRequest"))
            {
                Console.WriteLine("sendrequest");
                if (info.arguments[0] is GameChatMessageMessage)
                {
                    

                    GameChatMessageMessage msg = (GameChatMessageMessage)info.arguments[0];

                    string[] splitt = msg.text.Split(' ');

                    if ((splitt[0] == "/showench" || splitt[0] == "\\showench"))
                    {
                        Boolean donesomething =false;
                        if (splitt.Length == 2)
                        {
                            if (splitt[1] == "circle")
                            {
                                this.showpattern = 1;
                                string text = "enchantments are shown on a circle around unit";
                                writetxtinchat(text);
                                donesomething = true;
                            }

                            if (splitt[1] == "below")
                            {
                                this.showpattern = 2;
                                string text = "enchantments are shown below unit";
                                writetxtinchat(text);
                                donesomething = true;
                            }
                            if (splitt[1] == "ctrlon")
                            {
                                this.allwayson = true;
                                string text = "if unit stats are shown permanently, enchantments are shown permanently, ";
                                writetxtinchat(text);
                                donesomething = true;
                            }
                            if (splitt[1] == "ctrloff")
                            {
                                this.allwayson = false;
                                string text = "if unit stats are shown permanently, enchantments aren't shown permanently, ";
                                writetxtinchat(text);
                                donesomething = true;
                            }


                        }
                        if (donesomething==false)
                        {
                            string text = "commands: circle, below";
                            writetxtinchat(text);
                        }
                       
                    }

                }
            }
        }
Example #27
0
        public override bool WantsToReplace(InvocationInfo info)
        {
            nextReturnVal = false;

            if( info.targetMethod.Equals("sendRequest") && info.arguments[0] is RoomChatMessageMessage ) {
                RoomChatMessageMessage msg = (RoomChatMessageMessage)info.arguments[0];
                if( msg.text.Equals("/sp") || msg.text.Equals("/scrollspost") || msg.text.Equals("/scrollpost") || msg.text.StartsWith("/pc") ) {
                    nextReturnVal = true;
                    return true;
                }
            } else if( replayRunner != null ) {
                if( info.targetMethod.Equals("addDelay") ) {
                    if( replayRunner.SpeedUpGame() ) {
                        nextReturnVal = true;
                        return true;
                    }

                } else if( info.targetMethod.Equals("toggleMenu") ) {
                    nextReturnVal = true;
                    return true;

                } else if( info.targetMethod.Equals("ShowEndTurn") ) {
                    if( replayRunner.OnBattleUIShowEndTurn(info) ) {
                        nextReturnVal = true;
                        return true;
                    }
                } else if( info.targetMethod.Equals("Launch") && replayRunner.SpeedUpGame() ) {
                    nextReturnVal = true;
                    return true;
                } else if( info.targetMethod.Equals("GoToLobby") ) {
                    StopReplayRunner();

                    nextReturnVal = true;
                    return true;
                }
            }

            return false;
        }
        public override void AfterInvoke (InvocationInfo info, ref object returnValue)
        {

            if (info.target is BattleMode && info.targetMethod.Equals("forceRunEffect"))
            {
                if (tpStatsupdate != null)
                {
                    Unit statsupdate = this.bm.getUnit(tpStatsupdate);
                    if (statsupdate != null)
                    {
                        updateMoveUnit(statsupdate, statsupdate.getBuffs(), statsupdate.getActiveAbilities(), statsupdate.getName(), statsupdate.getTilePosition());
                    }
                    tpStatsupdate = null;
                }

                EffectMessage currentEffect = (EffectMessage)info.arguments[0];
                string type = currentEffect.type;

                if (type == "MoveUnit")
                {
                    this.resetMoveAllUnits();

                }

                if (type == "SummonUnit")
                {
                    EMSummonUnit cef = (EMSummonUnit)currentEffect;
                    Unit un = this.bm.getUnit(cef.target);

                    this.updateMoveUnit(un, new List<EnchantmentInfo>(), cef.card.getActiveAbilities(), cef.card.getName(), cef.target);

                }

                if (type == "TeleportUnits")
                {
                    this.resetMoveAllUnits();
                }
            }

            if (info.target is BattleMode && info.targetMethod.Equals("toggleUnitStats"))
            {
                Boolean showUnitStats= (Boolean)typeof(BattleMode).GetField ("showUnitStats", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(info.target);
                Allenchlist.Clear();
                this.showall = showUnitStats;
                if (showUnitStats == true)
                {
                    MethodInfo mi = typeof(BattleMode).GetMethod("getAllUnitsCopy", BindingFlags.NonPublic | BindingFlags.Instance);
                    foreach (Unit current in (List<Unit>)mi.Invoke(this.bm,null))
                    {  
                        List<EnchantmentInfo> enchants = current.getBuffs();
                        //Tile component = ((BattleMode)info.target).getTileFromUnit(current);
                        Tile component = ((BattleMode)info.target).getTile(current.getTilePosition());
                        this.Allenchantcreator(enchants, component, true);
              
                    }

                }
            }

            if (info.target is Unit && info.targetMethod.Equals("renderUnit"))
            {
                if (bm == null) return;
                Unit current = (Unit)info.target;
                List<EnchantmentInfo> enchants = current.getBuffs();
                if (enchants.Count > 0)
                {
                    //Tile component = ((BattleMode)bm).getTileFromUnit(current);
                    Tile component = ((BattleMode)bm).getTile(current.getTilePosition());
                    Tile.SelectionType marker = (Tile.SelectionType)mrktpe.GetValue(component);
                    if (marker != Tile.SelectionType.Hover)
                    {
                        
                        Material buffmat = (Material)this.buffMaterialInfo.GetValue(info.target);
                        buffmat.SetColor("_Color", ColorUtil.FromInts(255, 0, 0, 220));
                        buffmat.color = new Color(1.0f, 0.0f, 0.0f, 0.7f);
                        //current.renderer.material.color = new Color(1.0f, 0.5f, 0.5f, 0.7f);
                        //GameObject refer = (GameObject)reftile.GetValue(component);
                        //refer.renderer.material.color = new Color(1.0f, 0f, 0f, 0.4f);
                        //GameObject to = (GameObject)tileover.GetValue(component);
                        //to.renderer.material.color = new Color(1.0f, 0f, 0f, 0.4f);

                        //component.getReference().renderer.material.color = new Color(1f, 0f, 0f, 0.4f);
                    }
                }
            }

            if (info.target is BattleMode && info.targetMethod.Equals("Update"))
            {

                if (Input.GetKeyDown(KeyCode.M))
                {
                    foreach (Unit u in this.bm.getUnitsFor(TileColor.white))
                    {
                        showMoveOfUnit(u);
                    }
                    foreach (Unit u in this.bm.getUnitsFor(TileColor.black))
                    {
                        showMoveOfUnit(u);
                    }
                }

                if (Input.GetKeyUp(KeyCode.M))
                {

                    foreach (Unit u in this.bm.getUnitsFor(TileColor.white))
                    {
                        int v = (int)attackcounterinfo.GetValue(u);
                        u.setAttackCounter(v - 1);
                        u.setAttackCounter(v);
                    }
                    foreach (Unit u in this.bm.getUnitsFor(TileColor.black))
                    {
                        int v = (int)attackcounterinfo.GetValue(u);
                        u.setAttackCounter(v - 1);
                        u.setAttackCounter(v);
                    }



                }

            }

            if (info.target is BattleMode && info.targetMethod.Equals("OnGUI"))
            {
                if (bm == null)
                {
                    bm = (BattleMode)info.target;
                }

                if (Input.GetMouseButtonDown(0) && this.currentHover.color != TileColor.unknown)
                {
                    //mouse pressed!
                    this.calculateEnemyLobbers(this.currentHover.color.otherColor());

                    //Console.WriteLine("moves:###############################");
                    //printMove(TileColor.white);
                    //printMove(TileColor.black);
                }


                if (showall == true && this.allwayson==true)
                {

                    Allenchlist.Clear();
                    
                    foreach (Unit current in (List<Unit>)mi.Invoke(this.bm, null))
                    {
                        List<EnchantmentInfo> enchants = current.getBuffs();
                        //Tile component = ((BattleMode)info.target).getTileFromUnit(current);
                        Tile component = ((BattleMode)info.target).getTile(current.getTilePosition());
                        this.Allenchantcreator(enchants, component, true);
                    }

                    foreach (var item in Allenchlist)
                    {

                        Rect position = new Rect(item.posx, item.posy, picx, picy);
                        GUI.DrawTexture(position, enchantslib[item.name]);
                    }
                }
                else
                {
                    if (showpicture == true)
                    {
                      
                        foreach (var item in enchlist)
                        {

                            Rect position = new Rect(item.posx, item.posy, picx, picy);
                            GUI.DrawTexture(position, enchantslib[item.name]);
                        }

                    }
                }

                /*
                foreach (Unit current in (List<Unit>)mi.Invoke(this.bm, null))
                {
                    //current.renderer.material.color = new Color(1f, 1f, 1f, 1f);
                    Material buffmat = (Material)this.buffMaterialInfo.GetValue(current);
                    Console.WriteLine("#clolor12" + buffmat.GetColor("_Color"));
                    buffmat.SetColor("_Color", ColorUtil.FromHex24(16777173u));
                    List<EnchantmentInfo> enchants = current.getBuffs();
                    Tile component = ((BattleMode)info.target).getTileFromUnit(current);
                    if (enchants.Count > 0)
                    {
                        Tile.SelectionType marker = (Tile.SelectionType)mrktpe.GetValue(component);
                        if (marker != Tile.SelectionType.Hover)
                        {
                            //current.renderer.material.color = new Color(1.0f, 0.5f, 0.5f, 0.7f);
                            buffmat.SetColor("_Color", ColorUtil.FromInts(255,0,0,220));
                            buffmat.color = new Color(1.0f, 0.0f, 0.0f, 0.7f);
                            current.renderer.material.color = new Color(1.0f, 0.0f, 0.0f, 0.7f);
                            Console.WriteLine("#clolorrrrr" + buffmat.GetColor("_Color"));
                            //GameObject refer = (GameObject)reftile.GetValue(component);
                            //refer.renderer.material.color = new Color(1.0f, 0f, 0f, 0.4f);
                            //GameObject to = (GameObject)tileover.GetValue(component);
                            //to.renderer.material.color = new Color(1.0f, 0f, 0f, 0.4f);
                            
                            //component.getReference().renderer.material.color = new Color(1f, 0f, 0f, 0.4f);
                        }
                    }
                }*/
                
            }

           if (info.target is BattleMode && info.targetMethod.Equals("tileOver"))
            {
                showpicture = true;
                TilePosition tilepos = (TilePosition)info.arguments[0];
                this.currentHover.color = tilepos.color;
                this.currentHover.row = tilepos.row;
                this.currentHover.column = tilepos.column;
                //Unit unitFromTile = ((BattleMode)info.target).getUnitFromTile(component);
                Unit unitFromTile = ((BattleMode)info.target).getUnit(tilepos);
                Tile component = ((BattleMode)info.target).getTile(tilepos);
                enchlist.Clear();
                if (unitFromTile != null)
                {
                   List<EnchantmentInfo> enchants=  unitFromTile.getBuffs();
                    this.Allenchantcreator(enchants,component, false);
                }
            }
            if (info.target is BattleMode && info.targetMethod.Equals("tileOut"))
            {
                showpicture = false;
                this.currentHover.color = TileColor.unknown;
            }

            if (info.target is BattleMode && info.targetMethod.Equals("markMoveTile"))
            {
                TilePosition tilepos =(TilePosition)info.arguments[1];
                Tile tile = this.bm.getTile(tilepos);
                int bad = 0;
                foreach (TilePosition tp in this.enemyLobbers)
                {
                    if (tilepos.Equals(tp))
                    {
                        bad++;
                    }
                }

                if (bad>=1)
                {
                    //Console.WriteLine("bad spottet " +  tilepos);
                    GameObject to = (GameObject)tileover.GetValue(tile);
                    GameObject refer = (GameObject)reftile.GetValue(tile);
                    GameObject taf = (GameObject)targetAnimFront.GetValue(tile);
                    GameObject tab = (GameObject)targetAnimBack.GetValue(tile);
                    GameObject car = (GameObject)chargeAnim.GetValue(tile);
                    refer.renderer.material.color = new Color(1.0f, 0f, 0f, 0.2f * bad);
                    to.renderer.material.color = new Color(1.0f, 0f, 0f, 0.2f * bad);
                    if (taf != null) taf.renderer.material.color = new Color(1.0f, 0f, 0f, 0.2f * bad);
                    if (tab != null) tab.renderer.material.color = new Color(1.0f, 0f, 0f, 0.2f * bad);
                    if (car != null) car.renderer.material.color = new Color(1.0f, 0f, 0f, 0.2f * bad);
                }
            }


            if (this.mark && info.target is Tile && info.targetMethod.Equals("markInternal"))
            {

                TilePosition tpp = ((Tile)info.target).tilePosition();
                Tile tile = (Tile)info.target;
                int bad = 0;

               if (enemyLobbers.Count >= 1 && enemyLobbers[0].color == tpp.color && ((Tile.SelectionType)info.arguments[0]) == Tile.SelectionType.None)
                {
                    //this.mark = false;
                    return;
                }

                foreach (TilePosition tp in this.enemyLobbers)
                {
                    if (tpp.Equals(tp))
                    {
                        bad++;
                    }
                }

                if (bad >= 1)
                {
                    //Console.WriteLine("bad spottet " + tpp);
                    GameObject to = (GameObject)tileover.GetValue(tile);
                    GameObject refer = (GameObject)reftile.GetValue(tile);
                    GameObject taf = (GameObject)targetAnimFront.GetValue(tile);
                    GameObject tab = (GameObject)targetAnimBack.GetValue(tile);
                    refer.renderer.material.color = new Color(1.0f, 0f, 0f, 0.2f * bad);
                    to.renderer.material.color = new Color(1.0f, 0f, 0f, 0.2f * bad);
                    if (taf != null) taf.renderer.material.color = new Color(1.0f, 0f, 0f, 0.2f * bad);
                    if (tab != null) tab.renderer.material.color = new Color(1.0f, 0f, 0f, 0.2f * bad);
                }

            }

            return;
        }
Example #29
0
        public override bool BeforeInvoke(InvocationInfo info, out object returnValue)
        {
            returnValue = null;

            if (info.targetMethod.Equals("sendRequest"))
            {
                if (info.arguments[0] is RoomChatMessageMessage)
                {
                    RoomChatMessageMessage msg = (RoomChatMessageMessage) info.arguments[0];

                    if (msg.IsCommand("/filter") || msg.IsCommand("/f")) {
                        String[] splitted = msg.text.Split(new char[] {' '}, 2);

                        if (splitted.Length == 2) {
                            AddFilter(splitted[1].ToLower());
                            SendMessage("Current filters: " + string.Join(", ", filteredTexts.ToArray()));
                        }

                        return true;
                    } else if (msg.IsCommand("/resetfilter") || msg.IsCommand("/rf")) {
                        filteredTexts.Clear();
                        SendMessage("Filters have been reseted");

                        return true;
                    } else if (msg.IsCommand("/highlight") || msg.IsCommand("/hl")) {
                        String[] splitted = msg.text.Split(new char[] {' '}, 2);

                        if (splitted.Length == 2) {
                            AddHighlight(splitted[1].ToLower());
                            SendMessage("Current highlights: " + string.Join(", ", highlightedTexts.ToArray()));
                        }

                        return true;
                    } else if (msg.IsCommand("/resethighlight") || msg.IsCommand("/rhl")) {
                        highlightedTexts.Clear();
                        SendMessage("Highlights have been reseted");

                        return true;
                    }
                }
            } else if (info.targetMethod.Equals("ChatMessage")) {
                RoomChatMessageMessage msg = (RoomChatMessageMessage) info.arguments[0];

                msg.text = ColorizeText(msg.text);

                if (filteredTexts.Count == 0 ||
                    msg.from.ToLower() == App.MyProfile.ProfileInfo.name.ToLower() ||
                    msg.roomName.toLowerCase().StartsWith("trade-") ||
                    msg.from == "Scrolls") { // don't filter my message
                    return false;
                }

                foreach (String filteredText in filteredTexts) {
                    if (msg.text.ToLower().Contains(filteredText)) {
                        return false;
                    }
                }

                return filteredTexts.Count > 0;
            }

            return false;
        }
Example #30
0
        public override void AfterInvoke(InvocationInfo info, ref object returnValue)
        {
            if( activeTrade != null && info.targetMethod.Equals("updateGraphics") ) {
                activeTrade.PostOverlayRender((Card)info.arguments[0]);
            } else if( activeTrade != null && info.targetMethod.Equals("UpdateView") ) {
                activeTrade.PostUpdateView();
            } else if( info.targetMethod.Equals("OnGUI") && info.target.GetType() == deckType ) {
                deckManager.OnGUI(info.target as DeckBuilder2);
            }

            if(info.target is GameSocket && info.targetMethod.Equals("Init"))
            {
                Console.WriteLine("gamesocket init");
                this.gs = (GameSocket)info.target;
            }

            return;
        }
Example #31
0
		public void BeforeInvoke(InvocationInfo info)
		{

			switch ((String)info.targetMethod)
			{
                /*case "OnGUI":
                    {
                        if (playing) {
                            typeof(BattleMode).GetMethod ("deselectAllTiles", BindingFlags.Instance | BindingFlags.NonPublic).Invoke (info.target, null);
                        }
                    }
                    break;
                case "_handleMessage":
                    {
                        if (playing && readNextMsg != false)
                        {
                            readNextMsg = false;
                        }
                    }
                    break;
                 */
                case "toggleMenu":
					{
						if (playing)
						{ //quit on Esc/Back Arrow
							playing = false;
							App.Communicator.setData("");
							SceneLoader.loadScene("_Lobby");
                            this.replay.Abort();
                            this.replay = null;
						}
					}
					break;
			}
		}