コード例 #1
0
ファイル: Player.cs プロジェクト: francis0407/MMORPG
        public void AwardSilver()
        {
            SAwardSilver msg = new SAwardSilver();

            msg.count = attr_intelligence * 4;
            using (var conn = DataBase.GameDataBase.GetConnection())
            {
                using (var cmd = conn.CreateCommand())
                {
                    cmd.CommandText = "Update Player Set silver=silver+@count Where player_id=@player_id;";
                    cmd.Parameters.AddWithValue("count", msg.count);
                    cmd.Parameters.AddWithValue("player_id", player_id);
                    int res = cmd.ExecuteNonQuery();
                    if (res != 1)
                    {
                        Network.Incoming.ClientTipInfo(connection, "Can't add silver");
                        return;
                    }
                }
            }
            connection.Send(msg);
        }
コード例 #2
0
        private void OnRecvAwardSilver(IChannel channel, Message message)
        {
            SAwardSilver msg = message as SAwardSilver;

            FrontEnd.World.Instance.fPlayer.silver += msg.count;
        }