コード例 #1
0
ファイル: Zones.cs プロジェクト: Luth/TwitchBot
        // ----- Blacksmith Commands --------------------


        // ----- Forest Commands --------------------

        static private void cmd_forest_adventure(Player player)
        {
            // Move player to fight room
            player.changeZone("forestfight");

            // crete a new fight instance
            Monster mon = Monsters.createFor(player);

            // Whisper fight status
            Program.sendWhisper(player, "You see " + mon.name + " [" + mon.hp + "]! You have " + player.getHp() + "/" + player.getMaxHp() + " hp.");
            Program.sendWhisper(player, "You can !attack (!a) or !run (!r) -- Please WHISPER fight commands, do not spam the main channel.");
        }
コード例 #2
0
        public void attack()
        {
            string properName = char.ToUpper(name[0]) + name.Substring(1);

            Program.sendWhisper(player, properName + " hits you [" + Math.Max(player.getHp() - damage, 0) + "/" + player.getMaxHp() + "] for " + damage + ".");
            player.damage(damage);
            if (player.isDead())
            {
                Program.sendChannel("@" + player.getUsername() + " was knocked out by " + name + ".");
            }
        }
コード例 #3
0
ファイル: Zones.cs プロジェクト: Luth/TwitchBot
        // ----- Blacksmith Commands --------------------
        // ----- Forest Commands --------------------
        private static void cmd_forest_adventure( Player player )
        {
            // Move player to fight room
            player.changeZone( "forestfight" );

            // crete a new fight instance
            Monster mon = Monsters.createFor( player );

            // Whisper fight status
            Program.sendWhisper( player, "You see " + mon.name + " [" + mon.hp + "]! You have " + player.getHp() + "/" + player.getMaxHp() + " hp." );
            Program.sendWhisper( player, "You can !attack (!a) or !run (!r) -- Please WHISPER fight commands, do not spam the main channel." );
        }
コード例 #4
0
        public void chatCommand(string command, string[] opts = null)
        {
            if (command[0] == '!')
            {
                command = command.Substring(1);
            }

            Zone zone;

            // Global Commands
            switch (command)
            {
            case "letsplay":
                if (_player.isPlaying())
                {
                    Program.sendChannel("You are already playing, @" + _player.getUsername() + ". Try !help");
                }
                else
                {
                    _player.startNewGame();
                    Program.sendChannel("@" + _player.getUsername() + " enters the world.");
                    new PlayerCommand(_player).chatCommand("!help");
                }
                return;

            case "help":
                if (_player.isPlaying())
                {
                    zone = Zones.getZone(_player.getZoneId());
                    List <string> commands = zone.getCommands();
                    string        message  = "You are in the " + zone.getName() + ". Your commands are: ";
                    for (int i = 0; i < commands.Count; i++)
                    {
                        message += "!" + commands[i];
                        if (i < commands.Count - 1)
                        {
                            message += ", ";
                        }
                    }
                    Program.sendWhisper(_player, message);
                    Zones.sendZoneList(_player);
                }
                return;

            case "status":
                if (_player.isPlaying())
                {
                    zone = Zones.getZone(_player.getZoneId());
                    Program.sendWhisper(_player, "Experience: " + _player.getExperience() + "/" + (_player.getExpForLevel()) + " Level: " + _player.getLevel());
                    Program.sendWhisper(_player, "HP: " + _player.getHp() + "/" + _player.getMaxHp() + " Money: $" + _player.getMoney() + " Zone: " + zone.getName());
                    if (_player.isDead())
                    {
                        Program.sendWhisper(_player, "You have been knocked unconscious. You must rest until tomorrow.");
                    }
                }
                return;

            case "go":
                string newZoneId = opts[0];
                if (!Zones.isValidZoneId(newZoneId))
                {
                    Program.sendWhisper(_player, "And just where do you think you're going? " + newZoneId + "? Never heard of it.");
                    return;
                }
                string curZoneId = _player.getZoneId();
                zone = Zones.getZone(curZoneId);
                if (newZoneId == curZoneId)
                {
                    Program.sendChannel("@" + _player.getUsername() + " tries to leave the " + zone.getName() + ", but realizes he is already there.");
                    return;
                }

                // Can I leave here?
                if (!zone.canGo())
                {
                    Program.sendWhisper(_player, "You cannot leave this area right now.");
                    return;
                }

                // Can I go to there?
                zone = Zones.getZone(newZoneId);
                if (!zone.canGo())
                {
                    return;
                }

                _player.changeZone(newZoneId);
                Program.sendChannel("@" + _player.getUsername() + " travels to the " + zone.getName());
                return;
            }

            // Zone commands
            if (Zones.tryCommand(_player, _player.getZoneId(), command, opts))
            {
                return;
            }

            // other commands???
            Console.WriteLine("Unknown command: " + _player.getUsername() + " " + command);
        }