Beispiel #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);
        }
        private void OnConnected(NetworkMessage message)
        {
            Logging.Info($"Connected to server '{_server}'");
            var enterRoomMessage = new RoomEnterMessage()
            {
                RoomId = _roomId
            };

            _client.Send(NoonMsgType.RoomEnter, enterRoomMessage);
        }
Beispiel #3
0
        public void handleMessage(Message msg)
        {
            if (msg is FailMessage)
            {
                FailMessage failMessage = (FailMessage)msg;
                if (failMessage.isTypes(new Type[]
                {
                    typeof(ConnectMessage),
                    typeof(FirstConnectMessage)
                }))
                {
                    Thread t1 = new Thread(new ThreadStart(addListenerOnWrongLogin));
                    t1.Start();
                }
            }

            GetGoogleThings.Instance.handleMessage(msg);
            if (msg is CardTypesMessage)
            {
                generator.setallavailablecards(msg);
                mssgprsr.searchscrollsnicks.AddRange(helpf.loadedscrollsnicks);
            }

            if (msg is LibraryViewMessage)
            {
                if ((((LibraryViewMessage)msg).profileId == App.MyProfile.ProfileInfo.id))
                {
                    generator.setowncards(msg);
                    helpf.setOwnCards(msg);
                    this.ahui.clearOffercard();
                }
            }

            if (msg is BuyStoreItemResponseMessage)
            {
                // if we buy a card in the store, we have to reload the own cards , nexttime we open ah/generator
                List <Card> boughtCards = null;
                BuyStoreItemResponseMessage buyStoreItemResponseMessage = (BuyStoreItemResponseMessage)msg;
                if (buyStoreItemResponseMessage.cards.Length > 0)
                {
                    boughtCards = new List <Card>(buyStoreItemResponseMessage.cards);
                }
                else
                {
                    boughtCards = null;
                }
                DeckInfo[] deckInfo = buyStoreItemResponseMessage.deckInfos;
                if (boughtCards != null)
                {
                    deckchanged = true;
                }
                else
                {
                    if (deckInfo != null)
                    {
                        deckchanged = true;
                    }
                }
            }

            // following stuff writes the offer you want to buy/sell in chatroom after entering the trade-chat-room#####################

            if (msg is TradeResponseMessage)
            {
                //if he doesnt accept the trade, reset the variables
                TradeResponseMessage trm = (TradeResponseMessage)msg;
                if (trm.status != "ACCEPT")
                {
                    helpf.postmsgontrading        = false;
                    helpf.postmsggetnextroomenter = false;
                    helpf.postmsgmsg = "";
                }
            }


            if (helpf.postmsggetnextroomenter && msg is RoomEnterMessage)
            {// he accept your trade, post the auction message to yourself
                RoomEnterMessage rmem = (RoomEnterMessage)msg;
                if (rmem.roomName.StartsWith("trade-"))
                {
                    helpf.postmsggetnextroomenter = false;
                    // post the msg here!:
                    RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(rmem.roomName, "<color=#777460>" + helpf.postmsgmsg + "</color>");
                    joinmessage.from = "Scrolls";

                    //App.ChatUI.handleMessage(new RoomChatMessageMessage(rmem.roomName, "<color=#777460>" + postmsgmsg + "</color>"));
                    App.ArenaChat.ChatRooms.ChatMessage(joinmessage);
                    helpf.postmsgmsg = "";
                }
            }

            return;
        }
Beispiel #4
0
        public override bool WantsToReplace(InvocationInfo info)
        {
            if ((this.sttngs.waitForAuctionBot || this.sttngs.actualTrading) && info.target is InviteManager && info.targetMethod.Equals("handleMessage") && info.arguments[0] is TradeResponseMessage && (info.arguments[0] as TradeResponseMessage).to.name == this.twb.botname)
            { // return true if you are waiting for auctionbot
                //because we dont want to display the trading-gui
                return(true);
            }


            if (info.target is Store && info.targetMethod.Equals("OnGUI"))
            {
                // dont want to see the orginal store-interface in our AH
                if (helpf.inauchouse || helpf.generator || helpf.settings)
                {
                    return(true);
                }
            }

            if (info.target is ArenaChat && info.targetMethod.Equals("handleMessage"))
            {
                Message msg = (Message)info.arguments[0];
                if (msg is WhisperMessage)
                {
                    WhisperMessage wmsg = (WhisperMessage)msg;
                    //dont want to see whisper messages from/to the auctionbot
                    if (this.sttngs.actualTrading && wmsg.from == this.twb.botname)
                    {
                        return(true);
                    }
                    if (this.sttngs.waitForAuctionBot && wmsg.toProfileName == this.twb.botname)
                    {
                        return(true);
                    }
                    if ((wmsg.text.Equals("to slow") || wmsg.text.Contains("dont fool me") || wmsg.text.Contains("there is not such an auction") || wmsg.text.Contains("auctionlimit reached")) && wmsg.from == this.twb.botname)
                    {
                        return(true);
                    }
                }

                if (msg is RoomChatMessageMessage)
                {
                    RoomChatMessageMessage rem = (RoomChatMessageMessage)msg;
                    if ((this.sttngs.auctionScrollsMessagesCounter >= 1) && rem.roomName.StartsWith("trade-"))
                    {
                        if (this.sttngs.auctionScrollsMessagesCounter == 3)
                        {
                            this.sttngs.auctionScrollsMessagesCounter = 0;
                        }
                        return(true);
                    }
                    if (rem.text.StartsWith("auc parsertest"))
                    {
                        helpf.messegparsingtest(); return(true);
                    }
                }

                if (msg is RoomEnterMessage)
                {
                    RoomEnterMessage rem = (RoomEnterMessage)msg;
                    if ((this.sttngs.waitForAuctionBot || this.sttngs.actualTrading) && rem.roomName.StartsWith("trade-"))
                    {
                        return(true);
                    }
                }

                if (msg is RoomInfoMessage)
                {
                    RoomInfoMessage rem = (RoomInfoMessage)msg;
                    if ((this.sttngs.waitForAuctionBot || this.sttngs.actualTrading) && rem.roomName.StartsWith("trade-"))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }