public void Travel(PlayerScript playerScript, string[] command, MessageRelay messageRelay) { if (command.Length == 1) { messageRelay.Chat(playerScript.channel, playerScript.locationScript.travelDescription); } if (command.Length == 2) { if (command[1] == playerScript.locationScript.destination1Script.travelName) { CreateTraveler(playerScript, playerScript.locationObject, playerScript.locationScript, playerScript.locationScript.destination1Object, playerScript.locationScript.destination1Script, playerScript.locationScript.travelTime1, messageRelay); return; } if (playerScript.locationScript.destination2Script != null) { if (command [1] == playerScript.locationScript.destination2Script.travelName) { CreateTraveler(playerScript, playerScript.locationObject, playerScript.locationScript, playerScript.locationScript.destination2Object, playerScript.locationScript.destination2Script, playerScript.locationScript.travelTime2, messageRelay); return; } } if (playerScript.locationScript.destination3Script != null) { if (command [1] == playerScript.locationScript.destination3Script.travelName) { CreateTraveler(playerScript, playerScript.locationObject, playerScript.locationScript, playerScript.locationScript.destination3Object, playerScript.locationScript.destination3Script, playerScript.locationScript.travelTime3, messageRelay); return; } } messageRelay.Chat(playerScript.channel, "You cannot travel there!"); } }
//handles commands about deciding upon race void SetRace(PlayerScript playerScript, string[] command, MessageRelay messageRelay) { if (command [0] == "learn") { switch (command [1]) { case "race": messageRelay.Chat(playerScript.channel, "Don't actually type \"race\" FailFish Swap that out for the race you want to learn about!"); break; case "kappa": messageRelay.Chat(playerScript.channel, "Kappa Kappas are the commonfolk of TwitchLand. They are found everywhere but are native to KappaDale. " + "They start with balanced stats and the ability to travel slightly faster."); break; case "vohiyo": messageRelay.Chat(playerScript.channel, "VoHiYo Vohiyos are a mysterious people from Vohiyo Forest. They start with lower hp but higher mp " + "and the ability to quickly regenerate it for a time."); break; case "swiftrage": messageRelay.Chat(playerScript.channel, "SwiftRage Swiftrages are a strong and proud race that live on Swiftrage Mountain. They start with lower mp " + "but higher hp and the ability to take less damage and deal more for a time."); break; } return; } if (command[0] == "choose") { if (command[1] == "race") { messageRelay.Chat(playerScript.channel, "Don't actually type \"race\" FailFish Swap that out for the race you want to choose!"); return; } if (command[1] == "kappa" || command[1] == "vohiyo" || command[1] == "swiftrage") { switch (command[1]) { case "kappa": playerScript.locationObject = GameObject.Find("City_CastleKappa"); playerScript.locationScript = playerScript.locationObject.GetComponent <CityScript_CastleKappa> (); break; case "vohiyo": playerScript.locationObject = GameObject.Find("City_VohiyoVillage"); playerScript.locationScript = playerScript.locationObject.GetComponent <CityScript_VohiyoVillage> (); break; case "swiftrage": playerScript.locationObject = GameObject.Find("City_SwiftrageMountain"); playerScript.locationScript = playerScript.locationObject.GetComponent <CityScript_SwiftrageMountain> (); break; } playerScript.playerRace = command[1]; playerScript.tutorialProgress++; } } }
void SetClass(PlayerScript playerScript, string[] command, MessageRelay messageRelay) { if (command [0] == "learn") { switch (command [1]) { case "class": messageRelay.Chat(playerScript.channel, "Don't actually type \"class\" FailFish Swap that out for the class you want to learn about!"); break; case "knight": messageRelay.Chat(playerScript.channel, "Knights thrive on being in the front lines of combat. They have access to a variety of offensive, defensive, and " + "supportive abilities, allowing them to have an equal balance or a focus on just one fighting style."); break; case "medic": messageRelay.Chat(playerScript.channel, "Medics are fearless combat healers. They mostly have strong supportive abilities, but their offensive potential " + "shouldn't be underestimated."); break; case "ranger": messageRelay.Chat(playerScript.channel, "Rangers are tough and independant fighters. They have strong offense and a decent defense, but don't offer much support to " + "their allies."); break; case "wizard": messageRelay.Chat(playerScript.channel, "Wizards are eternal students of the magical arts. They have access to great offensive and utility abilities, but they sorely " + "lack and personal defense."); break; } return; } if (command[0] == "choose") { if (command[1] == "class") { messageRelay.Chat(playerScript.channel, "Don't actually type \"class\" FailFish Swap that out for the class you want to choose!"); return; } if (command[1] == "knight" || command[1] == "medic" || command[1] == "ranger" || command[1] == "wizard") { playerScript.playerClass = command[1]; playerScript.tutorialProgress++; } } }
public void LevelUp(PlayerScript playerScript, MessageRelay messageRelay) { if (playerScript.xpCur >= playerScript.xpMax) { playerScript.xpCur -= playerScript.xpMax; playerScript.xpMax += 150; playerScript.level++; playerScript.skillPoints += 2; playerScript.statPoints += 3; messageRelay.Chat(playerScript.channel, "Congratulations! You have reached level " + playerScript.level.ToString() + "! PogChamp"); } else { var diff = playerScript.xpMax - playerScript.xpCur; messageRelay.Chat(playerScript.channel, "You need " + diff.ToString() + " more XP before you can level up."); } }
public void Inspect(PlayerScript playerScript, string[] command, MessageRelay messageRelay) { var listVal = messageRelay.joinedChannels.IndexOf(command[1]); if (listVal == -1) { messageRelay.Chat(playerScript.channel, "That player either does not exist or is not logged in."); } else { inspectScript = messageRelay.playerScripts [listVal]; messageRelay.Chat(playerScript.channel, inspectScript.playerName + " is a level " + inspectScript.level.ToString() + " " + inspectScript.playerRace + " " + inspectScript.playerClass + ". They are equipped with " + inspectScript.gearHat.name + ", " + inspectScript.gearBod.name + ", " + inspectScript.gearWep.name + ", and " + inspectScript.gearAcc.name + ". They are currently located in " + inspectScript.locationScript.cityName + "."); } }
public void Status(PlayerScript playerScript, MessageRelay messageRelay) { string s = "You are "; if (playerScript.isTraveling) { s += "currently traveling from " + playerScript.traveler.originCityScript.cityName + " to " + playerScript.traveler.destinationCityScript.cityName + ". "; } else { s += "currently at " + playerScript.locationScript.cityName + ". "; } s += " You are level " + playerScript.level.ToString() + " with (" + playerScript.xpCur.ToString() + "/" + playerScript.xpMax.ToString() + ") XP"; s += " Your HP is (" + playerScript.hpCur.ToString() + "/" + playerScript.hpMax.ToString() + ")"; s += " Your MP is (" + playerScript.mpCur.ToString() + "/" + playerScript.mpMax.ToString() + ")"; messageRelay.Chat(playerScript.channel, s); }
public static bool CheckMessageRelay(string nonce, int time) { //This will check the message relay for its existance, and add it if it doesn't exist lock (MessageRelayList) { for (int i = 0; i < MessageRelayList.Count; i++) { if (MessageRelayList[i].msgnonce.Equals(nonce) == true && MessageRelayList[i].utctime == time) { return(true); //The message exists already, disregard } } MessageRelay rl = new MessageRelay(); rl.msgnonce = nonce; rl.utctime = time; MessageRelayList.Add(rl); if (MessageRelayList.Count > 1000) { //Too many things on the list MessageRelayList.RemoveAt(0); //Remove the oldest relay } return(false); //New message } }
public void Tutorial(PlayerScript playerScript, string[] command, MessageRelay messageRelay) { switch (playerScript.tutorialProgress) { case 1: messageRelay.Chat(playerScript.channel, "Hi there! I will talk you through character creation, but first, please consider typing \"/mod TwitchLandRPG\" so my messages don't get filtered as spam " + "if we go too fast. Type anything to continue."); playerScript.tutorialProgress++; break; case 2: messageRelay.Chat(playerScript.channel, "The first step is to select your race. This determines your home city, your starting stats, and your racial abilities. Available races are kappa, vohiyo, and " + "swiftrage. To learn more about a race, type \"learn race\". To select a race to play, type \"choose race\"."); playerScript.tutorialProgress++; break; case 3: if (command.Length == 2) { if (command[0] == "learn" || command[0] == "choose") { SetRace(playerScript, command, messageRelay); } } if (playerScript.tutorialProgress == 4) { messageRelay.Chat(playerScript.channel, "You chose " + playerScript.playerRace + " as your race! Excellent choice! Now it is time to choose your class, " + "which defines the passive and active abilities you can " + "learn as you level up. Available classes are Knight, Medic, Ranger, and Wizard. To learn more about a class, type \"learn class\". " + "To select a class to play, type \"choose class\"."); playerScript.tutorialProgress++; break; } break; case 5: if (command.Length == 2) { if (command[0] == "learn" || command[0] == "choose") { SetClass(playerScript, command, messageRelay); } } if (playerScript.tutorialProgress == 6) { messageRelay.Chat(playerScript.channel, "You chose " + playerScript.playerClass + " as your class! Superb choice! That is all there is to character creation. " + "You have been dropped off at your home city. The world is now yours to explore! Check below the stream to learn about the commands available to you. " + "I hope you enjoy the game! :)"); playerScript.tutorialProgress = 0; messageRelay.commandsManageStats.StartStats(playerScript); playerScript.location = playerScript.locationScript.travelName; playerScript.locationScript.population++; playerScript.hpCur = playerScript.hpMax; playerScript.mpCur = playerScript.mpMax; playerScript.level = 1; playerScript.xpCur = 0; playerScript.xpMax = 100; messageRelay.commandsLoadSave.Save(playerScript); break; } break; } }
public void Start() { messageRelay = MessageRelay.GetComponent <MessageRelay> (); }
public void Load(PlayerScript playerScript, MessageRelay messageRelay) { StreamReader reader = new StreamReader(@"X:\TLRPGdata\PlayerProfiles\" + playerScript.playerName + ".txt"); string[] data = reader.ReadLine().Split('~'); playerScript.playerName = data [0]; playerScript.level = IntParseFast(data [1]); playerScript.playerRace = data [2]; playerScript.playerClass = data [3]; playerScript.location = data [4]; playerScript.stats[0] = IntParseFast(data [5]); playerScript.stats[1] = IntParseFast(data [6]); playerScript.stats[2] = IntParseFast(data [7]); playerScript.stats[3] = IntParseFast(data [8]); playerScript.stats[4] = IntParseFast(data [9]); commandsManageStats.SetHpMp(playerScript); playerScript.xpCur = IntParseFast(data [10]); playerScript.xpMax = IntParseFast(data [11]); playerScript.skillPoints = IntParseFast(data [12]); playerScript.statPoints = IntParseFast(data [13]); playerScript.coins = IntParseFast(data [14]); playerScript.rewardFollow = IntParseFast(data [15]); playerScript.rewardSub = IntParseFast(data [16]); //EQUIP GEAR var i = itemBank.EquipIds.IndexOf(data [17]); if (i != -1) { playerScript.gearHat = itemBank.EquipStructs [i]; } i = itemBank.EquipIds.IndexOf(data [18]); if (i != -1) { playerScript.gearBod = itemBank.EquipStructs [i]; } i = itemBank.EquipIds.IndexOf(data [19]); if (i != -1) { playerScript.gearWep = itemBank.EquipStructs [i]; } i = itemBank.EquipIds.IndexOf(data [20]); if (i != -1) { playerScript.gearAcc = itemBank.EquipStructs [i]; } playerScript.inv[0] = data [21]; playerScript.inv[1] = data [22]; playerScript.inv[2] = data [23]; playerScript.inv[3] = data [24]; playerScript.inv[4] = data [25]; reader.Close(); var loc = cityNames.IndexOf(playerScript.location); playerScript.locationObject = cityObjects [loc]; playerScript.locationScript = playerScript.locationObject.GetComponent <City> (); playerScript.locationScript.population++; }
void CreateTraveler(PlayerScript playerScript, GameObject originCityObject, City originCityScript, GameObject destinationCityObject, City destinationCityScript, float travelTime, MessageRelay messageRelay) { TravelerClone = Instantiate(Traveler, transform.position, Quaternion.identity) as GameObject; TravelerClone.transform.parent = this.transform; TravelerClone.transform.position = originCityObject.transform.position; travelScript = TravelerClone.GetComponent <Traveler> (); travelScript.playerScript = playerScript; travelScript.originCityObject = originCityObject; travelScript.originCityScript = originCityScript; travelScript.destinationCityObject = destinationCityObject; travelScript.destinationCityScript = destinationCityScript; travelScript.travelTime = travelTime; travelScript.messageRelay = messageRelay; originCityScript.population--; playerScript.isTraveling = true; playerScript.traveler = travelScript; }
public void Fight(PlayerScript playerScript, string[] command, string mob, MessageRelay messageRelay) { var i = bestiaryScript.EnemyIds.IndexOf(mob); //Bestiary.Enemy enemy = new bestiaryScript.EnemyStructs[i]; }