示例#1
0
        public static void claimvote(User user)
        {
            int emptystacks = 0;

            switch (VoteUtils.CheckVote(user))
            {
            case -2:
                ChatUtils.SendMessage(user, "Received an unexpected response from Ecoservers. Please try again later.");
                return;

            case -1:
                ChatUtils.SendMessage(user, "There was an error when contacting Ecoservers.io. Please try again later.");
                return;

            case 0:
                ChatUtils.SendMessage(user, "You have not voted yet. Please vote on Ecoservers.io first.");
                return;

            case 1:     // pass
                break;

            case 2:
                ChatUtils.SendMessage(user, "You already claimed your reward.");
                return;

            default:
                ChatUtils.SendMessage(user, "Something went wrong... Try again, if it's still the same error, pls report it. (Checkcase default)");
                return;
            }

            foreach (ItemStack stack in user.Inventory.Stacks)
            {
                if (stack.Empty)
                {
                    emptystacks++;
                    //ChatUtils.SendMessage(user, "<color=green> Found empty Stack");
                }
                //else ChatUtils.SendMessage(user, "Stack: " + stack.Item.NameAndNum(stack.Quantity));
            }
            if (emptystacks <= 2)
            {
                ChatUtils.SendMessage(user, "Not enough space in inventory. Please make sure to have more free space.");
                return;
            }

            switch (VoteUtils.SetVote(user))
            {
            case -2:
                ChatUtils.SendMessage(user, "Received an unexpected response from Ecoservers. Please try again later.");
                return;

            case -1:
                ChatUtils.SendMessage(user, "There was an error when contacting Ecoservers.io. Please try again later.");
                return;

            case 0:
                ChatUtils.SendMessage(user, "Something went wrong... Try again, if it's still the same error, pls report it. (Claimcase 0)");
                return;

            case 1:
                break;

            default:
                ChatUtils.SendMessage(user, "Something went wrong... Try again, if it's still the same error, pls report it. (Claimcase default)");
                return;
            }
            ChatUtils.SendMessage(user, "Thanks for Voting! Here is your reward :D");

            // maybe that should be moved somewhere else for better configurability
            user.Inventory.AddItems(typeof(CoinItem), 10);
        }
示例#2
0
        private static void ServerGUIBroadcast()
        {
            string msgwithheader = "<b>Broadcast from Serverconsole</b><br><br>" + REYmodSettings.Obj.Config.ServerMessageSender;

            ChatUtils.BroadcastPopup(msgwithheader);
        }