//This Seperates the different commands into buckets public void FirstCommandBuckets(Arrrgs e) { string firstCommand = e.commandText; //Command.CommandText.ToLower(); //These commands will provide player confirmation/Response in CHAT if (firstCommand == "buy") { AddToChatQueue(e); } else if (firstCommand == "join") { AddToChatQueue(e); } else if (firstCommand == "equip") { AddToChatQueue(e); } else if (firstCommand == "money") { AddToChatQueue(e); } else if (firstCommand == "inuse") { AddToChatQueue(e); } else if (firstCommand == "skins") { AddToChatQueue(e); } else if (firstCommand == "give") { AddToChatQueue(e); } //These commands will provide player with visial confirmation in overlay else if (firstCommand == "play") { commands.Play(e); } else if (firstCommand == "rotate") { commands.Rotate(e); } //TEMPORARY CHAT COMMAND TO ROTATE SHOP //These commands will provide player with whisper confirmation else if (firstCommand == "help") { AddToChatQueue(e); } else if (firstCommand == "vfx") { } else if (firstCommand == "sfx") { } else { return; } }
public void Rotate(Arrrgs e) //Temporary command!!! TODO REMOVE { if (e.userID == "73184979") { FindObjectOfType <Shop>().ResetShop(); } }
private void AttemptToPlay(Arrrgs e) { string userID = e.userID; string displayName = e.displayName; if (gameDataScript.CheckIfPlayerExists(userID)) { if (gameController.currentState == gameState.gametime) { if (gameController.currentGameMode == gameMode.longjump) { jumpManager.CreateMarbleAndJump(e); } else if (gameController.currentGameMode == gameMode.highjump) { jumpManager.CreateMarbleAndHighJump(e); } else if (gameController.currentGameMode == gameMode.race) { } } else { return; } } else { chatClient.SendMessage(chatJoinedChannel, displayName + noPlayerEntryExists); } }
public void AttemptToBuy(Arrrgs e) { string commonName = ""; string playerID = e.userID; //Command.ChatMessage.UserId; string playerUserName = e.displayName; //Command.ChatMessage.Username; if (gameDataScript.CheckIfPlayerExists(playerID)) { commonName = e.commandArgs; /* * for (int index = 0; index < e.Command.ArgumentsAsList.Count; index++) * { * commonName += e.Command.ArgumentsAsList[index].ToLower(); * }*/ Debug.Log(commonName); if (marbleList.DoesMarbleCommonNameExist(commonName)) { if (shop.MarbleNamesInShop(commonName)) { int playerMoney = gameDataScript.CheckPlayerMoney(playerID); int marbleCost = marbleList.GetMarbleCostFromCommonName(commonName); int marbleCode = marbleList.GetMarbleCodeFromCommonName(commonName); if (gameDataScript.IsSkinUnlocked(playerID, marbleCode)) { chatClient.SendMessage(chatJoinedChannel, playerUserName + skinAlreadyUnlocked1 + commonName + skinAlreadyUnlocked2); } else { if (playerMoney >= marbleCost) { gameDataScript.SubtractMoneyFromPlayerID(marbleCost, playerID); gameDataScript.UnlockSkinForPlayer(playerID, marbleCode); int currentMoney = gameDataScript.CheckPlayerMoney(playerID); chatClient.SendMessage(chatJoinedChannel, playerUserName + unlockedMarble1 + commonName + unlockedMarble2 + commonName + unlockedMarble3 + unlockedMarble4 + currentMoney); } else { chatClient.SendMessage(chatJoinedChannel, playerUserName + notEnoughMoney + commonName); } } } else { chatClient.SendMessage(chatJoinedChannel, commonName + marbleNotInShop); } } else { chatClient.SendMessage(chatJoinedChannel, playerUserName + noMarbleWithNameExists); } } else { chatClient.SendMessage(chatJoinedChannel, playerUserName + noPlayerEntryExists); } }
private void Client_OnWhisperReceived(object sender, OnWhisperReceivedArgs e) { Arrrgs chatArgs = new Arrrgs(); chatArgs.message = e.WhisperMessage.Message; chatArgs.userID = e.WhisperMessage.UserId; chatArgs.displayName = e.WhisperMessage.DisplayName; chatArgs.commandText = ConvertWhisperToCommand(e.WhisperMessage.Message); chatArgs.commandArgs = ConvertWhisperToArguments(e.WhisperMessage.Message); commandQueue.FirstCommandBuckets(chatArgs); }
public void Play(Arrrgs e) { if (chatClient == null) { Setup(); AttemptToPlay(e); } else { AttemptToPlay(e); } }
public void Give(Arrrgs e) { if (chatClient == null) { Setup(); AttemptToGive(e); } else { AttemptToGive(e); } }
//Equip - checks if player data exists - checks if they own that skin - equips the skin public void Equip(Arrrgs e) { if (chatClient == null) { Setup(); AttemptToEquip(e); } else { AttemptToEquip(e); } }
//Join - check if player data exists - if not create empty player data entry public void Join(Arrrgs e) { if (chatClient == null) { Setup(); AttemptToJoin(e); } else { AttemptToJoin(e); } }
//Money - checks if player data exists - if so returns how much money they have in chat public void money(Arrrgs e) { if (chatClient == null) { Setup(); AttemptToCheckMoney(e); } else { AttemptToCheckMoney(e); } }
private void AttemptToJoin(Arrrgs e) { if (gameDataScript.CheckIfPlayerExists(e.userID)) { chatClient.SendMessage(chatJoinedChannel, e.displayName + playerAlreadyExists); } else { gameDataScript.CreateNewPlayerEntry(e); chatClient.SendMessage(chatJoinedChannel, e.displayName + playerEntryAdded); } }
//AcceptWhispers /* * public void AcceptWhispers(OnChatCommandReceivedArgs e) * { * if (chatClient == null) * { * Setup(); * AttemptToAcceptWhispers(e); * } * else * { * AttemptToAcceptWhispers(e); * } * } */ /*public void AttemptToAcceptWhispers(OnChatCommandReceivedArgs e) * { * Debug.Log("WHISPER,PLAYER ACTIVATED!"); * string userID = e.Command.ChatMessage.UserId; * string playerName = e.Command.ChatMessage.Username; * if (gameDataScript.CheckIfPlayerExists(userID)) * { * Debug.Log("WHISPER,PLAYER DONE!"); * gameDataScript.SubscribePlayerToWhispers(userID); * chatClient.SendWhisper(playerName, "THIS IS A TEST MESSEGE FROM SIMPA GAME BOT."); * } * else * { * chatClient.SendMessage(chatJoinedChannel, e.Command.ChatMessage.Username + noPlayerEntryExists); * } * } */ public void Skins(Arrrgs e) { if (chatClient == null) { Setup(); AttemptToSkins(e); } else { AttemptToSkins(e); } }
public void CreateNewPlayerEntry(Arrrgs e) { PlayerData tempData = new PlayerData(); tempData.money = 0; tempData.skins = FindObjectOfType <MarbleList>().getEmptyAllMarbleDictionary(); tempData.equiptSkin = 0; tempData.playerName = e.displayName; tempData.isSubscribed = false; gameData.Add(e.userID, tempData); SaveGameDataToTXT(); Debug.Log("GAME DATA SUCCESFULLY SAVED!!!!"); }
//Help - provids a list of commands public void Help(Arrrgs e) { if (chatClient == null) { Setup(); //chatClient.SendMessage(chatJoinedChannel, help); AttemptToHelp(e); } else { AttemptToHelp(e); } }
private void AttemptToCheckMoney(Arrrgs e) { string playerID = e.userID; string userName = e.displayName; if (gameDataScript.CheckIfPlayerExists(playerID)) { chatClient.SendMessage(chatJoinedChannel, userName + " money: " + gameDataScript.CheckPlayerMoney(playerID)); } else { chatClient.SendMessage(chatJoinedChannel, userName + noPlayerEntryExists); } }
public string CheckSkins(Arrrgs e) { string playerID = e.userID; string playerName = e.displayName; string skinList = playerName + ": "; for (int i = 0; i < gameData[playerID].skins.Count; i++) { if (gameData[playerID].skins[i] == true) { skinList += marbleList.marbleCodeToCommonName[i] + ", "; } } return(skinList); }
private void AttemptToInUse(Arrrgs e) { string playerID = e.userID; string playerUserName = e.displayName; if (gameDataScript.CheckIfPlayerExists(playerID)) { int marbleCode = gameDataScript.GetPlayerEquipSkin(playerID); string commonName = marbleList.GetCommonNameFromMarbleCode(marbleCode); chatClient.SendMessage(chatJoinedChannel, playerUserName + " is using the " + commonName + " skin!"); } else { chatClient.SendMessage(chatJoinedChannel, playerUserName + noPlayerEntryExists); } }
public void AttemptToSkins(Arrrgs e) { string userID = e.userID; string displayName = e.displayName; if (gameDataScript.CheckIfPlayerExists(userID)) { string skinsPlayerOwns = gameDataScript.CheckSkins(e); StartCoroutine(SkinsMessege(skinsPlayerOwns)); chatClient.SendMessage(chatJoinedChannel, "https://www.twitch.tv/simpagamebot"); } else { chatClient.SendMessage(chatJoinedChannel, displayName + noPlayerEntryExists); } }
private void MyCommandReceivedFunction(object sender, OnChatCommandReceivedArgs e) { Arrrgs chatArgs = new Arrrgs(); chatArgs.message = e.Command.ChatMessage.Message; chatArgs.userID = e.Command.ChatMessage.UserId; chatArgs.displayName = e.Command.ChatMessage.DisplayName; chatArgs.commandText = e.Command.CommandText.ToLower(); chatArgs.multiCommand = e.Command.ArgumentsAsList; for (int index = 0; index < e.Command.ArgumentsAsList.Count; index++) { chatArgs.commandArgs += e.Command.ArgumentsAsList[index].ToLower(); } commandQueue.FirstCommandBuckets(chatArgs); //e debug.text = (e.Command.ChatMessage.Username); }
public void CreateMarbleAndHighJump(Arrrgs e) { string userID = e.userID; string displayName = e.displayName; if (!(highJumpedPlayers.Contains(userID))) { highJumpedPlayers.Add(userID); var mb = Instantiate(marbleObject, longJumpLocation.position, transform.rotation); mb.transform.SetParent(transform); mb.GetComponentInChildren <SpriteRenderer>().sortingOrder = orderInLayer; orderInLayer++; playerMarble = mb.GetComponentInChildren <MarbleObject>(); playerMarble.playerName.text = displayName; int marbleIndex = gameData.GetPlayerEquipSkin(userID); GameObject marbleGameObject = marbleList.GetMarbleFromMarbleCode(marbleIndex); playerMarble.gameMarbleSprite.sprite = marbleGameObject.GetComponent <Marble>().marbleSprite; playerMarble.playerID = userID; } }
public void CreateMarbleAndJump(Arrrgs e) { string userID = e.userID; string displayName = e.displayName; //if the player has not jumped yet if (!(longJumpedPlayers.Contains(userID))) { longJumpedPlayers.Add(userID); var mb = Instantiate(marbleObject, longJumpLocation.position, transform.rotation); mb.transform.SetParent(transform); mb.GetComponentInChildren <SpriteRenderer>().sortingOrder = orderInLayer; orderInLayer++; playerMarble = mb.GetComponentInChildren <MarbleObject>(); playerMarble.playerName.text = displayName; int marbleIndex = gameData.GetPlayerEquipSkin(userID); GameObject marbleGameObject = marbleList.GetMarbleFromMarbleCode(marbleIndex); playerMarble.gameMarbleSprite.sprite = marbleGameObject.GetComponent <Marble>().marbleSprite; playerMarble.playerID = userID; } else //if player has already rolled { if (gameData.CheckPlayerMoney(userID) > costToReroll) { MarbleObject[] allMarbles = GetComponentsInChildren <MarbleObject>(); foreach (var marble in allMarbles) { if (marble.playerID == userID && !(marble.isrolling)) { Destroy(marble.transform.parent.gameObject); gameData.SubtractMoneyFromPlayerID(costToReroll, userID); longJumpedPlayers.Remove(userID); CreateMarbleAndJump(e); } } } //if marble object isRolling do nothing //if marble object is not Rolling then reroll and charge player 50 monies } }
private void AttemptToEquip(Arrrgs e) { string commonName = ""; string playerID = e.userID; string playerUserName = e.displayName; commonName = e.commandArgs; /* * for (int index = 0; index < e.Command.ArgumentsAsList.Count; index++) * { * commonName += e.Command.ArgumentsAsList[index].ToLower(); * }*/ if (gameDataScript.CheckIfPlayerExists(playerID)) { if (marbleList.DoesMarbleCommonNameExist(commonName)) { int marbleCode = marbleList.GetMarbleCodeFromCommonName(commonName); if (gameDataScript.IsSkinUnlocked(playerID, marbleCode)) { gameDataScript.SetPlayerEquipSkin(playerID, marbleCode); chatClient.SendMessage(chatJoinedChannel, playerUserName + ", you now have the " + commonName + " skin in use."); Debug.Log(playerUserName + " equipt " + commonName); } else { chatClient.SendMessage(chatJoinedChannel, playerUserName + dontOwnThatSkin); } } else { chatClient.SendMessage(chatJoinedChannel, playerUserName + noMarbleWithNameExists); } } else { chatClient.SendMessage(chatJoinedChannel, playerUserName + noPlayerEntryExists); } }
public void AddToChatQueue(Arrrgs arg) { commandQueueChat.Enqueue(arg); Debug.Log("Command in queue"); Debug.Log("There are " + commandQueueChat.Count + " in the queue"); }
private void AttemptToHelp(Arrrgs e) { chatClient.SendMessage(chatJoinedChannel, help); }
public void AttemptToGive(Arrrgs e) { if (e.multiCommand != null) { string userID = e.userID; string displayName = e.displayName; if (gameDataScript.CheckIfPlayerExists(userID)) { if (e.multiCommand.Count >= 2) { string otherPlayerDisplayName = e.multiCommand[0].TrimStart('@'); string PersonGettingMoney = gameDataScript.ConvertCommonNameToUserID(otherPlayerDisplayName); if (String.IsNullOrEmpty(PersonGettingMoney)) { chatClient.SendMessage(chatJoinedChannel, cantGiveMoneyToPlayer1 + otherPlayerDisplayName + cantGiveMoneyToPlayer2); } else { if (gameDataScript.CheckIfPlayerExists(PersonGettingMoney) && gameDataScript.CheckPlayerIDMatchesUserName(PersonGettingMoney, otherPlayerDisplayName)) { int cost; //money = int.TryParse((e.multiCommand[1]), money); if (int.TryParse((e.multiCommand[1]), out cost)) { int currentMoney = gameDataScript.CheckPlayerMoney(userID); if (currentMoney >= cost) { if (cost > 0 && cost <= 10000) { gameDataScript.SubtractMoneyFromPlayerID(cost, userID); gameDataScript.AddMoneyToPlayerID(cost, PersonGettingMoney); chatClient.SendMessage(chatJoinedChannel, displayName + " gave " + e.multiCommand[0] + " " + cost); } else { chatClient.SendMessage(chatJoinedChannel, displayName + " you can only give give between 1 and 10000"); } } else { chatClient.SendMessage(chatJoinedChannel, displayName + " you can't give money you dont have."); } } } else { chatClient.SendMessage(chatJoinedChannel, cantGiveMoneyToPlayer1 + e.multiCommand[0] + cantGiveMoneyToPlayer2); } } } else { chatClient.SendMessage(chatJoinedChannel, displayName + " to give use !give [PlayerName] [Amount]"); } } else { chatClient.SendMessage(chatJoinedChannel, displayName + noPlayerEntryExists); } } }
private void AddToWhisperQueue(Arrrgs arg) { commandQueueWhisper.Enqueue(arg); }