public override bool hooksSend(RoomChatMessageMessage rcmm) { String[] splitted = rcmm.text.Split(' '); if (splitted[0] == "/join" | splitted[0] == "/j") { if (splitted.Length == 2) { String roomToJoin = splitted[1]; App.ArenaChat.RoomEnter(roomToJoin); } return true; } else if (splitted[0] == "/part") { if (splitted.Length == 1) // leave current room { App.ArenaChat.ChatRooms.LeaveRoom(App.ArenaChat.ChatRooms.GetCurrentRoom()); } else if (splitted.Length == 2) { String roomToPart = splitted[1]; App.ArenaChat.ChatRooms.LeaveRoom(roomToPart); } return true; } return false; }
public override bool WantsToReplace(InvocationInfo info) { 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 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); } } } return(false); }
public void handleMessage(Message msg) { if (msg is RoomEnterMessage) { RoomEnterMessage rms = (RoomEnterMessage)msg; this.nomssg.Add(rms.roomName); } if (msg is RoomInfoMessage) { Console.WriteLine("joinleave bearbeitet: " + msg.getRawText()); //"removed"; //"updated"; JsonReader jsonReader = new JsonReader(); Dictionary<string, object> dictionary = (Dictionary<string, object>)jsonReader.Read(msg.getRawText()); string roomname = (string)dictionary["roomName"]; if (msg.getRawText().Contains("removed")) { Dictionary<string, object>[] d = (Dictionary<string, object>[])dictionary["removed"]; for (int i = 0; i < d.Length; i++) { string ltext = d[i]["name"] + " has left the room"; RoomChatMessageMessage leftmessage = new RoomChatMessageMessage(roomname, "<color=#777460>" + ltext + "</color>"); App.ChatUI.handleMessage(leftmessage); App.ArenaChat.ChatRooms.ChatMessage(leftmessage); } } if (msg.getRawText().Contains("updated") && this.nomssg.Contains(roomname)) { nomssg.RemoveAll(item => item == roomname); } else { if (msg.getRawText().Contains("updated")) { Dictionary<string, object>[] d = (Dictionary<string, object>[])dictionary["updated"]; for (int i = 0; i < d.Length; i++) { string ltext = d[i]["name"] + " has joined the room"; RoomChatMessageMessage leftmessage = new RoomChatMessageMessage(roomname, "<color=#777460>" + ltext + "</color>"); App.ChatUI.handleMessage(leftmessage); App.ArenaChat.ChatRooms.ChatMessage(leftmessage); } } } } return; }
public void handleMessage(Message msg) { // collect data for enchantments (or units who buff) if (msg is RoomChatMessageMessage) { RoomChatMessageMessage rcmm = (RoomChatMessageMessage)msg; if (rcmm.text.StartsWith("You have joined")) { if (this.getdata == false) { readJsonfromGoogle(getDataFromGoogleDocs()); this.getdata = true; } if (this.currentversion != this.newestversion) { RoomChatMessageMessage nrcmm = new RoomChatMessageMessage(rcmm.roomName, "your Guildchatmod is outdated, please install a new version"); nrcmm.from = "Version Checker"; App.ArenaChat.handleMessage(nrcmm); } warnings++; if (warnings >= anzWarnings) { App.Communicator.removeListener(this); } } } return; }
public void handleMessage(Message msg) { // collect data for enchantments (or units who buff) if (msg is RoomChatMessageMessage) { RoomChatMessageMessage rcmm = (RoomChatMessageMessage)msg; if (rcmm.text.StartsWith("You have joined")) { Console.WriteLine("##Aucversion:#" + currentversion + "#" + newestversion + "#"); if (this.currentversion != this.newestversion) { RoomChatMessageMessage nrcmm = new RoomChatMessageMessage("[note]", "your Auctionmod is outdated, please visit www.scrollsguide.com/forum and install a new version or check noHeros repository\r\n" + "your version: " + this.currentversion + "\r\n" + "latest version: " + this.newestversion); nrcmm.from = "Version Checker"; App.ArenaChat.handleMessage(nrcmm); } warnings++; if (warnings >= anzWarnings) { App.Communicator.removeListener(this); } } } return; }
public override bool hooksSend(RoomChatMessageMessage rcmm) { if (rcmm.text.StartsWith("/quit") || rcmm.text.StartsWith("/exit")) { Application.Quit(); return true; } return false; }
protected void msg(String txt) { RoomChatMessageMessage rcmm = new RoomChatMessageMessage(); rcmm.from = "ChatCommands"; rcmm.text = "<color=#aa803f>" + txt + "</color>"; rcmm.roomName = App.ArenaChat.ChatRooms.GetCurrentRoom(); App.ChatUI.handleMessage(rcmm); App.ArenaChat.ChatRooms.ChatMessage(rcmm); }
public override bool hooksSend(RoomChatMessageMessage rcmm) { String[] splitted = rcmm.text.Split(' '); // heh heh, allow mods to still use /mute if (splitted[0].Equals("/ignore") || (splitted[0].Equals("/mute") && App.MyProfile.ProfileInfo.adminRole == AdminRole.None)) { if (splitted.Length == 1) // just "/ignore", show ignore list { printIgnoreList(); } else { // get username from text if (splitted.Length >= 2) { String usernameToIgnore = splitted[1].ToLower(); // let's not ignore ourselves if (!ignoring.Contains(usernameToIgnore) && usernameToIgnore != App.MyProfile.ProfileInfo.name.ToLower()) { ignoring.Add(usernameToIgnore); // splitted[1] instead of usernameToIgnore because of caps :) msg("Added " + splitted[1] + " to the ignore list."); } else { msg(splitted[1] + " is already on the ignore list."); } } } return true; } else if (splitted[0].Equals("/unignore") || (splitted[0].Equals("/unmute") && App.MyProfile.ProfileInfo.adminRole == AdminRole.None)) { if (splitted.Length >= 2) // >2, kinda strips any trailing space ;) { if (ignoring.Contains(splitted[1].ToLower())) { ignoring.Remove(splitted[1].ToLower()); } msg("Removed " + splitted[1] + " from the ignore list."); } return true; } else if (splitted[0].Equals("/ignorelist") || splitted[0].Equals("/ignoring")) { printIgnoreList(); return true; } return false; }
public override bool hooksSend(RoomChatMessageMessage rcmm) { String[] splitted = rcmm.text.Split(' '); if (splitted[0].Equals("/player")) { if (splitted.Length >= 2) { String playerName = splitted[1]; loadPlayerInfo(playerName); } return true; } return false; }
public void messegparsingtest() { RoomChatMessageMessage msg = new RoomChatMessageMessage("parsertest", ""); msg.from = "Bob"; msg.text = "wts burn 100, quake 200"; App.ArenaChat.ChatRooms.ChatMessage(msg); msg.text = "wtb bunny 100, husk"; App.ArenaChat.ChatRooms.ChatMessage(msg); msg.text = "aucb 198 4;176 3;171 2;65 1"; App.ArenaChat.ChatRooms.ChatMessage(msg); msg.text = "aucs 198,176 3;171,65 0"; App.ArenaChat.ChatRooms.ChatMessage(msg); }
public void handleMessage(Message msg) { // collect data for enchantments (or units who buff) if ( showJoinMessage && msg is RoomChatMessageMessage ) { RoomChatMessageMessage rcmm = (RoomChatMessageMessage)msg; if (rcmm.text.StartsWith("You have joined")) { RoomChatMessageMessage nrcmm = new RoomChatMessageMessage("[note]", "DeckImporter was loadet"); nrcmm.from = "UltimateDeckImporter"; App.ArenaChat.handleMessage(nrcmm); this.showJoinMessage = false; } } if (!this.dckcrtr.sendCheated && msg is LibraryViewMessage) { if ((((LibraryViewMessage)msg).profileId == App.MyProfile.ProfileInfo.id)) { imp.onLibraryViewReceived(msg as LibraryViewMessage); dckcrtr.setOrginalLibraryView(msg); } } if (msg is CardTypesMessage) { dckcrtr.receiveCardlist(msg as CardTypesMessage); } // doesnt work, scrolls deletes the cards from the deckcardsmessage automatically /*if (!this.buildmode && msg is DeckCardsMessage) // repair mode { DeckCardsMessage dcm = msg as DeckCardsMessage; if (dcm.valid) return; this.invalidDeck = true; this.invalidDeckMessage = dcm; }*/ return; }
public override bool hooksSend(RoomChatMessageMessage rcmm) { if (rcmm.text.StartsWith("/setRes")) { string[] arguments = rcmm.text.Split(' '); if (arguments.Length < 3) { msg("To few arguments. " + format); return true; } int width, height; bool fullscreen = Screen.fullScreen; try { width = Convert.ToInt32(arguments[1]); height = Convert.ToInt32(arguments[2]); } catch { msg("Malformed arguments. " + format); return true; } if (arguments.Length == 4) { try { fullscreen = Convert.ToBoolean(arguments[3]); } catch { msg("Malformed arguments. " + format); return true; } } App.Config.SetResolution(width, height, fullscreen); return true; } return false; }
public void handleMessage(Message msg) { // collect data for enchantments (or units who buff) if (msg is RoomChatMessageMessage) { RoomChatMessageMessage rcmm = (RoomChatMessageMessage)msg; if (rcmm.text.StartsWith("You have joined")) { RoomChatMessageMessage nrcmm = new RoomChatMessageMessage(rcmm.roomName, "Change the language of the card-descriptions with /language ENG (for example).\r\nto change the font type /language font arial\r\nfor a list of available languages/fonts type /language help"); nrcmm.from = "LanguageChanger"; ctt.chatroom = nrcmm.roomName; App.ArenaChat.handleMessage(nrcmm); App.Communicator.removeListener(this); } } if (msg is MappedStringsMessage) { MappedStringsMessage msm = (MappedStringsMessage)msg; ctt.incommingMappedStringsMessage(msm); } if (msg is AchievementTypesMessage) { AchievementTypesMessage msm = (AchievementTypesMessage)msg; ctt.incommingAchiveMessage(msm); } /*if (msg is NewEffectsMessage ) { //for translating the tutorial chat-effect-messages! List<EffectMessage> effects = NewEffectsMessage.parseEffects(msg.getRawText()); }*/ return; }
public void handleMessage(Message msg) { // collect data for enchantments (or units who buff) if (msg is RoomChatMessageMessage) { RoomChatMessageMessage rcmm = (RoomChatMessageMessage)msg; if (rcmm.text == "You have joined \"" + gdata.guildroom + "\"") { if (!this.justontimeonline) { gdata.sendOnline(); this.justontimeonline = true; } RoomChatMessageMessage nrcmm = new RoomChatMessageMessage(gdata.guildroom, gdata.guildcolor + gdata.welcomeMessage + "</color>"); nrcmm.from = "Guildnews"; App.ArenaChat.handleMessage(nrcmm); } } return; }
public override bool hooksSend(RoomChatMessageMessage rcmm) { if (rcmm.text.ToLower().StartsWith("/trade") || rcmm.text.ToLower().StartsWith("/t")) { String[] splitted = rcmm.text.Split(' '); // Second clause below handles use of Tab on partial names to auto-complete (leaves a trailing space) if (splitted.Length == 2 || (splitted.Length == 3 && splitted[2] == "")) { String tradePartner = splitted[1]; List<ChatRooms.ChatUser> cUsers = App.ArenaChat.ChatRooms.GetCurrentRoomUsers(); string id = ""; //This loop searches for a user with whatever name was in the command so it can get their userid for (int i = 0; i < cUsers.Count; i++) { if (cUsers[i].name == tradePartner) { id = cUsers[i].id; break; } } if (!(id == "")) { //Sends a trade request to the user specified App.Communicator.sendRequest((Message)new TradeInviteMessage(id)); msg("Success: partner = " + tradePartner); } else { msg("Could not find trade partner in this room."); } } else { msg("Unexpected arguments: Expected:" + format); } return true; } return false; }
public override bool hooksSend(RoomChatMessageMessage rcmm) { try { String[] splitted = rcmm.text.Split(' '); if (splitted[0].Equals("/join") || splitted[0].Equals("/j")) { if (splitted.Length == 2) { String roomToJoin = splitted[1]; App.ArenaChat.RoomEnter(roomToJoin); } return true; } else if (splitted[0].Equals("/part")) { if (splitted.Length == 1) // leave current room { string croom = App.ArenaChat.ChatRooms.GetCurrentRoom(); App.ArenaChat.ChatRooms.LeaveRoom(croom); } else if (splitted.Length == 2) { String roomToPart = splitted[1]; App.ArenaChat.ChatRooms.LeaveRoom(roomToPart); } return true; } return false; } catch { //I had some debugging stuff here earlier, but it never reached this, so it never got an error apparently. return false; } }
public void PopupOk(string popupType, string choice) { if (popupType == "savedeck1") { this.choosenname = choice.Replace(";",""); string text = System.IO.File.ReadAllText(this.deckfolder + System.IO.Path.DirectorySeparatorChar + "decks.txt"); if(text.Contains(this.choosenname+";")) { App.Popups.ShowOkCancel(this, "savedeck2", "Override Deck", "the name is already in use, want to override existing deck?", "Ok", "Cancel"); } else { string link = this.createLink(); text = text + this.choosenname + ";" + link + "\r\n"; System.IO.File.WriteAllText(this.deckfolder + System.IO.Path.DirectorySeparatorChar + "decks.txt", text); Console.WriteLine("saved own deck"); App.Popups.ShowOk(this, "decksave", "Saved Deck", "Your deck was saved.", "OK"); } } if (popupType == "sharedeck2") { string link = this.createLink(); link=link.Replace("http://www.UltimateDeckImporter.com/?l=", ""); List<string> data = new List<string>(); data.Add(App.MyProfile.ProfileInfo.name); data.Add(link); data.Add(this.choosenname); data.Add(choice); this.googleie.postDataToGoogleForm(data); } if (popupType == "sharedeck1") { //App.Popups.ShowTextInput(this, "", "", "sharedeck2", "Share deck", "Insert the description for your deck:", "Share"); App.Popups.ShowTextEntry(this, "sharedeck2", "Share deck", "Insert the description for your deck:", "Share", "Cancel", ""); this.choosenname = choice; } if (popupType == "deletedeck" && choice == this.dcksrchui.infodeck.deckname) { string link = "DELETE " + this.dcksrchui.infodeck.link; List<string> data = new List<string>(); data.Add(App.MyProfile.ProfileInfo.name); data.Add(link); data.Add(choice); data.Add(this.dcksrchui.infodeck.timestamp); this.googleie.postDataToGoogleForm(data); App.Popups.ShowOk(this, "DeletedDeck", "Deleted Deck", "You deleted your deck! \r\nPlease refresh the decklist in a few seconds.", "OK"); } if (popupType == "impdeck") { try { string retu = imp.importFromURL(choice); if (retu == "notok") { App.Popups.ShowOk(this, "loadOldDeck", "An unknown Link appeared!", "either this is a deckbuilder the modcreator doesn't know\r\nor you are not able to copy links", "OK"); } if (retu == "noadded") { App.Popups.ShowOk(this, "loadOldDeck", "An empty Deck appeared!", "You dont want to add empty decks, dont you?", "OK"); } if (retu.StartsWith("You dont own: ")) { RoomChatMessageMessage nrcmm = new RoomChatMessageMessage("[note]", retu); nrcmm.from = "UltimateDeckImporter"; App.ArenaChat.handleMessage(nrcmm); App.Popups.ShowOk(this, "errorMessage", "You dont own all required Scrolls!", "...buy 'em all!\r\nsee Chat for missing cards.", "OK"); } } catch { App.Popups.ShowOk(this, "loadOldDeck", "A wild Error appeared!", "please recheck the link and try it again", "OK"); } } if (popupType == "impdeckbuildmode") { try { string retu = imp.importFromURL(choice); if (retu.StartsWith("You dont own: ")) { RoomChatMessageMessage nrcmm = new RoomChatMessageMessage("[note]", retu); nrcmm.from = "UltimateDeckImporter"; App.ArenaChat.handleMessage(nrcmm); App.Popups.ShowOk(this, "errorMessage", "You dont own all required Scrolls!", "...buy 'em all!\r\nsee Chat for missing cards.", "OK"); } } catch { App.Popups.ShowOk(this, "loadOldDeck", "A wild Error appeared!", "please recheck the link and try it again", "OK"); } } }
/** * returns true when the text message is a command for one of the functions */ private bool hooks(bool sending, RoomChatMessageMessage rcmm) { bool h = false; foreach (ChatComm cc in commands) { bool hooksSingle = sending ? cc.hooksSend(rcmm) : cc.hooksReceive(rcmm); h |= hooksSingle; } return h; }
public void SendMessage(String message) { var room = App.ArenaChat.ChatRooms.GetCurrentRoom(); if( room == null ) return; RoomChatMessageMessage msg = new RoomChatMessageMessage(); msg.from = GetName(); msg.text = message; msg.roomName = room.name; App.ChatUI.handleMessage(msg); App.ArenaChat.ChatRooms.ChatMessage(msg); }
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); }
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); } } } }
public override bool hooksSend(RoomChatMessageMessage rcmm) { if (App.MyProfile.ProfileInfo.adminRole == AdminRole.None && (rcmm.text.ToLower().Equals("/help") || rcmm.text.ToLower().StartsWith("/help "))) { string[] splitted = rcmm.text.Split(' '); //Used to determine whether the right help message could be shown, if not, shows the default bool helped = false; //Checks if they typed a command after /help if (splitted.Length == 2) { switch (splitted[1].ToLower()) { case "trade": case "t": msg("The trade command is used to send a trade request to another player in the same room."); msg(string.Concat("Usage: ", Trade.format)); helped = true; break; case "ignorelist": case "ignore": case "unignore": msg("The ignore command is used to ignore the messages of another player so you don't see them."); msg("To stop ignoring someone, you can use the unignore command."); msg("To see who you are ignoreing, you can use the ignorelist command."); msg("The list of ignored players is not saved between game sessions."); msg(string.Concat("Usage: ", Ignore.format)); helped = true; break; case "quit": case "exit": msg("The quit command closes scrolls."); msg(string.Concat("Usage: ", Quit.format)); helped = true; break; case "setres": msg("The setRes command sets the resolution of the game as long as it is a valid resolution."); msg(string.Concat("Usage: ", SetResolution.format)); helped = true; break; case "join": case "j": msg("The join command enters the chatroom specified as long as it is not full."); msg(string.Concat("Usage: ", RoomComm.joinformat)); helped = true; break; case "part": msg("The part command leaves the chatroom specified, or the current chatroom by default."); msg(string.Concat("Usage: ", RoomComm.partformat)); helped = true; break; case "player": msg("The player command retrieves the ranked stats of a player from scrollsguide.com."); msg(string.Concat("Usage: ", Player.format)); helped = true; break; case "help": msg("Really? You need help using the help command? :)"); helped = true; break; default: msg(string.Format("Command {0} not recognized, showing default help message.",splitted[1].ToLower())); break; } } if (!(splitted.Length == 2) || helped == false) { //Checks if they typed something weird after /help (example: /help /trade randomperson) if (splitted.Length > 2) { msg("Format not recognized, showing default help message."); } msg(string.Concat("ChatCommands Version: ", Convert.ToString(ChatCommands.GetVersion()))); msg("For more information on a specific command, type /help [command]"); msg("Commands: exit, help, ignore, ignorelist, j, join, part, player, quit, setRes, t, trade, unignore"); } return true; } return false; }
public override void ReplaceMethod(InvocationInfo info, out object returnValue) { returnValue = null; if (info.targetMethod.Equals("sendRequest")) { if (info.arguments[0] is RoomChatMessageMessage) { Boolean iscommand = false; RoomChatMessageMessage msg = (RoomChatMessageMessage)info.arguments[0]; string[] splitt = msg.text.Split(' '); if (splitt[0] == "/jl" || splitt[0] == "\\jl") { iscommand = true; bool donesomething = false; if (splitt.Length == 2) { if (splitt[1] == "allon" || splitt[1] == "on") { donesomething = true; var buffer = new List<string>(roomstoggle.Keys); foreach (var key in buffer) { roomstoggle[key] = true; } string text = "joinleave on"; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); } if (splitt[1] == "alloff" || splitt[1] == "off") { donesomething = true; var buffer = new List<string>(roomstoggle.Keys); foreach (var key in buffer) { roomstoggle[key] = false; } string text = "joinleave off"; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); } if (splitt[1] == "tggl" || splitt[1] == "toggle") { donesomething = true; roomstoggle[msg.roomName] = !roomstoggle[msg.roomName] ; string statuss = "on"; if (roomstoggle[msg.roomName] == false) { statuss = "off"; }; string text = "toggled " + msg.roomName + " " + statuss; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); } }; if (donesomething == false) { string text = "/jl commands are: on/allon, off/alloff, tggl/toggle "; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); } } return; } } return; }
public virtual bool hooksSend(RoomChatMessageMessage rcmm) { return false; }
public void handleMessage(Message msg) { // trading with auctionbot############################################################################################################# if (this.sttngs.waitForAuctionBot && msg is FailMessage) // bot is offline! shame on him! { FailMessage fm = (FailMessage)msg; if (fm.op == "Whisper" && fm.info == "Could not find the user '" + botname + "'.") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; pppmngr.startOKPopup("auctionmodresponse", "offline", "the auctionbot is offline"); } } if (this.sttngs.waitForAuctionBot && msg is WhisperMessage) { WhisperMessage wm = msg as WhisperMessage; if (wm.from == botname && wm.text == "invite me") { //invite the auctionmod for trade //App.Communicator.sendRequest(new TradeAcceptMessage("1b8a4125d2634634aa76f33e1d04b0d4")); App.Communicator.send(new TradeInviteMessage(botid)); this.sttngs.actualTrading = true; this.sttngs.addedCard = false; } } if ((this.sttngs.waitForAuctionBot || this.sttngs.actualTrading) && msg is WhisperMessage) { WhisperMessage wm = msg as WhisperMessage; if (wm.from == botname && wm.text == "invite me") { //invite the auctionmod for trade //App.Communicator.sendRequest(new TradeAcceptMessage("1b8a4125d2634634aa76f33e1d04b0d4")); this.sttngs.actualTrading = true; this.sttngs.addedCard = false; } if (wm.from == botname && wm.text == "there is not such an auction") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; Console.WriteLine("not such an auction"); pppmngr.startOKPopup("auctionmodresponse", "non exsisting", "the auction you chosed, doesnt exist anymore"); } if (wm.from == botname && wm.text == "to slow") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; Console.WriteLine("you are to slow bro"); pppmngr.startOKPopup("auctionmodresponse", "to slow", "you were responding to slow"); } if (wm.from == botname && wm.text == "auctionlimit reached") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; Console.WriteLine("not more than 10 auctions"); pppmngr.startOKPopup("auctionmodresponse", "to much auctions", "You cant create more auctions"); } if (wm.from == botname && wm.text == "dont fool me") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; Console.WriteLine("there are no auctions open"); pppmngr.startOKPopup("auctionmodresponse", "no auctions", "you dont own a finished auction"); } if (wm.from == botname && wm.text == "hit accept" && this.sttngs.AucBotMode == "getauc") { new Thread(new ThreadStart(this.acceptTrade)).Start(); } } //trade finished if (this.sttngs.actualTrading && msg is TradeViewMessage && (msg as TradeViewMessage).to.profile.name == botname && (msg as TradeViewMessage).modified == false && (msg as TradeViewMessage).to.accepted == true && (msg as TradeViewMessage).from.accepted == true) { if (this.sttngs.AucBotMode == "setauc") { pppmngr.startOKPopup("auctionmodresponse", "created auction", "you created the following auction:\r\n" + this.helpf.createdAuctionText); } if (this.sttngs.AucBotMode == "multisetauc") { pppmngr.startOKPopup("auctionmodresponse", "created auction", "you created some auctions!"); this.ps.clearAuctions(); } if (this.sttngs.AucBotMode == "bidauc") { pppmngr.startOKPopup("auctionmodresponse", "scroll bought", "you bought " + this.helpf.auctionBotCardsToNames[(msg as TradeViewMessage).to.cardIds[0]] + " for " + (msg as TradeViewMessage).from.gold + " gold."); } if (this.sttngs.AucBotMode == "getauc") { string reccards = ""; foreach (long x in (msg as TradeViewMessage).to.cardIds) { if (reccards != "") reccards = reccards + ", "; reccards = reccards + this.helpf.auctionBotCardsToNames[x]; } string output = "you received: " + (msg as TradeViewMessage).to.gold + " gold and some scrolls (look in Chat)."; if (reccards == "") { output = "you received: " + (msg as TradeViewMessage).to.gold + " gold."; } pppmngr.startOKPopup("auctionmodresponse", "stuff received", output); if (reccards != "") { RoomChatMessageMessage nrcmm = new RoomChatMessageMessage("[note]", "You received these scrolls: " + reccards + "."); nrcmm.from = "AuctionHouse"; App.ArenaChat.handleMessage(nrcmm); } } new Thread(new ThreadStart(this.getCardsAndGold)).Start(); } // get cardIDs+ Types from auctionbot, for knowing which cards you got :D if (this.sttngs.actualTrading && msg is LibraryViewMessage) { if ((((LibraryViewMessage)msg).profileId == this.botid)) { // the libViewMessage is from auctionmod :D helpf.setAuctionModCards(msg); } } //accept in bidmode, after he adds card + we adds money if (this.sttngs.actualTrading && msg is TradeViewMessage && this.sttngs.AucBotMode == "bidauc" && (msg as TradeViewMessage).to.profile.name == botname && (msg as TradeViewMessage).to.cardIds.Length == 1 && (msg as TradeViewMessage).to.cardIds[0] == this.sttngs.tradeCardID && (msg as TradeViewMessage).from.gold == this.sttngs.bidgold && (msg as TradeViewMessage).modified == true) { // trading with bot, he has added the wanted card, and we added the money... lets click ok in 5 seconds! (if modified = true (if he accept, it will be falls), so we accept only once new Thread(new ThreadStart(this.acceptTrade)).Start(); } //if trading with bot and wants to bid on an auction: add money, + wait till he adds card accept if (this.sttngs.waitForAuctionBot && !this.sttngs.addedCard && this.sttngs.AucBotMode == "bidauc" && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "ACCEPT") { new Thread(new ThreadStart(this.setGold)).Start(); } //if trading with bot and wants to set an auction: add card, accept after 5 seconds (threaded) if (this.sttngs.waitForAuctionBot && !this.sttngs.addedCard && this.sttngs.AucBotMode == "setauc" && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "ACCEPT") { App.Communicator.sendRequest(new TradeAddCardsMessage(new long[] { this.sttngs.tradeCardID })); this.sttngs.addedCard = true; new Thread(new ThreadStart(this.acceptTrade)).Start(); } //if trading with bot and wants to set some auctions: add cards, accept after 5 seconds (threaded) if (this.sttngs.waitForAuctionBot && !this.sttngs.addedCard && this.sttngs.AucBotMode == "multisetauc" && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "ACCEPT") { App.Communicator.sendRequest(new TradeAddCardsMessage(this.helpf.cardsForTradeIds.ToArray())); this.sttngs.addedCard = true; new Thread(new ThreadStart(this.acceptTrade)).Start(); } // trade was canceled if (this.sttngs.waitForAuctionBot && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "CANCEL_BARGAIN") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; } // trade was accepted if (this.sttngs.waitForAuctionBot && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "ACCEPT") { // nice! this.sttngs.waitForAuctionBot = false; } // trade was timeouted :D if (this.sttngs.waitForAuctionBot && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "TIMEOUT") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; } if (msg is RoomEnterMessage && (this.sttngs.waitForAuctionBot || this.sttngs.actualTrading)) { this.sttngs.autoAuctionRoom = (msg as RoomEnterMessage).roomName; this.sttngs.auctionScrollsMessagesCounter = 1; } if (msg is RoomChatMessageMessage && this.sttngs.auctionScrollsMessagesCounter >= 1) { if ((msg as RoomChatMessageMessage).from == "Scrolls") { this.sttngs.auctionScrollsMessagesCounter++; } if (this.sttngs.auctionScrollsMessagesCounter == 3) { App.ArenaChat.ChatRooms.LeaveRoom((msg as RoomChatMessageMessage).roomName); App.Communicator.send(new RoomExitMessage((msg as RoomChatMessageMessage).roomName)); } } return; }
public void workthread() { Console.WriteLine("#workthread"); string key = "ENG"; string[] aucfiles = Directory.GetFiles(this.pathToConfig, "*.txt"); string lol = ""; if (aucfiles.Contains(this.pathToConfig + "Config.txt"))//File.Exists() was slower { lol = File.ReadAllText(this.pathToConfig + "Config.txt"); } else { System.IO.File.WriteAllText(this.pathToConfig + "Config.txt", "ENG"); } if (lol != "") { key = lol; } if (key == "RU") sttngs.usedLanguage = Language.RU; if (key == "ENG") sttngs.usedLanguage = Language.ENG; if (key == "DE") sttngs.usedLanguage = Language.DE; if (key == "FR") sttngs.usedLanguage = Language.FR; if (key == "SP") sttngs.usedLanguage = Language.SP; if (sttngs.usedLanguage == Language.RU) sttngs.usedFont = -1; // special for crylic if (key != "ENG") { this.setOrginalCardtexts();// or it would be possible to display multiple languages string response = this.getDataFromGoogleDocs(this.googlekeys[key]); Console.WriteLine("#response"); Console.WriteLine(response); this.readJsonfromGoogle(response); this.setCardtexts(); if (this.googleAchivementkeys.ContainsKey(key)) { response = this.getDataFromGoogleDocs(this.googleAchivementkeys[key]); Console.WriteLine("#achivement response"); Console.WriteLine(response); this.readAchiveJsonfromGoogle(response); this.setAchiveTexts(); } if (this.googleTutorialkeys.ContainsKey(key)) { response = this.getDataFromGoogleDocs(this.googleTutorialkeys[key]); Console.WriteLine("#trial response"); Console.WriteLine(response); this.readTrialJsonfromGoogle(response); } } else { setOrginalCardtexts(); } RoomChatMessageMessage rcmm = new RoomChatMessageMessage(); rcmm.from = "LanguageChanger"; rcmm.roomName = this.chatroom; rcmm.text = "language was loaded!"; if (this.notTranslatedScrolls) { rcmm.text = rcmm.text + "\r\n" + "list of untranslated cards:\r\n"; foreach (string ntc in this.untranslatedcard) { rcmm.text = rcmm.text + ntc + ", "; } } App.ArenaChat.handleMessage(rcmm); }
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; }
protected void SendMessage(string message) { RoomChatMessageMessage msg = new RoomChatMessageMessage(); msg.from = GetName(); msg.text = message.Colorize(INFO_COLOR); msg.roomName = App.ArenaChat.ChatRooms.GetCurrentRoom().name; App.ChatUI.handleMessage(msg); App.ArenaChat.ChatRooms.ChatMessage(msg); }
public virtual bool hooksReceive(RoomChatMessageMessage rcmm) { return false; }
public override bool hooksReceive(RoomChatMessageMessage rcmm) { // return true if sender is ignored :) return ignoring.Contains(rcmm.from.ToLower()); }
public override void AfterInvoke(InvocationInfo info, ref object returnValue) { //if (info.target is EndGameScreen && info.targetMethod.Equals("GoToLobby")) { ntwrk.inbattle = false; } // user leaved a battle if (info.target is ChatUI && info.targetMethod.Equals("Show")) { helpf.chatisshown = (bool)info.arguments[0]; this.screenh = 0; } // so position will be calculatet new on next ongui if (info.target is ChatUI && info.targetMethod.Equals("Initiate")) { helpf.target = (ChatUI)info.target; helpf.setchatlogstyle((GUIStyle)this.chatLogStyleinfo.GetValue(info.target)); } if (info.target is TradeSystem && info.targetMethod.Equals("StartTrade"))// user start a trade, show the buy-message { if (helpf.postmsgontrading == true) { helpf.postmsgontrading = false; helpf.postmsggetnextroomenter = true;// the next RoomEnterMsg is the tradeRoom! } } if (info.target is Store && info.targetMethod.Equals("Start"))//user opened store { helpf.setlobbyskin((GUISkin)typeof(Store).GetField("lobbySkin", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(info.target)); helpf.storeinfo = (Store)info.target; helpf.showtradedialog = false; helpf.inauchouse = false; helpf.generator = false; helpf.settings = false; } if (info.target is ChatRooms && info.targetMethod.Equals("SetRoomInfo")) //adding new users to userlist { RoomInfoMessage roomInfo = (RoomInfoMessage)info.arguments[0]; RoomInfoProfile[] profiles = roomInfo.updated; for (int i = 0; i < profiles.Length; i++) { RoomInfoProfile p = profiles[i]; ChatUser user = ChatUser.FromRoomInfoProfile(p); if (!helpf.globalusers.ContainsKey(user.name)) { helpf.globalusers.Add(user.name, user); } ; } } if (info.target is Store && info.targetMethod.Equals("OnGUI")) // drawing our buttons and stuff in store { GUI.color = Color.white; GUI.contentColor = Color.white; drawsubmenu.Invoke(info.target, null); Vector2 screenMousePos = GUIUtil.getScreenMousePos(); if (!(Screen.height == screenh) || !(Screen.width == screenw) || helpf.chatLogStyle == null) // if resolution was changed, recalc positions { Console.WriteLine("change resolution"); screenh = Screen.height; screenw = Screen.width; helpf.chatLogStyle = (GUIStyle)chatLogStyleinfo.GetValue(helpf.target); recto.setupPositions(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin); // need it to calc fieldhight even if bothmenue=true if ((helpf.bothmenue || (helpf.createAuctionMenu && !helpf.offerMenuSelectCardMenu)) && !helpf.generator) { recto.setupPositionsboth(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin); } recto.setupsettingpositions(helpf.chatLogStyle, helpf.cardListPopupBigLabelSkin); } // delete picture on click! if ((Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1)) && crdvwr.clicked >= 3) { crdvwr.clearallpics(); } //klick button AH //Console.WriteLine("draw buttons"); if (LobbyMenu.drawButton(recto.ahbutton, "AH", helpf.lobbySkin) && !helpf.showtradedialog) { if (this.deckchanged) { App.Communicator.sendRequest(new LibraryViewMessage()); this.deckchanged = false; } if (helpf.bothmenue || helpf.createAuctionMenu) { recto.setupPositionsboth(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin); } else { recto.setupPositions(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin); } ahui.ahbuttonpressed(); } // klick button Gen if (LobbyMenu.drawButton(recto.genbutton, "Gen", helpf.lobbySkin) && !helpf.showtradedialog) { if (this.deckchanged) { App.Communicator.sendRequest(new LibraryViewMessage()); this.deckchanged = false; } recto.setupPositions(helpf.chatisshown, sttngs.rowscale, helpf.chatLogStyle, helpf.cardListPopupSkin); genui.genbuttonpressed(); } //klick settings-button if (LobbyMenu.drawButton(recto.settingsbutton, "Settings", helpf.lobbySkin) && !helpf.showtradedialog) { recto.setupsettingpositions(helpf.chatLogStyle, helpf.cardListPopupBigLabelSkin); setui.setbuttonpressed(); } // draw ah oder gen-menu if (helpf.inauchouse) { ahui.drawAH(); } if (helpf.generator) { genui.drawgenerator(); } if (helpf.settings) { setui.drawsettings(); } GUI.color = Color.white; GUI.contentColor = Color.white; crdvwr.draw(); // drawing the card you have clicked } else if (info.target is Store && (info.targetMethod.Equals("showBuyMenu") || info.targetMethod.Equals("showSellMenu"))) { //disable auc.house + generator Store.ENABLE_SHARD_PURCHASES = true; helpf.inauchouse = false; helpf.generator = false; helpf.settings = false; helpf.showtradedialog = false; helpf.makeOfferMenu = false; helpf.offerMenuSelectCardMenu = false; helpf.showtradedialog = false; if (info.targetMethod.Equals("showSellMenu")) { this.deckchanged = false; } } if (info.target is ChatRooms && info.targetMethod.Equals("ChatMessage")) { //get trademessages from chatmessages RoomChatMessageMessage msg = (RoomChatMessageMessage)info.arguments[0]; if (msg.from != "Scrolls") { AuctionHouse.Instance.addAuctions(mssgprsr.GetAuctionsFromMessage(msg.text, msg.from, msg.roomName)); } } return; }
//Cretids go t public void msg(String txt) { RoomChatMessageMessage rcmm = new RoomChatMessageMessage(); rcmm.from = "<color=#ffb400>FavoriteChannels</color>"; rcmm.text = "<color=#f0dec5>" + txt + "</color>"; rcmm.roomName = App.ArenaChat.ChatRooms.GetCurrentRoom(); App.ChatUI.handleMessage(rcmm); App.ArenaChat.ChatRooms.ChatMessage(rcmm); }
public void handleMessage(Message msg) { // trading with auctionbot############################################################################################################# if (this.sttngs.waitForAuctionBot && msg is FailMessage) // bot is offline! shame on him! { FailMessage fm = (FailMessage)msg; if (fm.op == "Whisper" && fm.info == "Could not find the user '" + botname + "'.") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; pppmngr.startOKPopup("auctionmodresponse", "offline", "the auctionbot is offline"); } } if (this.sttngs.waitForAuctionBot && msg is WhisperMessage) { WhisperMessage wm = msg as WhisperMessage; if (wm.from == botname && wm.text == "invite me") { //invite the auctionmod for trade //App.Communicator.sendRequest(new TradeAcceptMessage("1b8a4125d2634634aa76f33e1d04b0d4")); App.Communicator.send(new TradeInviteMessage(botid)); this.sttngs.actualTrading = true; this.sttngs.addedCard = false; } } if ((this.sttngs.waitForAuctionBot || this.sttngs.actualTrading) && msg is WhisperMessage) { WhisperMessage wm = msg as WhisperMessage; if (wm.from == botname && wm.text == "invite me") { //invite the auctionmod for trade //App.Communicator.sendRequest(new TradeAcceptMessage("1b8a4125d2634634aa76f33e1d04b0d4")); this.sttngs.actualTrading = true; this.sttngs.addedCard = false; } if (wm.from == botname && wm.text == "there is not such an auction") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; Console.WriteLine("not such an auction"); pppmngr.startOKPopup("auctionmodresponse", "non exsisting", "the auction you chosed, doesnt exist anymore"); } if (wm.from == botname && wm.text == "to slow") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; Console.WriteLine("you are to slow bro"); pppmngr.startOKPopup("auctionmodresponse", "to slow", "you were responding to slow"); } if (wm.from == botname && wm.text == "auctionlimit reached") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; Console.WriteLine("not more than 10 auctions"); pppmngr.startOKPopup("auctionmodresponse", "to much auctions", "You cant create more auctions"); } if (wm.from == botname && wm.text == "dont fool me") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; Console.WriteLine("there are no auctions open"); pppmngr.startOKPopup("auctionmodresponse", "no auctions", "you dont own a finished auction"); } if (wm.from == botname && wm.text == "hit accept" && this.sttngs.AucBotMode == "getauc") { new Thread(new ThreadStart(this.acceptTrade)).Start(); } } //trade finished if (this.sttngs.actualTrading && msg is TradeViewMessage && (msg as TradeViewMessage).to.profile.name == botname && (msg as TradeViewMessage).modified == false && (msg as TradeViewMessage).to.accepted == true && (msg as TradeViewMessage).from.accepted == true) { if (this.sttngs.AucBotMode == "setauc") { pppmngr.startOKPopup("auctionmodresponse", "created auction", "you created the following auction:\r\n" + this.helpf.createdAuctionText); } if (this.sttngs.AucBotMode == "multisetauc") { pppmngr.startOKPopup("auctionmodresponse", "created auction", "you created some auctions!"); this.ps.clearAuctions(); } if (this.sttngs.AucBotMode == "bidauc") { pppmngr.startOKPopup("auctionmodresponse", "scroll bought", "you bought " + this.helpf.auctionBotCardsToNames[(msg as TradeViewMessage).to.cardIds[0]] + " for " + (msg as TradeViewMessage).from.gold + " gold."); } if (this.sttngs.AucBotMode == "getauc") { string reccards = ""; foreach (long x in (msg as TradeViewMessage).to.cardIds) { if (reccards != "") { reccards = reccards + ", "; } reccards = reccards + this.helpf.auctionBotCardsToNames[x]; } string output = "you received: " + (msg as TradeViewMessage).to.gold + " gold and some scrolls (look in Chat)."; if (reccards == "") { output = "you received: " + (msg as TradeViewMessage).to.gold + " gold."; } pppmngr.startOKPopup("auctionmodresponse", "stuff received", output); if (reccards != "") { RoomChatMessageMessage nrcmm = new RoomChatMessageMessage("[note]", "You received these scrolls: " + reccards + "."); nrcmm.from = "AuctionHouse"; App.ArenaChat.handleMessage(nrcmm); } } new Thread(new ThreadStart(this.getCardsAndGold)).Start(); } // get cardIDs+ Types from auctionbot, for knowing which cards you got :D if (this.sttngs.actualTrading && msg is LibraryViewMessage) { if ((((LibraryViewMessage)msg).profileId == this.botid)) { // the libViewMessage is from auctionmod :D helpf.setAuctionModCards(msg); } } //accept in bidmode, after he adds card + we adds money if (this.sttngs.actualTrading && msg is TradeViewMessage && this.sttngs.AucBotMode == "bidauc" && (msg as TradeViewMessage).to.profile.name == botname && (msg as TradeViewMessage).to.cardIds.Length == 1 && (msg as TradeViewMessage).to.cardIds[0] == this.sttngs.tradeCardID && (msg as TradeViewMessage).from.gold == this.sttngs.bidgold && (msg as TradeViewMessage).modified == true) { // trading with bot, he has added the wanted card, and we added the money... lets click ok in 5 seconds! (if modified = true (if he accept, it will be falls), so we accept only once new Thread(new ThreadStart(this.acceptTrade)).Start(); } //if trading with bot and wants to bid on an auction: add money, + wait till he adds card accept if (this.sttngs.waitForAuctionBot && !this.sttngs.addedCard && this.sttngs.AucBotMode == "bidauc" && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "ACCEPT") { new Thread(new ThreadStart(this.setGold)).Start(); } //if trading with bot and wants to set an auction: add card, accept after 5 seconds (threaded) if (this.sttngs.waitForAuctionBot && !this.sttngs.addedCard && this.sttngs.AucBotMode == "setauc" && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "ACCEPT") { App.Communicator.sendRequest(new TradeAddCardsMessage(new long[] { this.sttngs.tradeCardID })); this.sttngs.addedCard = true; new Thread(new ThreadStart(this.acceptTrade)).Start(); } //if trading with bot and wants to set some auctions: add cards, accept after 5 seconds (threaded) if (this.sttngs.waitForAuctionBot && !this.sttngs.addedCard && this.sttngs.AucBotMode == "multisetauc" && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "ACCEPT") { App.Communicator.sendRequest(new TradeAddCardsMessage(this.helpf.cardsForTradeIds.ToArray())); this.sttngs.addedCard = true; new Thread(new ThreadStart(this.acceptTrade)).Start(); } // trade was canceled if (this.sttngs.waitForAuctionBot && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "CANCEL_BARGAIN") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; } // trade was accepted if (this.sttngs.waitForAuctionBot && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "ACCEPT") { // nice! this.sttngs.waitForAuctionBot = false; } // trade was timeouted :D if (this.sttngs.waitForAuctionBot && msg is TradeResponseMessage && (msg as TradeResponseMessage).to.name == botname && (msg as TradeResponseMessage).status == "TIMEOUT") { this.sttngs.AucBotMode = ""; this.sttngs.waitForAuctionBot = false; this.sttngs.actualTrading = false; } if (msg is RoomEnterMessage && (this.sttngs.waitForAuctionBot || this.sttngs.actualTrading)) { this.sttngs.autoAuctionRoom = (msg as RoomEnterMessage).roomName; this.sttngs.auctionScrollsMessagesCounter = 1; } if (msg is RoomChatMessageMessage && this.sttngs.auctionScrollsMessagesCounter >= 1) { if ((msg as RoomChatMessageMessage).from == "Scrolls") { this.sttngs.auctionScrollsMessagesCounter++; } if (this.sttngs.auctionScrollsMessagesCounter == 3) { App.ArenaChat.ChatRooms.LeaveRoom((msg as RoomChatMessageMessage).roomName); App.Communicator.send(new RoomExitMessage((msg as RoomChatMessageMessage).roomName)); } } return; }
public override void ReplaceMethod(InvocationInfo info, out object returnValue) { returnValue = null; if (info.target is Communicator && info.targetMethod.Equals("sendRequest")) { //Console.WriteLine("sendrequest"); if (info.arguments[0] is RoomChatMessageMessage) { RoomChatMessageMessage msg = (RoomChatMessageMessage)info.arguments[0]; string[] splitt = msg.text.Split(' '); if ((splitt[0] == "/trs" || splitt[0] == "\\trs")) { if (this.trading && msg.roomName == this.traderoomname) { Boolean donesomething = false; if (splitt.Length >= 3) { if (splitt[1] == "search" || splitt[1] == "s") { if (this.searchedself) { this.p1moddedlist.Clear(); this.p1moddedlist.AddRange(this.orgicardsPlayer1); this.onlytradeableself(); this.searchedself = false; } string searchstr = msg.text; searchstr = searchstr.Replace("/trs ", ""); searchstr = searchstr.Replace("\\trs ", ""); searchstr = searchstr.Replace("search ", ""); searchstr = searchstr.Replace("s ", ""); string text = "search in your cards for cards named: " + searchstr; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); searchforname(searchstr); this.updatetrade(); this.searchedself = true; donesomething = true; } if (splitt[1] == "searchopponent" || splitt[1] == "so") { if (this.searchedoppo) { this.p2moddedlist.Clear(); this.p2moddedlist.AddRange(this.orgicardsPlayer2); this.onlytradeableoppo(); this.searchedoppo = false; } string searchstr = msg.text; searchstr = searchstr.Replace("/trs ", ""); searchstr = searchstr.Replace("\\trs ", ""); searchstr = searchstr.Replace("searchopponent ", ""); searchstr = searchstr.Replace("so ", ""); string text = "search in opponent cards for cards named: " + searchstr; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); searchopponentforname(searchstr); this.updatetrade(); this.searchedoppo = true; donesomething = true; } if (splitt[1] == "contains" || splitt[1] == "c") { if (this.searchedself) { this.p1moddedlist.Clear(); this.p1moddedlist.AddRange(this.orgicardsPlayer1); this.onlytradeableself(); this.searchedself = false; } string searchstr = msg.text; searchstr = searchstr.Replace("/trs ", ""); searchstr = searchstr.Replace("\\trs ", ""); searchstr = searchstr.Replace("contains ", ""); searchstr = searchstr.Replace("c ", ""); string text = "search all own cards wich contains: " + searchstr; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); containsname(searchstr); this.updatetrade(); donesomething = true; } if (splitt[1] == "containsopponent" || splitt[1] == "co") { if (this.searchedoppo) { this.p2moddedlist.Clear(); this.p2moddedlist.AddRange(this.orgicardsPlayer2); this.onlytradeableoppo(); this.searchedoppo = false; } string searchstr = msg.text; searchstr = searchstr.Replace("/trs ", ""); searchstr = searchstr.Replace("\\trs ", ""); searchstr = searchstr.Replace("containsopponent ", ""); searchstr = searchstr.Replace("co ", ""); string text = "search all opponent cards wich contains: " + searchstr; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); containsopponentname(searchstr); this.updatetrade(); donesomething = true; } if (splitt[1] == "rarity" || splitt[1] == "ra") { if (this.searchedself) { this.p1moddedlist.Clear(); this.p1moddedlist.AddRange(this.orgicardsPlayer1); this.onlytradeableself(); this.searchedself = false; } string searchstr = msg.text; searchstr = searchstr.Replace("/trs ", ""); searchstr = searchstr.Replace("\\trs ", ""); searchstr = searchstr.Replace("rarity ", ""); searchstr = searchstr.Replace("ra ", ""); string[] raresplitt = searchstr.Split(' '); int[] rare = { -1, -1, -1 }; searchstr = ""; if (raresplitt.Contains("rare") || raresplitt.Contains("r")) { rare[2] = 2; searchstr = searchstr + "rare "; }; if (raresplitt.Contains("uncommon") || raresplitt.Contains("u")) { rare[1] = 1; searchstr = searchstr + "uncommon "; }; if (raresplitt.Contains("common") || raresplitt.Contains("c")) { rare[0] = 0; searchstr = searchstr + "common "; }; string text = "search all own cards wich have the rarity: " + searchstr; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); this.searchforownrarity(rare); this.updatetrade(); donesomething = true; } if (splitt[1] == "rarityopponent" || splitt[1] == "rao") { if (this.searchedoppo) { this.p2moddedlist.Clear(); this.p2moddedlist.AddRange(this.orgicardsPlayer2); this.onlytradeableoppo(); this.searchedoppo = false; } string searchstr = msg.text; searchstr = searchstr.Replace("/trs ", ""); searchstr = searchstr.Replace("\\trs ", ""); searchstr = searchstr.Replace("rarityopponent ", ""); searchstr = searchstr.Replace("rao ", ""); string[] raresplitt = searchstr.Split(' '); int[] rare = { -1, -1, -1 }; searchstr = ""; if (raresplitt.Contains("rare") || raresplitt.Contains("r")) { rare[2] = 2; searchstr = searchstr + "rare "; }; if (raresplitt.Contains("uncommon") || raresplitt.Contains("u")) { rare[1] = 1; searchstr = searchstr + "uncommon "; }; if (raresplitt.Contains("common") || raresplitt.Contains("c")) { rare[0] = 0; searchstr = searchstr + "common "; }; string text = "search all opponent cards wich have the rarity: " + searchstr; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); this.searchforopporarity(rare); this.updatetrade(); donesomething = true; } if (splitt[1] == "resource" || splitt[1] == "re") { if (this.searchedself) { this.p1moddedlist.Clear(); this.p1moddedlist.AddRange(this.orgicardsPlayer1); this.onlytradeableself(); this.searchedself = false; } string searchstr = msg.text; searchstr = searchstr.Replace("/trs ", ""); searchstr = searchstr.Replace("\\trs ", ""); searchstr = searchstr.Replace("resource ", ""); searchstr = searchstr.Replace("re ", ""); string[] raresplitt = searchstr.Split(' '); string[] rare = { "", "", "", "" }; searchstr = ""; if (raresplitt.Contains("decay") || raresplitt.Contains("d")) { rare[0] = "decay"; searchstr = searchstr + "decay "; }; if (raresplitt.Contains("energy") || raresplitt.Contains("e")) { rare[1] = "energy"; searchstr = searchstr + "energy "; }; if (raresplitt.Contains("growth") || raresplitt.Contains("g")) { rare[2] = "growth"; searchstr = searchstr + "growth "; }; if (raresplitt.Contains("order") || raresplitt.Contains("o")) { rare[3] = "order"; searchstr = searchstr + "order "; }; string text = "search own cards wich have the resource: " + searchstr; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); this.searchforownenergy(rare); this.updatetrade(); donesomething = true; } if (splitt[1] == "resourceopponent" || splitt[1] == "reo") { if (this.searchedoppo) { this.p2moddedlist.Clear(); this.p2moddedlist.AddRange(this.orgicardsPlayer2); this.onlytradeableoppo(); this.searchedoppo = false; } string searchstr = msg.text; searchstr = searchstr.Replace("/trs ", ""); searchstr = searchstr.Replace("\\trs ", ""); searchstr = searchstr.Replace("resourceopponent ", ""); searchstr = searchstr.Replace("reo ", ""); string[] raresplitt = searchstr.Split(' '); string[] rare = { "", "", "", "" }; searchstr = ""; if (raresplitt.Contains("decay") || raresplitt.Contains("d")) { rare[0] = "decay"; searchstr = searchstr + "decay "; }; if (raresplitt.Contains("energy") || raresplitt.Contains("e")) { rare[1] = "energy"; searchstr = searchstr + "energy "; }; if (raresplitt.Contains("growth") || raresplitt.Contains("g")) { rare[2] = "growth"; searchstr = searchstr + "growth "; }; if (raresplitt.Contains("order") || raresplitt.Contains("o")) { rare[3] = "order"; searchstr = searchstr + "order "; }; string text = "search opponent cards wich have the resource: " + searchstr; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); this.searchforoppoenergy(rare); this.updatetrade(); donesomething = true; } }//splitt length >=3 if (splitt.Length == 2) { if (splitt[1] == "clear" || splitt[1] == "c") { string text = "clear all filter"; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); this.p1moddedlist.Clear(); this.p2moddedlist.Clear(); this.p1moddedlist.AddRange(this.orgicardsPlayer1); this.p2moddedlist.AddRange(this.orgicardsPlayer2); this.onlytradeable(); this.updatetrade(); this.searchedoppo = false; this.searchedself = false; donesomething = true; } if (splitt[1] == "clearself" || splitt[1] == "cls") { string text = "clear own filter"; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); this.p1moddedlist.Clear(); this.p1moddedlist.AddRange(this.orgicardsPlayer1); this.onlytradeableself(); this.updatetrade(); donesomething = true; this.searchedself = false; } if (splitt[1] == "clearopponent" || splitt[1] == "clo") { string text = "clear opponent filter"; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); this.p2moddedlist.Clear(); this.p2moddedlist.AddRange(this.orgicardsPlayer2); this.onlytradeableoppo(); this.updatetrade(); donesomething = true; this.searchedoppo = false; } if (splitt[1] == "showall" || splitt[1] == "sa") { string text = "displays all cards"; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); this.p1moddedlist.Clear(); this.p1moddedlist.AddRange(this.orgicardsPlayer1); this.p2moddedlist.Clear(); this.p2moddedlist.AddRange(this.orgicardsPlayer2); this.updatetrade(); this.searchedself = false; this.searchedoppo = false; donesomething = true; } if (splitt[1] == "morethan3" || splitt[1] == "mt3") { if (this.searchedself) { this.p1moddedlist.Clear(); this.p1moddedlist.AddRange(this.orgicardsPlayer1); this.onlytradeableself(); this.searchedself = false; } string text = "displays all own cards which you owns more than 3 times "; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); this.searchmorethan3(); this.updatetrade(); donesomething = true; } if (splitt[1] == "morethan3opponent" || splitt[1] == "mt3o") { if (this.searchedoppo) { this.p2moddedlist.Clear(); this.p2moddedlist.AddRange(this.orgicardsPlayer2); this.onlytradeableoppo(); this.searchedoppo = false; } string text = "displays all opponent cards which he owns more than 3 times "; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); this.searchmorethan3oppo(); this.updatetrade(); donesomething = true; } } // splitt length ==2 if (!donesomething) { string text = "available commands are: search/s or searchopponent/so + Cardname\r\n contains/c or containsopponent/co + string \r\n"; text = text + "rarity/ra or rarityopponent/rao + rare/r and/or uncommon/u and/or common/c \r\n"; text = text + "resource/re or resourceopponent/reo + energy/e and/or growth/g and/or order/o and/or decay/d\r\n"; text = text + "clear/c, clearself/cls or clearopponent/clo, \r\n showall/sa, morethan3/mt3 or morethan3opponent/mt3o \r\n"; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); } } else // not trading { string text = "/trs only works while trading in traderoom"; RoomChatMessageMessage joinmessage = new RoomChatMessageMessage(msg.roomName, "<color=#777460>" + text + "</color>"); App.ChatUI.handleMessage(joinmessage); App.ArenaChat.ChatRooms.ChatMessage(joinmessage); } } } } }
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; }