Beispiel #1
0
		public override String run(CommandInfo cmdInfo, Bot bot) {
			List<int> weapons = new List<int>();
			String include = cmdInfo.getArg(0, "e");
			foreach (string key in lists.Keys) {
				if (include.Contains(key)) {
					foreach (int i in lists[key]) {
						weapons.Add(i);
					}
				}
			}

			dynamic json = Util.CreateSteamRequest(String.Format("http://api.steampowered.com/ITFItems_440/GetPlayerItems/v0001/?key=" + bot.apiKey + "&SteamID={0}&format=json",cmdInfo.getSteamid().ConvertToUInt64()),"GET");

			foreach (dynamic item in json.result.items.item) {
				weapons.Remove((int) item.defindex);
			}
		
			string output = "Woah, you sir are a god among gigs\nYou have all essential items :D";
			if (weapons.Count > 0) {
				output = "You are missing these items:";

				foreach (int it in weapons) {
					output += "\n" + Util.getItemInfo(it).getName();
				}
			}
		
			return output;
		}
Beispiel #2
0
		public override String run(CommandInfo cmdInfo, Bot bot) {
			String output = "Here are the items you have duplicates of:";
			dynamic json = Util.CreateSteamRequest(String.Format("http://api.steampowered.com/ITFItems_440/GetPlayerItems/v0001/?key=" + bot.apiKey + "&SteamID={0}&format=json",cmdInfo.getSteamid().ConvertToUInt64()),"GET");
		
			int limit = cmdInfo.getArg(0, 2);
			Dictionary<int, MutableInt> freq = new Dictionary<int, MutableInt>();
			foreach (dynamic i in json.result.items.item) {
				int defindex = i.defindex;
				if (freq.ContainsKey(defindex)) {
					freq[defindex].increment();
				} else {
					freq.Add(defindex, new MutableInt());
				}
			}

			List<KeyValuePair<int, MutableInt>> myList = freq.ToList();
			myList.Sort((firstPair,nextPair) =>
				{
					return firstPair.Value.CompareTo(nextPair.Value);
				}
			);
			
			foreach (KeyValuePair<int, MutableInt> entry in myList) {
				if (entry.Value.get() < limit) {
					break;
				}
				ItemInfo itemInfo = Util.getItemInfo(entry.Key);
				output += "\n" + itemInfo.getName() + " x" + entry.Value.get();
			}
			return output;
		}
Beispiel #3
0
		public override String run(CommandInfo cmdInfo, Bot bot) {
			foreach (SteamID steam in bot.SteamFriends.getFriends()) {
				Console.WriteLine(bot.SteamFriends.GetFriendPersonaName(steam));
				if (bot.SteamFriends.GetFriendPersonaName(steam).Equals(cmdInfo.getArg(0), StringComparison.OrdinalIgnoreCase)) {
					bot.SteamFriends.SendChatMessage(steam, EChatEntryType.ChatMsg, Util.removeArg0(cmdInfo.getArgsStr()));
					return "Message sent!";
				}
			}
			return "Could not find user :/";
		}
Beispiel #4
0
		public override String run(CommandInfo cmdInfo, Bot bot) {
			try {
				if (cmdInfo.getArg(0).Equals("add", StringComparison.OrdinalIgnoreCase)) {
					String quote = Util.removeArg0(cmdInfo.getArgsStr());
					bot.sql.update("INSERT INTO sayings (message) VALUES ('" + quote + "')");
					return "Quote added :D";
				} else {
					List<object[]> myReader = bot.sql.query("SELECT message FROM sayings ORDER BY RAND() LIMIT 1");
					if (myReader.Count > 0) {
						return (string) myReader[0][0];
					} else {
						return "Woops, I canne finda de quotes";
					}
				}
			} catch (Exception e) {
				Console.WriteLine(e.Message);
			}
			return "I'm in SPAAAAAAAAAAAAACE! ...and there are no quotes in space :<";
		}
Beispiel #5
0
		public override String run(CommandInfo cmdInfo, Bot bot) {
			return cmdInfo.getArgsStr();
		}
Beispiel #6
0
		public virtual String run(CommandInfo cmdInfo, Bot bot) {
			return "";
		}
Beispiel #7
0
		public override String run(CommandInfo cmdInfo, Bot bot) {
			return "You must be gig... herp derp derp";
		}