Exemple #1
0
 public void LearnNewMove(int moveNum)
 {
     if (CanLearnNewMove() == true)
     {
         for (int i = 0; i < Constants.MAX_PLAYER_MOVES; i++)
         {
             if (Moves[i].MoveNum < 1)
             {
                 Moves[i].MoveNum   = moveNum;
                 Moves[i].MaxPP     = MoveManager.Moves[moveNum].MaxPP;
                 Moves[i].CurrentPP = Moves[i].MaxPP;
                 Messenger.PlayerMsg(owner, "You have learned " + MoveManager.Moves[moveNum].Name + "!", Text.BrightGreen);
                 return;
             }
         }
     }
     else
     {
         LearningMove = moveNum;
         string questionText;
         if (Name != "")
         {
             questionText = Name + " is trying to learn " + MoveManager.Moves[moveNum].Name + ", but " + Name + " can only know 4 moves. Would you like to forget one to make room for " + MoveManager.Moves[moveNum].Name + "?";
         }
         else
         {
             questionText = "You are trying to learn " + MoveManager.Moves[moveNum].Name + ", but you can only know 4 moves. Would you like to forget one to make room for " + MoveManager.Moves[moveNum].Name + "?";
         }
         Owner.Player.Hunted = false;
         Messenger.AskQuestion(Owner, "MovesFull", questionText, -1);
     }
 }
Exemple #2
0
        public async Task ConnectAsync([Remainder] string characterName)
        {
            var client = ClientManager.FindClient(characterName);

            if (client == null)
            {
                await Context.Channel.SendMessageAsync("That player is not online.");

                return;
            }

            if (!client.Player.PlayerData.CanLinkDiscord)
            {
                await Context.Channel.SendMessageAsync("Unable to connect to ingame account.");

                return;
            }

            if (client.Player.PendingDiscordId > 0)
            {
                await Context.Channel.SendMessageAsync("An active connect is pending. Try again later, or reset with \"/resetdiscord\" ingame.");

                return;
            }

            client.Player.PendingDiscordId = Context.User.Id;
            await Context.Channel.SendMessageAsync("Please confirm ingame.");

            Messenger.AskQuestion(client, "LinkDiscord", $"Discord user \"{Context.User.Username}#{Context.User.Discriminator}\" would like to connect with your account. Allow?", -1);
        }
Exemple #3
0
        public static void AskDungeonCancelQuestion(Client client, string param1, string param2, string param3)
        {
            List <string> choices = new List <string>();

            choices.Add("Cancel");

            Messenger.AskQuestion(client, "PartyDungeon|" + param1 + "|" + param2 + "|" + param3, "Waiting for party members to enter...", -1, choices.ToArray());
        }
Exemple #4
0
 public static void TriggerJoinRequest(Client client)
 {
     if (client.Player.Muted)
     {
         Messenger.PlayerMsg(client, "You cannot join the game because you are muted!", Text.BrightRed);
     }
     if (client.Player.MapID == MapManager.GenerateMapID(CTF.HUBMAP))
     {
         if (Main.ActiveCTF == null)
         {
             Messenger.AskQuestion(client, "CTFCreate", "No game has been created yet. Would you like to create one?", -1);
         }
         else if (Main.ActiveCTF.GameState == CTF.CTFGameState.WaitingForPlayers)
         {
             if (exPlayer.Get(client).InCTF == false)
             {
                 Messenger.AskQuestion(client, "CTFRegistration", "Would you like to join the game?", -1);
             }
             else
             {
                 Messenger.PlayerMsg(client, "You have already joined the game!", Text.BrightRed);
             }
         }
         else
         {
             if (Main.ActiveCTF.GameState == CTF.CTFGameState.Started)
             {
                 Messenger.PlayerMsg(client, "There is already a game of Capture The Flag that has been started!", Text.BrightRed);
             }
             else
             {
                 Messenger.AskQuestion(client, "CTFCreate", "No game has been created yet. Would you like to create one?", -1);
             }
         }
     }
 }
Exemple #5
0
        public static void StartEvolution(Players.Player player)
        {
            try
            {
                int        speciesNum = player.GetActiveRecruit().Species;
                int        evoIndex   = -1;
                List <int> evoToLoad;
                for (int z = 0; z < Evolutions.MaxEvos; z++)
                {
                    if (Evolutions[z].Species == speciesNum)
                    {
                        evoIndex = z;
                    }
                }


                if (evoIndex == -1)
                {
                    Messenger.PlayerMsg(player.Client, "You cannot evolve anymore.", Text.BrightRed);
                }
                else
                {
                    evoToLoad = FindViableEvolutions(player.Client, evoIndex);
                    if (evoToLoad.Count == 0)
                    {
                        Messenger.PlayerMsg(player.Client, "You do not meet the requirements to evolve.", Text.BrightRed);
                    }
                    else if (evoToLoad.Count == 1)
                    {
                        Messenger.AskQuestion(player.Client, "SingleEvolution", "You who seek awakening, you shall evolve into " + Evolutions[evoIndex].Branches[evoToLoad[0]].Name + ".  Will you evolve?", -1);
                    }
                    else
                    {
                        string[] evochoices = new string[evoToLoad.Count + 1];
                        for (int i = 0; i < evoToLoad.Count; i++)
                        {
                            evochoices[i] = Evolutions[evoIndex].Branches[evoToLoad[i]].Name;
                        }
                        evochoices[evochoices.Length - 1] = "Cancel";
                        Messenger.AskQuestion(player.Client, "BranchEvolution", "You who seek awakening, into what do you wish to evolve?", -1, evochoices);
                    }

                    /*
                     * if (evoToLoad != -1) {
                     * if (player.GetActiveRecruit().Level >= Evolutions[evoIndex].MinLvl) {
                     *  //Classes.ClassManager.ChangePlayerClass(player.Client, Evolutions[evoIndex].SplitEvos[evoToLoad].NewClass);
                     *  player.GetActiveRecruit().Sprite = Evolutions[evoIndex].SplitEvos[evoToLoad].NewSprite;
                     *  if (!player.GetActiveRecruit().HasMove(Evolutions[evoIndex].SplitEvos[evoToLoad].MoveLearned)) {
                     *      player.GetActiveRecruit().LearnNewMove(Evolutions[evoIndex].SplitEvos[evoToLoad].MoveLearned);
                     *      Messenger.SendPlayerMoves(player.Client);
                     *      Messenger.PlayerMsg(player.Client, "You have learned " + MoveManager.Moves[Evolutions[evoIndex].SplitEvos[evoToLoad].MoveLearned].Name + "!", Text.White);
                     *  }
                     *  player.TakeItem(Evolutions[evoIndex].SplitEvos[evoToLoad].RequiredItem, 1);
                     *  if (player.GetActiveRecruit().Nickname == false) {
                     *      player.GetActiveRecruit().Name = Evolutions[evoIndex].SplitEvos[evoToLoad].Name;
                     *  }
                     *  player.GetActiveRecruit().Save(player.GetCharFolder(), player.GetActiveRecruitSlot());
                     *  Messenger.SendActiveTeam(player.Client);
                     *  Messenger.SendPlayerData(player.Client);
                     *  Messenger.PlayerMsg(player.Client, "You have evolved into a " + Evolutions[evoIndex].SplitEvos[evoToLoad].Name + "! Congratulations!", Text.Yellow);
                     * } else {
                     *  Messenger.PlayerMsg(player.Client, "You can't evolve yet... You must raise your level!", Text.BrightRed);
                     * }
                     * } else {
                     * Messenger.PlayerMsg(player.Client, "You do not have the proper item equipped to evolve!", Text.BrightRed);
                     * }
                     */
                }
            }
            catch (Exception ex)
            {
                Exceptions.ErrorLogger.WriteToErrorLog(ex, "Evolution, [Data] Index: " + player.Client.ToString() + ", Player Sprite: " + player.GetActiveRecruit().Sprite.ToString());
                Messenger.PlayerMsg(player.Client, "Evolution Error", Text.BrightRed);
            }
        }
Exemple #6
0
        public static void RegisterGuild(Client client, string name)
        {
            if (client.Player.HasItem(1) < CREATE_PRICE)
            {
                Messenger.PlayerMsg(client, "You do not have enough " + ItemManager.Items[1].Name + " to make a guild!", Text.BrightRed);
                return;
            }

            // Check if they are already in a guild
            if (!string.IsNullOrEmpty(client.Player.GuildName) && client.Player.GuildAccess > 0)
            {
                Messenger.PlayerMsg(client, "You are already in a guild!", Text.BrightRed);
                return;
            }

            for (int i = 0; i < name.Length; i++)
            {
                int n = (int)Convert.ToChar(name.Substring(i, 1));

                if (n == 32 && (i == 0 || i == name.Length - 1))
                {
                    Messenger.PlayerMsg(client, "Names cannot begin or end with spaces.", Text.BrightRed);
                    return;
                }

                if ((n >= 65 && n <= 90) || (n >= 97 && n <= 122) || (n == 95) || (n == 32) || (n >= 48 && n <= 57))
                {
                }
                else
                {
                    Messenger.PlayerMsg(client, "Invalid name, only letters, numbers, spaces, and _ are allowed.", Text.BrightRed);
                    return;
                }
            }

            if (name.Length < 3 || name.Length > 24)
            {
                Messenger.PlayerMsg(client, "Guild name must be between 3 and 24 letters long.", Text.BrightRed);
                return;
            }


            client.Player.GuildName = name;

            Party party = PartyManager.FindPlayerParty(client);

            if (party != null)
            {
                Messenger.AskQuestion(client, "CreateGuild", "Waiting for other party members to register...", -1, new string[1] {
                    "Cancel"
                });
            }

            if (party != null)
            {
                bool matches = true;
                foreach (Client member in party.GetOnlineMemberClients())
                {
                    if (member.Player.QuestionID != "CreateGuild")
                    {
                        return;
                    }
                }

                foreach (Client member in party.GetOnlineMemberClients())
                {
                    if (member.Player.GuildName != client.Player.GuildName)
                    {
                        matches = false;
                        return;
                    }
                }
                if (!matches)
                {
                    foreach (Client member in party.GetOnlineMemberClients())
                    {
                        Messenger.PlayerMsg(client, "The guild names don't agree.  All party members must agree on the same guild name.", Text.BrightRed);
                        member.Player.GuildName = "";
                        Messenger.ForceEndStoryTo(member);
                    }
                    return;
                }
            }


            using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) {
                ListPair <string, int> members = DataManager.Players.PlayerDataManager.LoadGuild(dbConnection.Database, name);

                if (party != null)
                {
                    foreach (Client member in party.GetOnlineMemberClients())
                    {
                        Messenger.ForceEndStoryTo(member);
                    }
                }

                if (members.Count > 0)
                {
                    if (party != null)
                    {
                        foreach (Client member in party.GetOnlineMemberClients())
                        {
                            Messenger.PlayerMsg(member, "That guild name already exists!", Text.BrightRed);
                            member.Player.GuildName = "";
                        }
                    }
                    else
                    {
                        Messenger.PlayerMsg(client, "That guild name already exists!", Text.BrightRed);
                        client.Player.GuildName = "";
                    }
                    return;
                }

                if (party != null)
                {
                    foreach (Client member in party.GetOnlineMemberClients())
                    {
                        member.Player.TakeItem(1, CREATE_PRICE, true);
                        DataManager.Players.PlayerDataManager.AddGuildMember(dbConnection.Database, name, member.Player.CharID);
                        DataManager.Players.PlayerDataManager.SetGuildAccess(dbConnection.Database, member.Player.CharID, (int)Enums.GuildRank.Founder);
                        member.Player.GuildName   = name;
                        member.Player.GuildAccess = Enums.GuildRank.Founder;
                        Messenger.SendPlayerGuild(member);
                        Messenger.PlayerMsg(client, "Guild created!", Text.BrightGreen);
                    }
                }
                else
                {
                    client.Player.TakeItem(1, CREATE_PRICE, true);
                    DataManager.Players.PlayerDataManager.AddGuildMember(dbConnection.Database, name, client.Player.CharID);
                    DataManager.Players.PlayerDataManager.SetGuildAccess(dbConnection.Database, client.Player.CharID, (int)Enums.GuildRank.Founder);
                    client.Player.GuildName   = name;
                    client.Player.GuildAccess = Enums.GuildRank.Founder;
                    Messenger.SendPlayerGuild(client);
                    Messenger.PlayerMsg(client, "Guild created!", Text.BrightGreen);
                }
            }
        }