예제 #1
0
        static void Main(string[] args)
        {
            Player          player          = Player.GetInstance();
            Files           f               = new Files();
            CharacterDriver characterDriver = new CharacterDriver();
            NonPlayer       npc             = characterDriver.GetNPC("wild_wolf_lvl_01");

            Console.WriteLine("Name: " + npc.CharacterName);
            Console.WriteLine("Sex: " + npc.CharacterSex);
            Console.WriteLine("Archetype: " + npc.CharacterArchetype.ArchetypeName);
            Console.WriteLine("Type: " + npc.CharacterType);
            Console.WriteLine("Level: " + npc.CharacterLevel);
            Console.WriteLine("Gold: " + npc.CharacterGold);
            Console.WriteLine("Item: " + npc.CharacterItem);
            Console.WriteLine("Moves:");
            foreach (Move move in npc.CharacterMoveSet.BattleMoves)
            {
                if (move != null)
                {
                    Console.WriteLine("  " + move.MoveName);
                }
            }
            Console.WriteLine("BaseStat:");
            Console.WriteLine("  HP:  " + npc.CharacterBaseStat.FullHp);
            Console.WriteLine("  ATK: " + npc.CharacterBaseStat.FullAtk);
            Console.WriteLine("  DEF: " + npc.CharacterBaseStat.FullDef);
            Console.WriteLine("  EVA: " + npc.CharacterBaseStat.FullEva);
            Console.WriteLine("  SPD: " + npc.CharacterBaseStat.FullSpd);
        }
        public NonPlayer GetNPC(String characterID)
        {
            NonPlayer npc = null;

            if (MySqlConnection.State.Equals("Closed"))
            {
                InitDriver();
            }

            SqlQuery        = "SELECT * FROM non_player_character WHERE character_id = '" + characterID + "'";
            MySqlCommand    = new MySqlCommand(SqlQuery, MySqlConnection);
            MySqlDataReader = MySqlCommand.ExecuteReader();
            if (MySqlDataReader.Read())
            {
                String    name      = MySqlDataReader.GetString(1);
                String    sex       = MySqlDataReader.GetString(2);
                String    type      = MySqlDataReader.GetString(3);
                Archetype archetype = Archetype.GetArchetype(MySqlDataReader.GetString(4));
                int       gold      = MySqlDataReader.GetInt32(5);
                int       level     = MySqlDataReader.GetInt32(6);
                Item      item      = null;
                if (!MySqlDataReader.IsDBNull(7))
                {
                    item = _itemDriver.GetItem(MySqlDataReader.GetString(7));
                }
                MoveSet  moveSet  = _moveSetDriver.GetMoveSet(characterID);
                BaseStat baseStat = _baseStatDriver.GetBaseStat(characterID);

                npc = new NonPlayer(name, sex, gold, level, archetype, moveSet, type, baseStat, new BattleStatus(), item, characterID);
            }
            return(npc);
        }